version 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 20965e2590585ffac10a15701214153bc52fba35
4
+ data.tar.gz: 3729b49f10a0de092ce3b33ca107948abf4dcc66
5
+ SHA512:
6
+ metadata.gz: 3af3ec96f5c52901e642532d8c996f95aff45ec147b99f872e170d9d3de7e275f0f909ffbe2b56a05224521fac6185f07824c5a890bb73aed8b4f1d6e3e13b3c
7
+ data.tar.gz: aa7d294c38282ca487dd171e3e33e3519910d08a826b716df11843e4ef2c18c0f98c8f713bd59afa307c645ca108be04285dcf05f591c2bc7b391be994862ef5
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,38 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ version (1.0.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.3)
10
+ rake (12.0.0)
11
+ rspec (3.5.0)
12
+ rspec-core (~> 3.5.0)
13
+ rspec-expectations (~> 3.5.0)
14
+ rspec-mocks (~> 3.5.0)
15
+ rspec-core (3.5.4)
16
+ rspec-support (~> 3.5.0)
17
+ rspec-expectations (3.5.0)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.5.0)
20
+ rspec-its (1.2.0)
21
+ rspec-core (>= 3.0.0)
22
+ rspec-expectations (>= 3.0.0)
23
+ rspec-mocks (3.5.0)
24
+ diff-lcs (>= 1.2.0, < 2.0)
25
+ rspec-support (~> 3.5.0)
26
+ rspec-support (3.5.0)
27
+
28
+ PLATFORMS
29
+ ruby
30
+
31
+ DEPENDENCIES
32
+ rake
33
+ rspec (~> 3)
34
+ rspec-its (~> 1)
35
+ version!
36
+
37
+ BUNDLED WITH
38
+ 1.14.6
data/Rakefile CHANGED
@@ -3,9 +3,9 @@ $: << 'lib'
3
3
  require 'rake/version_task'
4
4
 
5
5
  require 'rubygems'
6
- require 'rake/gempackagetask'
7
- require 'rake/rdoctask'
8
- require 'spec/rake/spectask'
6
+ require 'rubygems/package_task'
7
+ require 'rdoc/task'
8
+ require 'rspec/core/rake_task'
9
9
 
10
10
  spec = Gem::Specification.new do |s|
11
11
  s.name = 'version'
@@ -20,10 +20,11 @@ spec = Gem::Specification.new do |s|
20
20
  s.extra_rdoc_files = Dir['*.rdoc']
21
21
  s.rdoc_options = %w{ --main README.rdoc }
22
22
 
23
- s.add_development_dependency 'rspec'
23
+ s.add_development_dependency 'rake'
24
+ s.add_development_dependency 'rspec', '~> 1'
24
25
  end
25
26
 
26
- Rake::GemPackageTask.new(spec) do |gem|
27
+ Gem::PackageTask.new(spec) do |gem|
27
28
  gem.need_tar = true
28
29
  end
29
30
 
@@ -35,8 +36,8 @@ Rake::RDocTask.new do |doc|
35
36
  doc.rdoc_files.include('lib/**/*.rb')
36
37
  end
37
38
 
38
- Spec::Rake::SpecTask.new(:spec) do |task|
39
- task.spec_files = FileList['spec/**/*_spec.rb']
39
+ RSpec::Core::RakeTask.new(:spec) do |task|
40
+ task.pattern = 'spec/**/*_spec.rb'
40
41
  end
41
42
 
42
43
  Rake::VersionTask.new do |v|
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
@@ -12,18 +12,38 @@ class Rake::VersionTask < Rake::TaskLib
12
12
 
13
13
  # when true, tags version bumps automatically (default: false)
14
14
  attr_accessor :with_git_tag
15
+
16
+ # when true, commits version bumps automatically (default: autodetect)
17
+ attr_accessor :with_hg
18
+
19
+ # when true, tags version bumps automatically (default: false)
20
+ attr_accessor :with_hg_tag
21
+
22
+ # when true, commits version bumps automatically (default: autodetect)
23
+ attr_accessor :with_svn
24
+
25
+ # when true, tags version bumps automatically if the current svn URL
26
+ # either ends in '<base>/trunk' or '<base>/branches/<branch>' by
27
+ # copying the current svn URL to the '<base>/tags/<version>'
28
+ # (default: false)
29
+ attr_accessor :with_svn_tag
15
30
 
16
31
  # when set with a Gem::Specification, automatically emits an updated
17
32
  # gemspec on version bumps
18
33
  attr_accessor :with_gemspec
