gemlock 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -69,5 +69,18 @@ module Gemlock
69
69
  parsed_config = YAML.load_file(config_file)
70
70
  end
71
71
  end
72
+
73
+ def difference(local_version, gem_version)
74
+ lock_major, lock_minor, lock_patch = local_version.split('.')
75
+ gem_major, gem_minor, gem_patch = gem_version.split('.')
76
+
77
+ if gem_major > lock_major
78
+ "major"
79
+ elsif gem_minor > lock_minor
80
+ "minor"
81
+ elsif gem_patch>lock_patch
82
+ "patch"
83
+ end
84
+ end
72
85
  end
73
86
  end
@@ -1,3 +1,3 @@
1
1
  module Gemlock
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -1 +1 @@
1
- email : tester@example.com
1
+ email: tester@example.com
@@ -96,9 +96,23 @@ describe Gemlock do
96
96
  it "returns a hash containing the user's email if config_file is defined" do
97
97
  Gemlock.stubs(:config_file).returns((File.join(File.dirname(__FILE__), 'fixtures', 'gemlock.yml')))
98
98
 
99
- expected = {'email' => "tester@example.com"}
99
+ Gemlock.parsed_config["email"].should eql "tester@example.com"
100
+ end
101
+ end
102
+
103
+ describe "#difference" do
104
+ it "returns 'major' if there is a major version difference between the two gem versions" do
105
+ Gemlock.difference("2.0.0", "3.0.0").should eql "major"
106
+ Gemlock.difference("2.5.10", "3.1.0").should eql "major"
107
+ end
108
+
109
+ it "returns 'minor' if there is a minor version difference between the two gem versions" do
110
+ Gemlock.difference("3.0.0", "3.1.0").should eql "minor"
111
+ Gemlock.difference("3.1.0", "3.2.1").should eql "minor"
112
+ end
100
113
 
101
- Gemlock.parsed_config.should eql expected
114
+ it "returns 'patch' if there is a patch version difference between the two gem versions" do
115
+ Gemlock.difference("3.1.0", "3.1.1").should eql "patch"
102
116
  end
103
117
  end
104
118
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemlock
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mike Skalnik
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-10-10 00:00:00 Z
21
+ date: 2011-10-11 00:00:00 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: rake