YAVM 0.2.0 → 0.3.1

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: facb897561d347c7ffc318e9487ee3c7e5adde5d
4
- data.tar.gz: 54c812978d0f7ac5da5d9bc57653908cf31a5262
3
+ metadata.gz: 450e204f126f7defb9d7b30a04343d4dca59c690
4
+ data.tar.gz: efaef9d41a0e498d3d0abb67aa651b56464d7ffc
5
5
  SHA512:
6
- metadata.gz: 6e0a066aecde80ba4f9a547b3d1d04d3056bd3af37df82147b0b4fe852f40a8c723fd0744e5fd1f0a30210c2cc9d29c40483dc426be752a1d533616ed232521e
7
- data.tar.gz: 76d9eea472c53de52d227e5bf2a72908ba77467a493347035694a28476127059f7d9535e0aebaea09c22f4b2e32dd014d53bd3c42f8fd2d3ac5e7572ed12f70b
6
+ metadata.gz: 556e07afb6a9bb612d8bbf14b8c383cc9c1defb618e7968848e96bac2004a0c0bfd86d116c7c82657dd379d7303659fbfc9bf2ea1adf3fee7a6d73b4f82487c8
7
+ data.tar.gz: 961c5f4967d96c5ef8250b6d06054d1a65653cee1e478e3a76d40451b54f01fa1557e1bc03367ab33d081cc4e5ef74bb8cacd7aee4221c2bc443d6d9878fc631
data/README.md CHANGED
@@ -54,6 +54,8 @@ Tag | Meaning
54
54
  %t | Me**t**a
55
55
  %% | Literal % Character
56
56
 
57
+ Add a dash to `%s` and `%t` (`%-s`/`%-t`) to prefix with the appropriate character.
58
+
57
59
  ## Conflict Resolution
58
60
 
59
61
  If your project contains multiple supported version "stores", YAVM will keep them in sync.
@@ -89,9 +91,9 @@ Now on 1.0.3
89
91
  - [x] package.json support
90
92
  - [x] bower.json support
91
93
  - [x] when changing version, show new one