19
-
34
+
35
+ # when set allows to override commit message
36
+ attr_accessor :with_commit_message
37
+
20
38
  #
21
39
  # Creates a new VersionTask with the given +filename+. Attempts to
22
- # autodetect the +filetype+ and whether or not git is present.
40
+ # autodetect the +filetype+ and whether or not git or hg is present.
23
41
  #
24
42
  def initialize(filename = 'VERSION')
25
43
  self.filename = filename
26
44
  self.with_git = File.exist?('.git')
45
+ self.with_hg = File.exist?('.hg')
46
+ self.with_svn = File.exist?('.svn')
27
47
 
28
48
  yield(self) if block_given?
29
49
 
@@ -112,31 +132,64 @@ class Rake::VersionTask < Rake::TaskLib
112
132
  when 'yml' then YAML::load(contents).to_version
113
133
  end
114
134
  end
115
-
135
+
136
+ def commit_message(version)
137
+ self.with_commit_message || "Version bump to #{version}"
138
+ end
116
139
  #
117
140
  # Writes out +version+ to the file at +filename+ with the correct format.
118
141
  #
119
142
  def write(version)
120
143
  return if version == read
121
-
144
+
122
145
  path.open('w') do |io|
123
146
  io << case filetype.to_s
124
147
  when '' then version.to_s + "\n"
125
148
  when 'yml' then version.to_yaml
126
149
  end
127
150
  end
128
-
151
+
129
152
  if self.with_gemspec
130
153
  with_gemspec.version = version
131
154
  gemspec.open('w') {|io| io << with_gemspec.to_ruby }
132
155
  end
133
-
156
+
134
157
  if self.with_git
135
158
  `git add #{self.filename}`
136
159
  `git add #{self.gemspec}` if self.with_gemspec
137
- `git commit -m "Version bump to #{version}"`
160
+ `git commit -m "#{commit_message(version)}"`
138
161
  `git tag #{version}` if self.with_git_tag
139
162
  end
163
+
164
+ if self.with_hg
165
+ `hg add #{self.filename}` unless `hg status -u #{self.filename}`.empty?
166
+ `hg add #{self.gemspec}` if (self.with_gemspec && !`hg status -u #{self.gemspec}`.empty?)
167
+ `hg commit #{self.filename} #{self.with_gemspec ? self.gemspec : ''} -m "#{commit_message(version)}"`
168
+ `hg tag #{version}` if self.with_hg_tag
169
+ end
170
+
171
+ if self.with_svn
172
+ `svn commit #{self.filename} #{self.with_gemspec ? self.gemspec : ''} -m "#{commit_message(version)}"`
173
+
174
+ # This only attempts to make 'standard' tags. That is, if the
175
+ # current svn URL ends in 'trunk' or 'branches/<branch>', then
176
+ # it will be copied to 'tags/<version>'
177
+ if self.with_svn_tag
178
+ url = nil
179
+ `svn info`.each_line do |line|
180
+ if line =~ /^URL:\s+(.*)$/
181
+ url = $1
182
+ break
183
+ end
184
+ end
185
+
186
+ if url && url =~ /^(.*)\/(trunk|branches\/[\w]+)$/
187
+ base = $1
188
+ tag_url = "#{base}/tags/#{version}"
189
+ `svn copy #{url} #{tag_url} -m "Tag #{version}"`
190
+ end
191
+ end
192
+ end
140
193
 
141
194
  version
142
195
  end
@@ -10,9 +10,9 @@ require 'pathname'
10
10
  #
11
11
  class Version
12
12
  include Comparable
13
-
13
+
14
14
  autoload :Component, 'version/component'
15
-
15
+
16
16
  #
17
17
  # Searches through the parent directories of the calling method and looks
18
18
  # for a VERSION or VERSION.yml file to parse out the current version. Pass
@@ -25,15 +25,15 @@ class Version
25
25
  # automatically in the directory; if path is a filename, use it directly
26
26
  path = path ? Pathname.new(path) : self.version_file(caller.first)
27
27
  path = self.version_file(path) unless path.nil? or path.file?
28
-
28
+
29
29
  return nil unless path
30
-
30
+
31
31
  case path.extname
32
32
  when '' then path.read.strip.to_version
33
33
  when '.yml' then YAML::load(path.read).to_version
34
34
  end
35
35
  end
36
-
36
+
37
37
  #
38
38
  # Attempts to detect the version file for the passed +filename+. Looks up
39
39
  # the directory hierarchy for a file named VERSION or VERSION.yml. Returns
