ittf_points 0.1.0 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f4851982f9af2f265f5d49c1a108a624d8b70ef
4
- data.tar.gz: 42f5ac52479781bad7c463c8a40e75421dd01b9a
3
+ metadata.gz: 34cd41e76d9704e52cc256e6a7ccf6ec40592650
4
+ data.tar.gz: 9d23f0e90987fad46dcc37a6e623f44c255f8140
5
5
  SHA512:
6
- metadata.gz: e0a4f0a4345bd2b212aff69d8d95e0de6c729aeaf63db624bf4cbd96880229e992b51d073435784ab69095227d3ba4d7fc57cef351a274706df96cfe65f60024
7
- data.tar.gz: e6087bffa8ab46060e27a5030843c3bebe99e5efa5eac1f9767003db84f2de1f3d039886936c06233a68506863094edcaa3df18724473e662045018b9b1a40d5
6
+ metadata.gz: 963436b10f1398e308698c604df4fda9280be8746d084fe3d34c3807becd9d5ddcf039d869670877e5e26519dc172e03013947ac0b3febfcfc6eaf580287ea83
7
+ data.tar.gz: deda73744c09d33e16d178faeeff493d4793f7689d3de3d3652e962ec0c4ee58a7653294cd75dbff9605fc7211751b06f2af75e142e15affe0cf3d86cae43812
data/README.md CHANGED
@@ -32,6 +32,10 @@ p1.win([2122, 1471, 2621]).lose(2788)
32
32
  puts p1.new_rating_points
33
33
  ```
34
34
 
35
+ ### CLI
36
+
37
+ $ ittf_points player 2731 --win 2122 1471 2621 --lose 2788
38
+
35
39
  ## Contributing
36
40
 
37
41
  Bug reports and pull requests are welcome on GitHub at https://github.com/hachy/ittf_points.
data/exe/ittf_points CHANGED
@@ -1,3 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "ittf_points"
3
+ require 'ittf_points'
4
+
5
+ IttfPoints::CLI.start(ARGV)
data/ittf_points.gemspec CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ['lib']
20
20
 
21
+ spec.add_dependency 'thor'
21
22
  spec.add_development_dependency 'bundler', '~> 1.10'
22
23
  spec.add_development_dependency 'rake', '~> 10.0'
23
24
  spec.add_development_dependency 'rspec'
@@ -0,0 +1,20 @@
1
+ require 'thor'
2
+
3
+ module IttfPoints
4
+ class CLI < Thor
5
+ desc 'player RATING_POINTS', 'Show new rating points'
6
+ method_option :win, aliases: '-w', type: :array
7
+ method_option :lose, aliases: '-l', type: :array
8
+ def player(points, weight = :W2)
9
+ player = Player.new(rating_points: points, weight: weight)
10
+ if options[:win]
11
+ player.win(options[:win])
12
+ end
13
+ if options[:lose]
14
+ player.lose(options[:lose])
15
+ end
16
+ puts "New Added Rating Points: #{player.new_added_rating_points}"
17
+ puts "New Rating Points: #{player.new_rating_points}"
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module IttfPoints
2
- VERSION = "0.1.0"
2
+ VERSION = '0.1.1'
3
3
  end
data/lib/ittf_points.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  require 'ittf_points/version'
2
2
  require 'ittf_points/r'
3
3
  require 'ittf_points/player'
4
+ require 'ittf_points/cli'
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ittf_points
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - hachy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-09 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -72,6 +86,7 @@ files:
72
86
  - exe/ittf_points
73
87
  - ittf_points.gemspec
74
88
  - lib/ittf_points.rb
89
+ - lib/ittf_points/cli.rb
75
90
  - lib/ittf_points/player.rb
76
91
  - lib/ittf_points/r.rb
77
92
  - lib/ittf_points/version.rb