YAVM 0.5.3 → 0.6.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2eba9029c23bfd2f971f59a447b13e37e36b1142
4
- data.tar.gz: e90d9f8e38d38a98dd95b8f7a08f166481783086
3
+ metadata.gz: 21c63e026343a431d89b1a1aae437db9e899145a
4
+ data.tar.gz: 12ccfb21b7e2ea70c0c08e699074786f2fe3d2ad
5
5
  SHA512:
6
- metadata.gz: be6fdf71327b88a7efc45d21b693943bb5b2434a09d287ff8b7c001ee6a317c63acf6e01b1f3230a96c30999ab1c66649a46ad53817ae3de634ca92016a73f22
7
- data.tar.gz: cae1a8b5895a9866e50bc8cc01e60408350e406a6d337e08e0e0eaa019a0223dfa5998d57a83bffe02cfcccc89e06d5f8d5260342dfcc5367f150166d7956acd
6
+ metadata.gz: fa7b913dc3e02b68521cbf7f38aafa97553b5ade1631f58074403bb767d8f15a1420dd7485f7b242024420d5e874a5df04d788aa55363c7bff3a36f4f6e5f515
7
+ data.tar.gz: a6459ed4c915faf5833292564bc8c9f2584d4e719f70e47d9f5f0a4c23a3d4aa0ca3cb76cfcba27f9460c3c310a25dfb4fbf69730562be83390caccfc0fb909d
@@ -74,3 +74,17 @@ Feature: Command Line Interface
74
74
 
75
75
  And I run `version tag`
76
76
  Then the output should contain "0.0.1"
77
+
78
+ Scenario: JSON output - numbers
79
+ Given I run `version inc major`
80
+
81
+ And I run `version json`
82
+ Then the output should be valid JSON
83
+ And the json should contain major=1
84
+
85
+ Scenario: JSON output - meta
86
+ Given I run `version meta 20150129135914`
87
+
88
+ And I run `version json`
89
+ Then the output should be valid JSON
90
+ And the json should contain meta="20150129135914"
@@ -0,0 +1,23 @@
1
+ Then(/^the output should be valid YAML$/) do
2
+ expect {
3
+ YAML.load(last_command_started.output)
4
+ }.not_to raise_error
5
+ end
6
+
7
+ Then(/^the output should be valid JSON$/) do
8
+ expect {
9
+ JSON.load(last_command_started.output)
10
+ }.not_to raise_error
11
+ end
12
+
13
+ Then(/^the json should contain (major|minor|patch)=(.*?)$/) do |key, value|
14
+ json = JSON.load(last_command_started.output)
15
+
16
+ expect(json[key]).to eq(value.to_i)
17
+ end
18
+
19
+ Then(/^the json should contain (special|meta)="(.*?)"$/) do |key, value|
20
+ json = JSON.load(last_command_started.output)
21
+
22
+ expect(json[key]).to eq(value)
23
+ end
@@ -1,6 +1,9 @@
1
- require 'fileutils'
1
+ require 'securerandom'
2
2
 
3
3
  Given(/^I have a (?:project|component) called "(.*?)"$/) do |name|
4
- # Give each project/component/feature its own tmp dir
5
- @dirs << name
4
+ # Give each instance of a project/component/feature its own tmp dir
5
+ @project_dir = "#{name}-#{SecureRandom.hex(4)}"
6
+
7
+ create_directory @project_dir
8
+ cd @project_dir
6
9
  end
@@ -0,0 +1,6 @@
1
+ Given(/^I have a semver file containing:$/) do |content|
2
+
3
+ Dir.chdir(expand_path '.') do
4
+ open('.semver', 'w') { |file| file.write(content) }
5
+ end
6
+ end
@@ -6,15 +6,23 @@ Feature: Native .semver store
6
6
 
7
7
  Background:
8
8
  Given I have a project called "semver-file"
9
- And I have a semver file at version "1.3.2"
9
+ And I have a semver file containing:
10
+ """
11
+ ---
12
+ :major: 0
13
+ :minor: 3
14
+ :patch: 3
15
+ :special: ''
16
+ :meta: ''
17
+ """
10
18
 
11
- Scenario: File should exist in files subcommand
19
+ Scenario: The file should exist in files subcommand
12
20
  Given I run `version files`
13
- Then the output should contain './.semver'
21
+ Then the output should contain "./.semver"
14
22
 
15
23
  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
24
+ Given I run `version inc minor`
18
25
  And I run `cat ./.semver`
19
26
 
20
- Then the output should contain ':minor: 4'
27
+ Then the output should contain "minor: 4"
28
+ And the output should be valid YAML
@@ -3,5 +3,5 @@ require 'aruba/cucumber'
3
3
  Before do
4
4
  # Since we shell out in the tests, the `version` script
5
5
  # will only enable SimpleCov if this env var is set
6
- set_env('COVERAGE', 'true')
6
+ set_environment_variable 'COVERAGE', 'true'
7
7
  end
@@ -93,6 +93,9 @@ module YAVM
93
93
  when 'format'
94
94
  puts "#{version.format(@args['<string>'])}"
95
95
 
96
+ when 'json'
97
+ puts "#{version.to_json}"
98
+
96
99
  when 'tag'
97
100
  puts "#{version.tag}"
98
101
 