@@ -45,7 +45,7 @@ class Version
45
45
  break d.join('VERSION.yml') if d.join('VERSION.yml').file?
46
46
  end
47
47
  end
48
-
48
+
49
49
  #
50
50
  # Creates a new version number, with a +major+ version number, +minor+
51
51
  # revision number, +revision+ number, and optionally more (unnamed)
@@ -54,7 +54,7 @@ class Version
54
54
  def initialize(major, minor = 0, revision = nil, *rest)
55
55
  self.components = [ major, minor, revision, *rest ]
56
56
  end
57
-
57
+
58
58
  #
59
59
  # For +major+, +minor+, and +revision+, make a helper method that gets and
60
60
  # sets each based on accessing indexes.
@@ -66,7 +66,7 @@ class Version
66
66
  define_method(:"#{component}") { self.components[i] ? self.components[i].to_s : nil }
67
67
  define_method(:"#{component}=") {|v| self[i] = v }
68
68
  end
69
-
69
+
70
70
  #
71
71
  # Set the component of the Version at +index+ to +value+. Zeroes out any
72
72
  # trailing components.
@@ -77,11 +77,11 @@ class Version
77
77
  def []=(index, value)
78
78
  return self.resize!(index) if value.nil? || value.to_s.empty?
79
79
  return self[self.length + index] = value if index < 0
80
-
80
+
81
81
  length = self.length - index
82
82
  zeroes = Array.new length.abs, Version::Component.new('0')
83
83
  value = Version::Component.new(value.to_s)
84
-
84
+
85
85
  if length >= 0
86
86
  self.components[index, length] = zeroes
87
87
  self.components[index] = value
@@ -90,11 +90,11 @@ class Version
90
90
  self.components << value
91
91
  end
92
92
  end
93
-
93
+
94
94
  def prerelease?
95
95
  self.components.any? {|c| c.prerelease? }
96
96
  end
97
-
97
+
98
98
  #
99
99
  # Resizes the Version to +length+, removing any trailing components. Is a
100
100
  # no-op if +length+ is greater than its current length.
@@ -103,12 +103,13 @@ class Version
103
103
  self.components = self.components.take(length)
104
104
  self
105
105
  end
106
-
106
+
107
107
  #
108
- # Bumps the version number. Pass +component+ to bump a component other than
109
- # the least-significant part. Set +pre+ to true if you want to bump the
110
- # component to a prerelease version. Set +trim+ to true if you want the
111
- # version to be resized to only large enough to contain the component set.
108
+ # Bumps the version number and replaces the current object. Pass
109
+ # +component+ to bump a component other than the least-significant
110
+ # part. Set +pre+ to true if you want to bump the component to a
111
+ # prerelease version. Set +trim+ to true if you want the version to
112
+ # be resized to only large enough to contain the component set.
112
113
  #
113
114
  # "1.0.4a".bump! # => '1.0.4'
114
115
  # "1.0.4a".bump!(:pre) # => '1.0.4b'
@@ -125,10 +126,10 @@ class Version
125
126
  else
126
127
  # resize to match the new length, if applicable
127
128
  self.resize!(component + 1) if (trim or component >= self.length)
128
-
129
+
129
130
  # mark all but the changed bit as non-prerelease
130
131
  self[0...component].each(&:unprerelease!)
131
-
132
+
132
133
  # I don't even understand this part any more; god help you
133
134
  self[component] = self[component].next if pre and self.prerelease? and component == self.length - 1
134
135
  self[component] = self[component].next unless pre and self.prerelease? and component == -1
@@ -136,14 +137,21 @@ class Version
136
137
  self
137
138
  end
138
139
  end
139
-
140
+
141
+ #
142
+ # Bumps the version number.
143
+ #
144
+ def bump(component = -1, pre = false, trim = false)
145
+ self.dup.bump!(component, pre, trim)
146
+ end
147
+
140
148
  #
141
149
  # Returns the current length of the version number.
142
150
  #
143
151
  def length
144
152
  self.components.length
145
153
  end
146
-
154
+
147
155
  #
148
156
  # Compares a Version against any +other+ object that responds to
149
157
  # +to_version+.
@@ -151,14 +159,14 @@ class Version
151
159
  def <=>(other)
152
160
  self.components <=> other.to_version.components
153
161
  end
154
-
162
+
155
163
  #
156
164
  # Converts the version number into an array of its components.
157
165
  #
158
166
  def to_a
159
167
  self.components.map {|c| c.to_s }
