liferaft 0.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 726bdd18f87db3ca713d640a46abee6202f638d5
4
+ data.tar.gz: e4c6ff1d08f7560637cf497c4ea21b0bd2fb9f52
5
+ SHA512:
6
+ metadata.gz: f1635a9a3f360ab6ab4c5ee845fc5a6e4b6c9f311b85f753ef0843035b67d47ba9deaaf70efd6c9fd7a45a66e95652680b8f31c05e976266e5c1bf982324e046
7
+ data.tar.gz: 3711a70f0a690ba8a5469aade643ad11ee2bb6fc16ddd20a81c9e8b42ec7d7ac1f8706ad8b54578fc773641e2572d03bdd354d5c082c9f956226eef8faf437df
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
@@ -0,0 +1,11 @@
1
+ Lint/Void:
2
+ Enabled: false
3
+
4
+ Metrics/AbcSize:
5
+ Max: 20
6
+
7
+ Metrics/LineLength:
8
+ Max: 100
9
+
10
+ Style/Documentation:
11
+ Enabled: false
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm: 2.0.0-p598
3
+ cache: bundler
4
+ script:
5
+ - bundle exec rake spec
6
+ - bundle exec rubocop
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'bacon'
7
+ gem 'mocha-on-bacon'
8
+ gem 'mocha', '~> 0.11.4'
9
+ gem 'prettybacon', git: 'https://github.com/irrationalfab/PrettyBacon.git', branch: 'master'
10
+ gem 'coveralls', require: false
11
+ gem 'rubocop', require: false
12
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Boris Bügling
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,41 @@
1
+ # Liferaft
2
+
3
+ [![Build Status](http://img.shields.io/travis/neonichu/liferaft/master.svg?style=flat)](https://travis-ci.org/neonichu/liferaft)
4
+ [![Coverage Status](https://coveralls.io/repos/neonichu/liferaft/badge.svg)](https://coveralls.io/r/neonichu/liferaft)
5
+ [![Gem Version](http://img.shields.io/gem/v/liferaft.svg?style=flat)](http://badge.fury.io/rb/liferaft)
6
+ [![Code Climate](http://img.shields.io/codeclimate/github/neonichu/liferaft.svg?style=flat)](https://codeclimate.com/github/neonichu/liferaft)
7
+
8
+ Liferaft parses Apple build numbers, like `6D1002`.
9
+
10
+ ## Usage
11
+
12
+ ```ruby
13
+ v = Version.new('6D1002')
14
+
15
+ puts '#{v.major}.#{v.minor}.#{v.patch} Build #{v.build}'
16
+ ## => '6.3.1 Build 2'
17
+ ```
18
+
19
+ ## Installation
20
+
21
+ Add this line to your application's Gemfile:
22
+
23
+ ```ruby
24
+ gem 'liferaft'
25
+ ```
26
+
27
+ And then execute:
28
+
29
+ $ bundle
30
+
31
+ Or install it yourself as:
32
+
33
+ $ gem install liferaft
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it ( https://github.com/[my-github-username]/liferaft/fork )
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create a new Pull Request
@@ -0,0 +1,12 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ def specs(dir)
4
+ FileList["spec/#{dir}/*_spec.rb"].sample
5
+ end
6
+
7
+ desc 'Runs all the specs'
8
+ task :spec do
9
+ sh "bundle exec bacon #{specs('**')}"
10
+ end
11
+
12
+ task default: :specs
@@ -0,0 +1,2 @@
1
+ require 'liferaft/gem_version'
2
+ require 'liferaft/version'
@@ -0,0 +1,3 @@
1
+ module Liferaft
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,20 @@
1
+ module Liferaft
2
+ class Version
3
+ attr_reader :major, :minor, :patch, :build
4
+
5
+ def initialize(version_string)
6
+ components = version_string.downcase.split(/[a-z]/)
7
+ character = version_string.downcase.gsub(/[^a-z]/, '')
8
+
9
+ if character.length != 1
10
+ @major = @minor = @patch = @build = 0
11
+ return
12
+ end
13
+
14
+ @major = components[0].to_i
15
+ @minor = character.ord - 'a'.ord
16
+ @patch = components[1].to_i / 1000
17
+ @build = components[1].to_i % 1000
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'liferaft/gem_version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'liferaft'
8
+ spec.version = Liferaft::VERSION
9
+ spec.authors = ['Boris Bügling']
10
+ spec.email = ['boris@icculus.org']
11
+ spec.summary = 'Liferaft parses Apple build numbers, like 6D1002'
12
+ spec.homepage = 'https://github.com/neonichu/liferaft'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_development_dependency 'bundler', '~> 1.7'
21
+ spec.add_development_dependency 'rake', '~> 10.0'
22
+ end
@@ -0,0 +1,14 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
4
+ require 'pathname'
5
+ ROOT = Pathname.new(File.expand_path('../../', __FILE__))
6
+ $LOAD_PATH.unshift((ROOT + 'lib').to_s)
7
+ $LOAD_PATH.unshift((ROOT + 'spec').to_s)
8
+
9
+ require 'bundler/setup'
10
+ require 'bacon'
11
+ require 'mocha-on-bacon'
12
+ require 'pretty_bacon'
13
+
14
+ require 'liferaft'
@@ -0,0 +1,86 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ module Liferaft
4
+ describe Version do
5
+ it 'parses 6D570 correctly' do
6
+ version = Version.new('6D570')
7
+
8
+ version.major.should == 6
9
+ version.minor.should == 3
10
+ version.patch.should == 0
11
+ version.build.should == 570
12
+ end
13
+
14
+ it 'parses 6D1002 correctly' do
15
+ version = Version.new('6D1002')
16
+
17
+ version.major.should == 6
18
+ version.minor.should == 3
19
+ version.patch.should == 1
20
+ version.build.should == 002
21
+ end
22
+
23
+ it 'parses 6E7 correctly' do
24
+ version = Version.new('6E7')
25
+
26
+ version.major.should == 6
27
+ version.minor.should == 4
28
+ version.patch.should == 0
29
+ version.build.should == 7
30
+ end
31
+
32
+ it 'parses 6E14 correctly' do
33
+ version = Version.new('6E14')
34
+
35
+ version.major.should == 6
36
+ version.minor.should == 4
37
+ version.patch.should == 0
38
+ version.build.should == 14
39
+ end
40
+
41
+ it 'parses 6E14 correctly' do
42
+ version = Version.new('6E14')
43
+
44
+ version.major.should == 6
45
+ version.minor.should == 4
46
+ version.patch.should == 0
47
+ version.build.should == 14
48
+ end
49
+
50
+ it 'parses 16E14 correctly' do
51
+ version = Version.new('16E14')
52
+
53
+ version.major.should == 16
54
+ version.minor.should == 4
55
+ version.patch.should == 0
56
+ version.build.should == 14
57
+ end
58
+
59
+ it 'is resilient against empty minor versions' do
60
+ version = Version.new('614')
61
+
62
+ version.major.should == 0
63
+ version.minor.should == 0
64
+ version.patch.should == 0
65
+ version.build.should == 0
66
+ end
67
+
68
+ it 'is resilient against multi-character minor versions' do
69
+ version = Version.new('6EE14')
70
+
71
+ version.major.should == 0
72
+ version.minor.should == 0
73
+ version.patch.should == 0
74
+ version.build.should == 0
75
+ end
76
+
77
+ it 'is resilient against parsing broken versions' do
78
+ version = Version.new('ERTTR456E')
79
+
80
+ version.major.should == 0
81
+ version.minor.should == 0
82
+ version.patch.should == 0
83
+ version.build.should == 0
84
+ end
85
+ end
86
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: liferaft
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Boris Bügling
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description:
42
+ email:
43
+ - boris@icculus.org
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - .rubocop.yml
50
+ - .travis.yml
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - lib/liferaft.rb
56
+ - lib/liferaft/gem_version.rb
57
+ - lib/liferaft/version.rb
58
+ - liferaft.gemspec
59
+ - spec/spec_helper.rb
60
+ - spec/version_spec.rb
61
+ homepage: https://github.com/neonichu/liferaft
62
+ licenses:
63
+ - MIT
64
+ metadata: {}
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 2.0.14
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: Liferaft parses Apple build numbers, like 6D1002
85
+ test_files:
86
+ - spec/spec_helper.rb
87
+ - spec/version_spec.rb
88
+ has_rdoc: