sequel-rails 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZGRiMzE5ODMwN2ExNjJhMDYyNWMzYzZmZWVmZjEyM2FmODFmZDZhNA==
5
- data.tar.gz: !binary |-
6
- NDYxNDE0OWExOTk5MDllNDYyZGViYWYyZWVhNGU1YzhlMjUyNGUwNQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- ZjJlOGExNjc3Nzc3YTg0ZDExNTkzYjdjMTAyOTg5YWYwYjhjNmI0Y2Y0NTk2
10
- YzYyMjc2ODY5ODAwNmFlZDg3OGQxYThmNmYyNGU5ZmM5OTc1Y2Q4MWEyMDNk
11
- ZjYwODk5MTdiY2U1YTU0OGRiMzhlM2RkZjRjODdjY2Y1NTQwMjQ=
12
- data.tar.gz: !binary |-
13
- ZDhjZjQ0MTRhNjM4ZDkzM2YzNTU2N2QzYzQwNzNhYThiZGM5NWZiYjM4ZTAz
14
- NjRhYzE4NzljNGE1MGU2ZDRkNzcwYjUxMGIwODc4ZjhjZDVkODcwZDc0ODYz
15
- ZDZhMjA0ZjliMGU2YzEyNzg5YmRjMDkxYmJiYWFlZGI4ZTUxNzc=
2
+ SHA1:
3
+ metadata.gz: d8ea9bc9710a82354d3df888106dc2c6b971eb41
4
+ data.tar.gz: bb493d857f3236c479356890e1790906ff7ed3ab
5
+ SHA512:
6
+ metadata.gz: a7f6e7394c214be105146096a8f65e7f0eda0b33d7525a67f51b0a2611454a52f8baf352a6868d317e1e2488b4e283d0d2169d2a3fa8dbbf2044bcb6f07cbda4
7
+ data.tar.gz: cd45198031727fdefee6ca5a4c68a80db03d7c3e7bc3111cb0ddd3169577030bd0815a5c00b2f76085832c250ce051b451899baf86743ad752ebbab3c65566b7
data/.gitignore CHANGED
@@ -28,3 +28,5 @@ vendor
28
28
  .rvmrc
29
29
  *.gem
30
30
  Gemfile.lock
31
+
32
+ spec/internal/db/database.sqlite3
data/.travis.yml CHANGED
@@ -8,11 +8,11 @@ env:
8
8
  - "TEST_ADAPTER=postgresql TEST_OWNER=postgres TEST_USERNAME=postgres SEQUEL='~> 3.28'"
9
9
  - "TEST_ADAPTER=mysql TEST_USERNAME=root TEST_ENCODING=utf8 SEQUEL='~> 3.28'"
10
10
  - "TEST_ADAPTER=mysql2 TEST_USERNAME=root TEST_ENCODING=utf8 SEQUEL='~> 3.28'"
11
- - "TEST_ADAPTER=sqlite3 TEST_DATABASE=':memory:' SEQUEL='~> 3.28'"
11
+ - "TEST_ADAPTER=sqlite3 TEST_DATABASE='db/database.sqlite3' SEQUEL='~> 3.28'"
12
12
  - "TEST_ADAPTER=postgresql TEST_OWNER=postgres TEST_USERNAME=postgres SEQUEL='~> 4.0.0'"
13
13
  - "TEST_ADAPTER=mysql TEST_USERNAME=root TEST_ENCODING=utf8 SEQUEL='~> 4.0.0'"
14
14
  - "TEST_ADAPTER=mysql2 TEST_USERNAME=root TEST_ENCODING=utf8 SEQUEL='~> 4.0.0'"
15
- - "TEST_ADAPTER=sqlite3 TEST_DATABASE=':memory:' SEQUEL='~> 4.0.0'"
15
+ - "TEST_ADAPTER=sqlite3 TEST_DATABASE='db/database.sqlite3' SEQUEL='~> 4.0.0'"
16
16
  gemfile:
17
17
  - ci/rails-3.2.gemfile
18
18
  - ci/rails-4.0.gemfile