160
168
  end
161
-
169
+
162
170
  #
163
171
  # Converts the version number into a hash of its components.
164
172
  #
@@ -169,48 +177,48 @@ class Version
169
177
  :rest => self.length > 3 ? self.to_a.drop(3) : nil }.
170
178
  delete_if {|k,v| v.nil? }
171
179
  end
172
-
180
+
173
181
  #
174
182
  # The canonical representation of a version number.
175
183
  #
176
184
  def to_s
177
185
  self.to_a.join('.')
178
186
  end
179
-
187
+
180
188
  #
181
189
  # Returns +self+.
182
190
  #
183
191
  def to_version
184
192
  self
185
193
  end
186
-
194
+
187
195
  #
188
196
  # Returns a YAML representation of the version number.
189
197
  #
190
198
  def to_yaml
191
199
  YAML::dump(self.to_hash)
192
200
  end
193
-
201
+
194
202
  #
195
203
  # Returns a human-friendly version format.
196
204
  #
197
205
  def inspect
198
206
  self.to_s.inspect
199
207
  end
200
-
208
+
201
209
  protected
202
-
210
+
203
211
  #
204
212
  # Retrieves the component of the Version at +index+.
205
213
  #
206
214
  def [](index)
207
215
  self.components[index] || Component.new('0')
208
216
  end
209
-
217
+
210
218
  def components
211
219
  @components ||= []
212
220
  end
213
-
221
+
214
222
  def components=(components)
215
223
  components.each_with_index {|c, i| self[i] = c }
216
224
  end
@@ -1,9 +1,104 @@
1
- $:.unshift File.dirname(__FILE__)
2
- $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
-
4
1
  require 'version'
5
- require 'spec'
6
- require 'spec/autorun'
2
+ # This file was generated by the `rspec --init` command. Conventionally, all
3
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
4
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
5
+ # this file to always be loaded, without a need to explicitly require it in any
6
+ # files.
7
+ #
8
+ # Given that it is always loaded, you are encouraged to keep this file as
9
+ # light-weight as possible. Requiring heavyweight dependencies from this file
10
+ # will add to the boot time of your test suite on EVERY test run, even for an
11
+ # individual file that may not need all of that loaded. Instead, consider making
12
+ # a separate helper file that requires the additional dependencies and performs
13
+ # the additional setup, and require it from the spec files that actually need
14
+ # it.
15
+ #
16
+ # The `.rspec` file also contains a few flags that are not defaults but that
17
+ # users commonly want.
18
+ #
19
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
20
+ RSpec.configure do |config|
21
+ # rspec-expectations config goes here. You can use an alternate
22
+ # assertion/expectation library such as wrong or the stdlib/minitest
23
+ # assertions if you prefer.
24
+ config.expect_with :rspec do |expectations|
25
+ # This option will default to `true` in RSpec 4. It makes the `description`
26
+ # and `failure_message` of custom matchers include text for helper methods
27
+ # defined using `chain`, e.g.:
28
+ # be_bigger_than(2).and_smaller_than(4).description
29
+ # # => "be bigger than 2 and smaller than 4"
30
+ # ...rather than:
31
+ # # => "be bigger than 2"
32
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
33
+ end
34
+
35
+ # rspec-mocks config goes here. You can use an alternate test double
36
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
37
+ config.mock_with :rspec do |mocks|
38
+ # Prevents you from mocking or stubbing a method that does not exist on
39
+ # a real object. This is generally recommended, and will default to
40
+ # `true` in RSpec 4.
41
+ mocks.verify_partial_doubles = true
42
+ end
43
+
44
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
45
+ # have no way to turn it off -- the option exists only for backwards
46
+ # compatibility in RSpec 3). It causes shared context metadata to be
47
+ # inherited by the metadata hash of host groups and examples, rather than
48
+ # triggering implicit auto-inclusion in groups with matching metadata.
49
+ config.shared_context_metadata_behavior = :apply_to_host_groups
50
+
51
+ # The settings below are suggested to provide a good initial experience
52
+ # with RSpec, but feel free to customize to your heart's content.
53
+ =begin
54
+ # This allows you to limit a spec run to individual examples or groups
55
+ # you care about by tagging them with `:focus` metadata. When nothing
56
+ # is tagged with `:focus`, all examples get run. RSpec also provides
57
+ # aliases for `it`, `describe`, and `context` that include `:focus`
58
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
59
+ config.filter_run_when_matching :focus
60
+
61
+ # Allows RSpec to persist some state between runs in order to support
62
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
63
+ # you configure your source control system to ignore this file.
64
+ config.example_status_persistence_file_path = "spec/examples.txt"
65
+
66
+ # Limits the available syntax to the non-monkey patched syntax that is
67
+ # recommended. For more details, see:
68
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
69
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
70
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
71
+ config.disable_monkey_patching!
72
+
73
+ # This setting enables warnings. It's recommended, but in some cases may
74
+ # be too noisy due to issues in dependencies.
75
+ config.warnings = true
76
+
77
+ # Many RSpec users commonly either run the entire suite or an individual
78
+ # file, and it's useful to allow more verbose output when running an
79
+ # individual spec file.
80
+ if config.files_to_run.one?
81
+ # Use the documentation formatter for detailed output,
82
+ # unless a formatter has already been configured
83
+ # (e.g. via a command-line flag).
84
+ config.default_formatter = 'doc'
85
+ end
86
+
87
+ # Print the 10 slowest examples and example groups at the
88
+ # end of the spec run, to help surface which specs are running
89
+ # particularly slow.
90
+ config.profile_examples = 10
91
+
92
+ # Run specs in random order to surface order dependencies. If you find an
93
+ # order dependency and want to debug it, you can fix the order by providing
94
+ # the seed, which is printed after each run.
95
+ # --seed 1234
96
+ config.order = :random
7
97
 
