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
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/commands/push_sub_commands/push_translations_command.rb
Ruby
mit
191
master
421
module Locomotive::Wagon class PushTranslationsCommand < PushBaseCommand def entities repositories.translation.all end def decorate(entity) TranslationDecorator.new(entity) end def persist(decorated_entity) api_client.translations.update(decorated_entity.id, decorated_entity....
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/commands/push_sub_commands/push_pages_command.rb
Ruby
mit
191
master
4,126
module Locomotive::Wagon class PushPagesCommand < PushBaseCommand def entities repositories.page.all.map do |entity| next if skip?(entity) entity end.compact end def decorate(entity) _decorate(entity).tap do |decorated| if parent = repositories.page.parent_of(e...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/commands/push_sub_commands/push_site_command.rb
Ruby
mit
191
master
1,069
module Locomotive::Wagon class PushSiteCommand < PushBaseCommand def entities [repositories.site.first] end def decorate(entity) UpdateSiteDecorator.new(entity, default_locale, path, content_assets_pusher) end def persist(decorated_entity) _attributes = decorated_entity.to_ha...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/commands/push_sub_commands/push_content_entries_command.rb
Ruby
mit
191
master
2,566
module Locomotive::Wagon class PushContentEntriesCommand < PushBaseCommand attr_reader :step alias_method :default_push, :_push def _push ([:without_relationships] + other_locales + [:only_relationships]).each do |step| @step = step default_push end end def entitie...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/generators/public_form.rb
Ruby
mit
191
master
2,501
require 'thor/group' require 'active_support' require 'active_support/core_ext' module Locomotive module Wagon module Generators class PublicForm < Thor::Group include Thor::Actions include Locomotive::Wagon::CLI::ForceColor argument :target_path # path to the site def cr...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/generators/snippet.rb
Ruby
mit
191
master
1,365
require 'thor/group' require 'active_support' require 'active_support/core_ext' module Locomotive module Wagon module Generators class Snippet < Thor::Group include Thor::Actions include Locomotive::Wagon::CLI::ForceColor argument :slug argument :locales argument :...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/generators/site_metafields.rb
Ruby
mit
191
master
1,604
require 'thor/group' require 'active_support' require 'active_support/core_ext' module Locomotive module Wagon module Generators class SiteMetafields < Thor::Group include Thor::Actions include Locomotive::Wagon::CLI::ForceColor argument :target_path # path to the site de...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/generators/section.rb
Ruby
mit
191
master
5,644
require 'thor/group' require 'faker' require 'active_support' require 'active_support/core_ext' module Locomotive module Wagon module Generators class Section < Thor::Group ICON_LIST = ['header', 'default', 'slide', 'text', ...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/generators/content_type.rb
Ruby
mit
191
master
1,782
require 'thor/group' require 'ostruct' require 'active_support' require 'active_support/core_ext' require 'faker' # Remove I18n warnings (i18n lib is required by faker) I18n.enforce_available_locales = false module Locomotive module Wagon module Generators class ContentType < Thor::Group include ...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/generators/relationship.rb
Ruby
mit
191
master
3,232
require 'thor/group' require 'thor/error' require 'active_support' require 'active_support/core_ext' module Locomotive module Wagon module Generators class Relationship < Thor::Group include Thor::Actions include Locomotive::Wagon::CLI::ForceColor argument :source # slug of a con...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/generators/webpack.rb
Ruby
mit
191
master
586
require 'thor/group' require 'active_support' require 'active_support/core_ext' module Locomotive module Wagon module Generators class Webpack < Thor::Group include Thor::Actions include Locomotive::Wagon::CLI::ForceColor argument :target_path # path to the site def copy_...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/generators/site.rb
Ruby
mit
191
master
4,348
require 'ostruct' require 'singleton' module Locomotive module Wagon module Generators module Site # Register a generator by adding it to the list of existing generators. # # @param [ String ] name The name of the generator # @param [ Class ] klass The class of the generat...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/generators/page.rb
Ruby
mit
191
master
2,266
require 'thor/group' require 'active_support' require 'active_support/core_ext' module Locomotive module Wagon module Generators class Page < Thor::Group include Thor::Actions include Locomotive::Wagon::CLI::ForceColor argument :slug argument :target_path # path to the sit...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/generators/site/base.rb
Ruby
mit
191
master
1,152
require 'thor/group' require 'active_support' require 'active_support/core_ext' require 'active_support/core_ext/string/inflections' require 'locomotive/wagon/version' module Locomotive module Wagon module Generators module Site class Base < Thor::Group include Thor::Actions i...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/generators/site/blank.rb
Ruby
mit
191
master
272
module Locomotive module Wagon module Generators module Site class Blank < Base end Locomotive::Wagon::Generators::Site.register(:blank, Blank, %{ A blank site with the minimal files. }) end end end end
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/generators/site/cloned.rb
Ruby
mit
191
master
434
module Locomotive module Wagon module Generators module Site # Template used when the remote LocomotiveCMS site is cloned # in order to have the minimal files. class Cloned < Base argument :connection_info def copy_sources copy_sources_from_generato...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/decorators/theme_asset_decorator.rb
Ruby
mit
191
master
1,924
module Locomotive module Wagon class ThemeAssetDecorator < SimpleDelegator include ToHashConcern EXTENSIONS_TABLE = { '.scss' => '.css', '.css.scss' => '.css', '.sass' => '.css', '.css.sass' => '.css', '.less' => '.css', '.css.le...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/decorators/content_type_field_decorator.rb
Ruby
mit
191
master
1,623
module Locomotive module Wagon class ContentTypeFieldDecorator < SimpleDelegator include ToHashConcern def initialize(entity, persisted = false) @persisted = persisted super(entity) end def __attributes__ %i(name type label hint required localized unique positio...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/decorators/page_decorator.rb
Ruby
mit
191
master
2,875
module Locomotive module Wagon class PageDecorator < Locomotive::Steam::Decorators::TemplateDecorator include ToHashConcern include PersistAssetsConcern attr_accessor :__content_assets_pusher__, :__persist_content__ def initialize(object, locale, content_assets_pusher, persist_content)...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/decorators/content_entry_decorator.rb
Ruby
mit
191
master
2,756
module Locomotive module Wagon class ContentEntryDecorator < Locomotive::Steam::Decorators::I18nDecorator include ToHashConcern include PersistAssetsConcern attr_accessor :__base_path__, :__content_assets_pusher__ DEFAULT_ATTRIBUTES = %i(_slug seo_title meta_keywords meta_description)....
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/decorators/section_decorator.rb
Ruby
mit
191
master
704
module Locomotive module Wagon class SectionDecorator < Locomotive::Steam::Decorators::TemplateDecorator include ToHashConcern include PersistAssetsConcern attr_accessor :__content_assets_pusher__ def initialize(object, content_assets_pusher) self.__content_assets_pusher__ = co...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/decorators/translation_decorator.rb
Ruby
mit
191
master
227
module Locomotive module Wagon class TranslationDecorator < SimpleDelegator include ToHashConcern def id key end def __attributes__ %i(key values) end end end end
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/decorators/editable_element_decorator.rb
Ruby
mit
191
master
675
module Locomotive module Wagon class EditableElementDecorator < Locomotive::Steam::Decorators::TemplateDecorator include ToHashConcern include PersistAssetsConcern attr_accessor :__content_assets_pusher__ def initialize(object, locale = nil, content_assets_pusher) self.__conten...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/decorators/content_asset_decorator.rb
Ruby
mit
191
master
562
module Locomotive module Wagon class ContentAssetDecorator < Struct.new(:filepath) include ToHashConcern def __attributes__ %i(source) end def source Locomotive::Coal::UploadIO.new(_readfile(filepath), nil, filename) end def checksum Digest::MD5.hex...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/decorators/site_decorator.rb
Ruby
mit
191
master
2,287
module Locomotive module Wagon class SiteDecorator < Locomotive::Steam::Decorators::I18nDecorator include ToHashConcern include PersistAssetsConcern attr_accessor :__base_path__, :__content_assets_pusher__ def initialize(object, locale = nil, base_path = nil, content_assets_pusher = ni...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/decorators/snippet_decorator.rb
Ruby
mit
191
master
821
module Locomotive module Wagon class SnippetDecorator < Locomotive::Steam::Decorators::TemplateDecorator include ToHashConcern include PersistAssetsConcern attr_accessor :__content_assets_pusher__ def initialize(object, locale = nil, content_assets_pusher) self.__content_assets...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/decorators/content_type_decorator.rb
Ruby
mit
191
master
2,492
module Locomotive module Wagon class ContentTypeDecorator < SimpleDelegator include ToHashConcern def initialize(entity, existing_fields = []) @existing_fields = existing_fields super(entity) end def __attributes__ %i(name slug description label_field_name tree_...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/decorators/concerns/persist_assets_concern.rb
Ruby
mit
191
master
645
require_relative '../../tools/yaml_ext.rb' module Locomotive::Wagon module PersistAssetsConcern def replace_with_content_assets!(text) return text if text.blank? text.to_s.gsub(/([^a-zA-Z0-9]|^)(\/samples\/[\/a-zA-Z0-9_-]+(\.[a-zA-Z0-9]+)*)/) do url = __content_assets_pusher__.persist($2) ...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/decorators/concerns/to_hash_concern.rb
Ruby
mit
191
master
697
require 'locomotive/coal' module Locomotive::Wagon module ToHashConcern def to_hash {}.tap do |hash| __attributes__.each do |name| value = self.public_send(name) next if value.nil? hash[name] = prepare_value_for_hash(value) end end end def pr...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/middlewares/error_page.rb
Ruby
mit
191
master
4,003
require 'erb' require 'locomotive/steam/middlewares/concerns/helpers' require 'locomotive/steam/middlewares/thread_safe' module Locomotive::Wagon module Middlewares # Display a nice page error # class ErrorPage < Locomotive::Steam::Middlewares::ThreadSafe include Locomotive::Steam::Middlewares::C...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/tools/styled_yaml.rb
Ruby
mit
191
master
3,305
require 'psych' require 'stringio' # Public: A Psych extension to enable choosing output styles for specific # objects. # # Thanks to Tenderlove for help in <http://stackoverflow.com/q/9640277/11687> # # Examples # # data = { # response: { body: StyledYAML.literal(json_string), status: 200 }, # person: Style...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/tools/glob.rb
Ruby
mit
191
master
2,014
# Original source code: https://raw.githubusercontent.com/alexch/rerun/master/lib/rerun/glob.rb # License here: https://github.com/alexch/rerun/blob/master/LICENSE # # based on http://cpan.uwinnipeg.ca/htdocs/Text-Glob/Text/Glob.pm.html#glob_to_regex_string- # module Locomotive module Wagon class Glob NO_L...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/tools/yaml_ext.rb
Ruby
mit
191
master
438
module Locomotive module Wagon module YamlExt def self.transform(hash, &block) return if hash.blank? || !hash.respond_to?(:has_key?) hash.each do |key, value| case value when Hash then transform(value, &block) when Array then value.each { |v| transform(v, ...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/tools/tcp_port.rb
Ruby
mit
191
master
766
require 'socket' module Locomotive module Wagon class TcpPort MAX_ATTEMPTS = 1000 def initialize(host, from) @host = host @from = from end def first current = @from.to_i max = current + MAX_ATTEMPTS while open_port(@host, current) ...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
lib/locomotive/wagon/tools/listen.rb
Ruby
mit
191
master
2,125
begin require 'listen' rescue LoadError => ex puts "Cannot find the `listen` gem. Did you forgot to use `bundle exec` when running your wagon command?". raise ex end module Locomotive::Wagon class Listen < Struct.new(:path, :cache, :options) def self.start(path, cache, options) new(path, cache, opt...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/spec_helper.rb
Ruby
mit
191
master
330
require 'locomotive/wagon' require 'rspec' require 'simplecov' SimpleCov.start do add_filter 'spec/' end Dir["#{File.expand_path('../support', __FILE__)}/*.rb"].each do |file| require file end RSpec.configure do |c| c.include Spec::Helpers c.before(:all) { remove_logs } c.before { reset! } c.after { res...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/support/vcr.rb
Ruby
mit
191
master
899
require 'vcr' require 'faraday' # Custom VCR matchers custom_body_matcher = lambda do |request_1, request_2| if request_1.body.encoding.name == 'ASCII-8BIT' # when uploading a file, we noticed that VCR or Faraday added 2 extra characters # at the end of the body: \r\n. request_1.body == request_2.body ||...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/support/api_settings.rb
Ruby
mit
191
master
278
TEST_PLATFORM_URL = 'http://localhost:3000'.freeze TEST_PLATFORM_ALT_URL = 'localhost:3000'.freeze TEST_API_EMAIL = 'admin@locomotivecms.com'.freeze TEST_API_PASSWORD = 'locomotive'.freeze TEST_API_KEY = 'd49cd50f6f0d2b163f48fc73cb249f0244c37074'.freeze
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/support/thor.rb
Ruby
mit
191
master
216
def capture(stream) begin stream = stream.to_s eval "$#{stream} = StringIO.new" yield result = eval("$#{stream}").string ensure eval("$#{stream} = #{stream.upcase}") end result.strip end
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/support/helpers.rb
Ruby
mit
191
master
999
module Spec module Helpers def default_site_path File.expand_path('../../fixtures/default', __FILE__) end def reset! FileUtils.rm_rf(File.expand_path('../../../site', __FILE__)) end def remove_logs FileUtils.rm_rf(File.expand_path('../../fixtures/default/log', __FILE__)) e...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
Ruby
mit
191
master
1,277
# encoding: utf-8 require 'spec_helper' require 'active_support' require 'active_support/core_ext' require 'locomotive/wagon/commands/pull_sub_commands/pull_base_command' require 'locomotive/wagon/commands/pull_sub_commands/pull_content_types_command' describe Locomotive::Wagon::PullContentTypesCommand do let(:lo...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/unit/commands/pull_sub_commands/concerns/assets_concern_spec.rb
Ruby
mit
191
master
2,034
# encoding: utf-8 require 'spec_helper' require 'active_support' require 'active_support/core_ext' require 'locomotive/wagon/commands/pull_sub_commands/concerns/assets_concern' describe Locomotive::Wagon::AssetsConcern do let(:concern) { Class.new { include Locomotive::Wagon::AssetsConcern; def path; 'tmp'; end; ...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
Ruby
mit
191
master
1,284
# encoding: utf-8 require 'spec_helper' require 'locomotive/steam' require 'locomotive/wagon/commands/push_sub_commands/push_base_command' require 'locomotive/wagon/commands/push_sub_commands/push_theme_assets_command' describe Locomotive::Wagon::PushThemeAssetsCommand do let(:command) { described_class.new(nil, ...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/unit/commands/push_sub_commands/push_pages_command_spec.rb
Ruby
mit
191
master
3,339
# encoding: utf-8 require 'spec_helper' require 'locomotive/wagon/commands/push_sub_commands/push_base_command' require 'locomotive/wagon/commands/push_sub_commands/push_pages_command' require 'ostruct' describe Locomotive::Wagon::PushPagesCommand do let(:api_response) { [] } let(:site) { instance_dou...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/unit/decorators/site_decorator_spec.rb
Ruby
mit
191
master
2,315
# encoding: utf-8 require 'spec_helper' require 'ostruct' require 'locomotive/wagon/decorators/concerns/to_hash_concern' require 'locomotive/wagon/decorators/concerns/persist_assets_concern' require 'locomotive/steam/decorators/i18n_decorator' require 'locomotive/wagon/decorators/site_decorator' describe Locomotive:...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/unit/decorators/content_entry_decorator_spec.rb
Ruby
mit
191
master
4,074
# encoding: utf-8 require 'spec_helper' require 'locomotive/steam' require 'locomotive/wagon/decorators/concerns/to_hash_concern' require 'locomotive/wagon/decorators/concerns/persist_assets_concern' require 'locomotive/wagon/decorators/content_entry_decorator' describe Locomotive::Wagon::ContentEntryDecorator do ...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/unit/decorators/page_decorator_spec.rb
Ruby
mit
191
master
795
# encoding: utf-8 require 'spec_helper' require 'ostruct' require 'locomotive/wagon/decorators/concerns/to_hash_concern' require 'locomotive/wagon/decorators/concerns/persist_assets_concern' require 'locomotive/steam/decorators/template_decorator' require 'locomotive/wagon/decorators/page_decorator' describe Locomot...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/unit/decorators/theme_asset_decorator_spec.rb
Ruby
mit
191
master
2,769
# encoding: utf-8 require 'spec_helper' require 'ostruct' require 'locomotive/wagon/decorators/concerns/to_hash_concern' require 'locomotive/wagon/decorators/theme_asset_decorator' describe Locomotive::Wagon::ThemeAssetDecorator do let(:filepath) { '/somewhere/mysite/public/stylesheets/application.css' } let(:...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/unit/tools/glob_spec.rb
Ruby
mit
191
master
436
# encoding: utf-8 require 'spec_helper' require_relative '../../../lib/locomotive/wagon/tools/glob.rb' describe Locomotive::Wagon::Glob do let(:string) { '' } let(:instance) { described_class.new(string) } describe "#to_regexp" do subject { instance.to_regexp } describe '**/*.css' do let...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/unit/tools/yaml_ext_spec.rb
Ruby
mit
191
master
863
# encoding: utf-8 require 'spec_helper' require_relative '../../../lib/locomotive/wagon/tools/yaml_ext.rb' describe Locomotive::Wagon::YamlExt do describe '.transform' do let(:hash) { nil } let(:block) { -> (value) { value + '!' } } subject { described_class.transform(hash, &block); hash } it ...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/integration/integration_helper.rb
Ruby
mit
191
master
411
# encoding: utf-8 require File.dirname(__FILE__) + '/../spec_helper' # require 'vcr' # require 'webmock/rspec' # VCR.configure do |c| # c.ignore_localhost = false # c.cassette_library_dir = File.dirname(__FILE__) + '/cassettes' # c.hook_into :webmock # c.default_cassette_options = { record: :new_episodes } #...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/integration/cli_spec.rb
Ruby
mit
191
master
334
# encoding: utf-8 require File.dirname(__FILE__) + '/integration_helper' require 'locomotive/wagon/cli' describe Locomotive::Wagon::CLI do subject { capture(:stdout) { command } } describe '#version' do let(:command) { Locomotive::Wagon::CLI::Main.start(['version']) } it { is_expected.to match /^3\.2/ ...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/integration/commands/sync_command_spec.rb
Ruby
mit
191
master
2,562
# encoding: utf-8 require File.dirname(__FILE__) + '/../integration_helper' require 'locomotive/steam' require 'locomotive/steam/adapters/filesystem' require 'locomotive/wagon/commands/push_command' require 'locomotive/wagon/commands/sync_command' require 'thor' describe Locomotive::Wagon::SyncCommand do before { ...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/integration/commands/push_command_spec.rb
Ruby
mit
191
master
3,098
# encoding: utf-8 require File.dirname(__FILE__) + '/../integration_helper' require 'locomotive/wagon/commands/push_command' require 'thor' describe Locomotive::Wagon::PushCommand do before { VCR.insert_cassette 'push', match_requests_on: [:uri, :method, :query, :body, :headers] } after { VCR.eject_cassette } ...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/integration/commands/delete_command_spec.rb
Ruby
mit
191
master
4,780
# encoding: utf-8 require File.dirname(__FILE__) + '/../integration_helper' require 'locomotive/wagon/commands/authenticate_command' require 'locomotive/wagon/commands/delete_command' require 'thor' describe Locomotive::Wagon::DeleteCommand do before { VCR.insert_cassette 'delete', record: :new_episodes, match_requ...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/integration/commands/authenticate_command_spec.rb
Ruby
mit
191
master
1,804
# encoding: utf-8 require File.dirname(__FILE__) + '/../integration_helper' require 'locomotive/wagon/commands/authenticate_command' require 'thor' describe Locomotive::Wagon::AuthenticateCommand do before { VCR.insert_cassette 'authenticate', record: :new_episodes, match_requests_on: [:method, :query, :body] } ...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/integration/generators/page_spec.rb
Ruby
mit
191
master
1,970
# encoding: utf-8 require File.dirname(__FILE__) + '/../integration_helper' require 'locomotive/wagon' require 'locomotive/wagon/cli' describe 'Locomotive::Wagon::Generators::Page' do before { make_working_copy_of_site(:blog) } after { remove_working_copy_of_site(:blog) } let(:path) { working_cop...
github
locomotivecms/wagon
https://github.com/locomotivecms/wagon
spec/integration/generators/relationship_spec.rb
Ruby
mit
191
master
2,498
# encoding: utf-8 require File.dirname(__FILE__) + '/../integration_helper' require 'locomotive/wagon' require 'locomotive/wagon/cli' describe 'Locomotive::Wagon::Generators::Relationship' do before(:all) { make_working_copy_of_site(:blog) } after(:all) { remove_working_copy_of_site(:blog) } let(:...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
torque_postgresql.gemspec
Ruby
mit
191
master
1,732
$:.push File.expand_path('../lib', __FILE__) # Maintain your gem's version: require 'torque/postgresql/version' require 'date' # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = 'torque-postgresql' s.version = Torque::PostgreSQL::VERSION s.date = Date.toda...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
Gemfile
Ruby
mit
191
master
579
source 'https://rubygems.org' # Declare your gem's dependencies in torque_postgresql.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 inste...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
Rakefile
Ruby
mit
191
master
899
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 = 'Torque::Postgresql' rdoc.options << '--line-numbers' rdoc.rdoc_files.include('README.r...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/initialize.rb
Ruby
mit
191
master
2,824
require_relative '../lib/torque/postgresql/auxiliary_statement' require_relative '../lib/torque/postgresql/adapter/schema_overrides' require_relative '../lib/torque/postgresql/adapter/oid/box' require_relative '../lib/torque/postgresql/adapter/oid/circle' require_relative '../lib/torque/postgresql/adapter/oid/enum' r...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/spec_helper.rb
Ruby
mit
191
master
1,678
require 'torque-postgresql' require 'database_cleaner' require 'factory_bot' require 'dotenv' require 'faker' require 'rspec' begin require 'debug/prelude' rescue LoadError # No debugger available, skip end Dotenv.load ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'] || { adapter: 'postgresql', us...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/schema.rb
Ruby
mit
191
master
6,127
# 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 source for your # dat...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/period_spec.rb
Ruby
mit
191
master
35,628
require 'spec_helper' # TODO: Convert to shared examples RSpec.describe 'Period' do let(:model) { Class.new(TimeKeeper) } let(:instance) { model.new } let(:fields) { %i[available period tzperiod] } let(:method_names) { Torque::PostgreSQL::config.period.method_names } let(:attribute_klass) { Torque::PostgreSQ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/enum_set_spec.rb
Ruby
mit
191
master
9,886
require 'spec_helper' RSpec.describe 'Enum' do let(:connection) { ActiveRecord::Base.connection } let(:attribute_klass) { Torque::PostgreSQL::Attributes::EnumSet } let(:table_definition) { ActiveRecord::ConnectionAdapters::PostgreSQL::TableDefinition } def decorate(model, field, options = {}) attribute_kl...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/full_text_seach_test.rb
Ruby
mit
191
master
10,391
require 'spec_helper' RSpec.describe 'FullTextSearch' do context 'on builder' do let(:builder) { Torque::PostgreSQL::Attributes::Builder } describe '.to_search_weights' do it 'works with a single column' do expect(builder.to_search_weights('title')).to eq({ 'title' => 'A' }) expect(bui...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/insert_all_spec.rb
Ruby
mit
191
master
3,144
require 'spec_helper' RSpec.describe 'InsertAll' do context 'on executing' do before do ActiveRecord::InsertAll.send(:public, :to_sql) allow_any_instance_of(ActiveRecord::InsertAll).to receive(:execute, &:to_sql) end subject { Tag } let(:entries) { [{ name: 'A' }, { name: 'B' }] } ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/function_spec.rb
Ruby
mit
191
master
1,493
require 'spec_helper' RSpec.describe 'Function' do let(:helper) { Torque::PostgreSQL::FN } let(:conn) { ActiveRecord::Base.connection } let(:visitor) { ::Arel::Visitors::PostgreSQL.new(conn) } let(:collector) { ::Arel::Collectors::SQLString } context 'on helper' do it 'helps creating a bind' do ty...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/relation_spec.rb
Ruby
mit
191
master
10,480
require 'spec_helper' RSpec::Matchers.define :be_attributes_as do |list| match do |other| other.each_with_index.map do |item, idx| item.relation.name == list[idx][0] && item.name.to_s == list[idx][1] end.all? end end RSpec.describe 'Relation', type: :helper do context 'on resolving columns' do ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/belongs_to_many_spec.rb
Ruby
mit
191
master
17,593
require 'spec_helper' RSpec.describe 'BelongsToMany' do context 'on model' do let(:model) { Video } let(:key) { :tests } let(:builder) { Torque::PostgreSQL::Associations::Builder::BelongsToMany } let(:reflection) { Torque::PostgreSQL::Reflection::BelongsToManyReflection } after { model._reflecti...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/geometric_builder_spec.rb
Ruby
mit
191
master
7,759
require 'spec_helper' RSpec.describe 'Geometries' do context 'on build' do let(:klass) do klass = Class.new(Torque::PostgreSQL::GeometryBuilder) klass.define_singleton_method(:name) { 'TestSample' } klass.const_set('PIECES', %i[a b c d].freeze) klass.const_set('FORMATION', '(%s, %s, <%s, ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/quoting_spec.rb
Ruby
mit
191
master
705
require 'spec_helper' RSpec.describe 'Quoting', type: :helper do let(:connection) { ActiveRecord::Base.connection } context 'on type names' do it 'accepts type name only' do expect(connection.quote_type_name('sample')).to eql('"public"."sample"') end it 'accepts schema and type name' do e...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/lazy_spec.rb
Ruby
mit
191
master
663
require 'spec_helper' RSpec.describe 'Lazy', type: :helper do subject { Torque::PostgreSQL::Attributes::Lazy } it 'is consider nil' do expect(subject.new(String, '')).to be_nil end it 'inspects as nil' do expect(subject.new(String, '').inspect).to be_eql('nil') end it 'compares to nil only' do ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/collector_spec.rb
Ruby
mit
191
master
1,376
require 'spec_helper' RSpec.describe 'Data collector', type: :helper do let(:methods_list) { [:foo, :bar] } subject { Torque::PostgreSQL::Collector.new(*methods_list) } it 'is a class creator' do expect(subject).to be_a(Class) end it 'has the requested methods' do instance = subject.new methods...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/versioned_commands_spec.rb
Ruby
mit
191
master
17,761
require 'spec_helper' RSpec.describe 'VersionedCommands' do let(:connection) { ActiveRecord::Base.connection } context 'on migration' do it 'does not have any of the schema methods' do expect(connection).not_to respond_to(:create_function) expect(connection).not_to respond_to(:create_type) e...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/interval_spec.rb
Ruby
mit
191
master
5,307
require 'spec_helper' RSpec.describe 'Interval' do let(:table_definition) { ActiveRecord::ConnectionAdapters::PostgreSQL::TableDefinition } let(:connection) { ActiveRecord::Base.connection } let(:source) { ActiveRecord::Base.connection_pool } context 'on settings' do it 'must be set to ISO 8601' do ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/auxiliary_statement_spec.rb
Ruby
mit
191
master
40,968
require 'spec_helper' RSpec.describe 'AuxiliaryStatement' do before :each do User.auxiliary_statements_list = {} end context 'on relation' do let(:klass) { User } let(:true_value) { 'TRUE' } subject { klass.unscoped } it 'has its method' do expect(subject).to respond_to(:with) end...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/enum_spec.rb
Ruby
mit
191
master
18,368
require 'spec_helper' RSpec.describe 'Enum' do let(:connection) { ActiveRecord::Base.connection } let(:attribute_klass) { Torque::PostgreSQL::Attributes::Enum } let(:table_definition) { ActiveRecord::ConnectionAdapters::PostgreSQL::TableDefinition } def decorate(model, field, options = {}) attribute_klass...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/predicate_builder_spec.rb
Ruby
mit
191
master
4,643
require 'spec_helper' RSpec.describe 'PredicateBuilder' do describe 'on enumerator lazy' do let(:timed_out_error) do Torque::PostgreSQL::PredicateBuilder::EnumeratorLazyHandler::Timeout end subject { Video.all } after do Torque::PostgreSQL.config.predicate_builder.lazy_timeout = 0.02 ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/has_many_spec.rb
Ruby
mit
191
master
16,680
require 'spec_helper' RSpec.describe 'HasMany' do context 'on builder' do let(:builder) { ActiveRecord::Associations::Builder::HasMany } it 'adds the array option' do expect(builder.send(:valid_options, {})).to include(:array) end end context 'on original' do let(:other) { Text } let(...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/distinct_on_spec.rb
Ruby
mit
191
master
2,016
require 'spec_helper' RSpec.describe 'DistinctOn' do context 'on relation' do subject { Post.unscoped } it 'has its method' do expect(subject).to respond_to(:distinct_on) end it 'does not mess with original distinct form without select' do expect(subject.distinct.to_sql).to \ e...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/schema_spec.rb
Ruby
mit
191
master
4,787
require 'spec_helper' RSpec.describe 'Schema' do let(:connection) { ActiveRecord::Base.connection } let(:source) { ActiveRecord::Base.connection_pool } before do connection.instance_variable_set(:@schemas_blacklist, nil) connection.instance_variable_set(:@schemas_whitelist, nil) end context 'on mig...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/table_inheritance_spec.rb
Ruby
mit
191
master
18,094
require 'spec_helper' RSpec.describe 'TableInheritance' do let(:connection) { ActiveRecord::Base.connection } context 'on migration' do mock_create_table it 'does not affect some basic forms of table creation' do sql = connection.create_table('schema_migrations', id: false) do |t| t.string ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/tests/arel_spec.rb
Ruby
mit
191
master
6,392
require 'spec_helper' RSpec.describe 'Arel' do context 'on inflix operation' do let(:collector) { ::Arel::Collectors::SQLString } let(:attribute) { ::Arel::Table.new('a')['sample'] } let(:conn) { ActiveRecord::Base.connection } let(:visitor) { ::Arel::Visitors::PostgreSQL.new(conn) } [ [:o...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/factories/comments.rb
Ruby
mit
191
master
276
FactoryBot.define do factory :comment do content { Faker::Lorem.paragraph } factory :comment_recursive do comment_id { Comment.order('RANDOM()').first.id } end trait :random_user do user_id { User.order('RANDOM()').first.id } end end end
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/models/user.rb
Ruby
mit
191
master
242
class User < ActiveRecord::Base has_many :comments auxiliary_statement :last_comment do |cte| cte.query Comment.distinct_on(:user_id).order(:user_id, id: :desc) cte.attributes id: :comment_id, content: :comment_content end end
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/mocks/cache_query.rb
Ruby
mit
191
master
843
module Mocks module CacheQuery def get_last_executed_query(&block) cache = ActiveRecord::Base.connection.query_cache cache.instance_variable_set(:@enabled, true) map = cache.instance_variable_get(:@map) block.call result = map.keys.first cache.instance_variable_set(:@enabled...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
spec/mocks/create_table.rb
Ruby
mit
191
master
406
module Mocks module CreateTable def mock_create_table around do |example| original_method = ActiveRecord::Base.connection.method(:log) original_method.receiver.define_singleton_method(:log) do |sql, *, **, &block| sql end example.run original_method.receive...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql.rb
Ruby
mit
191
master
1,127
require 'i18n' require 'ostruct' require 'active_model' require 'active_record' require 'active_support' require 'active_support/core_ext/date/acts_like' require 'active_support/core_ext/time/zones' require 'active_record/connection_adapters/postgresql_adapter' require 'torque/postgresql/config' require 'torque/postg...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/schema_cache.rb
Ruby
mit
191
master
5,110
# frozen_string_literal: true require 'torque/postgresql/schema_cache/inheritance' require 'torque/postgresql/schema_cache/schema_reflection' require 'torque/postgresql/schema_cache/bound_schema_reflection' module Torque module PostgreSQL LookupError = Class.new(ArgumentError) # :TODO: Create the +add+ to ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter.rb
Ruby
mit
191
master
1,633
# frozen_string_literal: true require_relative 'adapter/database_statements' require_relative 'adapter/oid' require_relative 'adapter/quoting' require_relative 'adapter/schema_creation' require_relative 'adapter/schema_definitions' require_relative 'adapter/schema_dumper' require_relative 'adapter/schema_statements' ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/relation.rb
Ruby
mit
191
master
5,237
# frozen_string_literal: true require_relative 'relation/distinct_on' require_relative 'relation/inheritance' require_relative 'relation/merger' module Torque module PostgreSQL module Relation extend ActiveSupport::Concern include DistinctOn include Inheritance SINGLE_VALUE_METHODS = ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/insert_all.rb
Ruby
mit
191
master
490
# frozen_string_literal: true module Torque module PostgreSQL module InsertAll attr_reader :where def initialize(*args, where: nil, **xargs) super(*args, **xargs) @where = where end end module InsertAll::Builder delegate :where, to: :insert_all def where_...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/function.rb
Ruby
mit
191
master
3,333
# frozen_string_literal: true module Torque module PostgreSQL # Simplified module for creating arel functions. This is used internally # but can also be made available to other devs on their own projects module Function class << self # A facilitator to create a bind param that is fully com...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/associations.rb
Ruby
mit
191
master
471
require_relative 'associations/association_scope' require_relative 'associations/belongs_to_many_association' require_relative 'associations/foreign_association' require_relative 'associations/builder' require_relative 'associations/preloader' association_mod = Torque::PostgreSQL::Associations::ForeignAssociation ::A...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/i18n.rb
Ruby
mit
191
master
452
# frozen_string_literal: true module Torque module PostgreSQL module I18n # Adds extra suport to localize durations # This is a temporary solution, since 3600.seconds does not translate into # 1 hour def localize(locale, object, format = :default, options = {}) return super unles...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/base.rb
Ruby
mit
191
master
14,120
# frozen_string_literal: true module Torque module PostgreSQL module Base extend ActiveSupport::Concern ## # :singleton-method: schema # :call-seq: schema # # The schema to which the table belongs to. included do mattr_accessor :belongs_to_many_required_by_defa...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/table_name.rb
Ruby
mit
191
master
911
# frozen_string_literal: true module Torque module PostgreSQL class TableName < Delegator def initialize(klass, table_name) @klass = klass @table_name = table_name end def schema return @schema if defined?(@schema) @schema = ([@klass] + @klass.module_parents[0....
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/reflection.rb
Ruby
mit
191
master
663
# frozen_string_literal: true require_relative 'reflection/abstract_reflection' require_relative 'reflection/association_reflection' require_relative 'reflection/belongs_to_many_reflection' require_relative 'reflection/has_many_reflection' require_relative 'reflection/runtime_reflection' require_relative 'reflection/t...