@@ -31,7 +31,7 @@ matrix:
31
31
  env: "TEST_ADAPTER=postgresql TEST_OWNER=postgres TEST_USERNAME=postgres SEQUEL='~> 3.28'"
32
32
  gemfile: ci/rails-4.0.gemfile
33
33
  - rvm: jruby-18mode
34
- env: "TEST_ADAPTER=sqlite3 TEST_DATABASE=':memory:' SEQUEL='~> 3.28'"
34
+ env: "TEST_ADAPTER=sqlite3 TEST_DATABASE='db/database.sqlite3' SEQUEL='~> 3.28'"
35
35
  gemfile: ci/rails-4.0.gemfile
36
36
  - rvm: jruby-19mode
37
37
  env: "TEST_ADAPTER=mysql2 TEST_USERNAME=root TEST_ENCODING=utf8 SEQUEL='~> 3.28'"
@@ -52,7 +52,7 @@ matrix:
52
52
  env: "TEST_ADAPTER=postgresql TEST_OWNER=postgres TEST_USERNAME=postgres SEQUEL='~> 4.0.0'"
53
53
  gemfile: ci/rails-4.0.gemfile
54
54
  - rvm: jruby-18mode
55
- env: "TEST_ADAPTER=sqlite3 TEST_DATABASE=':memory:' SEQUEL='~> 4.0.0'"
55
+ env: "TEST_ADAPTER=sqlite3 TEST_DATABASE='db/database.sqlite3' SEQUEL='~> 4.0.0'"
56
56
  gemfile: ci/rails-4.0.gemfile
57
57
  - rvm: jruby-19mode
58
58
  env: "TEST_ADAPTER=mysql2 TEST_USERNAME=root TEST_ENCODING=utf8 SEQUEL='~> 4.0.0'"
data/History.md CHANGED
@@ -1,3 +1,11 @@
1
+ 0.5.1 (2013-08-05)
2
+ ==================
3
+
4
+ * Allow setting if schema should be dumped (Rafał Rzepecki) [#37](https://github.com/TalentBox/sequel-rails/issues/37)
5
+ * Allow `rake db:dump` and `rake db:load` to work on `sqlite3` [#31](https://github.com/TalentBox/sequel-rails/issues/31)
6
+ * Append migrations schema information to `schema.rb` and `structure.sql` [#31](https://github.com/TalentBox/sequel-rails/issues/31)
7
+ * Allow setting the search path in app config (Rafał Rzepecki) [#36](https://github.com/TalentBox/sequel-rails/issues/36)
8
+
1
9
  0.5.0 (2013-07-08)
2
10
  ==================
3
11
 
data/README.md CHANGED
@@ -52,6 +52,24 @@ require "sequel_rails/railties/legacy_model_config"
52
52
 
53
53
  After those changes, you should be good to go!
54
54
 
55
+ Configuration
56
+ ====================================
57
+ You can configure some options with the usual rails mechanism, in
58
+ `config/application.rb` and/or in `config/environments/*.rb`.
59
+
60
+ ```ruby
61
+ # Allowed options: :sql, :ruby.
62
+ config.sequel.schema_format = :sql
63
+
64
+ # Whether to dump the schema after successful migrations.
65
+ # Defaults to false in production and test, true otherwise.
66
+ config.sequel.schema_dump = true
67
+
68
+ # These override corresponding settings from the database config.
69
+ config.sequel.max_connections = 16
70
+ config.sequel.search_path = %w(mine public)
71
+ ```
72
+
55
73
  Available sequel specific rake tasks
56
74
  ====================================
57
75
 
@@ -35,8 +35,16 @@ module SequelRails
35
35
  end
36
36
  end
37
37
 
38
+ def schema_dump
39
+ super.nil? ? (schema_dump = default_schema_dump) : super
40
+ end
41
+
38
42
  private
39
43
 
44
+ def default_schema_dump
45
+ not %w(test production).include? Rails.env
46
+ end
47
+
40
48
  def initialize(root, database_yml_hash)
41
49
  super()
42
50
  @root, @raw = root, database_yml_hash
@@ -75,12 +83,17 @@ module SequelRails
75
83
 
76
84
  # override max connections if requested in app configuration
77
85
  config['max_connections'] = max_connections if max_connections
86
+ config['search_path'] = search_path if search_path
78
87
 
79
88
  # some adapters only support an url
80
89
  if config['adapter'] && config['adapter'] =~ /^(jdbc|do):/
81
90
  params = {}
82
91
  config.each do |k, v|
83
92
  next if ['adapter', 'host', 'port', 'database'].include?(k)
93
+ if k == 'search_path'
94
+ v = v.split(',').map &:strip unless v.is_a? Array
95
+ v = URI::escape(v.join(','))
96
+ end
84
97
  params[k] = v
85
98
  end
86
99
  params_str = params.map { |k, v| "#{k}=#{v}" }.join('&')
@@ -15,6 +15,25 @@ module SequelRails
15
15
  return false unless File.exists?(Rails.root.join("db/migrate"))
16
16
  !::Sequel::Migrator.is_current?(::Sequel::Model.db, Rails.root.join("db/migrate"))
17
17
  end
18
+
19
+ def dump_schema_information(opts={})
20
+ sql = opts.fetch :sql
21
+ db = ::Sequel::Model.db
22
+ migrator = ::Sequel::TimestampMigrator.new db, "db/migrate"
23
+
24
+ inserts = migrator.applied_migrations.map do |migration_name|
25
+ insert = migrator.ds.insert_sql(migrator.column => migration_name)
26
+ sql ? insert : " self << #{insert.inspect}"
27
+ end
28
+
29
+ res = ""
30
+ if inserts.any?
31
+ res << "Sequel.migration do\n change do\n" unless sql
32
+ res << inserts.join("\n")
33
+ res << "\n end\nend\n" unless sql
34
+ end
35
+ res
36
+ end
18
37
  end
19
38
  end
20
39
  end
@@ -19,8 +19,10 @@ namespace :db do
19
19
  desc "Create a db/schema.rb file that can be portably used against any DB supported by Sequel"
20
20
  task :dump => :environment do
21
21
  db_for_current_env.extension :schema_dumper
22
- File.open(ENV['SCHEMA'] || "#{Rails.root}/db/schema.rb", "w") do |file|
23
- file.write db_for_current_env.dump_schema_migration(:same_db => true)
22
+ filename = ENV['SCHEMA'] || "#{Rails.root}/db/schema.rb"
23
+ File.open filename, "w" do |file|
24
+ file << db_for_current_env.dump_schema_migration(:same_db => true)
25
+ file << SequelRails::Migrations.dump_schema_information(:sql => false)
24
26
  end
25
27
  Rake::Task["db:schema:dump"].reenable
26
28
  end
@@ -42,26 +44,30 @@ namespace :db do
42
44
  desc "Dump the database structure to db/structure.sql. Specify another file with DB_STRUCTURE=db/my_structure.sql"
43
45
  task :dump, [:env] => :environment do |t, args|
44
46
  args.with_defaults(:env => Rails.env)
45
-
47
+
46
48
  filename = ENV['DB_STRUCTURE'] || File.join(Rails.root, "db", "structure.sql")
47
- unless SequelRails::Storage.dump_environment args.env, filename
49
+ if SequelRails::Storage.dump_environment args.env, filename
50
+ ::File.open filename, "a" do |file|
51
+ file << SequelRails::Migrations.dump_schema_information(:sql => true)
52
+ end
53
+ else
48
54
  abort "Could not dump structure for #{args.env}."
49
55
  end
50
-
56
+
51
57
  Rake::Task["db:structure:dump"].reenable
52
58
  end
53
59
 
54
60
  task :load, [:env] => :environment do |t, args|
55
61
  args.with_defaults(:env => Rails.env)
56
-
62
+
57
63
  filename = ENV['DB_STRUCTURE'] || File.join(Rails.root, "db", "structure.sql")
58
64
  unless SequelRails::Storage.load_environment args.env, filename
59
65
  abort "Could not load structure for #{args.env}."
60
66
  end
61
67
  end
62
68
  end
63
-
64
- task dump: :environment do
69
+
70
+ task :dump => :environment do
65
71
  case (SequelRails.configuration.schema_format ||= :ruby)
66
72
  when :ruby
67
73
  Rake::Task["db:schema:dump"].invoke
@@ -71,8 +77,8 @@ namespace :db do
71
77
  abort "unknown schema format #{SequelRails.configuration.schema_format}"
72
78
  end
73
79
  end
74
-
75
- task load: :environment do
80
+
81
+ task :load => :environment do
76
82
  case (SequelRails.configuration.schema_format ||= :ruby)
77
83
  when :ruby
78
84
  Rake::Task["db:schema:load"].invoke
@@ -82,7 +88,7 @@ namespace :db do
82
88
  abort "unknown schema format #{SequelRails.configuration.schema_format}"
83
89
  end
84
90
  end
85
-
91
+
86
92
  namespace :create do
87
93
  desc 'Create all the local databases defined in config/database.yml'
88
94
  task :all => :environment do
@@ -143,7 +149,7 @@ namespace :db do
143
149
  version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
144
150
  raise "VERSION is required" unless version
145
151
  SequelRails::Migrations.migrate_up!(version)
146
- Rake::Task["db:dump"].invoke unless Rails.env.test?
152
+ Rake::Task["db:dump"].invoke if SequelRails.configuration.schema_dump
147
153
  end
148
154
 
149
155
  desc 'Runs the "down" for a given migration VERSION.'
@@ -151,14 +157,14 @@ namespace :db do
151
157
  version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
152
158
  raise "VERSION is required" unless version
153
159
  SequelRails::Migrations.migrate_down!(version)
154
- Rake::Task["db:dump"].invoke unless Rails.env.test?
160
+ Rake::Task["db:dump"].invoke if SequelRails.configuration.schema_dump
155
161
  end
156
162
  end
157
163
 
158
164
  desc 'Migrate the database to the latest version'
159
165
  task :migrate => "migrate:load" do
160
166
  SequelRails::Migrations.migrate_up!(ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
161
- Rake::Task["db:dump"].invoke unless Rails.env.test?
167
+ Rake::Task["db:dump"].invoke if SequelRails.configuration.schema_dump
162
168
  end
163
169
 
164
170
  desc 'Load the seed data from db/seeds.rb'
@@ -24,7 +24,7 @@ module SequelRails
24
24
  adapter.close_connections
25
25
  adapter.drop
26
26
  end
27
-
27
+
28
28
  def self.dump_environment(config_or_env, filename)
29
29
  adapter_for(config_or_env).dump(filename)
30
30
  end
@@ -21,13 +21,13 @@ module SequelRails
21
21
  res
22
22
  end
23
23
 
24
- def dump filename
24
+ def dump(filename)
25
25
  res = _dump filename
26
26
  puts "[sequel] Dumped structure of database '#{database}' to '#{filename}'" if res
27
27
  res
28
28
  end
29
29
 
30
- def load filename
30
+ def load(filename)
31
31
  res = _load filename
32
32
  puts "[sequel] Loaded structure of database '#{database}' from '#{filename}'" if res
33
33
  res
@@ -42,7 +42,7 @@ module SequelRails
42
42
  def _drop
43
43
  if _is_sqlite?
44
44
  return if in_memory?
45
- ::Sequel.connect config['url']
45
+ FileUtils.rm db_name if File.exists? db_name
46
46
  elsif _is_mysql?
47
47
  ::Sequel.connect("#{_root_url}#{_params}") do |db|
48
48
  db.execute("DROP DATABASE IF EXISTS `#{db_name}`")
@@ -11,7 +11,7 @@ module SequelRails
11
11
  execute("DROP DATABASE IF EXISTS `#{database}`")
12
12
  end
13
13
 
14
- def _dump filename
14
+ def _dump(filename)
15
15
  commands = %w(mysqldump --no-data)
16
16
  commands << "--user=#{Shellwords.escape(username)}" unless username.blank?
17
17
  commands << "--password=#{Shellwords.escape(password)}" unless password.blank?
@@ -21,7 +21,7 @@ module SequelRails
21
21
  system(*commands)
22
22
  end
23
23
 
24
- def _load filename
24
+ def _load(filename)
25
25
  commands = %w(mysql)
26
26
  commands << "--user=#{Shellwords.escape(username)}" unless username.blank?
27
27
  commands << "--password=#{Shellwords.escape(password)}" unless password.blank?
@@ -25,8 +25,8 @@ module SequelRails
25
25
  ENV["PGPASSWORD"] = nil unless password.blank?
26
26
  res
27
27
  end
28
-
29
- def _dump filename
28
+
29
+ def _dump(filename)
30
30
  ENV["PGPASSWORD"] = password unless password.blank?
31
31
  commands = %w(pg_dump -i -s -x -O)
32
32
  commands << "-f" << filename
@@ -39,7 +39,7 @@ module SequelRails
39
39
  res
40
40
  end
41
41
 
42
- def _load filename
42
+ def _load(filename)
43
43
  ENV["PGPASSWORD"] = password unless password.blank?
44
44
  commands = %w(psql)
45
45
  commands << "-f" << filename
@@ -63,8 +63,8 @@ module SequelRails
63
63
  WHERE datname = '#{database}';
64
64
  SQL
65
65
  rescue => _
66
- # Will raise an error as it kills existing process running this
67
- # command. Seems to be only way to ensure *all* test connections
66
+ # Will raise an error as it kills existing process running this
67
+ # command. Seems to be only way to ensure *all* test connections
68
68
  # are closed
69
69
  end
70
70
  end
@@ -11,6 +11,16 @@ module SequelRails
11
11
  path.unlink if path.file?
12
12
  end
13
13
 
14
+ def _dump(filename)
15
+ return if in_memory?
16
+ system "sqlite3 \"#{path.to_s}\" .schema > \"#{filename}\""
17
+ end
18
+
19
+ def _load(filename)
20
+ return if in_memory?
21
+ system "sqlite3 \"#{path.to_s}\" < \"#{filename}\""
22
+ end
23
+
14
24
  private
15
25
 
16
26
  def in_memory?
@@ -1,3 +1,3 @@
1
1
  module SequelRails
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -0,0 +1,9 @@
1
+ Sequel.migration do
2
+
3
+ change do
4
+ alter_table :users do
5
+ add_column :twitter_handle, String, :text => true
6
+ end
7
+ end
8
+
9
+ end
File without changes
@@ -42,32 +42,21 @@ describe SequelRails::Configuration do
42
42
 
43
43
  describe ".setup" do
44
44
 
45
- shared_context "max_connections" do
46
- let(:max_connections) { 31337 }
47
- before do
48
- environments[environment]["max_connections"] = 7
49
- SequelRails.configuration.max_connections = max_connections
50
- end
51
- end
52
-
53
- shared_examples "max_connections_c" do
45
+ shared_examples "max_connections" do
54
46
  context "with max_connections config option" do
55
- include_context "max_connections"
56
- it "overrides the option from the configuration" do
57
- ::Sequel.should_receive(:connect) do |hash|
58
- hash['max_connections'].should == max_connections
59
- end
60
- subject
47
+ let(:max_connections) { 31337 }
48
+ before do
49
+ environments[environment]["max_connections"] = 7
50
+ SequelRails.configuration.max_connections = max_connections
61
51
  end
62
- end
63
- end
64
52
 
65
- shared_examples "max_connections_j" do
66
- context "with max_connections config option" do
67
- include_context "max_connections"
68
53
  it "overrides the option from the configuration" do
69
- ::Sequel.should_receive(:connect) do |url, hash|
70
- url.should include("max_connections=#{max_connections}")
54
+ ::Sequel.should_receive(:connect) do |hash_or_url, *_|
55
+ if hash_or_url.is_a? Hash
56
+ hash_or_url['max_connections'].should == max_connections
57
+ else
58
+ hash_or_url.should include("max_connections=#{max_connections}")
59
+ end
71
60
  end
72
61
  subject
73
62
  end
@@ -76,11 +65,33 @@ describe SequelRails::Configuration do
76
65
 
77
66
  context "for a postgres connection" do
78
67
 
68
+ shared_examples "search_path" do
69
+ context "with search_path config option" do
70
+ let(:search_path) { ['secret', 'private', 'public'] }
71
+ before do
72
+ environments[environment]["search_path"] = "private, public"
73
+ SequelRails.configuration.search_path = search_path
74
+ end
75
+
76
+ it "overrides the option from the configuration" do
77
+ ::Sequel.should_receive(:connect) do |hash_or_url, *_|
78
+ if hash_or_url.is_a? Hash
79
+ hash_or_url['search_path'].should == search_path
80
+ else
81
+ hash_or_url.should include("search_path=secret,private,public")
82
+ end
83
+ end
84
+ subject
85
+ end
86
+ end
87
+ end
88
+
79
89
  let(:environment) { 'development' }
80
90
 
81
91
  context "in C-Ruby" do
82
92
 
83
- include_examples "max_connections_c"
93
+ include_examples "max_connections"
94
+ include_examples "search_path"
84
95
 
85
96
  it "produces a sane config without url" do
86
97
  ::Sequel.should_receive(:connect) do |hash|
@@ -93,7 +104,8 @@ describe SequelRails::Configuration do
93
104
 
94
105
  context "in JRuby" do
95
106
 
96
- include_examples "max_connections_j"
107
+ include_examples "max_connections"
108
+ include_examples "search_path"
97
109
 
98
110
  let(:is_jruby) { true }
99
111
 
@@ -114,7 +126,7 @@ describe SequelRails::Configuration do
114
126
 
115
127
  context "in C-Ruby" do
116
128
 
117
- include_examples "max_connections_c"
129
+ include_examples "max_connections"
118
130
 
119
131
  it "produces a config without url" do
120
132
  ::Sequel.should_receive(:connect) do |hash|
@@ -126,7 +138,7 @@ describe SequelRails::Configuration do
126
138
 
127
139
  context "in JRuby" do
128
140
 
129
- include_examples "max_connections_j"
141
+ include_examples "max_connections"
130
142
 
131
143
  let(:is_jruby) { true }
132
144
 
@@ -0,0 +1,64 @@
1
+ require "spec_helper"
2
+
3
+ describe "Database rake tasks" do
4
+
5
+ let(:app) { Combustion::Application }
6
+ let(:app_root) { app.root }
7
+
8
+ around do |example|
9
+ begin
10
+ FileUtils.rm schema if File.exists? schema
11
+ example.run
12
+ ensure
13
+ FileUtils.rm schema if File.exists? schema
14
+ end
15
+ end
16
+
17
+ describe "db:schema:dump" do
18
+ let(:schema) { "#{app_root}/db/schema.rb" }
19
+
20
+ it "dumps the schema in 'db/schema.rb'" do
21
+ Dir.chdir app_root do
22
+ `rake db:schema:dump`
23
+ File.exists?(schema).should be_true
24
+ end
25
+ end
26
+
27
+ it "append the migration schema information if any" do
28
+ Dir.chdir app_root do
29
+ `rake db:migrate db:schema:dump`
30
+ sql = Sequel::Model.db.from(:schema_migrations).
31
+ insert_sql(:filename => "1273253849_add_twitter_handle_to_users.rb")
32
+ File.read(schema).should include <<-EOS
33
+ Sequel.migration do
34
+ change do
35
+ self << #{sql.inspect}
36
+ end
37
+ end
38
+ EOS
39
+ end
40
+ end
41
+ end
42
+
43
+ describe "db:structure:dump", :skip_jdbc do
44
+ let(:schema) { "#{app_root}/db/structure.sql" }
45
+
46
+ it "dumps the schema in 'db/structure.sql'" do
47
+ Dir.chdir app_root do
48
+ `rake db:structure:dump`
49
+ File.exists?(schema).should be_true
50
+ end
51
+ end
52
+
53
+ it "append the migration schema information if any" do
54
+ Dir.chdir app_root do
55
+ `rake db:migrate db:structure:dump`
56
+
57
+ sql = Sequel::Model.db.from(:schema_migrations).
58
+ insert_sql(:filename => "1273253849_add_twitter_handle_to_users.rb")
59
+ File.read(schema).should include sql
60
+ end
61
+ end
62
+ end
63
+
64
+ end
data/spec/spec_helper.rb CHANGED
@@ -9,7 +9,12 @@ Combustion.initialize! "sequel_rails"
9
9
  # Load support files
10
10
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
11
 
12
+ rspec_exclusions = {}
13
+ rspec_exclusions[:skip_jdbc] = true if SequelRails.jruby?
14
+
12
15
  RSpec.configure do |config|
16
+ config.treat_symbols_as_metadata_keys_with_true_values = true
17
+ config.filter_run_excluding rspec_exclusions
13
18
  config.around :each do |example|
14
19
  Sequel::Model.db.transaction(:rollback => :always) do
15
20
  example.run
@@ -26,7 +31,7 @@ begin
26
31
  end
27
32
 
28
33
  require 'sequel/extensions/migration'
29
- load "#{Rails.root}/db/schema.rb"
34
+ load "#{Rails.root}/db/schema.rb.init"
30
35
  Sequel::Migration.descendants.first.apply Sequel::Model.db, :up
31
36
  rescue Sequel::DatabaseConnectionError => e
32
37
  puts "Database connection error: #{e.message}"
data/tasks/spec.rake CHANGED
@@ -54,7 +54,7 @@ begin
54
54
  clean_env
55
55
  Rake::Task["spec"].reenable
56
56
  ENV["TEST_ADAPTER"] = "sqlite3"
57
- ENV["TEST_DATABASE"] = ":memory:"
57
+ ENV["TEST_DATABASE"] = "db/database.sqlite3"
58
58
  Rake::Task["spec"].invoke
59
59
  end
60
60
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brasten Sager (brasten)
@@ -9,98 +9,98 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-08 00:00:00.000000000 Z
12
+ date: 2013-08-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
+ name: sequel
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - ! '>='
18
+ - - '>='
18
19
  - !ruby/object:Gem::Version
19
20
  version: '3.28'
20
21
  - - <
21
22
  - !ruby/object:Gem::Version
22
23
  version: 4.1.0
24
+ type: :runtime
25
+ prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
24
27
  requirements:
25
- - - ! '>='
28
+ - - '>='
26
29
  - !ruby/object:Gem::Version
27
30
  version: '3.28'
28
31
  - - <
29
32
  - !ruby/object:Gem::Version
30
33
  version: 4.1.0
31
- type: :runtime
32
- prerelease: false
33
- name: sequel
34
34
  - !ruby/object:Gem::Dependency
35
+ name: railties
35
36
  requirement: !ruby/object:Gem::Requirement
36
37
  requirements:
37
- - - ! '>='
38
+ - - '>='
38
39
  - !ruby/object:Gem::Version
39
40
  version: 3.2.0
41
+ type: :runtime
42
+ prerelease: false
40
43
  version_requirements: !ruby/object:Gem::Requirement
41
44
  requirements:
42
- - - ! '>='
45
+ - - '>='
43
46
  - !ruby/object:Gem::Version
44
47
  version: 3.2.0
45
- type: :runtime
46
- prerelease: false
47
- name: railties
48
48
  - !ruby/object:Gem::Dependency
49
+ name: rake
49
50
  requirement: !ruby/object:Gem::Requirement
50
51
  requirements:
51
- - - ! '>='
52
+ - - '>='
52
53
  - !ruby/object:Gem::Version
53
54
  version: 0.8.7
55
+ type: :development
56
+ prerelease: false
54
57
  version_requirements: !ruby/object:Gem::Requirement
55
58
  requirements:
56
- - - ! '>='
59
+ - - '>='
57
60
  - !ruby/object:Gem::Version
58
61
  version: 0.8.7
59
- type: :development
60
- prerelease: false
61
- name: rake
62
62
  - !ruby/object:Gem::Dependency
63
+ name: rspec
63
64
  requirement: !ruby/object:Gem::Requirement
64
65
  requirements:
65
66
  - - ~>
66
67
  - !ruby/object:Gem::Version
67
68
  version: 2.7.0
69
+ type: :development
70
+ prerelease: false
68
71
  version_requirements: !ruby/object:Gem::Requirement
69
72
  requirements:
70
73
  - - ~>
71
74
  - !ruby/object:Gem::Version
72
75
  version: 2.7.0
73
- type: :development
74
- prerelease: false
75
- name: rspec
76
76
  - !ruby/object:Gem::Dependency
77
+ name: combustion
77
78
  requirement: !ruby/object:Gem::Requirement
78
79
  requirements:
79
80
  - - ~>
80
81
  - !ruby/object:Gem::Version
81
82
  version: 0.5.0
83
+ type: :development
84
+ prerelease: false
82
85
  version_requirements: !ruby/object:Gem::Requirement
83
86
  requirements:
84
87
  - - ~>
85
88
  - !ruby/object:Gem::Version
86
89
  version: 0.5.0
87
- type: :development
88
- prerelease: false
89
- name: combustion
90
90
  - !ruby/object:Gem::Dependency
91
+ name: generator_spec
91
92
  requirement: !ruby/object:Gem::Requirement
92
93
  requirements:
93
94
  - - ~>
94
95
  - !ruby/object:Gem::Version
95
96
  version: 0.9.0
97
+ type: :development
98
+ prerelease: false
96
99
  version_requirements: !ruby/object:Gem::Requirement
97
100
  requirements:
98
101
  - - ~>
99
102
  - !ruby/object:Gem::Version
100
103
  version: 0.9.0
101
- type: :development
102
- prerelease: false
103
- name: generator_spec
104
104
  description: Integrate Sequel with Rails 3
105
105
  email:
106
106
  - brasten@gmail.com
@@ -158,12 +158,14 @@ files:
158
158
  - spec/internal/config/database.yml
159
159
  - spec/internal/config/initializers/session.rb
160
160
  - spec/internal/config/routes.rb
161
- - spec/internal/db/schema.rb
161
+ - spec/internal/db/migrate/1273253849_add_twitter_handle_to_users.rb
162
+ - spec/internal/db/schema.rb.init
162
163
  - spec/internal/public/favicon.ico
163
164
  - spec/lib/generators/sequel/migration_spec.rb
164
165
  - spec/lib/sequel_rails/configuration_spec.rb
165
166
  - spec/lib/sequel_rails/migrations_spec.rb
166
167
  - spec/lib/sequel_rails/railtie_spec.rb
168
+ - spec/lib/sequel_rails/railties/database_rake_spec.rb
167
169
  - spec/lib/sequel_rails/railties/log_subscriber_spec.rb
168
170
  - spec/lib/sequel_rails/storage_spec.rb
169
171
  - spec/spec_helper.rb
@@ -178,12 +180,12 @@ require_paths:
178
180
  - lib
179
181
  required_ruby_version: !ruby/object:Gem::Requirement
180
182
  requirements:
181
- - - ! '>='
183
+ - - '>='
182
184
  - !ruby/object:Gem::Version
183
185
  version: '0'
184
186
  required_rubygems_version: !ruby/object:Gem::Requirement
185
187
  requirements:
186
- - - ! '>='
188
+ - - '>='
187
189
  - !ruby/object:Gem::Version
188
190
  version: '0'
189
191
  requirements: []
@@ -198,12 +200,14 @@ test_files:
198
200
  - spec/internal/config/database.yml
199
201
  - spec/internal/config/initializers/session.rb
200
202
  - spec/internal/config/routes.rb
201
- - spec/internal/db/schema.rb
203
+ - spec/internal/db/migrate/1273253849_add_twitter_handle_to_users.rb
204
+ - spec/internal/db/schema.rb.init
202
205
  - spec/internal/public/favicon.ico
203
206
  - spec/lib/generators/sequel/migration_spec.rb
204
207
  - spec/lib/sequel_rails/configuration_spec.rb
205
208
  - spec/lib/sequel_rails/migrations_spec.rb
206
209
  - spec/lib/sequel_rails/railtie_spec.rb
210
+ - spec/lib/sequel_rails/railties/database_rake_spec.rb
207
211
  - spec/lib/sequel_rails/railties/log_subscriber_spec.rb
208
212
  - spec/lib/sequel_rails/storage_spec.rb
209
213
  - spec/spec_helper.rb