8
- Spec::Runner.configure do |config|
98
+ # Seed global randomization in this process using the `--seed` CLI option.
99
+ # Setting this allows you to use `--seed` to deterministically reproduce
100
+ # test failures related to randomization by passing the same `--seed` value
101
+ # as the one that triggered the failure.
102
+ Kernel.srand config.seed
103
+ =end
9
104
  end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rspec/its'
2
2
 
3
3
  module ImplicitVersion
4
4
  def method_missing(name, *args, &block)
@@ -15,41 +15,41 @@ describe Version do
15
15
 
16
16
  subject { v2_9 }
17
17
 
18
- its(:major) { should == '2' }
19
- its(:minor) { should == '9' }
20
- its(:revision) { should be_nil }
21
- its(:prerelease?) { should be_false }
18
+ its(:major) { is_expected.to eq('2') }
19
+ its(:minor) { is_expected.to eq('9') }
20
+ its(:revision) { is_expected.to be_nil }
21
+ its(:prerelease?) { is_expected.to be_falsey }
22
22
 
23
- it 'should bump to 2.10' do
24
- subject.bump!.should == v2_10
23
+ it 'is_expected.to bump to 2.10' do
24
+ expect(subject.bump!).to eq(v2_10)
25
25
  end
26
26
 
27
- it 'should major-bump to 3.0' do
28
- subject.bump!(:major).should == v3_0
27
+ it 'is_expected.to major-bump to 3.0' do
28
+ expect(subject.bump!(:major)).to eq(v3_0)
29
29
  end
30
30
 
31
- it 'should minor-bump to 2.10' do
32
- subject.bump!(:minor).should == v2_10
31
+ it 'is_expected.to minor-bump to 2.10' do
32
+ expect(subject.bump!(:minor)).to eq(v2_10)
33
33
  end
34
34
 
35
- it 'should revision-bump to 2.9.1' do
36
- subject.bump!(:revision).should == v2_9_1
35
+ it 'is_expected.to revision-bump to 2.9.1' do
36
+ expect(subject.bump!(:revision)).to eq(v2_9_1)
37
37
  end
38
38
 
39
- it 'should prerelease-bump to 2.10a' do
40
- subject.bump!(:pre).should == v2_10a
39
+ it 'is_expected.to prerelease-bump to 2.10a' do
40
+ expect(subject.bump!(:pre)).to eq(v2_10a)
41
41
  end
42
42
 
43
- it 'should prerelease-bump major to 3_0a' do
44
- subject.bump!(:major, true).should == v3_0a
43
+ it 'is_expected.to prerelease-bump major to 3_0a' do
44
+ expect(subject.bump!(:major, true)).to eq(v3_0a)
45
45
  end
46
46
 
47
- it 'should prerelease-bump minor to 2.10a' do
48
- subject.bump!(:minor, true).should == v2_10a
47
+ it 'is_expected.to prerelease-bump minor to 2.10a' do
48
+ expect(subject.bump!(:minor, true)).to eq(v2_10a)
49
49
  end
50
50
 
