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 +4 -4
- data/features/command_line.feature +1 -1
- data/features/step_definitions/project.rb +3 -5
- data/features/stores/gemspec.feature +21 -0
- data/features/stores/semver.feature +20 -0
- data/features/support/env.rb +3 -8
- data/lib/yavm/stores/gem_spec.rb +15 -3
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eba9029c23bfd2f971f59a447b13e37e36b1142
|
4
|
+
data.tar.gz: e90d9f8e38d38a98dd95b8f7a08f166481783086
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be6fdf71327b88a7efc45d21b693943bb5b2434a09d287ff8b7c001ee6a317c63acf6e01b1f3230a96c30999ab1c66649a46ad53817ae3de634ca92016a73f22
|
7
|
+
data.tar.gz: cae1a8b5895a9866e50bc8cc01e60408350e406a6d337e08e0e0eaa019a0223dfa5998d57a83bffe02cfcccc89e06d5f8d5260342dfcc5367f150166d7956acd
|
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
|
-
Given(/^I have a project called "(.*?)"$/) do |name|
|
4
|
-
|
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'
|
data/features/support/env.rb
CHANGED
@@ -1,12 +1,7 @@
|
|
1
1
|
require 'aruba/cucumber'
|
2
2
|
|
3
|
-
Before do
|
4
|
-
|
5
|
-
|
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
|
data/lib/yavm/stores/gem_spec.rb
CHANGED
@@ -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
|
-
|
31
|
-
new_spec
|
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.
|
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-
|
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
|