92
- - [ ] programmatic interface
93
- - [ ] tests
94
+ - [x] programmatic interface
95
+ - [ ] tests. inprogress
94
96
  - [ ] handle invalid version info (see Version#parse)
95
97
  - [x] 'version init'
96
- - [ ] quick mode (when finding versions - short circuit once one is found)
98
+ - [x] quick mode (when finding versions - short circuit once one is found)
97
99
  - [ ] raise sensible exceptions
data/bin/version CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'simplecov_loader' if ENV['COVERAGE']
4
+
3
5
  lib = File.expand_path('../lib/', __FILE__)
4
6
  $:.unshift lib unless $:.include?(lib)
5
7
 
@@ -0,0 +1,76 @@
1
+ Feature: Command Line Interface
2
+ The command line interface allows the end-user to increment the
3
+ version number, and set the 'special' and 'meta' fields
4
+
5
+ Background:
6
+ Given I have a project called "project"
7
+ And I run `version init`
8
+
9
+ Then the output should contain "0.0.0"
10
+
11
+ Scenario: Incrementing major version
12
+ Given I run `version inc major`
13
+ Then the output should contain "1.0.0"
14
+
15
+ Scenario: Incrementing minor version
16
+ Given I run `version inc minor`
17
+ Then the output should contain "0.1.0"
18
+
19
+ Scenario: Incrementing patch level
20
+ Given I run `version inc patch`
21
+ Then the output should contain "0.0.1"
22
+
23
+ Scenario: Incrementing major version resets minor and patch
24
+ Given I run `version inc minor`
25
+ And I run `version inc patch`
26
+ And I run `version inc major`
27
+
28
+ Then the output should contain "1.0.0"
29
+
30
+ Scenario: Incrementing minor version resets patch
31
+ Given I run `version inc major`
32
+ And I run `version inc patch`
33
+ And I run `version inc minor`
34
+
35
+ Then the output should contain "1.1.0"
36
+
37
+ Scenario: Setting the special field
38
+ Given I run `version special "pre3"`
39
+ Then the output should contain "0.0.0-pre3"
40
+
41
+ Scenario: Setting the meta field
42
+ Given I run `version meta 20150129135914`
43
+ Then the output should contain "0.0.0"
44
+
45
+ And I run `version tag`
46
+ Then the output should contain "0.0.0+20150129135914"
47
+
48
+ Scenario: Setting both meta and special fields
49
+ Given I run `version special "pre3"`
50
+ And I run `version meta 20150129135914`
51
+
52
+ Then the output should contain "0.0.0-pre3"
53
+
54
+ Scenario: Incrementing major version resets special and meta
55
+ Given I run `version special "pre3"`
56
+ And I run `version meta 20150129135914`
57
+ And I run `version inc major`
58
+
59
+ And I run `version tag`
60
+ Then the output should contain "1.0.0"
61
+
62
+ Scenario: Incrementing minor version resets special and meta
63
+ Given I run `version special "pre3"`
64
+ And I run `version meta 20150129135914`
65
+ And I run `version inc minor`
66
+
67
+ And I run `version tag`
68
+ Then the output should contain "0.1.0"
69
+
70
+ Scenario: Incrementing patch level resets special and meta
71
+ Given I run `version special "pre3"`
72
+ And I run `version meta 20150129135914`
73
+ And I run `version inc patch`
74
+
75
+ And I run `version tag`
76
+ Then the output should contain "0.0.1"
@@ -3,6 +3,8 @@ require 'aruba/cucumber'
3
3
  Before do |scenario|
4
4
  @dirs = ['tmp/aruba']
5
5
  @cwd = Dir.pwd
6
+
7
+ set_env('COVERAGE', 'true')
6
8
  end
7
9
 
8
10
  After do |scenario|
data/lib/yavm.rb CHANGED
@@ -6,20 +6,18 @@ require 'yavm/stores'
6
6
 
7
7
  module YAVM
8
8
 
9
- def find(quiet = true)
10
- versions = YAVM::Stores.locate_versions
9
+ def version(quiet: true, quick: true)
10
+ versions = YAVM::Stores.locate_versions(quick)
11
11
 
12
12
  if versions.equal?
13
13
  return versions.first
14
14
  else
15
15
  return nil if quiet
16
16
 
17
- raise RuntimeError, ''
18
-
17
+ raise RuntimeError, 'No version information available'
19
18
  end
20
-
21
19
  end
22
20
 
23
- module_function :find
21
+ module_function :version
24
22
 
25
23
  end
@@ -153,8 +153,8 @@ module YAVM
153
153
  init Create a .semver file for tracking versioning
154
154
  special Set a special (eg: pre-release) suffix
155
155
  meta Set a metadata version suffix
156
- format Display version in specific format (%M, %m, %p, %s, %t)
157
- tag Equivalent to format 'v%M.%m.%p%s'
156
+ format Display version in specific format (%M, %m, %p, %s, %t, %-s, %-t)
157
+ tag Equivalent to format 'v%M.%m.%-p%-s'
158
158
  help Show this screen.
159
159
 
160
160
  DOCOPT
data/lib/yavm/stores.rb CHANGED
@@ -17,10 +17,16 @@ module YAVM
17
17
  ]
18
18
  end
19
19
 
20
- def locate_versions
20
+ def locate_versions(quick = false)
21
21
  versions = stores.map do |store|
22
22
  store = store.new
23
- next store.to_version if store.exists?
23
+ if store.exists?
24
+ if quick
25
+ return YAVM::Versions.new([store.to_version])
26
+ else
27
+ next store.to_version
28
+ end
29
+ end
24
30
  end
25
31
 
26
32
  YAVM::Versions.new(versions)
data/lib/yavm/version.rb CHANGED
@@ -29,7 +29,7 @@ module YAVM
29
29
  end
30
30
 
31
31
  def to_s
32
- format('%M.%m.%p%s')
32
+ format('%M.%m.%p%-s')
33
33
  end
34
34
 
35
35
  def to_hash
@@ -44,8 +44,12 @@ module YAVM
44
44
  to_hash.to_yaml
45
45
  end
46
46
 
47
+ def to_json
48
+ to_hash.to_json
49
+ end
50
+
47
51
  def tag
48
- format('v%M.%m.%p%s%t')
52
+ format('v%M.%m.%p%-s%-t')
49
53
  end
50
54
 
51
55
  def format(string = '')
@@ -55,8 +59,10 @@ module YAVM
55
59
  string.gsub!('%M', major.to_s)
56
60
  string.gsub!('%m', minor.to_s)
57
61
  string.gsub!('%p', patch.to_s)