51
- it 'should prerelease-bump revision to 2.9.1a' do
52
- subject.bump!(:revision, true).should == v2_9_1a
51
+ it 'is_expected.to prerelease-bump revision to 2.9.1a' do
52
+ expect(subject.bump!(:revision, true)).to eq(v2_9_1a)
53
53
  end
54
54
  end
55
55
 
@@ -58,41 +58,41 @@ describe Version do
58
58
 
59
59
  subject { v0_10_0 }
60
60
 
61
- its(:major) { should == '0' }
62
- its(:minor) { should == '10' }
63
- its(:revision) { should == '0' }
64
- its(:prerelease?) { should be_false }
61
+ its(:major) { is_expected.to eq('0') }
62
+ its(:minor) { is_expected.to eq('10') }
63
+ its(:revision) { is_expected.to eq('0') }
64
+ its(:prerelease?) { is_expected.to be_falsey }
65
65
 
66
- it 'should bump to 0.10.1' do
67
- subject.bump!.should == v0_10_1
66
+ it 'is_expected.to bump to 0.10.1' do
67
+ expect(subject.bump!).to eq(v0_10_1)
68
68
  end
69
69
 
70
- it 'should major-bump to 1.0.0' do
71
- subject.bump!(:major).should == v1_0_0
70
+ it 'is_expected.to major-bump to 1.0.0' do
71
+ expect(subject.bump!(:major)).to eq(v1_0_0)
72
72
  end
73
73
 
74
- it 'should minor-bump to 0.11.0' do
75
- subject.bump!(:minor).should == v0_11_0
74
+ it 'is_expected.to minor-bump to 0.11.0' do
75
+ expect(subject.bump!(:minor)).to eq(v0_11_0)
76
76
  end
77
77
 
78
- it 'should revision-bump to 0.10.1' do
79
- subject.bump!(:revision).should == v0_10_1
78
+ it 'is_expected.to revision-bump to 0.10.1' do
79
+ expect(subject.bump!(:revision)).to eq(v0_10_1)
80
80
  end
81
81
 
82
- it 'should prerelease-bump to 0.10.1a' do
83
- subject.bump!(:pre).should == v0_10_1a
82
+ it 'is_expected.to prerelease-bump to 0.10.1a' do
83
+ expect(subject.bump!(:pre)).to eq(v0_10_1a)
84
84
  end
85
85
 
86
- it 'should prerelease-bump major to 1.0.0a' do
87
- subject.bump!(:major, true).should == v1_0_0a
86
+ it 'is_expected.to prerelease-bump major to 1.0.0a' do
87
+ expect(subject.bump!(:major, true)).to eq(v1_0_0a)
88
88
  end
89
89
 
90
- it 'should prerelease-bump minor to 0.11.0a' do
91
- subject.bump!(:minor, true).should == v0_11_0a
90
+ it 'is_expected.to prerelease-bump minor to 0.11.0a' do
91
+ expect(subject.bump!(:minor, true)).to eq(v0_11_0a)
92
92
  end
93
93
 
94
- it 'should prerelease-bump revision to 0.10.1a' do
95
- subject.bump!(:revision, true).should == v0_10_1a
94
+ it 'is_expected.to prerelease-bump revision to 0.10.1a' do
95
+ expect(subject.bump!(:revision, true)).to eq(v0_10_1a)
96
96
  end
97
97
  end
98
98
 
@@ -102,41 +102,41 @@ describe Version, 'with a prerelease revision' do
102
102
 
103
103
  subject { v1_6_3a }
104
104
 
105
- its(:major) { should == '1' }
106
- its(:minor) { should == '6' }
107
- its(:revision) { should == '3a' }
108
- its(:prerelease?) { should be_true }
105
+ its(:major) { is_expected.to eq('1') }
106
+ its(:minor) { is_expected.to eq('6') }
107
+ its(:revision) { is_expected.to eq('3a') }
108
+ its(:prerelease?) { is_expected.to be_truthy }
109
109
 
110
- it 'should bump to 1.6.3' do
111
- subject.bump!.should == v1_6_3
110
+ it 'is_expected.to bump to 1.6.3' do
111
+ expect(subject.bump!).to eq(v1_6_3)
112
112
  end
113
113
 
114
- it 'should major-bump to 2.0.0' do
115
- subject.bump!(:major).should == v2_0_0
114
+ it 'is_expected.to major-bump to 2.0.0' do
115
+ expect(subject.bump!(:major)).to eq(v2_0_0)
116
116
  end
117
117
 
