semver2 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/.semver +2 -2
  2. data/README.md +7 -2
  3. data/lib/semver.rb +9 -5
  4. metadata +3 -3
data/.semver CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- :major: 2
2
+ :major: 3
3
3
  :minor: 0
4
4
  :patch: 0
5
- :special: ""
5
+ :special: rc.1
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- SemVer
1
+ SemVer 3.0.0-rc.1 gem, following semver.org 2.0.0-rc.1
2
2
  ======
3
3
 
4
4
  quickstart on the command line
@@ -12,17 +12,21 @@ use it
12
12
  % semver init
13
13
  % semver tag # => v0.0.0
14
14
  % semver inc minor # => v0.1.0
15
+ % semver special 'alpha.45' # => v0.1.0-alpha.45
16
+ % semver format "%M.%m" # => 0.1
15
17
  % git tag -a `semver tag`
16
18
  % say 'that was easy'
17
19
 
18
20
  quickstart for ruby
19
21
  -------------------
22
+
20
23
  require 'semver'
21
24
  v = SemVer.find
22
25
  v.major # => "0"
23
26
  v.major += 1
24
27
  v.major # => "1"
25
- v.format "%M.%m.%p" # => "1.1.0"
28
+ v.special = 'alpha.46'
29
+ v.format "%M.%m.%p%s" # => "1.1.0-alpha.46"
26
30
  v.to_s # => "v1.1.0"
27
31
  v.save
28
32
 
@@ -31,3 +35,4 @@ git integration
31
35
  % git config --global alias.semtag '!git tag -a $(semver tag) -m "tagging $(semver tag)"'
32
36
 
33
37
  [Franco Lazzarino](mailto:flazzarino@gmail.com)
38
+ [Henrik Feldt](mailto:henrik@haf.se)
data/lib/semver.rb CHANGED
@@ -38,7 +38,7 @@ class SemVer
38
38
  patch.kind_of? Integer or raise "invalid patch: #{patch}"
39
39
 
40
40
  unless special.empty?
41
- special =~ /[A-Za-z][0-9A-Za-z-]+/ or raise "invalid special: #{special}"
41
+ special =~ /[A-Za-z][0-9A-Za-z\.]+/ or raise "invalid special: #{special}"
42
42
  end
43
43
 
44
44
  @major, @minor, @patch, @special = major, minor, patch, special
@@ -68,10 +68,14 @@ class SemVer
68
68
  end
69
69
 
70
70
  def format fmt
71
- fmt.gsub! '%M', @major.to_s
72
- fmt.gsub! '%m', @minor.to_s
73
- fmt.gsub! '%p', @patch.to_s
74
- fmt.gsub! '%s', @special.to_s
71
+ fmt = fmt.gsub '%M', @major.to_s
72
+ fmt = fmt.gsub '%m', @minor.to_s
73
+ fmt = fmt.gsub '%p', @patch.to_s
74
+ if @special.nil? or @special.length == 0 then
75
+ fmt = fmt.gsub '%s', ''
76
+ else
77
+ fmt = fmt.gsub '%s', "-" + @special.to_s
78
+ end
75
79
  fmt
76
80
  end
77
81
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semver2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-07-07 00:00:00.000000000Z
13
+ date: 2012-02-13 00:00:00.000000000Z
14
14
  dependencies: []
15
15
  description: maintain versions as per http://semver.org
16
16
  email: henrik@haf.se
@@ -45,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
45
45
  version: '0'
46
46
  requirements: []
47
47
  rubyforge_project:
48
- rubygems_version: 1.8.5
48
+ rubygems_version: 1.8.15
49
49
  signing_key:
50
50
  specification_version: 3
51
51
  summary: Semantic Versioning