sem_version 1.0.0 → 1.1.0

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.
Files changed (2) hide show
  1. data/lib/sem_version.rb +10 -1
  2. metadata +3 -3
data/lib/sem_version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  class SemVersion
2
2
  include Comparable
3
3
 
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  # Pattern allows min and patch to be skipped. We have to do extra checking if we want them
6
6
  SEMVER_REGEX = /^(\d+)(?:\.(\d+)(?:\.(\d+)(?:-([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?(?:\+([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?)?)?$/
7
7
 
@@ -86,6 +86,11 @@ class SemVersion
86
86
  end
87
87
  end
88
88
 
89
+ def self.open_constraint?(constraint)
90
+ comparison, version = constraint.strip.split(' ', 2)
91
+ !['=', '=='].include?(comparison) && !version.nil?
92
+ end
93
+
89
94
  def major=(val)
90
95
  raise ArgumentError, "#{val} is not a valid major version (must be an integer >= 0)" unless val.is_a?(Fixnum) && val >= 0
91
96
  @major = val
@@ -150,4 +155,8 @@ class SemVersion
150
155
  # If we got this far, either they're equal (same length) or they won
151
156
  return (our_parts.length == their_parts.length) ? 0 : -1
152
157
  end
158
+ end
159
+
160
+ def SemVersion(*args)
161
+ SemVersion.new(*args)
153
162
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sem_version
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-06 00:00:00.000000000 Z
12
+ date: 2012-12-12 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Allows you to parse and compare semantic versions, as specified by http://semver.org/.
15
15
  Allows constraint checking e.g. >=, <, ~>
@@ -39,7 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
39
39
  version: '0'
40
40
  requirements: []
41
41
  rubyforge_project:
42
- rubygems_version: 1.8.23
42
+ rubygems_version: 1.8.24
43
43
  signing_key:
44
44
  specification_version: 3
45
45
  summary: ! 'SemVersion: Semantic version parsing and comparison. See http://semver.org/'