118
- it 'should minor-bump to 1.7.0' do
119
- subject.bump!(:minor).should == v1_7_0
118
+ it 'is_expected.to minor-bump to 1.7.0' do
119
+ expect(subject.bump!(:minor)).to eq(v1_7_0)
120
120
  end
121
121
 
122
- it 'should revision-bump to 1.6.3' do
123
- subject.bump!(:revision).should == v1_6_3
122
+ it 'is_expected.to revision-bump to 1.6.3' do
123
+ expect(subject.bump!(:revision)).to eq(v1_6_3)
124
124
  end
125
125
 
126
- it 'should prerelease-bump to 1.6.3b' do
127
- subject.bump!(:pre).should == v1_6_3b
126
+ it 'is_expected.to prerelease-bump to 1.6.3b' do
127
+ expect(subject.bump!(:pre)).to eq(v1_6_3b)
128
128
  end
129
129
 
130
- it 'should prerelease-bump major to 2.0.0a' do
131
- subject.bump!(:major, true).should == v2_0_0a
130
+ it 'is_expected.to prerelease-bump major to 2.0.0a' do
131
+ expect(subject.bump!(:major, true)).to eq(v2_0_0a)
132
132
  end
133
133
 
134
- it 'should prerelease-bump minor to 1.7.0a' do
135
- subject.bump!(:minor, true).should == v1_7_0a
134
+ it 'is_expected.to prerelease-bump minor to 1.7.0a' do
135
+ expect(subject.bump!(:minor, true)).to eq(v1_7_0a)
136
136
  end
137
137
 
138
- it 'should prerelease-bump revision to 1.6.4a' do
139
- subject.bump!(:revision, true).should == v1_6_4a
138
+ it 'is_expected.to prerelease-bump revision to 1.6.4a' do
139
+ expect(subject.bump!(:revision, true)).to eq(v1_6_4a)
140
140
  end
141
141
  end
142
142
 
@@ -145,64 +145,64 @@ describe Version, 'with a prerelease minor version' do
145
145
 
146
146
  subject { v1_6a }
147
147
 
148
- its(:major) { should == '1' }
149
- its(:minor) { should == '6a' }
150
- its(:revision) { should == nil }
151
- its(:prerelease?) { should be_true }
148
+ its(:major) { is_expected.to eq('1') }
149
+ its(:minor) { is_expected.to eq('6a') }
150
+ its(:revision) { is_expected.to eq(nil) }
151
+ its(:prerelease?) { is_expected.to be_truthy }
152
152
 
153
- it 'should bump to 1.6' do
154
- subject.bump!.should == v1_6
153
+ it 'is_expected.to bump to 1.6' do
154
+ expect(subject.bump!).to eq(v1_6)
155
155
  end
156
156
 
157
- it 'should major-bump to 2.0' do
158
- subject.bump!(:major).should == v2_0
157
+ it 'is_expected.to major-bump to 2.0' do
158
+ expect(subject.bump!(:major)).to eq(v2_0)
159
159
  end
160
160
 
161
- it 'should minor-bump to 1.6' do
162
- subject.bump!(:minor).should == v1_6
161
+ it 'is_expected.to minor-bump to 1.6' do
162
+ expect(subject.bump!(:minor)).to eq(v1_6)
163
163
  end
164
164
 
165
- it 'should revision-bump to 1.6.1' do
166
- subject.bump!(:revision).should == v1_6_1
165
+ it 'is_expected.to revision-bump to 1.6.1' do
166
+ expect(subject.bump!(:revision)).to eq(v1_6_1)
167
167
  end
168
168
 
169
- it 'should bump to 1.6b' do
170
- subject.bump!(:pre).should == v1_6b
169
+ it 'is_expected.to bump to 1.6b' do
170
+ expect(subject.bump!(:pre)).to eq(v1_6b)
171
171
  end
172
172
 
173
- it 'should prerelease-bump major to 2.0a' do
174
- subject.bump!(:major, true).should == v2_0a
173
+ it 'is_expected.to prerelease-bump major to 2.0a' do
174
+ expect(subject.bump!(:major, true)).to eq(v2_0a)
175
175
  end
176
176
 
177
- it 'should prerelease-bump minor to 1.7a' do
178
- subject.bump!(:minor, true).should == v1_7a
177
+ it 'is_expected.to prerelease-bump minor to 1.7a' do
178
+ expect(subject.bump!(:minor, true)).to eq(v1_7a)
179
179
  end
180
180
 
