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
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/unit/relation/join_dsl_spec.rb
Ruby
mit
220
release-3.7
2,764
# frozen_string_literal: true RSpec.describe ROM::Relation, '#join_dsl', relations: false do subject(:relation) { relations[:tasks] } before do conf.relation(:users) do schema(infer: true) do associations do has_many :tasks end end end conf.relation(:tasks) do ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/unit/relation/lock_spec.rb
Ruby
mit
220
release-3.7
2,686
# frozen_string_literal: true require 'concurrent/atomic/count_down_latch' RSpec.describe ROM::Relation, '#lock' do include_context 'users and tasks' subject(:relation) { users } def lock_style(relation) relation.dataset.opts.fetch(:lock) end context 'with hitting the database' do let(:latch) { C...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/unit/relation/qualified_columns_spec.rb
Ruby
mit
220
release-3.7
810
# frozen_string_literal: true RSpec.describe ROM::Relation, '#qualified_columns' do subject(:relation) { container.relations.users } include_context 'users and tasks' before do conf.relation(:users) do schema(infer: true) def sorted order(:id) end end end with_adapters d...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/unit/relation/exists_spec.rb
Ruby
mit
220
release-3.7
1,268
# frozen_string_literal: true RSpec.describe ROM::Relation, '#exists', relations: false do include_context 'users and tasks' before do conn[:users].insert name: 'Jack' conf.relation(:users) do schema(infer: true) do associations do has_many :tasks end end end ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/unit/relation/right_join_spec.rb
Ruby
mit
220
release-3.7
1,564
# frozen_string_literal: true RSpec.describe ROM::Relation, '#right_join' do subject(:relation) { relations[:tasks] } include_context 'users and tasks' with_adapters :postgres, :mysql do it 'joins relations using right outer join' do users.insert id: 3, name: 'Jade' relation.insert id: 3, title...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/unit/relation/avg_spec.rb
Ruby
mit
220
release-3.7
291
# frozen_string_literal: true RSpec.describe ROM::Relation, '#avg' do subject(:relation) { container.relations.users } include_context 'users and tasks' with_adapters do it 'delegates to dataset and return value' do expect(relation.avg(:id)).to eql(1.5) end end end
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/unit/relation/select_spec.rb
Ruby
mit
220
release-3.7
1,469
# frozen_string_literal: true RSpec.describe ROM::Relation, '#select' do subject(:relation) { container.relations.tasks } include_context 'users and tasks' before do conf.relation(:tasks) { schema(infer: true) } end with_adapters do it 'projects a relation using a list of symbols' do expect(...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/unit/relation/unfiltered_spec.rb
Ruby
mit
220
release-3.7
399
# frozen_string_literal: true RSpec.describe ROM::Relation, '#unfiltered' do subject(:relation) { relations[:tasks].select(:id, :title) } include_context 'users and tasks' with_adapters do it 'undoes restrictions' do expect(relation.where(id: 1).unfiltered.to_a).to eql( [{ id: 1, title: "Joe'...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/unit/relation/distinct_spec.rb
Ruby
mit
220
release-3.7
461
# frozen_string_literal: true RSpec.describe ROM::Relation, '#distinct' do subject(:relation) { relations[:users] } include_context 'users and tasks' before do relation.insert id: 3, name: 'Jane' end with_adapters :postgres do it 'delegates to dataset and returns a new relation' do expect(re...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/unit/relation/order_spec.rb
Ruby
mit
220
release-3.7
3,101
# frozen_string_literal: true RSpec.describe ROM::Relation, '#order' do subject(:relation) { relations[:users] } include_context 'users and tasks' before do relation.insert(id: 3, name: 'Jade') end with_adapters do it 'orders by provided attribute names' do ordered = relation.order(:name, :i...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/unit/plugin/timestamp_spec.rb
Ruby
mit
220
release-3.7
3,446
# frozen_string_literal: true RSpec.describe 'Plugin / Timestamp' do include_context 'users' include_context 'notes' with_adapters do before do conf.commands(:notes) do define :create do result :one use :timestamps timestamp :updated_at, :created_at date...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/unit/plugin/associates_spec.rb
Ruby
mit
220
release-3.7
2,422
# frozen_string_literal: true require 'ostruct' require 'rom/sql/commands' RSpec.describe ROM::SQL::Plugin::Associates do subject(:command) do command_class.build(posts).with_association(:tags) end let(:posts) do instance_double(Class.new(ROM::SQL::Relation), schema?: false, associations: associations)...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/unit/plugin/pagination_spec.rb
Ruby
mit
220
release-3.7
2,907
# frozen_string_literal: true require 'rom/sql/plugin/pagination' RSpec.describe 'Plugin / Pagination', seeds: false do include_context 'users' with_adapters do before do 9.times { |i| conn[:users].insert(name: "User #{i}") } conf.relation(:users) do use :pagination per_page 4 ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/unit/plugin/nullify_spec.rb
Ruby
mit
220
release-3.7
451
# frozen_string_literal: true require 'rom/sql/plugin/nullify' RSpec.describe ROM::Relation, '#nullify' do include_context 'users' before do conf.relation(:users) do use :nullify end end with_adapters do it 'nullifies a relation which has records' do # pending 'not working on JRuby' ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/combine_with_spec.rb
Ruby
mit
220
release-3.7
2,832
# frozen_string_literal: true RSpec.describe 'Eager loading' do include_context 'users and tasks' with_adapters do before do conf.relation(:users) do auto_map false def by_name(name) where(name: name) end end conf.relation(:tasks) do auto_map false...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/setup_spec.rb
Ruby
mit
220
release-3.7
614
# frozen_string_literal: true RSpec.describe 'ROM.container' do include_context 'database setup' with_adapters do let(:rom) do ROM.container(:sql, uri) do |conf| conf.default.create_table(:dragons) do primary_key :id column :name, String end conf.relation(:dr...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/wrap_spec.rb
Ruby
mit
220
release-3.7
4,042
# frozen_string_literal: true RSpec.describe ROM::SQL::Wrap do with_adapters do include_context 'users and tasks' describe '#wrap' do shared_context 'joined tuple' do it 'returns nested tuples' do task_with_user = tasks .wrap(name) .where { id.qualified.is(2) ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/migration_spec.rb
Ruby
mit
220
release-3.7
1,516
# frozen_string_literal: true RSpec.describe ROM::SQL, '.migration' do include_context 'database setup' before do inferrable_relations.push(:dragons, :schema_migrations) end with_adapters do before { conf } it 'creates a migration for a specific gateway' do migration = ROM::SQL.migration(c...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/relation_schema_spec.rb
Ruby
mit
220
release-3.7
9,281
# frozen_string_literal: true RSpec.describe 'Inferring schema from database' do include_context 'users' include_context 'posts' with_adapters do context 'when database schema exists' do it 'infers the schema from the database relations' do conf.relation(:users) expect(container.relat...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/gateway_spec.rb
Ruby
mit
220
release-3.7
3,343
# frozen_string_literal: true RSpec.describe ROM::SQL::Gateway, :postgres do include_context 'database setup' describe 'migration' do before do inferrable_relations.push(:rabbits, :carrots) end context 'creating migrations inline' do subject(:gateway) { container.gateways[:default] } ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/relation/default_views_spec.rb
Ruby
mit
220
release-3.7
779
# frozen_string_literal: true RSpec.describe 'Relation / Default views' do include_context 'database setup' with_adapters do describe '#by_pk' do subject(:users) { relations[:users] } context 'when dataset is overridden' do before do conn.create_table(:users) do prim...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/commands/upsert_spec.rb
Ruby
mit
220
release-3.7
3,219
# frozen_string_literal: true RSpec.describe 'Commands / Postgres / Upsert', :postgres, seeds: false do subject(:command) { task_commands[:create_or_update] } include_context 'relations' before do conn.execute 'ALTER TABLE tasks add CONSTRAINT tasks_title_key UNIQUE (title)' conn[:users].insert id: 1,...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/commands/update_spec.rb
Ruby
mit
220
release-3.7
3,386
# frozen_string_literal: true require 'dry-struct' RSpec.describe 'Commands / Update', seeds: false do include_context 'users' let(:profile_commands) { container.commands[:profiles] } let(:update_user) { user_commands[:update] } let(:update_profile) { profile_commands[:update] } let(:piotr) { users.by_na...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/commands/delete_spec.rb
Ruby
mit
220
release-3.7
2,124
# frozen_string_literal: true RSpec.describe 'Commands / Delete' do include_context 'users and tasks' let(:delete_user) { user_commands.delete } with_adapters do before do conf.relation(:users) do def by_name(name) where(name: name) end end conf.commands(:users)...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/commands/create_spec.rb
Ruby
mit
220
release-3.7
9,181
# frozen_string_literal: true require 'dry-struct' RSpec.describe 'Commands / Create', :postgres, seeds: false do include_context 'relations' let(:profile_commands) { container.commands[:profiles] } let(:create_user) { user_commands.create } let(:create_users) { user_commands.create_many } let(:create_tas...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/associations/many_to_many_spec.rb
Ruby
mit
220
release-3.7
4,645
# frozen_string_literal: true RSpec.describe ROM::SQL::Associations::ManyToMany, helpers: true do include_context 'users and tasks' with_adapters do context 'through a relation with a composite PK' do subject(:assoc) do build_assoc(:many_to_many, :tasks, :tags, through: :task_tags) end ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/associations/one_to_many_spec.rb
Ruby
mit
220
release-3.7
2,519
# frozen_string_literal: true RSpec.describe ROM::SQL::Associations::OneToMany, helpers: true do include_context 'users and tasks' subject(:assoc) do build_assoc(:one_to_many, :users, :tasks) end with_adapters do before do conf.relation(:tasks) do schema do attribute :id, ROM:...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/associations/one_to_one_through_spec.rb
Ruby
mit
220
release-3.7
2,675
# frozen_string_literal: true RSpec.describe ROM::SQL::Associations::OneToOneThrough, helpers: true do include_context 'users' include_context 'accounts' subject(:assoc) do build_assoc(:one_to_one_through, :users, :cards, through: :accounts) end with_adapters do before do conf.relation(:accou...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/associations/one_to_one_spec.rb
Ruby
mit
220
release-3.7
2,519
# frozen_string_literal: true RSpec.describe ROM::SQL::Associations::OneToOne, helpers: true do include_context 'users' include_context 'accounts' subject(:assoc) do build_assoc(:one_to_one, :users, :accounts) end with_adapters do before do conn[:accounts].insert user_id: 1, number: '43', bal...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/associations/many_to_one_spec.rb
Ruby
mit
220
release-3.7
3,397
# frozen_string_literal: true RSpec.describe ROM::SQL::Associations::ManyToOne, helpers: true do with_adapters do context 'common name conventions' do include_context 'users and tasks' include_context 'accounts' subject(:assoc) do build_assoc(:many_to_one, :tasks, :users) end ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/associations/many_to_many/custom_fks_spec.rb
Ruby
mit
220
release-3.7
2,308
# frozen_string_literal: true RSpec.describe ROM::SQL::Associations::ManyToMany, '#call' do include_context 'users' before do inferrable_relations.push(:puzzles, :puzzle_solvers) end subject(:assoc) do relations[:users].associations[:puzzles] end let(:puzzles) { relations[:puzzles] } let(:puzz...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/associations/many_to_many/from_view_spec.rb
Ruby
mit
220
release-3.7
2,589
# frozen_string_literal: true RSpec.describe ROM::SQL::Associations::ManyToMany, '#call' do include_context 'users' before do inferrable_relations.push(:puzzles, :puzzle_solvers) end subject(:assoc) do relations[:users].associations[:solved_puzzles] end let(:puzzles) { relations[:puzzles] } le...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/associations/many_to_many/self_ref_spec.rb
Ruby
mit
220
release-3.7
1,518
# frozen_string_literal: true RSpec.describe ROM::SQL::Associations::ManyToMany, '#call' do include_context 'database setup' subject(:assoc) do employees.associations[:subordinates] end let(:positions) do relations[:positions] end let(:employees) do relations[:employees] end with_adapte...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/associations/one_to_many/self_ref_spec.rb
Ruby
mit
220
release-3.7
1,601
# frozen_string_literal: true require 'spec_helper' RSpec.describe ROM::SQL::Associations::OneToMany, '#call' do include_context 'database setup' before do inferrable_relations.push(:categories) end subject(:assoc) do relations[:categories].associations[:children] end with_adapters do befor...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/associations/one_to_many/from_view_spec.rb
Ruby
mit
220
release-3.7
1,514
# frozen_string_literal: true require 'spec_helper' RSpec.describe ROM::SQL::Associations::OneToMany, '#call' do include_context 'users' before do inferrable_relations.push(:puzzles) end subject(:assoc) do relations[:users].associations[:solved_puzzles] end with_adapters do before do ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/associations/one_to_many/custom_fks_spec.rb
Ruby
mit
220
release-3.7
1,496
# frozen_string_literal: true require 'spec_helper' RSpec.describe ROM::SQL::Associations::OneToMany, '#call' do include_context 'users' before do inferrable_relations.push(:puzzles) end subject(:assoc) do relations[:users].associations[:solved_puzzles] end with_adapters do before do ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/associations/many_to_one/self_ref_spec.rb
Ruby
mit
220
release-3.7
1,527
# frozen_string_literal: true require 'spec_helper' RSpec.describe ROM::SQL::Associations::ManyToOne, '#call' do subject(:assoc) do relations[:categories].associations[:parent] end include_context 'database setup' with_adapters do before do conn.create_table(:categories) do primary_key...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/associations/many_to_one/from_view_spec.rb
Ruby
mit
220
release-3.7
2,670
# frozen_string_literal: true require 'spec_helper' RSpec.describe ROM::SQL::Associations::ManyToOne, '#call' do include_context 'database setup' before do inferrable_relations.push(:destinations, :flights) end let(:assoc_inter) { relations[:flights].associations[:inter_destination] } let(:assoc_final...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/associations/many_to_one/custom_fks_spec.rb
Ruby
mit
220
release-3.7
1,984
# frozen_string_literal: true require 'spec_helper' RSpec.describe ROM::SQL::Associations::ManyToOne, '#call' do include_context 'database setup' before do inferrable_relations.push(:destinations, :flights) end let(:assoc_from) { relations[:flights].associations[:from] } let(:assoc_to) { relations[:fl...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/plugins/associates_spec.rb
Ruby
mit
220
release-3.7
7,086
# frozen_string_literal: true RSpec.describe 'Plugins / :associates', seeds: false do include_context 'relations' with_adapters do context 'with Create command' do let(:users) { container.commands[:users] } let(:tasks) { container.commands[:tasks] } let(:tags) { container.commands[:tags] } ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/plugins/explain_spec.rb
Ruby
mit
220
release-3.7
1,240
# frozen_string_literal: true require 'yaml' RSpec.describe 'Plugins / :explain', :postgres do include_context 'users and tasks' before do conf.plugin(:sql, relations: :pg_explain) end it 'returns the execution plan of a request' do expect(users.explain).to match(/(Index|Seq Scan)|Sort/) end it...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/plugins/full_text_search_spec.rb
Ruby
mit
220
release-3.7
1,074
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Plugins / :pg_full_text_search', :postgres do include_context 'users and tasks' before do conf.plugin(:sql, relations: :pg_full_text_search) end it 'searches against the provided columns' do task = conn[:tasks].insert id: 3, user_id...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/plugins/pg_streaming_spec.rb
Ruby
mit
220
release-3.7
2,329
# frozen_string_literal: true require 'rom/plugins/relation/sql/postgres/streaming' RSpec.describe 'Plugins / :pg_streaming', seeds: true do with_adapters(:postgres) do include_context 'users and tasks' before do skip 'it is not supported by jruby' if jruby? conf.plugin(:sql, relations: :pg_str...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/plugins/auto_restrictions_spec.rb
Ruby
mit
220
release-3.7
3,224
# frozen_string_literal: true RSpec.describe 'Plugins / :auto_restrictions', seeds: true do include_context 'users and tasks' with_adapters do before do conn.add_index :tasks, :title, unique: true end shared_context 'auto-generated restriction view' do it 'defines restriction views for al...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/plugins/associates/many_to_many_spec.rb
Ruby
mit
220
release-3.7
1,564
# frozen_string_literal: true RSpec.describe 'Plugins / :associates / with many-to-many', :sqlite, seeds: false do include_context 'users and tasks' let(:create_tag) { tag_commands.create } let(:create_task) { task_commands.create } let(:jane) do users.by_pk(users.insert(name: 'Jane')).one end let(:...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/schema/rename_spec.rb
Ruby
mit
220
release-3.7
526
# frozen_string_literal: true require 'spec_helper' RSpec.describe ROM::SQL::Schema, '#rename', :postgres, seeds: false do include_context 'users' before do conf.relation(:users) do schema(infer: true) end end it 'auto-projects a relation with renamed' do expect(relations[:users].schema.qu...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/schema/call_spec.rb
Ruby
mit
220
release-3.7
655
# frozen_string_literal: true require 'spec_helper' RSpec.describe ROM::SQL::Schema, '#call' do include_context 'users' with_adapters :postgres do before do conf.relation(:users) do schema(infer: true) end end let(:schema) { relations[:users].schema } it 'auto-projects a rel...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/schema/view_spec.rb
Ruby
mit
220
release-3.7
802
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Defining a view using schemas', seeds: false do include_context 'users' with_adapters do describe 'defining a projected view' do before do conf.relation(:users) do schema(infer: true) view(:names) do ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/schema/inferrer_spec.rb
Ruby
mit
220
release-3.7
14,082
# frozen_string_literal: true RSpec.describe 'Schema inference for common datatypes', seeds: false do include_context 'users and tasks' before do inferrable_relations.push(:test_characters, :test_inferrence, :test_numeric) end let(:schema) { container.relations[dataset].schema } def trunc_ts(time, dro...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/schema/qualified_spec.rb
Ruby
mit
220
release-3.7
447
# frozen_string_literal: true require 'spec_helper' RSpec.describe ROM::SQL::Schema, '#qualified', :postgres, seeds: false do include_context 'users' before do conf.relation(:users) do schema(infer: true) end end it 'qualifies column names' do expect(relations[:users].schema.qualified.(rel...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/schema/prefix_spec.rb
Ruby
mit
220
release-3.7
521
# frozen_string_literal: true require 'spec_helper' RSpec.describe ROM::SQL::Schema, '#prefix', :postgres, seeds: false do include_context 'users' before do conf.relation(:users) do schema(infer: true) end end it 'auto-projects a relation with renamed columns using provided prefix' do expe...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/schema/inferrer/mysql_spec.rb
Ruby
mit
220
release-3.7
2,598
# frozen_string_literal: true RSpec.describe 'ROM::SQL::Schema::MysqlInferrer', :mysql do include_context 'database setup' before do inferrable_relations.push(:test_inferrence) end before do conn.create_table :test_inferrence do tinyint :tiny mediumint :medium bigint :big date...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/schema/inferrer/postgres_spec.rb
Ruby
mit
220
release-3.7
9,566
# frozen_string_literal: true RSpec.describe 'ROM::SQL::Schema::PostgresInferrer', :postgres, :helpers do include_context 'database setup' before do inferrable_relations.push(:test_inferrence) end colors = %w[red orange yellow green blue purple] before do conn.execute('create extension if not exis...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/schema/inferrer/sqlite_spec.rb
Ruby
mit
220
release-3.7
1,493
# frozen_string_literal: true RSpec.describe 'ROM::SQL::Schema::SqliteInferrer', :sqlite, helpers: true do include_context 'database setup' before do inferrable_relations.push(:test_inferrence) end before do conn.create_table :test_inferrence do tinyint :tiny int8 :big bigint :long ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/auto_migrations/file_based_migrations_spec.rb
Ruby
mit
220
release-3.7
4,052
# frozen_string_literal: true RSpec.describe ROM::SQL::Gateway, :postgres, :helpers, skip_tables: true do include_context 'database setup' subject(:gateway) { container.gateways[:default] } let(:path) { TMP_PATH.join('test/migrations') } before { FileUtils.rm_rf(path) } after { FileUtils.rm_rf(path) } ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/auto_migrations/indexes_spec.rb
Ruby
mit
220
release-3.7
7,088
# frozen_string_literal: true RSpec.describe ROM::SQL::Gateway, :postgres, :helpers do include_context 'database setup' before do conn.drop_table?(:users) end let(:table_name) { :users } let(:relation_name) { ROM::Relation::Name.new(table_name) } subject(:gateway) { container.gateways[:default] } ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/auto_migrations/managing_columns_spec.rb
Ruby
mit
220
release-3.7
3,819
# frozen_string_literal: true RSpec.describe ROM::SQL::Gateway, :postgres, :helpers do include_context 'database setup' before do conn.drop_table?(:users) end before do conf.relation(:users) do schema do attribute :id, ROM::SQL::Types::Serial attribute :name, ROM::SQL::Types...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/auto_migrations/errors_spec.rb
Ruby
mit
220
release-3.7
748
# frozen_string_literal: true RSpec.describe ROM::SQL::Gateway, :postgres do include_context 'database setup' subject(:gateway) { container.gateways[:default] } before do conn.drop_table?(:users) end describe 'unsupported conversions' do before do conf.relation(:users) do schema do ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/auto_migrations/foreign_keys_spec.rb
Ruby
mit
220
release-3.7
3,325
# frozen_string_literal: true RSpec.describe ROM::SQL::Gateway, :postgres, :helpers do include_context 'database setup' before do conn.drop_table?(:posts) conn.drop_table?(:users) end let(:table_name) { :posts } let(:relation_name) { ROM::Relation::Name.new(table_name) } let(:posts) { container.r...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/auto_migrations/postgres/column_types_spec.rb
Ruby
mit
220
release-3.7
4,330
# frozen_string_literal: true RSpec.describe ROM::SQL::Gateway, :postgres, :helpers do include_context 'database setup' before do conn.drop_table?(:test_pg_types) conn.execute('create extension if not exists hstore') conn.execute('create extension if not exists ltree') end let(:table_name) { :te...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/support/rails_log_subscriber_spec.rb
Ruby
mit
220
release-3.7
730
# frozen_string_literal: true require 'spec_helper' require 'active_support/log_subscriber/test_helper' RSpec.describe 'Rails log subscriber', :postgres, seeds: false do before do ROM::SQL.load_extensions(:active_support_notifications, :rails_log_subscriber) end include ActiveSupport::LogSubscriber::TestH...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/integration/support/active_support_notifications_spec.rb
Ruby
mit
220
release-3.7
585
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'ActiveSupport::Notifications support', :postgres, seeds: false do before do ROM::SQL.load_extensions(:active_support_notifications, :rails_log_subscriber) end include_context 'users' it 'works' do container.gateways[:default].use_lo...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/shared/puppies.rb
Ruby
mit
220
release-3.7
343
# frozen_string_literal: true RSpec.shared_context 'puppies' do before do inferrable_relations.push(:puppies) end before do conn.create_table :puppies do primary_key :id String :name, null: false boolean :cute, null: false, default: true end conf.relation(:puppies) { schema(in...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/shared/json_notes.rb
Ruby
mit
220
release-3.7
561
# frozen_string_literal: true RSpec.shared_context 'json_notes' do before do inferrable_relations.push(:json_notes) end before do |_example| conn.create_table :json_notes do primary_key :id String :note end write_type = Dry.Types.Constructor(String) { |value| JSON.dump({ content: va...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/shared/articles.rb
Ruby
mit
220
release-3.7
1,026
# frozen_string_literal: true RSpec.shared_context 'articles' do before do inferrable_relations.push(:articles) end before do conn.create_table :articles do primary_key :article_id String :author_name String :title String :body String :status index :author_name ...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/shared/users.rb
Ruby
mit
220
release-3.7
774
# frozen_string_literal: true RSpec.shared_context 'users' do include_context 'database setup' before do inferrable_relations.push(:users) end let(:users) { container.relations[:users] } let(:user_commands) { container.commands[:users] } let(:jane_id) { 1 } let(:joe_id) { 2 } before do |example...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/shared/database_setup.rb
Ruby
mit
220
release-3.7
1,665
# frozen_string_literal: true RSpec.shared_context 'database setup' do all_tables = %i[users tasks users_tasks tags task_tags posts puppies accounts cards subscriptions notes destinations flights categories user_group test_inferrence test_bidirectional people dra...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/shared/users_and_tasks.rb
Ruby
mit
220
release-3.7
1,463
# frozen_string_literal: true RSpec.shared_context 'users and tasks' do include_context 'users' let(:tasks) { container.relations[:tasks] } let(:tags) { container.relations[:tags] } let(:task_commands) { container.commands[:tasks] } let(:tag_commands) { container.commands[:tags] } before do inferrab...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/shared/notes.rb
Ruby
mit
220
release-3.7
592
# frozen_string_literal: true RSpec.shared_context 'notes' do before do inferrable_relations.push(:notes) end before do |example| ctx = self conn.create_table :notes do primary_key :id foreign_key :user_id, :users String :text, null: false # TODO: Remove Oracle's workarounds...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/shared/relations.rb
Ruby
mit
220
release-3.7
226
# frozen_string_literal: true RSpec.shared_context 'relations' do include_context 'users and tasks' before do conf.relation(:users) { schema(infer: true) } conf.relation(:tasks) { schema(infer: true) } end end
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/shared/posts.rb
Ruby
mit
220
release-3.7
678
# frozen_string_literal: true RSpec.shared_context 'posts' do before do inferrable_relations.push(:posts) end before do |_example| conn.create_table :posts do primary_key :post_id foreign_key :author_id, :users String :title String :body end conf.relation(:posts) { schem...
github
rom-rb/rom-sql
https://github.com/rom-rb/rom-sql
spec/shared/accounts.rb
Ruby
mit
220
release-3.7
1,182
# frozen_string_literal: true RSpec.shared_context 'accounts' do let(:accounts) { container.relations[:accounts] } let(:cards) { container.relations[:cards] } before do inferrable_relations.push(:accounts, :cards, :subscriptions) end before do |example| ctx = self conn.create_table :accounts d...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
Rakefile
Ruby
mit
220
main
296
require "bundler/gem_tasks" require "rspec/core/rake_task" task default: :spec RSpec::Core::RakeTask.new require_relative "lib/ufo" require "cli_markdown" desc "Generates cli reference docs as markdown" task :docs do CliMarkdown::Creator.create_all(cli_class: Ufo::CLI, cli_name: "ufo") end
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
ufo.gemspec
Ruby
mit
220
main
1,987
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "ufo/version" Gem::Specification.new do |spec| spec.name = "ufo" spec.version = Ufo::VERSION spec.authors = ["Tung Nguyen"] spec.email = ["tongueroo@gmail.com"] spec.summary...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
.cody/acceptance/iam_role.rb
Ruby
mit
220
main
484
iam_policy( "application-autoscaling", "autoscaling", "cloudformation", "ec2", "ecr", "ecs", "elasticloadbalancing", "elasticloadbalancingv2", "iam", # to create .ufo/resources/iam_roles "logs", "route53", "ssm", # for codebuild to pull in ssm parameter ) iam_policy( Action: [ "iam:PassRo...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
.cody/acceptance/project.rb
Ruby
mit
220
main
282
github("boltops-tools/ufo") image("aws/codebuild/amazonlinux2-x86_64-standard:3.0") env_vars( DOCKER_USER: "ssm:/#{Cody.env}/DOCKER_USER", DOCKER_PASS: "ssm:/#{Cody.env}/DOCKER_PASS", ) # triggers( # webhook: true, # filter_groups: [[{type: "EVENT", pattern: "PUSH"}]] # )
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo.rb
Ruby
mit
220
main
655
$stdout.sync = true unless ENV["UFO_STDOUT_SYNC"] == "0" require 'active_support' require 'active_support/core_ext/class' require 'active_support/core_ext/hash' require 'active_support/core_ext/module/delegation' require 'cli-format' require 'deep_merge/rails_compat' require 'dsl_evaluator' require 'fileutils' require...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/yaml.rb
Ruby
mit
220
main
356
module Ufo class Yaml class << self def load(text) path = "#{Ufo.root}/.ufo/tmp/temp.yml" FileUtils.mkdir_p(File.dirname(path)) IO.write(path, text) Validator.new(path).validate! Loader.new(text).load end def validate!(path) Validator.new(path).va...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/log_group.rb
Ruby
mit
220
main
1,648
# Use to automatically create the CloudWatch group. # For some reason creating ECS does do this by default. module Ufo class LogGroup < Ufo::CLI::Base include Ufo::AwsServices def create logger.debug "Ensuring log group for #{@task_definition.name.color(:green)} task definition exists" return if ...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/names.rb
Ruby
mit
220
main
2,311
module Ufo class Names extend Memoist include Ufo::TaskDefinition::Helpers::AwsHelper include Ufo::Config::CallableOption::Concern attr_reader :role def initialize @role = Ufo.role end def cluster string = callable_option( config_name: "ecs.cluster", # Ufo.ecs.cluster...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/config.rb
Ruby
mit
220
main
9,132
require "singleton" module Ufo class Config extend Memoist include DslEvaluator include Singleton include Ufo::Utils::Logging include Ufo::TaskDefinition::Helpers attr_reader :config def initialize @config = defaults end def defaults config = ActiveSupport::OrderedO...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/aws_services.rb
Ruby
mit
220
main
2,599
require "aws-sdk-acm" require "aws-sdk-applicationautoscaling" require "aws-sdk-cloudformation" require "aws-sdk-cloudwatchlogs" require "aws-sdk-ec2" require "aws-sdk-ecr" require "aws-sdk-ecs" require "aws-sdk-elasticloadbalancingv2" require "aws-sdk-s3" require "aws-sdk-ssm" require "aws-sdk-wafv2" require "aws_mfa...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/booter.rb
Ruby
mit
220
main
540
module Ufo module Booter def boot run_hooks end # Special boot hooks run super early. # Useful for setting env vars and other early things. # # .ufo/boot.rb # .ufo/boot/dev.rb # def run_hooks run_hook run_hook(Ufo.env) Ufo::Config::Inits.run_all e...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/layering.rb
Ruby
mit
220
main
325
require "active_support/lazy_load_hooks" module Ufo module Layering def layers pre_layers + main_layers + post_layers end def main_layers super end def pre_layers [] end def post_layers [] end end end ActiveSupport.run_load_hooks(:ufo_layering, Ufo::Layer...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/info.rb
Ruby
mit
220
main
2,550
module Ufo class Info < Ufo::CLI::Base include Ufo::AwsServices def run unless service puts no_service_message return end puts "Resources:" stack_resources.each do |r| puts "#{r.logical_resource_id} - #{r.resource_type}:".color(:green) puts " #{r.physi...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/core.rb
Ruby
mit
220
main
2,458
require 'pathname' require 'yaml' module Ufo module Core extend Memoist include Ufo::Utils::Pretty def role ENV['UFO_ROLE'] || 'web' end def app return ENV['UFO_APP'] if ENV['UFO_APP'] if @@config_loaded config.app else puts "ERROR: Using Ufo.app or :APP...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/param.rb
Ruby
mit
220
main
426
require 'yaml' module Ufo class Param extend Memoist def initialize @params_path = "#{Ufo.root}/.ufo/params.yml" end def data return {} unless File.exist?(@params_path) result = RenderMePretty.result(@params_path, context: template_scope) data = YAML.load(result) || {} ...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/logger.rb
Ruby
mit
220
main
783
require 'logger' module Ufo class Logger < ::Logger def initialize(*args) super self.formatter = Formatter.new self.level = ENV['UFO_LOG_LEVEL'] || :info # note: only respected when config.logger not set in config/app.rb end def format_message(severity, datetime, progname, msg) l...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/command.rb
Ruby
mit
220
main
5,584
require "thor" # Override thor's long_desc identation behavior # https://github.com/erikhuda/thor/issues/398 class Thor module Shell class Basic def print_wrapped(message, options = {}) message = "\n#{message}" unless message[0] == "\n" stdout.puts message end end end module ...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/cli.rb
Ruby
mit
220
main
4,975
require 'thor' require 'ufo/command' module Ufo class CLI < Command include Help opts = Opts.new(self) desc "central SUBCOMMAND", "central subcommands" long_desc Help.text(:central) subcommand "central", Central desc "docker SUBCOMMAND", "docker subcommands" long_desc Help.text(:docker)...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/task_definition.rb
Ruby
mit
220
main
452
module Ufo class TaskDefinition extend Memoist include Ufo::Concerns # for names attr_reader :name, :role def initialize(options={}) @options = options @role = Ufo.role @name = names.task_definition # IE: :APP-:ROLE-:ENV => demo-web-dev end def path expr = "#{Ufo.root...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/autoloader.rb
Ruby
mit
220
main
727
require "zeitwerk" module Ufo class Autoloader class Inflector < Zeitwerk::Inflector def camelize(basename, _abspath) map = { cli: "CLI", version: "VERSION" } map[basename.to_sym] || super end end class << self def setup loader = Zeitwerk::Loader.new loa...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/completer.rb
Ruby
mit
220
main
4,449
=begin Code Explanation: There are 3 types of things to auto-complete: 1. command: the command itself 2. parameters: command parameters. 3. options: command options Here's an example: mycli hello name --from me * command: hello * parameters: name * option: --from When command parameters are done pro...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/concerns.rb
Ruby
mit
220
main
374
module Ufo module Concerns extend Memoist include Names def build Ufo::CLI::Build.new(@options) end memoize :build def deploy Ufo::Cfn::Deploy.new(@options) end memoize :deploy def info Ufo::Info.new(@options) end memoize :info def ps Ufo::CL...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/iam_role/registry.rb
Ruby
mit
220
main
740
require "set" module Ufo::IamRole class Registry class_attribute :policies self.policies = {} class_attribute :managed_policies self.managed_policies = {} class << self def register_policy(role_type, policy_name, *statements) statements.flatten! self.policies[role_type] ||=...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/iam_role/builder.rb
Ruby
mit
220
main
1,601
module Ufo::IamRole class Builder def initialize(role_type) @role_type = role_type end def build resource(policies, managed_policy_arns) end def build? !!(policies || managed_policy_arns) end def policies items = Registry.policies[@role_type] # Array of Arrays ...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/iam_role/dsl.rb
Ruby
mit
220
main
652
module Ufo::IamRole class Dsl include DslEvaluator include Ufo::TaskDefinition::Helpers::AwsHelper def initialize(path) @path = path # IE: .ufo/iam_roles/task_role.rb end def evaluate evaluate_file(@path) end def iam_policy(policy_name, statements) role_type = File.bas...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/cfn/deploy.rb
Ruby
mit
220
main
1,395
module Ufo::Cfn class Deploy < Base def run ensure_log_group_exist ensure_cluster_exist stop_old_tasks stack = Stack.new(@options) success = stack.deploy return unless @options[:wait] if success puts "Software shipped!" else puts "Software fail to s...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/cfn/stack.rb
Ruby
mit
220
main
6,622
# CloudFormation status codes, full list: # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-describing-stacks.html # # CREATE_COMPLETE # ROLLBACK_COMPLETE # DELETE_COMPLETE # UPDATE_COMPLETE # UPDATE_ROLLBACK_COMPLETE # # CREATE_FAILED # DELETE_FAILED # ROLLBACK_FAILED # UPD...
github
boltops-tools/ufo
https://github.com/boltops-tools/ufo
lib/ufo/cfn/stack/params.rb
Ruby
mit
220
main
1,444
class Ufo::Cfn::Stack class Params < Ufo::Cfn::Stack::Builder::Base def build logger.info "Building params" params = { Vpc: vpc.id, ElbSubnets: vpc.elb_subnets, EcsSubnets: vpc.ecs_subnets, CreateElb: vars[:create_elb] ? "true" : "false", ElbTargetGroup: vars[:...