@@ -155,6 +158,7 @@ module YAVM
155
158
  #{@invocation} special [<string>]
156
159
  #{@invocation} meta [<string>]
157
160
  #{@invocation} format <string>
161
+ #{@invocation} json
158
162
  #{@invocation} tag
159
163
  #{@invocation} files [(-1|-0)]
160
164
  #{@invocation} help
@@ -165,6 +169,7 @@ module YAVM
165
169
  special Set a special (eg: pre-release) suffix
166
170
  meta Set a metadata version suffix
167
171
  format Display version in specific format (%M, %m, %p, %s, %t, %-s, %-t)
172
+ json Display version in machine-readable JSON
168
173
  tag Equivalent to format 'v%M.%m.%-p%-s'
169
174
  files List the files which store version information
170
175
  help Show this screen.
@@ -181,7 +186,7 @@ module YAVM
181
186
  end
182
187
 
183
188
  def version_commands
184
- %w(show inc special meta init format tag)
189
+ %w(show inc special meta init format json tag)
185
190
  end
186
191
 
187
192
  def support_commands
@@ -43,22 +43,16 @@ module YAVM
43
43
  end
44
44
 
45
45
  def format(string = '')
46
- string = string.dup
47
-
48
- _special = special || ''
49
- _meta = meta || ''
50
-
51
- # ? http://stackoverflow.com/a/8132638
52
- string.gsub!('%M', major.to_s)
53
- string.gsub!('%m', minor.to_s)
54
- string.gsub!('%p', patch.to_s)
55
- string.gsub!('%s', _special)
56
- string.gsub!('%t', _meta)
57
- string.gsub!('%-s', _special.empty? ? '' : "-#{special}")
58
- string.gsub!('%-t', _meta.empty? ? '' : "+#{meta}")
59
- string.gsub!('%%', '%')
60
-
61
- string
46
+ string.gsub(/(%-?[Mmpst%])/, {
47
+ '%M' => major.to_s,
48
+ '%m' => minor.to_s,
49
+ '%p' => patch.to_s,
50
+ '%s' => special.to_s,
51
+ '%t' => meta.to_s,
52
+ '%-s' => special.to_s.empty? ? '' : "-#{special}",
53
+ '%-t' => meta.to_s.empty? ? '' : "+#{meta}",
54
+ '%%' => '%'
55
+ })
62
56
  end
63
57
 
64
58
  # rubocop:disable Style/RedundantSelf
metadata CHANGED
@@ -1,113 +1,113 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: YAVM
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.2
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-07 00:00:00.000000000 Z
11
+ date: 2017-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '10.4'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.4'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.32'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.32'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: cucumber
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - "~>"
59
+ - - ~>
74
60
  - !ruby/object:Gem::Version
75
61
  version: '1.3'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - "~>"
66
+ - - ~>
81
67
  - !ruby/object:Gem::Version
82
68
  version: '1.3'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: aruba
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - "~>"
73
+ - - ~>
88
74
  - !ruby/object:Gem::Version
89
75
  version: '0.6'
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
- - - "~>"
80
+ - - ~>
95
81
  - !ruby/object:Gem::Version
96
82
  version: '0.6'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: simplecov
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
- - - "~>"
87
+ - - ~>
102
88
  - !ruby/object:Gem::Version
103
89
  version: '0.9'
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
- - - "~>"
94
+ - - ~>
109
95
  - !ruby/object:Gem::Version
110
96
  version: '0.9'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: '0.40'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: '0.40'
111
111
  description: A tiny gem for managing project version numbers
112
112
  email: me@lewiseason.co.uk
113
113
  executables:
@@ -121,7 +121,9 @@ files:
121
121
  - bin/version
122
122
  - features/command_line.feature
123
123
  - features/initialization.feature
124
+ - features/step_definitions/formats.rb
124
125
  - features/step_definitions/project.rb
126
+ - features/step_definitions/stores/semver.rb
125
127
  - features/stores/gemspec.feature
126
128
  - features/stores/semver.feature
127
129
  - features/support/env.rb
@@ -145,24 +147,26 @@ require_paths:
145
147
  - lib
146
148
  required_ruby_version: !ruby/object:Gem::Requirement
147
149
  requirements:
148
- - - ">="
150
+ - - '>='
149
151
  - !ruby/object:Gem::Version
150
152
  version: 1.9.2
151
153
  required_rubygems_version: !ruby/object:Gem::Requirement
152
154
  requirements:
153
- - - ">="
155
+ - - '>='
154
156
  - !ruby/object:Gem::Version
155
157
  version: '0'
156
158
  requirements: []
157
159
  rubyforge_project:
158
- rubygems_version: 2.4.5
160
+ rubygems_version: 2.6.11
159
161
  signing_key:
160
162
  specification_version: 4
161
163
  summary: Yet Another Version Manager
162
164
  test_files:
163
- - features/initialization.feature
164
165
  - features/support/env.rb
165
- - features/command_line.feature
166
+ - features/step_definitions/formats.rb
166
167
  - features/step_definitions/project.rb
167
- - features/stores/semver.feature
168
+ - features/step_definitions/stores/semver.rb
169
+ - features/command_line.feature
168
170
  - features/stores/gemspec.feature
171
+ - features/stores/semver.feature
172
+ - features/initialization.feature