181
- it 'should prerelease-bump revision to 1.6.1a' do
182
- subject.bump!(:revision, true).should == v1_6_1a
181
+ it 'is_expected.to prerelease-bump revision to 1.6.1a' do
182
+ expect(subject.bump!(:revision, true)).to eq(v1_6_1a)
183
183
  end
184
184
  end
185
185
 
186
186
  describe Version do
187
187
  include ImplicitVersion
188
188
 
189
- it 'should preserve equality' do
190
- v0_0.should == v0_0
191
- v0_1_1.should == v0_1_1
192
- v0_4_alpha.should == v0_4_alpha
193
- v1_0_2.should == v1_0_2
194
- v1_0_2b.should == v1_0_2b
195
- v1_01.should == v1_01
196
- v1_10.should == v1_10
197
- v2_0.should == v2_0
198
- va.should == vb
199
- end
200
-
201
- it 'should order correctly' do
202
- v0_0.should < v0_0_0_0_0_1
203
- v0_0_0_1.should < v1
204
- v0_1a.should < v0_1
205
- v0_01.should < v0_10
206
- v0_9.should < v0_10
189
+ it 'is_expected.to preserve equality' do
190
+ expect(v0_0).to eq(v0_0)
191
+ expect(v0_1_1).to eq(v0_1_1)
192
+ expect(v0_4_alpha).to eq(v0_4_alpha)
193
+ expect(v1_0_2).to eq(v1_0_2)
194
+ expect(v1_0_2b).to eq(v1_0_2b)
195
+ expect(v1_01).to eq(v1_01)
196
+ expect(v1_10).to eq(v1_10)
197
+ expect(v2_0).to eq(v2_0)
198
+ expect(va).to eq(vb)
199
+ end
200
+
201
+ it 'is_expected.to order correctly' do
202
+ expect(v0_0).to be < v0_0_0_0_0_1
203
+ expect(v0_0_0_1).to be < v1
204
+ expect(v0_1a).to be < v0_1
205
+ expect(v0_01).to be < v0_10
206
+ expect(v0_9).to be < v0_10
207
207
  end
208
208
  end
metadata CHANGED
@@ -1,84 +1,93 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: version
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 1.0.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - Stephen Touset
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2011-05-10 00:00:00 -04:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: rspec
11
+ date: 2017-04-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
18
21
  prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
20
- none: false
21
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
22
24
  - - ">="
23
- - !ruby/object:Gem::Version
24
- version: "0"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1'
25
34
  type: :development
26
- version_requirements: *id001
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1'
27
41
  description:
28
42
  email: stephen@touset.org
29
43
  executables: []
30
-
31
44
  extensions: []
32
-
33
- extra_rdoc_files:
45
+ extra_rdoc_files:
34
46
  - History.rdoc
35
47
  - README.rdoc
36
48
  - TODO.rdoc
37
- files:
49
+ files:
50
+ - Gemfile
51
+ - Gemfile.lock
38
52
  - History.rdoc
39
53
  - License.txt
40
- - Rakefile
41
54
  - README.rdoc
55
+ - Rakefile
42
56
  - TODO.rdoc
43
57
  - VERSION
44
58
  - lib/rake/version_task.rb
59
+ - lib/version.rb
45
60
  - lib/version/component.rb
46
61
  - lib/version/ext/array.rb
47
62
  - lib/version/ext/hash.rb
48
63
  - lib/version/ext/module.rb
49
64
  - lib/version/ext/string.rb
50
- - lib/version.rb
51
65
  - spec/spec.opts
52
66
  - spec/spec_helper.rb
53
67
  - spec/version_spec.rb
54
- has_rdoc: true
55
68
  homepage:
56
69
  licenses: []
57
-
70
+ metadata: {}
58
71
  post_install_message:
59
- rdoc_options:
60
- - --main
72
+ rdoc_options:
73
+ - "--main"
61
74
  - README.rdoc
62
- require_paths:
75
+ require_paths:
63
76
  - lib
64
- required_ruby_version: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
67
79
  - - ">="
68
- - !ruby/object:Gem::Version
69
- version: "0"
70
- required_rubygems_version: !ruby/object:Gem::Requirement
71
- none: false
72
- requirements:
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
73
84
  - - ">="
74
- - !ruby/object:Gem::Version
75
- version: "0"
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
76
87
  requirements: []
77
-
78
88
  rubyforge_project:
79
- rubygems_version: 1.6.2
89
+ rubygems_version: 2.6.10
80
90
  signing_key:
81
- specification_version: 3
91
+ specification_version: 4
82
92
  summary: simple version-number encapsulation
83
93
  test_files: []
84
-