58
- string.gsub!('%s', special ? "-#{special}" : '')
59
- string.gsub!('%t', meta ? "+#{meta}" : '')
62
+ string.gsub!('%s', special || '')
63
+ string.gsub!('%t', meta || '')
64
+ string.gsub!('%-s', special ? "-#{special}" : '')
65
+ string.gsub!('%-t', meta ? "+#{meta}" : '')
60
66
  string.gsub!('%%', '%')
61
67
 
62
68
  string
metadata CHANGED
@@ -1,115 +1,113 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: YAVM
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lewis Eason
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-27 00:00:00.000000000 Z
11
+ date: 2015-01-30 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
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 0.5.0
20
17
  - - "~>"
21
18
  - !ruby/object:Gem::Version
22
- version: 0.5.0
19
+ version: '0.5'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 0.5.0
30
24
  - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: 0.5.0
26
+ version: '0.5'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: json
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: 1.8.0
40
31
  - - "~>"
41
32
  - !ruby/object:Gem::Version
42
- version: 1.8.1
33
+ version: '1.8'
43
34
  type: :runtime
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
46
37
  requirements:
47
- - - ">="
38
+ - - "~>"
48
39
  - !ruby/object:Gem::Version
49
- version: 1.8.0
40
+ version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
50
45
  - - "~>"
51
46
  - !ruby/object:Gem::Version
52
- version: 1.8.1
47
+ version: '10.4'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.4'
53
55
  - !ruby/object:Gem::Dependency
54
56
  name: rubocop
55
57
  requirement: !ruby/object:Gem::Requirement
56
58
  requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: 0.28.0
60
59
  - - "~>"
61
60
  - !ruby/object:Gem::Version
62
- version: 0.28.0
61
+ version: '0.28'
63
62
  type: :development
64
63
  prerelease: false
65
64
  version_requirements: !ruby/object:Gem::Requirement
66
65
  requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: 0.28.0
70
66
  - - "~>"
71
67
  - !ruby/object:Gem::Version
72
- version: 0.28.0
68
+ version: '0.28'
73
69
  - !ruby/object:Gem::Dependency
74
70
  name: cucumber
75
71
  requirement: !ruby/object:Gem::Requirement
76
72
  requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- version: 1.3.18
80
73
  - - "~>"
81
74
  - !ruby/object:Gem::Version
82
- version: 1.3.18
75
+ version: '1.3'
83
76
  type: :development
84
77
  prerelease: false
85
78
  version_requirements: !ruby/object:Gem::Requirement
86
79
  requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: 1.3.18
90
80
  - - "~>"
91
81
  - !ruby/object:Gem::Version
92
- version: 1.3.18
82
+ version: '1.3'
93
83
  - !ruby/object:Gem::Dependency
94
84
  name: aruba
95
85
  requirement: !ruby/object:Gem::Requirement
96
86
  requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- version: 0.6.2
100
87
  - - "~>"
101
88
  - !ruby/object:Gem::Version
102
- version: 0.6.2
89
+ version: '0.6'
103
90
  type: :development
104
91
  prerelease: false
105
92
  version_requirements: !ruby/object:Gem::Requirement
106
93
  requirements:
107
- - - ">="
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
108
102
  - !ruby/object:Gem::Version
109
- version: 0.6.2
103
+ version: '0.9'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
110
108
  - - "~>"
111
109
  - !ruby/object:Gem::Version
112
- version: 0.6.2
110
+ version: '0.9'
113
111
  description: A tiny gem for managing project version numbers
114
112
  email: me@lewiseason.co.uk
115
113
  executables:
@@ -119,6 +117,7 @@ extra_rdoc_files: []
119
117
  files:
120
118
  - README.md
121
119
  - bin/version
120
+ - features/command_line.feature
122
121
  - features/initialization.feature
123
122
  - features/step_definitions/project.rb
124
123
  - features/support/env.rb
@@ -144,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
143
  requirements:
145
144
  - - ">="
146
145
  - !ruby/object:Gem::Version
147
- version: '0'
146
+ version: 1.9.2
148
147
  required_rubygems_version: !ruby/object:Gem::Requirement
149
148
  requirements:
150
149
  - - ">="
@@ -158,6 +157,7 @@ specification_version: 4
158
157
  summary: Yet Another Version Manager
159
158
  test_files:
160
159
  - features/initialization.feature
160
+ - features/command_line.feature
161
161
  - features/support/env.rb
162
162
  - features/step_definitions/project.rb
163
163
  has_rdoc: