liferaft 0.0.2 → 0.0.3

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: 7326123507d7f8865f08559e3b30e8fbb8b7ed74
4
- data.tar.gz: 1e27c01b8edeb60f87d8df604645b2d7ecfd990a
3
+ metadata.gz: e855e2a34754fbe9ff001abf1acd49a035bbd38e
4
+ data.tar.gz: 9f4f6477edd83b553046279313ed365275133dd2
5
5
  SHA512:
6
- metadata.gz: cc7a98f75072cb4541a4c04642e559c289bf28eb44586c5bed6b1ee4471a1c09739cfd59191b0b9d700afd7831d0592114398c6f853a3027a40f4ef3aa48704b
7
- data.tar.gz: f9640d871571aab359dbefcf73892c6ebc2ade105d045f123e516b6ac5f0ffffe4abbb8f5b04ec02bd54814196c2966595fcca4956286bdd319f753db9535767
6
+ metadata.gz: 529a56052774df97faf327ae1c637f6cd58dd9001c4a650c4c38445015eba49716e8156f5300716ed12ce06ec8f10622916825aecc4d7612f39eb48fd6afc8cc
7
+ data.tar.gz: 84c1ab2c187108565a5411dd0a4559c789de0e411652c132e7919b6ec5616e2fff3591d2a4dcd97e21ad9116c1c3f92fad59288a53c311b6d47fa04e8ca1b910
data/README.md CHANGED
@@ -34,7 +34,7 @@ Or install it yourself as:
34
34
 
35
35
  ## Contributing
36
36
 
37
- 1. Fork it ( https://github.com/[my-github-username]/liferaft/fork )
37
+ 1. Fork it ( https://github.com/neonichu/liferaft/fork )
38
38
  2. Create your feature branch (`git checkout -b my-new-feature`)
39
39
  3. Commit your changes (`git commit -am 'Add some feature'`)
40
40
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,3 +1,3 @@
1
1
  module Liferaft
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -1,4 +1,8 @@
1
1
  module Liferaft
2
+ def self.version_string_create(major, minor, patch, build = 0)
3
+ "#{major}#{(minor + 'A'.ord).chr}#{patch * 1000 + build}"
4
+ end
5
+
2
6
  class Version
3
7
  attr_reader :major, :minor, :patch, :build
4
8
 
@@ -21,6 +25,10 @@ module Liferaft
21
25
  other < self
22
26
  end
23
27
 
28
+ def >=(other)
29
+ other < self || other == self
30
+ end
31
+
24
32
  def <(other)
25
33
  return true if major < other.major
26
34
  return true if minor < other.minor
@@ -28,6 +36,10 @@ module Liferaft
28
36
  build < other.build
29
37
  end
30
38
 
39
+ def <=(other)
40
+ self < other || other == self
41
+ end
42
+
31
43
  def ==(other)
32
44
  other.instance_of?(self.class) &&
33
45
  major == other.major && minor == other.minor &&
@@ -16,5 +16,23 @@ module Liferaft
16
16
 
17
17
  v1.should == v2
18
18
  end
19
+
20
+ it 'implements greater-than-or-equals operator' do
21
+ v1 = Version.new('6D570')
22
+ v2 = Version.new('6D570')
23
+ v3 = Version.new('6D1002')
24
+
25
+ v2.should >= v1
26
+ v2.should >= v3
27
+ end
28
+
29
+ it 'implements less-than-or-equals operator' do
30
+ v1 = Version.new('6D570')
31
+ v2 = Version.new('6D570')
32
+ v3 = Version.new('6D1002')
33
+
34
+ v1.should <= v2
35
+ v1.should <= v3
36
+ end
19
37
  end
20
38
  end
data/spec/version_spec.rb CHANGED
@@ -1,6 +1,20 @@
1
1
  require File.expand_path('../spec_helper', __FILE__)
2
2
 
3
3
  module Liferaft
4
+ describe Liferaft do
5
+ it 'writes 6D570 correctly' do
6
+ version_string = Liferaft.version_string_create(6, 3, 0, 570)
7
+
8
+ version_string.should == '6D570'
9
+ end
10
+
11
+ it 'writes 6D1002 correctly' do
12
+ version_string = Liferaft.version_string_create(6, 3, 1, 2)
13
+
14
+ version_string.should == '6D1002'
15
+ end
16
+ end
17
+
4
18
  describe Version do
5
19
  it 'parses 6D570 correctly' do
6
20
  version = Version.new('6D570')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liferaft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Bügling
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-27 00:00:00.000000000 Z
11
+ date: 2015-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler