YAVM 0.5.0 → 0.5.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 +4 -4
- data/bin/git-versiontag +22 -0
- data/bin/version +3 -5
- data/features/command_line.feature +1 -1
- data/features/initialization.feature +1 -1
- data/features/support/env.rb +3 -3
- data/lib/yavm.rb +6 -4
- data/lib/yavm/command_line.rb +9 -2
- data/lib/yavm/stores.rb +1 -2
- data/lib/yavm/stores/base.rb +0 -6
- data/lib/yavm/stores/bower.rb +1 -3
- data/lib/yavm/stores/gem_spec.rb +0 -2
- data/lib/yavm/stores/package.rb +1 -3
- data/lib/yavm/stores/semver.rb +0 -2
- data/lib/yavm/version.rb +39 -30
- data/lib/yavm/versions.rb +5 -2
- metadata +22 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89f5ae4a9ec1d9aba8068c16cae331911225edbf
|
4
|
+
data.tar.gz: 00dd29ac52b21bd6cff55f408263b9398a742eb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3750f8ab3725a3c65ea16bd2b53d6c8f0db680bff35687e1027b85e83804ab60b3419144a9fb4f4536922c2a29d3fcdc363f54ef75a6a6df99621534086fef32
|
7
|
+
data.tar.gz: 5fe02152701c63abf62927279d2200da953cb7f969872b3d57540417cd28b7aefb13271fa06e73e54f05db8c35a82d0b5374b3635e1628b0928b66f19c14d359
|
data/bin/git-versiontag
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib/', __FILE__)
|
4
|
+
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
|
5
|
+
|
6
|
+
lib = File.expand_path('../../lib/', __FILE__)
|
7
|
+
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
|
8
|
+
|
9
|
+
require 'yavm'
|
10
|
+
require 'shell'
|
11
|
+
|
12
|
+
Shell.def_system_command :git, 'git'
|
13
|
+
|
14
|
+
sh = Shell.new
|
15
|
+
|
16
|
+
version = YAVM.version
|
17
|
+
files = YAVM.versions.files
|
18
|
+
|
19
|
+
sh.git('add', *files)
|
20
|
+
sh.git('commit', '--allow-empty', '-m', "Version #{version}", '--only', *files)
|
21
|
+
sh.git('tag', '-a', version.tag, '-m' "Version #{version}")
|
22
|
+
|
data/bin/version
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'simplecov_loader' if ENV['COVERAGE']
|
4
|
-
|
5
3
|
lib = File.expand_path('../lib/', __FILE__)
|
6
|
-
|
4
|
+
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
|
7
5
|
|
8
6
|
lib = File.expand_path('../../lib/', __FILE__)
|
9
|
-
|
10
|
-
|
7
|
+
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
|
11
8
|
|
9
|
+
require 'simplecov_loader' if ENV['COVERAGE']
|
12
10
|
require 'yavm/command_line'
|
13
11
|
|
14
12
|
begin
|
data/features/support/env.rb
CHANGED
data/lib/yavm.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
lib = File.dirname(__FILE__)
|
2
|
-
|
2
|
+
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
|
3
3
|
|
4
4
|
require 'yavm/version'
|
5
5
|
require 'yavm/stores'
|
6
6
|
|
7
7
|
module YAVM
|
8
|
-
|
9
8
|
def version(quiet: true, quick: true)
|
10
9
|
versions = YAVM::Stores.locate_versions(quick)
|
11
10
|
|
@@ -14,10 +13,13 @@ module YAVM
|
|
14
13
|
else
|
15
14
|
return nil if quiet
|
16
15
|
|
17
|
-
|
16
|
+
fail 'No version information available'
|
18
17
|
end
|
19
18
|
end
|
20
19
|
|
21
|
-
|
20
|
+
def versions
|
21
|
+
YAVM::Stores.locate_versions
|
22
|
+
end
|
22
23
|
|
24
|
+
module_function :version, :versions
|
23
25
|
end
|
data/lib/yavm/command_line.rb
CHANGED
@@ -97,7 +97,14 @@ module YAVM
|
|
97
97
|
puts "#{version.tag}"
|
98
98
|
|
99
99
|
when 'files'
|
100
|
-
|
100
|
+
sep = "\n"
|
101
|
+
pad = ''
|
102
|
+
|
103
|
+
sep = ' ' if @args['-1']
|
104
|
+
pad = '"' if @args['-1']
|
105
|
+
sep = "\0" if @args['-0']
|
106
|
+
|
107
|
+
puts versions.files.map { |v| "#{pad}#{v}#{pad}" }.join(sep)
|
101
108
|
|
102
109
|
when 'help'
|
103
110
|
Docopt::Exit.set_usage(nil)
|
@@ -149,7 +156,7 @@ module YAVM
|
|
149
156
|
#{@invocation} meta [<string>]
|
150
157
|
#{@invocation} format <string>
|
151
158
|
#{@invocation} tag
|
152
|
-
#{@invocation} files
|
159
|
+
#{@invocation} files [(-1|-0)]
|
153
160
|
#{@invocation} help
|
154
161
|
|
155
162
|
Options:
|
data/lib/yavm/stores.rb
CHANGED
data/lib/yavm/stores/base.rb
CHANGED
@@ -2,7 +2,6 @@ require 'json'
|
|
2
2
|
|
3
3
|
module YAVM
|
4
4
|
module Stores
|
5
|
-
|
6
5
|
class Base
|
7
6
|
def name
|
8
7
|
self.class.name
|
@@ -21,11 +20,9 @@ module YAVM
|
|
21
20
|
def filename
|
22
21
|
Dir[glob].first if exists?
|
23
22
|
end
|
24
|
-
|
25
23
|
end
|
26
24
|
|
27
25
|
class GenericJSON < YAVM::Stores::Base
|
28
|
-
|
29
26
|
def data
|
30
27
|
@data ||= JSON.parse(IO.read(filename))
|
31
28
|
end
|
@@ -38,9 +35,6 @@ module YAVM
|
|
38
35
|
@data = update_version_key(new_version.to_s)
|
39
36
|
File.open(filename, 'w') { |f| f.write JSON.pretty_generate(data) }
|
40
37
|
end
|
41
|
-
|
42
38
|
end
|
43
|
-
|
44
|
-
|
45
39
|
end
|
46
40
|
end
|
data/lib/yavm/stores/bower.rb
CHANGED
@@ -3,7 +3,6 @@ require 'yavm/stores/base'
|
|
3
3
|
module YAVM
|
4
4
|
module Stores
|
5
5
|
class Bower < YAVM::Stores::GenericJSON
|
6
|
-
|
7
6
|
def name
|
8
7
|
'bower.json file'
|
9
8
|
end
|
@@ -18,9 +17,8 @@ module YAVM
|
|
18
17
|
|
19
18
|
def update_version_key(what)
|
20
19
|
data['version'] = what
|
21
|
-
|
20
|
+
data
|
22
21
|
end
|
23
|
-
|
24
22
|
end
|
25
23
|
end
|
26
24
|
end
|
data/lib/yavm/stores/gem_spec.rb
CHANGED
@@ -5,7 +5,6 @@ require 'yavm/stores/base'
|
|
5
5
|
module YAVM
|
6
6
|
module Stores
|
7
7
|
class GemSpec < YAVM::Stores::Base
|
8
|
-
|
9
8
|
def name
|
10
9
|
"gemspec: #{filename}"
|
11
10
|
end
|
@@ -33,7 +32,6 @@ module YAVM
|
|
33
32
|
|
34
33
|
File.open(filename, 'w') { |f| f.write new_spec }
|
35
34
|
end
|
36
|
-
|
37
35
|
end
|
38
36
|
end
|
39
37
|
end
|
data/lib/yavm/stores/package.rb
CHANGED
@@ -3,7 +3,6 @@ require 'yavm/stores/base'
|
|
3
3
|
module YAVM
|
4
4
|
module Stores
|
5
5
|
class Package < YAVM::Stores::GenericJSON
|
6
|
-
|
7
6
|
def name
|
8
7
|
'npm package.json'
|
9
8
|
end
|
@@ -18,9 +17,8 @@ module YAVM
|
|
18
17
|
|
19
18
|
def update_version_key(what)
|
20
19
|
data['version'] = what
|
21
|
-
|
20
|
+
data
|
22
21
|
end
|
23
|
-
|
24
22
|
end
|
25
23
|
end
|
26
24
|
end
|
data/lib/yavm/stores/semver.rb
CHANGED
@@ -5,7 +5,6 @@ require 'yavm/stores/base'
|
|
5
5
|
module YAVM
|
6
6
|
module Stores
|
7
7
|
class Semver < YAVM::Stores::Base
|
8
|
-
|
9
8
|
def name
|
10
9
|
'.semver file'
|
11
10
|
end
|
@@ -29,7 +28,6 @@ module YAVM
|
|
29
28
|
def set!(new_version)
|
30
29
|
File.open(filename, 'w') { |f| f.write new_version.to_yaml }
|
31
30
|
end
|
32
|
-
|
33
31
|
end
|
34
32
|
end
|
35
33
|
end
|
data/lib/yavm/version.rb
CHANGED
@@ -5,6 +5,8 @@ module YAVM
|
|
5
5
|
class Version
|
6
6
|
extend ::Forwardable
|
7
7
|
|
8
|
+
VERSION_REGEX = /\A(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)(?:-(?<special>[a-z0-9]+))?(?:\+(?<meta>[a-z0-9]+))?\z/i
|
9
|
+
|
8
10
|
attr_accessor :store
|
9
11
|
|
10
12
|
def initialize(store, vobject = nil)
|
@@ -20,24 +22,12 @@ module YAVM
|
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
23
|
-
def special
|
24
|
-
empty_is_nil(:special)
|
25
|
-
end
|
26
|
-
|
27
|
-
def meta
|
28
|
-
empty_is_nil(:meta)
|
29
|
-
end
|
30
|
-
|
31
25
|
def to_s
|
32
26
|
format('%M.%m.%p%-s')
|
33
27
|
end
|
34
28
|
|
35
29
|
def to_hash
|
36
|
-
|
37
|
-
dump[:special] ||= ''
|
38
|
-
dump[:meta] ||= ''
|
39
|
-
|
40
|
-
dump
|
30
|
+
@_version.marshal_dump
|
41
31
|
end
|
42
32
|
|
43
33
|
def to_yaml
|
@@ -55,14 +45,17 @@ module YAVM
|
|
55
45
|
def format(string = '')
|
56
46
|
string = string.dup
|
57
47
|
|
48
|
+
_special = special || ''
|
49
|
+
_meta = meta || ''
|
50
|
+
|
58
51
|
# ? http://stackoverflow.com/a/8132638
|
59
52
|
string.gsub!('%M', major.to_s)
|
60
53
|
string.gsub!('%m', minor.to_s)
|
61
54
|
string.gsub!('%p', patch.to_s)
|
62
|
-
string.gsub!('%s',
|
63
|
-
string.gsub!('%t',
|
64
|
-
string.gsub!('%-s',
|
65
|
-
string.gsub!('%-t',
|
55
|
+
string.gsub!('%s', _special)
|
56
|
+
string.gsub!('%t', _meta)
|
57
|
+
string.gsub!('%-s', _special.empty? ? '' : "-#{special}")
|
58
|
+
string.gsub!('%-t', _meta.empty? ? '' : "+#{meta}")
|
66
59
|
string.gsub!('%%', '%')
|
67
60
|
|
68
61
|
string
|
@@ -80,28 +73,36 @@ module YAVM
|
|
80
73
|
case what
|
81
74
|
when :major
|
82
75
|
self.major += 1
|
83
|
-
self.minor = 0
|
84
|
-
self.patch = 0
|
85
76
|
when :minor
|
86
77
|
self.minor += 1
|
87
|
-
self.patch = 0
|
88
78
|
when :patch
|
89
79
|
self.patch += 1
|
90
80
|
else
|
91
81
|
fail "Can't increment #{what}"
|
92
82
|
end
|
83
|
+
end
|
93
84
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
85
|
+
def major=(value)
|
86
|
+
clears(:minor, :patch, :special, :meta)
|
87
|
+
@_version.major = value
|
88
|
+
end
|
89
|
+
|
90
|
+
def minor=(value)
|
91
|
+
clears(:patch, :special, :meta)
|
92
|
+
@_version.minor = value
|
93
|
+
end
|
94
|
+
|
95
|
+
def patch=(value)
|
96
|
+
@_version.patch = value
|
98
97
|
end
|
99
98
|
|
100
99
|
private
|
101
100
|
|
102
|
-
def
|
103
|
-
|
104
|
-
|
101
|
+
def clears(*properties)
|
102
|
+
properties.each do |p|
|
103
|
+
value = @_version.send(p).is_a?(Fixnum) ? 0 : ''
|
104
|
+
@_version.send("#{p}=", value)
|
105
|
+
end
|
105
106
|
end
|
106
107
|
|
107
108
|
def empty
|
@@ -111,16 +112,18 @@ module YAVM
|
|
111
112
|
end
|
112
113
|
|
113
114
|
def parse(string)
|
114
|
-
match = string.match(
|
115
|
+
match = string.match(VERSION_REGEX)
|
115
116
|
|
116
117
|
@_version = Hash[match.names.zip(match.captures)]
|
117
118
|
@_version = OpenStruct.new(@_version)
|
118
119
|
integerize!
|
120
|
+
stringify!
|
119
121
|
end
|
120
122
|
|
121
123
|
def load(hash)
|
122
124
|
@_version = OpenStruct.new(hash)
|
123
125
|
integerize!
|
126
|
+
stringify!
|
124
127
|
end
|
125
128
|
|
126
129
|
def integerize!
|
@@ -129,11 +132,17 @@ module YAVM
|
|
129
132
|
@_version.patch = @_version.patch.to_i
|
130
133
|
end
|
131
134
|
|
135
|
+
def stringify!
|
136
|
+
@_version.special ||= ''
|
137
|
+
@_version.meta ||= ''
|
138
|
+
end
|
139
|
+
|
132
140
|
#
|
133
141
|
# Allows calling "version.minor" and the like on the Version instance
|
134
142
|
#
|
135
143
|
def_delegators :@_version,
|
136
|
-
:major,
|
137
|
-
:
|
144
|
+
:major, :minor, :patch,
|
145
|
+
:special, :meta,
|
146
|
+
:special=, :meta=
|
138
147
|
end
|
139
148
|
end
|
data/lib/yavm/versions.rb
CHANGED
@@ -23,12 +23,15 @@ module YAVM
|
|
23
23
|
versions.reject { |v| v == versions.first }.length.zero?
|
24
24
|
end
|
25
25
|
|
26
|
+
def files
|
27
|
+
versions.map { |v| v.store.filename || nil }.compact
|
28
|
+
end
|
29
|
+
|
26
30
|
def_delegators :versions, :<<, :length, :size, :[],
|
27
|
-
|
31
|
+
:first, :each, :each_with_index, :empty?, :any?, :map
|
28
32
|
|
29
33
|
private
|
30
34
|
|
31
35
|
attr_accessor :versions
|
32
|
-
|
33
36
|
end
|
34
37
|
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.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-
|
11
|
+
date: 2015-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +58,14 @@ dependencies:
|
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
61
|
+
version: '0.32'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
68
|
+
version: '0.32'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: cucumber
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,10 +112,12 @@ description: A tiny gem for managing project version numbers
|
|
98
112
|
email: me@lewiseason.co.uk
|
99
113
|
executables:
|
100
114
|
- version
|
115
|
+
- git-versiontag
|
101
116
|
extensions: []
|
102
117
|
extra_rdoc_files: []
|
103
118
|
files:
|
104
119
|
- README.md
|
120
|
+
- bin/git-versiontag
|
105
121
|
- bin/version
|
106
122
|
- features/command_line.feature
|
107
123
|
- features/initialization.feature
|
@@ -137,13 +153,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
153
|
version: '0'
|
138
154
|
requirements: []
|
139
155
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.
|
156
|
+
rubygems_version: 2.4.5
|
141
157
|
signing_key:
|
142
158
|
specification_version: 4
|
143
159
|
summary: Yet Another Version Manager
|
144
160
|
test_files:
|
145
161
|
- features/initialization.feature
|
146
|
-
- features/command_line.feature
|
147
162
|
- features/support/env.rb
|
163
|
+
- features/command_line.feature
|
148
164
|
- features/step_definitions/project.rb
|
149
|
-
has_rdoc:
|