sequel-rails 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/History.md +12 -0
- data/README.md +1 -0
- data/lib/sequel_rails/migrations.rb +3 -3
- data/lib/sequel_rails/railtie.rb +2 -1
- data/lib/sequel_rails/version.rb +1 -1
- data/spec/lib/sequel_rails/migrations_spec.rb +5 -5
- data/spec/lib/sequel_rails/railtie_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZGUzMDc4YTE3MzgzNDk3OTk0YWIzOTJhZDkyYmZiM2Q1ZGI0N2QxNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTUzM2RjZDFjZmQ1NjljYTU3NTE5MTcwODBhZjkzODNiMWI0NWM1Mw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTE4ZDhjNDllOGNhNzA2MzZmMTczMmM1Yjk4MDMzZWI2ZDM2YTAwNzU2MWRh
|
10
|
+
M2UxYmJkYjA2YWFmOGQ2MjYwNTcyYjNlOGI3ZWYwODBjYTU0YThhZjlhYmNl
|
11
|
+
MmQ0NzQ1MzExOTliYWRlNjhkMzYwNDAxMTAyZWRhYTBlMzcxZTE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjdlNmEwNWM1MjM3NmVmZjVlMDIzYjY1MzcwOGZlMTFhNzIyY2EzNGIzMDIw
|
14
|
+
MmEyNzc2NDEyNDUyZTllY2IwNmYzODI4YmVmYzc2YWEzY2ZlZTZiZTU3ZGY1
|
15
|
+
MTA2YzkyY2JkNDJiZDZiYmQzZDA3YzMzMDBlZDkwMjIzOGJkMjk=
|
data/History.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
0.4.3 (2013-04-03)
|
2
|
+
==================
|
3
|
+
|
4
|
+
* Handle `Sequel::NoMatchingRow` exception to return a `404`.
|
5
|
+
|
6
|
+
As of `Sequel` `3.46.0`, this new standard exception class has been added.
|
7
|
+
The main use case is when no row is found when using the new `Dataset#first!`
|
8
|
+
method, this new method raise an exception instead of returning `nil` like
|
9
|
+
`Dataset#first`.
|
10
|
+
|
11
|
+
* Ensure migration tasks points to migration directory's full path (Sean Sorrell)
|
12
|
+
|
1
13
|
0.4.2 (2013-03-18)
|
2
14
|
==================
|
3
15
|
|
data/README.md
CHANGED
@@ -6,14 +6,14 @@ module SequelRails
|
|
6
6
|
def migrate(version=nil)
|
7
7
|
opts = {}
|
8
8
|
opts[:target] = version.to_i if version
|
9
|
-
::Sequel::Migrator.run(::Sequel::Model.db, "db/migrate", opts)
|
9
|
+
::Sequel::Migrator.run(::Sequel::Model.db, Rails.root.join("db/migrate"), opts)
|
10
10
|
end
|
11
11
|
alias_method :migrate_up!, :migrate
|
12
12
|
alias_method :migrate_down!, :migrate
|
13
13
|
|
14
14
|
def pending_migrations?
|
15
|
-
return false unless File.exists?("db/migrate")
|
16
|
-
!::Sequel::Migrator.is_current?(::Sequel::Model.db, "db/migrate")
|
15
|
+
return false unless File.exists?(Rails.root.join("db/migrate"))
|
16
|
+
!::Sequel::Migrator.is_current?(::Sequel::Model.db, Rails.root.join("db/migrate"))
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/lib/sequel_rails/railtie.rb
CHANGED
@@ -29,10 +29,11 @@ module SequelRails
|
|
29
29
|
|
30
30
|
config.action_dispatch.rescue_responses.merge!(
|
31
31
|
"Sequel::Plugins::RailsExtensions::ModelNotFound" => :not_found,
|
32
|
+
"Sequel::NoMatchingRow" => :not_found,
|
32
33
|
"Sequel::ValidationFailed" => :unprocessable_entity,
|
33
34
|
"Sequel::NoExistingObject" => :unprocessable_entity
|
34
35
|
)
|
35
|
-
|
36
|
+
|
36
37
|
config.sequel = ActiveSupport::OrderedOptions.new
|
37
38
|
|
38
39
|
rake_tasks do
|
data/lib/sequel_rails/version.rb
CHANGED
@@ -11,7 +11,7 @@ describe SequelRails::Migrations do
|
|
11
11
|
let(:opts) { {} }
|
12
12
|
it "runs migrations using Sequel::Migrator" do
|
13
13
|
::Sequel::Migrator.should_receive(:run).with(
|
14
|
-
db, "db/migrate", opts
|
14
|
+
db, Rails.root.join("db/migrate"), opts
|
15
15
|
).and_return result
|
16
16
|
described_class.send(migration_method).should be result
|
17
17
|
end
|
@@ -20,7 +20,7 @@ describe SequelRails::Migrations do
|
|
20
20
|
let(:opts) { {:target => 1} }
|
21
21
|
it "runs migrations using Sequel::Migrator" do
|
22
22
|
::Sequel::Migrator.should_receive(:run).with(
|
23
|
-
db, "db/migrate", opts
|
23
|
+
db, Rails.root.join("db/migrate"), opts
|
24
24
|
).and_return result
|
25
25
|
described_class.send(migration_method, 1).should be result
|
26
26
|
end
|
@@ -30,7 +30,7 @@ describe SequelRails::Migrations do
|
|
30
30
|
|
31
31
|
describe ".pending_migrations?" do
|
32
32
|
include FakeFS::SpecHelpers
|
33
|
-
let(:path) { "db/migrate" }
|
33
|
+
let(:path) { Rails.root.join("db/migrate") }
|
34
34
|
|
35
35
|
it "returns false if no db/migrate directory exists" do
|
36
36
|
described_class.pending_migrations?.should == false
|
@@ -41,14 +41,14 @@ describe SequelRails::Migrations do
|
|
41
41
|
|
42
42
|
it "returns true if any pending migration" do
|
43
43
|
::Sequel::Migrator.should_receive(:is_current?).with(
|
44
|
-
db, "db/migrate"
|
44
|
+
db, Rails.root.join("db/migrate")
|
45
45
|
).and_return false
|
46
46
|
described_class.pending_migrations?.should == true
|
47
47
|
end
|
48
48
|
|
49
49
|
it "returns false if no pending migration" do
|
50
50
|
::Sequel::Migrator.should_receive(:is_current?).with(
|
51
|
-
db, "db/migrate"
|
51
|
+
db, Rails.root.join("db/migrate")
|
52
52
|
).and_return true
|
53
53
|
described_class.pending_migrations?.should == false
|
54
54
|
end
|
@@ -32,6 +32,10 @@ describe SequelRails::Railtie do
|
|
32
32
|
rescue_responses["Sequel::Plugins::RailsExtensions::ModelNotFound"].should == :not_found
|
33
33
|
end
|
34
34
|
|
35
|
+
it "to handle Sequel::NoMatchingRow with :not_found" do
|
36
|
+
rescue_responses["Sequel::NoMatchingRow"].should == :not_found
|
37
|
+
end
|
38
|
+
|
35
39
|
it "to handle Sequel::ValidationFailed with :unprocessable_entity" do
|
36
40
|
rescue_responses["Sequel::ValidationFailed"].should == :unprocessable_entity
|
37
41
|
end
|
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.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brasten Sager (brasten)
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03
|
12
|
+
date: 2013-04-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|