source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
robbyrussell/rubyurl
https://github.com/robbyrussell/rubyurl
spec/controllers/api/links_controller_spec.rb
Ruby
mit
221
main
1,349
require File.dirname(__FILE__) + '/../../spec_helper' describe Api::LinksController, "creating a new rubyurl" do def valid_parameters { :website_url => 'http://robbyonrails.com/' } end before( :each ) do @link = mock_model( Link ) @link.stub!( :ip_address= ) @link.stub!( :new_record? ).and_ret...
github
robbyrussell/rubyurl
https://github.com/robbyrussell/rubyurl
spec/models/link_spec.rb
Ruby
mit
221
main
4,626
require File.dirname(__FILE__) + '/../spec_helper' describe Link, "with fixtures loaded" do fixtures :links it "should load a non-empty collection of links" do Link.find(:all).should_not be_empty end it "should have four records" do Link.should have(4).records end end describe "Planet Argon li...
github
robbyrussell/rubyurl
https://github.com/robbyrussell/rubyurl
test/test_helper.rb
Ruby
mit
221
main
1,317
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' class Test::Unit::TestCase # Transactional fixtures accelerate your tests by wrapping each test method # in a transaction that's rolled back on completion. This ensures that the # test datab...
github
robbyrussell/rubyurl
https://github.com/robbyrussell/rubyurl
lib/hash_extensions.rb
Ruby
mit
221
main
660
# # Based on http://pastie.caboo.se/10707 # class Hash # Returns the hash with entries removed # { :a => 1, :b => 2, :c => 3}.except(:a) -> { :b => 2, :c => 3 } # { :a => 1, :b => 2, :c => 3}.except(:a, :c) -> { :b => 2 } def except(*keys) self.reject { |k,v| keys.include? k.to_sym } end unless insta...
github
robbyrussell/rubyurl
https://github.com/robbyrussell/rubyurl
lib/tasks/rspec.rake
Ruby
mit
221
main
5,612
raise "To avoid rake task loading problems: run 'rake clobber' in vendor/plugins/rspec" if File.directory?(File.join(File.dirname(__FILE__), *%w[.. .. vendor plugins rspec pkg])) raise "To avoid rake task loading problems: run 'rake clobber' in vendor/plugins/rspec-rails" if File.directory?(File.join(File.dirname(__FIL...
github
robbyrussell/rubyurl
https://github.com/robbyrussell/rubyurl
lib/tasks/capistrano.rake
Ruby
mit
221
main
3,767
# ============================================================================= # A set of rake tasks for invoking the Capistrano automation utility. # ============================================================================= # Invoke the given actions via Capistrano def cap(*parameters) begin require 'rubyg...
github
robbyrussell/rubyurl
https://github.com/robbyrussell/rubyurl
db/migrate/003_add_index_on_website_url.rb
Ruby
mit
221
main
244
class AddIndexOnWebsiteUrl < ActiveRecord::Migration def self.up execute "CREATE INDEX website_url_index ON links ((substring(website_url, 0, 200)));" end def self.down execute "DROP INDEX website_url_index;" end end
github
robbyrussell/rubyurl
https://github.com/robbyrussell/rubyurl
db/migrate/002_create_visits.rb
Ruby
mit
221
main
402
class CreateVisits < ActiveRecord::Migration def self.up create_table :visits do |t| t.column :link_id, :integer t.column :referral_link, :text t.column :flagged, :string t.column :ip_address, :text t.column :created_at, :timestamp end add_index :visits, :link_id ad...
github
robbyrussell/rubyurl
https://github.com/robbyrussell/rubyurl
db/migrate/001_create_links.rb
Ruby
mit
221
main
416
class CreateLinks < ActiveRecord::Migration def self.up create_table :links do |t| t.column "website_url", :text t.column "token", :string t.column "permalink", :string t.column "ip_address", :string t.column "created_at", :datetime t.column "updated_at", :datetime ...
github
undercase/proof
https://github.com/undercase/proof
Gemfile
Ruby
mit
221
master
582
source 'https://rubygems.org' # Declare your gem's dependencies in proof.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec # Declare any dependencies that are still in development here instead of in # y...
github
undercase/proof
https://github.com/undercase/proof
Rakefile
Ruby
mit
221
master
573
begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end require 'rdoc/task' RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = 'Proof' rdoc.options << '--line-numbers' rdoc.rdoc_files.include('README.rdoc') rdoc....
github
undercase/proof
https://github.com/undercase/proof
proof.gemspec
Ruby
mit
221
master
882
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "proof/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "proof-rails" s.version = Proof::VERSION s.authors = ["Thomas Hobohm", "Jonathan Gertig"] s.email = ...
github
undercase/proof
https://github.com/undercase/proof
lib/proof.rb
Ruby
mit
221
master
229
require 'proof/token.rb' require 'proof/proof_actions.rb' require 'proof/require_proof.rb' module Proof ActionController::Base.send :include, Proof::ProofActions ActionController::Base.send :include, Proof::RequireProof end
github
undercase/proof
https://github.com/undercase/proof
lib/proof/proof_actions.rb
Ruby
mit
221
master
2,063
module Proof # @api private class Error < StandardError; end # Error that will be raised when authorization has failed class NotAuthorizedError < Error; end module ProofActions extend ActiveSupport::Concern included do end module ClassMethods def proof_actions(options={}, &block) ...
github
undercase/proof
https://github.com/undercase/proof
lib/proof/token.rb
Ruby
mit
221
master
1,771
require 'jwt' module Proof class Token attr_reader :data, :expiration_date, :secret_key, :algorithm, :token def initialize(data, secret_key, algorithm, token) # Convert Raw Hash Keys into Ruby Symbols @data = Hash.new data.each do |key, value| @data[key.to_sym] = value end ...
github
undercase/proof
https://github.com/undercase/proof
lib/proof/require_proof.rb
Ruby
mit
221
master
1,247
module Proof module RequireProof extend ActiveSupport::Concern def require_proof(options={}) options[:authenticatable] ||= :User options[:header] ||= 'Authorization' raw_token = request.headers[options[:header]].split(' ').last if request.headers[options[:header]] begin token...
github
undercase/proof
https://github.com/undercase/proof
lib/generators/proof/devise/devise_generator.rb
Ruby
mit
221
master
672
module Proof module Generators class DeviseGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) argument :class_name, type: :string, default: "User" desc "This generator creates a 'login' route, and configures it to work with Devise (with the default mo...
github
undercase/proof
https://github.com/undercase/proof
test/require_proof_test.rb
Ruby
mit
221
master
875
require 'test_helper' class RequireProofTest < ActionController::TestCase @@authorized_token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxfQ.aM3hZFSjILMLjRBOZSXmClIGJeoNgjqCDC37FyJ8RBg' def setup User.create(email: 'real@email.com', password: 'realpassword') @controller = AuthenticationControl...
github
undercase/proof
https://github.com/undercase/proof
test/proof_actions_test.rb
Ruby
mit
221
master
940
require 'json' require 'test_helper' class ProofActionsTest < ActionController::TestCase def setup User.create(email: 'real@email.com', password: 'realpassword') @controller = AuthenticationController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new ...
github
undercase/proof
https://github.com/undercase/proof
test/token_test.rb
Ruby
mit
221
master
1,829
require 'test_helper' class TokenTest < ActiveSupport::TestCase # Utility variables @@token_from_encoded_data = { username: 'johnsmith', password: 'password' } @@token_from_data = { user_id: 1 } # Utility methods def exp_removed(data) # Remove expiration date from hash d = data.clon...
github
undercase/proof
https://github.com/undercase/proof
test/block_actions_test.rb
Ruby
mit
221
master
716
require 'json' require 'test_helper' class BlockActionsTest < ActionController::TestCase def setup User.create(email: 'real@email.com', password: 'realpassword') @controller = BlockController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new Rails.a...
github
undercase/proof
https://github.com/undercase/proof
test/dummy/config/application.rb
Ruby
mit
221
master
1,015
require File.expand_path('../boot', __FILE__) require 'rails/all' Bundler.require(*Rails.groups) require "proof" module Dummy class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/init...
github
undercase/proof
https://github.com/undercase/proof
test/dummy/db/schema.rb
Ruby
mit
221
master
1,004
# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative sou...
github
undercase/proof
https://github.com/undercase/proof
test/dummy/app/controllers/authentication_controller.rb
Ruby
mit
221
master
210
class AuthenticationController < ApplicationController proof_actions authenticate: :authenticate before_action :require_proof, except: :login def test render json: { status: 'authorized' } end end
github
undercase/proof
https://github.com/undercase/proof
test/dummy/app/controllers/block_controller.rb
Ruby
mit
221
master
306
class BlockController < ApplicationController proof_actions authenticatable: :User do |user, token| { user_id: user.id, email: user.email, auth_token: token } end before_action :require_proof, except: :login def test render json: { status: 'authorized' } end end
github
manuelmeurer/services
https://github.com/manuelmeurer/services
services.gemspec
Ruby
mit
221
main
1,730
lib = File.expand_path('../lib', __FILE__) unless $LOAD_PATH.include?(lib) $LOAD_PATH.unshift(lib) end require 'services/version' Gem::Specification.new do |gem| files = `git ls-files`.split($/) test_files = files.grep(%r(^spec/)) gem.name = 'services' gem.version = Ser...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
Guardfile
Ruby
mit
221
main
2,057
require 'guard/rspec' module ::Guard class RSpec < Plugin # Add `stop` method if not defined # so that `stop_*` callbacks work. unless instance_methods.include?(:stop) def stop; end end end module ServicesGemHelpers SPEC_SUPPORT_DIR = Pathname.new(File.expand_path('../spec/support', __...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
lib/services.rb
Ruby
mit
221
main
1,907
require 'gem_config' require_relative 'services/logger/null' module Services include GemConfig::Base NoBackgroundProcessorFound = Class.new(StandardError) RedisNotFound = Class.new(StandardError) with_configuration do has :logger, default: Services::Logger::Null.new has :redis has :...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
lib/services/base.rb
Ruby
mit
221
main
3,012
require 'active_record' require 'securerandom' require 'action_dispatch' require 'digest' module Services class Base include ObjectClass class << self def inherited(subclass) subclass.const_set :Error, Class.new(StandardError) subclass.public_send :include, Rails.application.routes.url...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
lib/services/query.rb
Ruby
mit
221
main
4,923
module Services class Query include ObjectClass COMMA_REGEX = /\s*,\s*/ TABLE_NAME_REGEX = /\A([A-Za-z0-9_]+)\./ CREATED_BEFORE_AFTER_REGEX = /\Acreated_(before|after)\z/ class << self delegate :call, to: :new def convert_condition_objects_to_ids(*class_name...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
lib/services/asyncable.rb
Ruby
mit
221
main
1,733
require 'active_support/concern' require 'global_id' module Services module Asyncable extend ActiveSupport::Concern ASYNC_METHOD_SUFFIXES = %i(async in at).freeze included do sidekiq_loaded = false begin require 'sidekiq' require 'sidekiq/api' rescue LoadError e...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
lib/services/railtie.rb
Ruby
mit
221
main
243
module Services class Railtie < Rails::Railtie # Require `Services::Query` here since it relies # on Rails.application to be present. initializer 'services.load_services_query' do require 'services/query' end end end
github
manuelmeurer/services
https://github.com/manuelmeurer/services
lib/services/modules/object_class.rb
Ruby
mit
221
main
245
module Services module ObjectClass private def object_class self.class.to_s[/\A(?:Services::)?([^:]+)/, 1].singularize.constantize rescue raise "Could not determine service class from #{self.class}." end end end
github
manuelmeurer/services
https://github.com/manuelmeurer/services
lib/services/modules/uniqueness_checker.rb
Ruby
mit
221
main
4,019
module Services class Base module UniquenessChecker KEY_PREFIX = %w( services uniqueness ).join(':').freeze ON_ERROR = %i( fail ignore reschedule return ).freeze MAX_RETRIES = 10.freeze THIRTY_DAYS = (60 * 60 * 24 * 30).freeze ...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
lib/services/modules/exception_wrapper.rb
Ruby
mit
221
main
283
module Services class Base module ExceptionWrapper def call(*args, **kwargs) super rescue StandardError => e if e.class <= self.class::Error raise e else raise self.class::Error, e end end end end end
github
manuelmeurer/services
https://github.com/manuelmeurer/services
lib/services/modules/call_logger.rb
Ruby
mit
221
main
1,922
module Services class Base module CallLogger def self.prepended(mod) mod.extend ClassMethods mod.instance_eval do def inherited(subclass) subclass.extend ClassMethods subclass.disable_call_logging if self.call_logging_disabled end end ...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
lib/services/logger/file.rb
Ruby
mit
221
main
561
require 'active_support/tagged_logging' module Services module Logger class File def initialize(log_dir) log_file = ::File.join(log_dir, 'services.log') @logger = ActiveSupport::TaggedLogging.new(::Logger.new(log_file)) @logger.clear_tags! end def log(message, meta = {}...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
lib/services/logger/redis.rb
Ruby
mit
221
main
1,779
module Services module Logger class Redis META_CLASSES = [ NilClass, TrueClass, FalseClass, Symbol, String, Numeric ].freeze InvalidMetaError = Class.new(StandardError) EmptyResponseFromRedisMultiError = Class.new(StandardErr...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
spec/spec_helper.rb
Ruby
mit
221
main
2,505
require 'rspec' require 'tries' require 'redis' require 'sidekiq' require 'timecop' require 'active_support' require 'active_support/core_ext' require_relative '../lib/services' PROJECT_ROOT = Pathname.new(File.expand_path('../..', __FILE__)) SUPPORT_DIR = Pathname.new(File.expand_path('../suppor...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
spec/support/activerecord_models_and_services.rb
Ruby
mit
221
main
1,461
require 'active_record' ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') ActiveRecord::Schema.define do create_table :posts, force: true do |t| t.string :title t.text :body end create_table :comments, force: true do |t| t.string :body t.references :post end en...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
spec/support/call_proxy.rb
Ruby
mit
221
main
224
# This is just a helper file to ensure that # the services lib folder appears in the caller # locations. module Services class CallProxy def self.call(object, method) object.public_send method end end end
github
manuelmeurer/services
https://github.com/manuelmeurer/services
spec/support/test_services.rb
Ruby
mit
221
main
3,654
class Model class << self def table_name 'models' end # Stub ActiveRecord methods %i(select order where limit page per).each do |m| define_method m do |*args| self end end end attr_reader :id def initialize(id) @id = id ModelRepository.add self end d...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
spec/support/helpers.rb
Ruby
mit
221
main
811
require 'sidekiq/api' ExpectedDataNotFoundError = Class.new(StandardError) def wait_for(&block) 60.tries on: ExpectedDataNotFoundError, delay: 0.1 do block.call or raise ExpectedDataNotFoundError end end def worker_with_jid(jid) Sidekiq::Workers.new.detect do |_, _, work| work['payload']['jid'] == jid ...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
spec/support/shared.rb
Ruby
mit
221
main
415
RSpec.shared_context 'capture logs' do let(:logger) { spy('logger') } let(:logs) { [] } before do Services.configuration.logger = logger allow(logger).to receive(:log) do |message, meta, severity| logs << { message: message, meta: meta, severity: severity } ...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
spec/services/base_spec.rb
Ruby
mit
221
main
3,442
require 'spec_helper' describe Services::Base do let(:model_ids) { (1..5).to_a.shuffle } let(:model_objects) { model_ids.map { |id| Model.new(id) } } let(:model_ids_and_objects) { model_ids[0..2] + model_objects[3..-1] } describe '#find_objects' do context 'when passing in objects' do ...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
spec/services/asyncable_spec.rb
Ruby
mit
221
main
661
require 'spec_helper' describe Services::Asyncable do describe '#perform' do it 'calls `call` with the correct args' do expect { AsyncService.new.perform 'test', pelle: 'fant' }.to raise_error(%w(test baz fant).to_json) # If the `call` method arguments contains kwargs and the last argument to `perfo...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
spec/services/query_spec.rb
Ruby
mit
221
main
1,047
require 'spec_helper' require SUPPORT_DIR.join('activerecord_models_and_services') describe Services::Query do include_context 'capture logs' it 'has call logging disabled by default' do expect { Services::Posts::Find.call [] }.to_not change { logs } end describe '.convert_condition_objects_to_ids' do ...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
spec/services/configuration_spec.rb
Ruby
mit
221
main
250
require 'spec_helper' describe Services do context 'configuration' do describe 'logger' do it 'uses the null logger by default' do expect(Services.configuration.logger).to be_a(Services::Logger::Null) end end end end
github
manuelmeurer/services
https://github.com/manuelmeurer/services
spec/services/logger/redis_spec.rb
Ruby
mit
221
main
2,406
require 'spec_helper' describe Services::Logger::Redis do let(:key) { 'custom_log_key' } let(:redis) { Redis.new(url: REDIS_URL) } let(:logger) { described_class.new(redis, key) } let(:logs) { [ { time: Date.new(2014, 9, 15), message: "One day baby we'll be old", seve...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
spec/services/modules/uniqueness_checker_spec.rb
Ruby
mit
221
main
4,279
require 'spec_helper' shared_examples 'checking the uniqueness properly' do it 'notices when the same job is executed multiple times' do wait_for_job_to_run_and_finish service_class, *args, 'fail', true do # Check that error is raised when on_error is "fail" puts 'Checking on_error = fail' if d...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
spec/services/modules/call_logger_spec.rb
Ruby
mit
221
main
3,229
require 'spec_helper' describe Services::Base::CallLogger do include_context 'capture logs' context 'when call logging is enabled' do it 'logs start and end' do service, args = EmptyService.new, %w(foo bar) service.call *args caller_regex = /\A#{Regexp.escape __FILE__}:\d+\z/ expect(lo...
github
manuelmeurer/services
https://github.com/manuelmeurer/services
spec/services/modules/exception_wrapper_spec.rb
Ruby
mit
221
main
2,053
require 'spec_helper' describe Services::Base::ExceptionWrapper do if StandardError.new.respond_to?(:cause) it 'does not wrap service errors or subclasses' do expect do ErrorService.call end.to raise_error do |error| expect(error).to be_a(ErrorService::Error) expect(error.mess...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
Rakefile
Ruby
apache-2.0
221
main
389
require "bundler/setup" require "rake/testtask" require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec) do |task| task.rspec_opts = "--pattern test/rspecs/**{,/*/**}/*_rspec.rb" end Rake::TestTask.new do |test| test.pattern = "test/**/*_spec.rb" test.verbose = true end desc "Run all tests" task :defaul...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
sparkle_formation.gemspec
Ruby
apache-2.0
221
main
1,172
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__)) + "/lib/" require "sparkle_formation/version" Gem::Specification.new do |s| s.name = "sparkle_formation" s.version = SparkleFormation::VERSION.version s.summary = "Orchestration Template Generator" s.author = "Chris Roberts" s.email = "chrisroberts.c...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
examples/allinone/parse.rb
Ruby
apache-2.0
221
main
292
require 'sparkle_formation' require 'pp' require 'json' SparkleFormation.sparkle_path = File.join(File.dirname(__FILE__), 'cloudformation') puts JSON.pretty_generate( SparkleFormation.compile( File.join( File.dirname(__FILE__), 'cloudformation/ec2_example.rb' ) ) )
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
examples/allinone/cloudformation/ec2_example.rb
Ruby
apache-2.0
221
main
1,761
SparkleFormation.new('ec2_example') do description "AWS CloudFormation Sample Template EC2InstanceSample..." parameters do key_name do description 'Name of an existing EC2 KeyPair to enable SSH access to the instance' type 'String' end end mappings.region_map do set!('us-east-1'._no_hu...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
examples/ami_component/cloudformation/ec2_example.rb
Ruby
apache-2.0
221
main
1,200
SparkleFormation.new('ec2_example').load(:ami).overrides do description "AWS CloudFormation Sample Template EC2InstanceSample..." dynamic!(:ec2_instance, :my) do properties do key_name ref!(:key_name) image_id map!(:region_map, region!, :ami) user_data base64!('80') end end outputs ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
examples/ami_component/cloudformation/components/ami.rb
Ruby
apache-2.0
221
main
614
SparkleFormation.build do parameters do key_name do description 'Name of an existing EC2 KeyPair to enable SSH access to the instance' type 'String' end end mappings.region_map do set!('us-east-1'._no_hump, :ami => 'ami-7f418316') set!('us-west-1'._no_hump, :ami => 'ami-951945d0') ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/sparkle_struct.rb
Ruby
apache-2.0
221
main
6,466
require "sparkle_formation" require "attribute_struct/monkey_camels" class SparkleFormation # SparkleFormation customized AttributeStruct class SparkleStruct < AttributeStruct # AWS specific struct class Aws < SparkleStruct include SparkleAttribute include SparkleAttribute::Aws end #...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/error.rb
Ruby
apache-2.0
221
main
1,061
require "sparkle_formation" class SparkleFormation # SparkleFormation specific errors class Error < StandardError # Inheritance error class CircularInheritance < Error; end # Found resource improperly constructed class InvalidResource < Error; end # File not found error class NotFound <...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/resources.rb
Ruby
apache-2.0
221
main
8,311
require "sparkle_formation" class SparkleFormation # Resources helper class Resources autoload :Aws, "sparkle_formation/resources/aws" autoload :Azure, "sparkle_formation/resources/azure" autoload :Google, "sparkle_formation/resources/google" autoload :Heat, "sparkle_formation/resources/heat" a...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/utils.rb
Ruby
apache-2.0
221
main
3,616
class SparkleFormation # Helper utilities module Utils # Execue provided block without warnings def self.silence_warnings v = $VERBOSE $VERBOSE = nil yield ensure $VEBOSE = v end # Type check helpers module TypeCheckers # Validate given value is type defined...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/sparkle.rb
Ruby
apache-2.0
221
main
11,282
require "sparkle_formation" # Unicorns and rainbows class SparkleFormation # Independent collection of SparkleFormation items class Sparkle class << self @@_pack_registry = Smash.new # Register a SparklePack for short name access # # @param name [String, Symbol] name of pack # @p...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/audit_log.rb
Ruby
apache-2.0
221
main
2,540
class SparkleFormation class AuditLog include Enumerable class SourcePoint attr_reader :line attr_reader :path def initialize(*args) if args.last.is_a?(Hash) opts = args.pop.to_smash else opts = Smash.new end @path, @line = args @...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/translation.rb
Ruby
apache-2.0
221
main
9,695
require "sparkle_formation" require "multi_json" require "logger" class SparkleFormation # Translator class Translation autoload :Heat, "sparkle_formation/translation/heat" autoload :Rackspace, "sparkle_formation/translation/rackspace" include SparkleFormation::Utils::AnimalStrings include Sparkle...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/function_struct.rb
Ruby
apache-2.0
221
main
9,267
require "sparkle_formation" class SparkleFormation # SparkleFormation customized AttributeStruct targeted at defining # strings of code for remote evaulation class FunctionStruct < AttributeStruct # @return [String] name of function attr_reader :_fn_name # @return [Array<Object>] function argument ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/provider.rb
Ruby
apache-2.0
221
main
470
require "sparkle_formation" class SparkleFormation # Provider specific implementation namespace module Provider autoload :Aws, "sparkle_formation/provider/aws" autoload :Azure, "sparkle_formation/provider/azure" autoload :Google, "sparkle_formation/provider/google" autoload :Heat, "sparkle_formatio...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/sparkle_attribute.rb
Ruby
apache-2.0
221
main
5,732
require "sparkle_formation" class SparkleFormation # Provides template helper methods module SparkleAttribute autoload :Aws, "sparkle_formation/sparkle_attribute/aws" autoload :Azure, "sparkle_formation/sparkle_attribute/azure" autoload :Google, "sparkle_formation/sparkle_attribute/google" autoloa...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/sparkle_collection.rb
Ruby
apache-2.0
221
main
5,563
require "sparkle_formation" class SparkleFormation # Provides a collection of sparkles # @todo add unmemoize behavior on collection modification to prevent # leak on long running processes with long lasting collections class SparkleCollection < Sparkle autoload :Rainbow, "sparkle_formation/sparkle_collecti...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/composition.rb
Ruby
apache-2.0
221
main
5,261
require "sparkle_formation" class SparkleFormation # Internal template composition class Composition # Component item of composition Component = Utils.silence_warnings do Struct.new("Component", :origin, :key, :block) do def key self[:key].to_s end end end # ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/aws.rb
Ruby
apache-2.0
221
main
205
# TODO: Include deprecation notice information require "sparkle_formation" # Shortcut helper constant SfnAws = SparkleFormation::Aws = SparkleFormation::Resources::Aws # rubocop:disable Style/ConstantName
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/sparkle_formation.rb
Ruby
apache-2.0
221
main
38,742
require "bogo" require "multi_json" require "attribute_struct" # Formation container class SparkleFormation autoload :Aws, "sparkle_formation/aws" autoload :AuditLog, "sparkle_formation/audit_log" autoload :AzureVariableStruct, "sparkle_formation/function_struct" autoload :Composition, "sparkle_formation/compo...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/provider/heat.rb
Ruby
apache-2.0
221
main
7,029
require "sparkle_formation" class SparkleFormation module Provider # Heat specific implementation module Heat # @return [String] Type string for OpenStack HEAT stack resource def stack_resource_type "OS::Heat::Stack" end # Generate policy for stack # # @return [H...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/provider/google.rb
Ruby
apache-2.0
221
main
7,579
require "sparkle_formation" class SparkleFormation module Provider # Google specific implementation module Google # Always return as nested since nesting is our final form def nested?(*_) true end # Extract nested stack templates and store in root level files # #...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/provider/aws.rb
Ruby
apache-2.0
221
main
8,979
require "sparkle_formation" class SparkleFormation module Provider # AWS specific implementation module Aws # @return [String] Type string for AWS CFN stack resource def stack_resource_type "AWS::CloudFormation::Stack" end # Generate policy for stack # # @return ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/provider/azure.rb
Ruby
apache-2.0
221
main
7,754
require "sparkle_formation" class SparkleFormation module Provider # Azure specific implementation module Azure # @return [String] Type string for Azure Resource Manager stack resource def stack_resource_type "Microsoft.Resources/deployments" end # Generate policy for stack ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/provider/terraform.rb
Ruby
apache-2.0
221
main
5,835
require "sparkle_formation" class SparkleFormation module Provider # Terraform specific implementation module Terraform # Customized dump to break out templates into consumable structures for # passing to the deployment manager API # # @return [Hash] def terraform_dump ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/resources/rackspace.rb
Ruby
apache-2.0
221
main
701
require "sparkle_formation" class SparkleFormation # Resources helper class Resources # Rackspace specific resources collection class Rackspace < Resources class << self include Bogo::Memoization # Load the builtin AWS resources # # @return [TrueClass] def l...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/resources/google.rb
Ruby
apache-2.0
221
main
1,078
require "sparkle_formation" class SparkleFormation # Resources helper class Resources # Google specific resources collection class Google < Resources # Characters to be removed from supplied key on matching RESOURCE_TYPE_TR = "._" # String to split for resource namespacing RESOUR...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/resources/terraform.rb
Ruby
apache-2.0
221
main
1,471
require "sparkle_formation" class SparkleFormation # Resources helper class Resources # Terraform specific resources collection class Terraform < Resources # String to split for resource namespacing RESOURCE_TYPE_NAMESPACE_SPLITTER = ["_"] class << self include Bogo::Memoizati...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/resources/aws.rb
Ruby
apache-2.0
221
main
14,918
require "sparkle_formation" class SparkleFormation # Resources helper class Resources # AWS specific resources collection class Aws < Resources # Conditionals for property updates PROPERTY_UPDATE_CONDITIONALS = Smash.new( "AWS::DynamoDB::Table" => { "GlobalSecondaryIndexes"...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/resources/azure.rb
Ruby
apache-2.0
221
main
1,530
require "sparkle_formation" class SparkleFormation # Resources helper class Resources # Azure specific resources collection class Azure < Resources # Characters to be removed from supplied key on matching RESOURCE_TYPE_TR = "/._" # String to split for resource namespacing RESOURC...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/resources/heat.rb
Ruby
apache-2.0
221
main
681
require "sparkle_formation" class SparkleFormation # Resources helper class Resources # Heat specific resources collection class Heat < Resources class << self include Bogo::Memoization # Load the builtin AWS resources # # @return [TrueClass] def load! ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/translation/rackspace.rb
Ruby
apache-2.0
221
main
18,080
class SparkleFormation class Translation # Translation for Rackspace class Rackspace < Heat # Custom mapping for network interfaces # # @param value [Object] original property value # @param args [Hash] # @option args [Hash] :new_resource # @option args [Hash] :new_propert...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/translation/heat.rb
Ruby
apache-2.0
221
main
14,373
class SparkleFormation class Translation # Translation for Heat (HOT) class Heat < Translation # Translate stack definition # # @return [TrueClass] # @note this is an override to return in proper HOT format # @todo still needs replacements of functions and pseudo-params de...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/sparkle_attribute/google.rb
Ruby
apache-2.0
221
main
5,059
require "zlib" require "sparkle_formation" class SparkleFormation module SparkleAttribute # Google specific helper implementations module Google CHARACTER_COLLECTION = ("a".."z").to_a def self.included(klass) klass.const_set(:CAMEL_STYLE, :no_leading) klass.class_eval do ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/sparkle_attribute/heat.rb
Ruby
apache-2.0
221
main
6,334
require "sparkle_formation" class SparkleFormation # Provides template helper methods module SparkleAttribute # Heat specific helper implementations module Heat # Set customized struct behavior def self.included(klass) if klass.const_defined?(:CAMEL_KEYS) klass.send(:remove...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/sparkle_attribute/terraform.rb
Ruby
apache-2.0
221
main
5,307
require "sparkle_formation" class SparkleFormation # Provides template helper methods module SparkleAttribute # Terraform specific helper implementations module Terraform # Set customized struct behavior def self.included(klass) klass.const_set(:CAMEL_KEYS, false) end de...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/sparkle_attribute/azure.rb
Ruby
apache-2.0
221
main
5,972
require "sparkle_formation" class SparkleFormation # Provides template helper methods module SparkleAttribute # Azure specific helper implementations module Azure # Extract resources Hash from template dump and transform to # Array type expected by the ARM API # # @param hash [Ha...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/sparkle_attribute/rackspace.rb
Ruby
apache-2.0
221
main
414
require "sparkle_formation" class SparkleFormation # Provides template helper methods module SparkleAttribute # Rackspace specific helper implementations module Rackspace # @!parse include SparkleFormation::SparkleAttribute::Heat # Set customized struct behavior def self.included(klas...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/sparkle_attribute/aws.rb
Ruby
apache-2.0
221
main
12,913
require "sparkle_formation" class SparkleFormation # Provides template helper methods module SparkleAttribute # AWS specific helper implementations module Aws # CIDR generator # # @param ipblock [String] CIDR address block # @param count [Integer] Number of CIDRs to generate ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
lib/sparkle_formation/sparkle_collection/rainbow.rb
Ruby
apache-2.0
221
main
2,400
require "sparkle_formation" require "forwardable" class SparkleFormation class SparkleCollection # Contains a layered number of a specific item defined via # a Sparkle. Items higher in the spectrum (greater layer index) # have higher precedence than those below. This can be used for # properly gener...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/spec.rb
Ruby
apache-2.0
221
main
306
require "sparkle_formation" require "minitest/autorun" def capture_stdout old, $stdout = $stdout, StringIO.new yield $stdout.string ensure $stdout = old end $sparkle_path_spec = File.join( File.dirname(__FILE__), "specs", "sparkleformation" ) SparkleFormation.sparkle_path = $sparkle_path_spec
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/sparkle_struct_rspec.rb
Ruby
apache-2.0
221
main
3,878
require_relative "../rspecs" RSpec.describe SparkleFormation::SparkleStruct do before { SparkleFormation._cleanify! } let(:instance) { described_class.new } describe "#_set_self" do context "when set with SparkleFormation type value" do it "should not raise error" do u_self = SparkleFormation...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/function_struct_rspec.rb
Ruby
apache-2.0
221
main
5,115
require_relative "../rspecs" RSpec.describe SparkleFormation do before { SparkleFormation._cleanify! } describe SparkleFormation::FunctionStruct do let(:instance) { described_class.new } describe "#nil?" do it "should always be false" do expect(instance.nil?).to be(false) end end ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/sparkle_formation_rspec.rb
Ruby
apache-2.0
221
main
2,922
require_relative "../rspecs" RSpec.describe SparkleFormation do before { SparkleFormation._cleanify! } let(:instance_args) { {} } let(:instance) { described_class.new("test", instance_args) { content "value" } } describe "#compile" do describe "compile time parameters" do let(:instance_args) { {:co...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/composition_rspec.rb
Ruby
apache-2.0
221
main
6,069
require_relative "../rspecs" RSpec.describe SparkleFormation::Composition do before { SparkleFormation._cleanify! } it "should raise error if provided origin is not a SparkleFormation instance" do expect { described_class.new(true) }.to raise_error(TypeError) end context "with only origin provided" do ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/audit_log_rspec.rb
Ruby
apache-2.0
221
main
3,195
require_relative "../rspecs" RSpec.describe SparkleFormation::AuditLog do before { SparkleFormation._cleanify! } describe SparkleFormation::AuditLog::SourcePoint do let(:path) { "PATH" } let(:line) { 3 } it "should allow explicit arguments" do i = described_class.new(path, line) expect(i....
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/sparkle_attribute_rspec.rb
Ruby
apache-2.0
221
main
3,055
require_relative "../rspecs" RSpec.describe SparkleFormation::SparkleAttribute do before { SparkleFormation._cleanify! } let(:instance) do obj = Class.new(SparkleFormation::SparkleStruct).new obj._set_self(SparkleFormation.new("test")) obj end context "#_resource_name" do context "with resour...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/utils_rspec.rb
Ruby
apache-2.0
221
main
3,565
require_relative "../rspecs" RSpec.describe SparkleFormation::Utils do before { SparkleFormation._cleanify! } let(:subject) do mod = Module.new mod.extend(described_class) mod end describe SparkleFormation::Utils::TypeCheckers do describe "stringish value check" do it "should not raise ...