versioncake 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile.lock +1 -1
- data/gemfiles/rails3.2.gemfile.lock +1 -1
- data/gemfiles/rails4.0.gemfile.lock +1 -1
- data/gemfiles/rails4.1.gemfile.lock +1 -1
- data/lib/versioncake/strategies/extraction_strategy.rb +7 -1
- data/lib/versioncake/version.rb +1 -1
- data/test/unit/strategies/extraction_strategy_test.rb +15 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTZjMGMyZDYzMThlZTljNzJlYjliY2FkMmYwZGRhOWYyMTc5YjZjNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MWVhM2IzMGVlODFhYWFhOTkyNTc2MTYzMzMzMTlmNTExODM4YjAxMQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTg2MjZkMWI1ODkxMzM1MjJlZWExMDNjZGQyZjYwZjc3N2MwODkzNjM4OGZj
|
10
|
+
NGQxMDY2ZWZiZGZiOWI3MTBiOGE1YzdhZTExOGJmMTIzYjczYjk4ZTNjMTU2
|
11
|
+
NDM2MDMwOTVjMmIzMDBhNmM0YzQxN2JlOTJiZWYyYjQzOGM5NzA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTJhNDY0ZDM1MGFlNDI5NDZjN2MyNGNmMGI1NDcwYTc3MzVmNjgwNjJmMGQy
|
14
|
+
NjFmOTg5NzI5ODkwYjY1ODczYzkwODI2NjBhODQyZDY3NTNjNDRjMTZhZjky
|
15
|
+
MjQ2MjEyNjkwODMzZGQ1OGZkZTVlMmYzNWFjZTMxNmI4ZGU5MmI=
|
data/Gemfile.lock
CHANGED
@@ -5,7 +5,13 @@ module VersionCake
|
|
5
5
|
|
6
6
|
def extract(request)
|
7
7
|
version = execute(request)
|
8
|
-
|
8
|
+
if version.is_a?(Fixnum)
|
9
|
+
version
|
10
|
+
elsif version.is_a?(String) && /[0-9]+/.match(version)
|
11
|
+
version.to_i
|
12
|
+
else
|
13
|
+
nil
|
14
|
+
end
|
9
15
|
end
|
10
16
|
|
11
17
|
def version_key
|
data/lib/versioncake/version.rb
CHANGED
@@ -7,13 +7,27 @@ class ExtractionStrategyTest < ActiveSupport::TestCase
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
test "
|
10
|
+
test "custom strategy result will be converted to integer" do
|
11
11
|
class TestStrategy < VersionCake::ExtractionStrategy
|
12
12
|
def execute(request); "123"; end
|
13
13
|
end
|
14
14
|
assert_equal 123, TestStrategy.new.extract("request")
|
15
15
|
end
|
16
16
|
|
17
|
+
test "custom strategy result will be returned" do
|
18
|
+
class TestStrategy < VersionCake::ExtractionStrategy
|
19
|
+
def execute(request); 123; end
|
20
|
+
end
|
21
|
+
assert_equal 123, TestStrategy.new.extract("request")
|
22
|
+
end
|
23
|
+
|
24
|
+
test "custom strategy will fail if it returns unexpected result" do
|
25
|
+
class TestStrategy < VersionCake::ExtractionStrategy
|
26
|
+
def execute(request); Object.new; end
|
27
|
+
end
|
28
|
+
assert_nil TestStrategy.new.extract("request")
|
29
|
+
end
|
30
|
+
|
17
31
|
test "it can lookup a strategy" do
|
18
32
|
strategy = VersionCake::ExtractionStrategy.lookup(:query_parameter)
|
19
33
|
assert_equal VersionCake::QueryParameterStrategy, strategy.class
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: versioncake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Jones
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|