YAVM 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 89f5ae4a9ec1d9aba8068c16cae331911225edbf
4
- data.tar.gz: 00dd29ac52b21bd6cff55f408263b9398a742eb4
3
+ metadata.gz: 2eba9029c23bfd2f971f59a447b13e37e36b1142
4
+ data.tar.gz: e90d9f8e38d38a98dd95b8f7a08f166481783086
5
5
  SHA512:
6
- metadata.gz: 3750f8ab3725a3c65ea16bd2b53d6c8f0db680bff35687e1027b85e83804ab60b3419144a9fb4f4536922c2a29d3fcdc363f54ef75a6a6df99621534086fef32
7
- data.tar.gz: 5fe02152701c63abf62927279d2200da953cb7f969872b3d57540417cd28b7aefb13271fa06e73e54f05db8c35a82d0b5374b3635e1628b0928b66f19c14d359
6
+ metadata.gz: be6fdf71327b88a7efc45d21b693943bb5b2434a09d287ff8b7c001ee6a317c63acf6e01b1f3230a96c30999ab1c66649a46ad53817ae3de634ca92016a73f22
7
+ data.tar.gz: cae1a8b5895a9866e50bc8cc01e60408350e406a6d337e08e0e0eaa019a0223dfa5998d57a83bffe02cfcccc89e06d5f8d5260342dfcc5367f150166d7956acd
@@ -3,7 +3,7 @@ Feature: Command Line Interface
3
3
  version number, and set the 'special' and 'meta' fields
4
4
 
5
5
  Background:
6
- Given I have a project called "versioning"
6
+ Given I have a project called "cli"
7
7
  And I run `version init`
8
8
 
9
9
  Then the output should contain "0.0.0"
@@ -1,8 +1,6 @@
1
1
  require 'fileutils'
2
2
 
3
- Given(/^I have a project called "(.*?)"$/) do |name|
4
- @project_dir = "tmp/aruba/#{name}"
5
-
6
- FileUtils.mkdir_p @project_dir
7
- Dir.chdir @project_dir
3
+ Given(/^I have a (?:project|component) called "(.*?)"$/) do |name|
4
+ # Give each project/component/feature its own tmp dir
5
+ @dirs << name
8
6
  end
@@ -0,0 +1,21 @@
1
+ Feature: GemSpec Store
2
+ This store should update the version information
3
+ in a gemspec file without mangling the gemspec
4
+
5
+ Background:
6
+ Given I have a project called "gemspec"
7
+ And I have a gemspec at version "1.3.2" called "test.gemspec"
8
+
9
+ Scenario: The file should exist in files subcommand
10
+ Given I run `version files`
11
+ Then the output should contain './test.gemspec'
12
+
13
+ Scenario: Updating the version should be reflected in the file
14
+ Given I increment the minor version in the semver store
15
+ And I set all version stores
16
+ And I run `cat ./test.gemspec`
17
+
18
+ Then the output should match 'Gem::Specification.*\|([^\|]+)\|.*\1\.version\s+=\s+("|')([^"']+)(\2)'
19
+ # ruby -c path_to_gemspec
20
+ And the gemspec should be valid
21
+
@@ -0,0 +1,20 @@
1
+ Feature: Native .semver store
2
+ Where no other versioning store is available, or to
3
+ take advantage of any additional feautres, a yaml file
4
+ called `.semver' will be available to store version
5
+ information.
6
+
7
+ Background:
8
+ Given I have a project called "semver-file"
9
+ And I have a semver file at version "1.3.2"
10
+
11
+ Scenario: File should exist in files subcommand
12
+ Given I run `version files`
13
+ Then the output should contain './.semver'
14
+
15
+ Scenario: Updating the version should be reflected in the file
16
+ Given I increment the minor version in the semver store
17
+ And I set all version stores
18
+ And I run `cat ./.semver`
19
+
20
+ Then the output should contain ':minor: 4'
@@ -1,12 +1,7 @@
1
1
  require 'aruba/cucumber'
2
2
 
3
- Before do |_scenario|
4
- @dirs = ['.']
5
- @cwd = Dir.pwd
6
-
3
+ Before do
4
+ # Since we shell out in the tests, the `version` script
5
+ # will only enable SimpleCov if this env var is set
7
6
  set_env('COVERAGE', 'true')
8
7
  end
9
-
10
- After do |_scenario|
11
- Dir.chdir @cwd
12
- end
@@ -5,6 +5,8 @@ require 'yavm/stores/base'
5
5
  module YAVM
6
6
  module Stores
7
7
  class GemSpec < YAVM::Stores::Base
8
+ REGEX = %r{(Gem::Specification\.new do \|([^\|]+)\|.*)(\2.version\s+=\s+("|'))(\S+)\4(.*)}m
9
+
8
10
  def name
9
11
  "gemspec: #{filename}"
10
12
  end
@@ -23,12 +25,22 @@ module YAVM
23
25
 
24
26
  #
25
27
  # Munge the existing file to replace the version identifier.
26
- # This might be a bit brittle.
28
+ # This might be a bit brittle, although it's slightly better
29
+ # than it was.
30
+ #
31
+ # The match groups in use are as follows
32
+ # 1: Everything before the ".version =" line
33
+ # 3: The start of that line, up to the opening quote
34
+ # 4: Backreference to the opening quote
35
+ # 6: The rest of the file
27
36
  #
28
37
  def set!(new_version)
29
38
  current_spec = IO.read(filename)
30
- spec_token = current_spec.match(/Gem::Specification.new do \|(?<token>[^\|]+)\|/m)['token']
31
- new_spec = current_spec.gsub(/^(\s+#{spec_token}\.version\s+=\s+)("|')([^"']+)(\2)/, "\\1\\2#{new_version}\\4")
39
+
40
+ new_spec = current_spec.gsub(REGEX) do
41
+ m = Regexp.last_match
42
+ next [m[1], m[3], new_version, m[4], m[6]].join
43
+ end
32
44
 
33
45
  File.open(filename, 'w') { |f| f.write new_spec }
34
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: YAVM
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lewis Eason
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-02 00:00:00.000000000 Z
11
+ date: 2015-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -122,6 +122,8 @@ files:
122
122
  - features/command_line.feature
123
123
  - features/initialization.feature
124
124
  - features/step_definitions/project.rb
125
+ - features/stores/gemspec.feature
126
+ - features/stores/semver.feature
125
127
  - features/support/env.rb
126
128
  - lib/yavm.rb
127
129
  - lib/yavm/command_line.rb
@@ -162,3 +164,5 @@ test_files:
162
164
  - features/support/env.rb
163
165
  - features/command_line.feature
164
166
  - features/step_definitions/project.rb
167
+ - features/stores/semver.feature
168
+ - features/stores/gemspec.feature