rtm-time 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 67b902a7b3ba58fda565a396af81a2e6d1535f64
4
+ data.tar.gz: 6eab58437a01034f193a4f624ea659c22205ce32
5
+ SHA512:
6
+ metadata.gz: 4b6b4b5340c533c3b6a0dab694df9c709e2a93eae7209c43bfe906377415766c8d347a04476cf0b74d6971f6f010181f759e9625c7fa4e62e20fc39c6291ce65
7
+ data.tar.gz: 721a9947600de5f24d3c833d7a8b14c43cf8cb9518008bd9b4159e609438f83b421b9e896ca936f30a8b59196955fea154cda041da1d0f769a3847d70e497e9d
@@ -0,0 +1,52 @@
1
+ Gemfile.lock
2
+
3
+ # rcov generated
4
+ coverage
5
+
6
+ # rdoc generated
7
+ rdoc
8
+
9
+ # yard generated
10
+ doc
11
+ .yardoc
12
+
13
+ # bundler
14
+ .bundle
15
+
16
+ # jeweler generated
17
+ pkg
18
+
19
+ vendor
20
+
21
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
22
+ #
23
+ # * Create a file at ~/.gitignore
24
+ # * Include files you want ignored
25
+ # * Run: git config --global core.excludesfile ~/.gitignore
26
+ #
27
+ # After doing this, these files will be ignored in all your git projects,
28
+ # saving you from having to 'pollute' every project you touch with them
29
+ #
30
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
31
+ #
32
+ # For MacOS:
33
+ #
34
+ .DS_Store
35
+
36
+ # For TextMate
37
+ #*.tmproj
38
+ #tmtags
39
+
40
+ # For emacs:
41
+ *~
42
+ \#*
43
+ .\#*
44
+
45
+ # For vim:
46
+ *.swp
47
+
48
+ # For redcar:
49
+ #.redcar
50
+
51
+ # For rubinius:
52
+ #*.rbc
data/Gemfile CHANGED
@@ -1,13 +1,4 @@
1
- # -*- mode: ruby -*-
1
+ source 'https://rubygems.org'
2
2
 
3
- source "http://rubygems.org"
4
-
5
- # Add dependencies to develop your gem here.
6
- # Include everything needed to run rake, tests, features, etc.
7
- group :development do
8
- gem "rspec"
9
- gem "rr"
10
- gem "bundler"
11
- gem "jeweler"
12
- gem "rcov", ">= 0"
13
- end
3
+ # Specify your gem's dependencies in rtm-time.gemspec
4
+ gemspec
data/Rakefile CHANGED
@@ -1,29 +1,5 @@
1
- # -*- mode: ruby; coding: utf-8 -*-
2
-
3
- require 'rubygems'
4
- require 'bundler'
5
- begin
6
- Bundler.setup(:default, :development)
7
- rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
10
- exit e.status_code
11
- end
12
- require 'rake'
13
-
14
- require 'jeweler'
15
- Jeweler::Tasks.new do |gem|
16
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
- gem.name = "rtm-time"
18
- gem.homepage = "http://github.com/wtnabe/rtm-time"
19
- gem.license = "BSD"
20
- gem.summary = %Q{A parser for RTM's estimate time}
21
- gem.description = %Q{parse and inspect RTM's estimate time}
22
- gem.email = "wtnabe@gmail.com"
23
- gem.authors = ["wtnabe"]
24
- # dependencies defined in Gemfile
25
- end
26
- Jeweler::RubygemsDotOrgTasks.new
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
27
3
 
28
4
  require 'rspec/core'
29
5
  require 'rspec/core/rake_task'
@@ -31,16 +7,16 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
31
7
  spec.pattern = FileList['spec/**/*_spec.rb']
32
8
  end
33
9
 
34
- RSpec::Core::RakeTask.new(:rcov) do |spec|
35
- spec.pattern = 'spec/**/*_spec.rb'
36
- spec.rcov = true
10
+ if (Gem::Version.create(RUBY_VERSION) <=> Gem::Version.create('1.9')) < 0
11
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
12
+ spec.pattern = 'spec/**/*_spec.rb'
13
+ spec.rcov = true
14
+ end
37
15
  end
38
16
 
39
- task :default => :spec
40
-
41
17
  require 'rdoc/task'
42
18
  RDoc::Task.new do |rdoc|
43
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
19
+ version = defined?(RtmTime::VERSION) ? RtmTime::VERSION : ""
44
20
 
45
21
  rdoc.rdoc_dir = 'rdoc'
46
22
  rdoc.title = "rtm-time #{version}"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rtm/time"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -24,7 +24,7 @@ module RtmTime
24
24
  @hour = nil
25
25
  @min = nil
26
26
 
27
- parsed = time_str.scan(/(?:([0-9\.]+)\s*([^0-9]+|\z))/u)
27
+ parsed = time_str.sub(/[PT]/, ' ').scan(/(?:([0-9\.]+)\s*([^0-9]+|\z))/u)
28
28
 
29
29
  if parsed.size > 0
30
30
  # d, h, m の順番にも縛りはない
@@ -10,11 +10,11 @@ module RtmTime
10
10
  #
11
11
  def assort( num, unit )
12
12
  case unit
13
- when /\Ad/u
13
+ when /\Ad/ui
14
14
  @day ||= num.to_i
15
- when /\Ah/u
15
+ when /\Ah/ui
16
16
  @hour ||= num.to_f
17
- when /\Am/u
17
+ when /\Am/ui
18
18
  @min ||= num.to_i
19
19
  end
20
20
  end
@@ -0,0 +1,3 @@
1
+ module RtmTime
2
+ VERSION = '0.3.0'
3
+ end
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rtm_time/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rtm-time"
8
+ spec.version = RtmTime::VERSION
9
+ spec.authors = ["wtnabe"]
10
+ spec.email = ["wtnabe@gmail.com"]
11
+
12
+ spec.summary = %q{parse and inspect RTM's estimate time}
13
+ spec.description = %q{parse and inspect RTM's estimate time}
14
+ spec.homepage = "https://github.com/wtnabe/rtm-time"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.12"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "rr"
25
+ if (Gem::Version.create(RUBY_VERSION) <=> Gem::Version.create('1.9')) >= 0
26
+ spec.add_development_dependency "simplecov"
27
+ else
28
+ spec.add_development_dependency "rcov"
29
+ end
30
+ end
metadata CHANGED
@@ -1,123 +1,130 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtm-time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
- prerelease:
4
+ version: 0.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - wtnabe
9
8
  autorequire:
10
- bindir: bin
9
+ bindir: exe
11
10
  cert_chain: []
12
- date: 2011-12-29 00:00:00.000000000Z
11
+ date: 2016-08-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: rspec
16
- requirement: &3875330 !ruby/object:Gem::Requirement
17
- none: false
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '0'
19
+ version: '1.12'
22
20
  type: :development
23
21
  prerelease: false
24
- version_requirements: *3875330
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
25
27
  - !ruby/object:Gem::Dependency
26
- name: rr
27
- requirement: &3875090 !ruby/object:Gem::Requirement
28
- none: false
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - "~>"
31
32
  - !ruby/object:Gem::Version
32
- version: '0'
33
+ version: '10.0'
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *3875090
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
36
41
  - !ruby/object:Gem::Dependency
37
- name: bundler
38
- requirement: &3874790 !ruby/object:Gem::Requirement
39
- none: false
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ! '>='
45
+ - - ">="
42
46
  - !ruby/object:Gem::Version
43
47
  version: '0'
44
48
  type: :development
45
49
  prerelease: false
46
- version_requirements: *3874790
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
47
55
  - !ruby/object:Gem::Dependency
48
- name: jeweler
49
- requirement: &3874490 !ruby/object:Gem::Requirement
50
- none: false
56
+ name: rr
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ! '>='
59
+ - - ">="
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  type: :development
56
63
  prerelease: false
57
- version_requirements: *3874490
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
58
69
  - !ruby/object:Gem::Dependency
59
- name: rcov
60
- requirement: &3874190 !ruby/object:Gem::Requirement
61
- none: false
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
62
72
  requirements:
63
- - - ! '>='
73
+ - - ">="
64
74
  - !ruby/object:Gem::Version
65
75
  version: '0'
66
76
  type: :development
67
77
  prerelease: false
68
- version_requirements: *3874190
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: parse and inspect RTM's estimate time
70
- email: wtnabe@gmail.com
84
+ email:
85
+ - wtnabe@gmail.com
71
86
  executables: []
72
87
  extensions: []
73
- extra_rdoc_files:
74
- - LICENSE.txt
75
- - README.rdoc
88
+ extra_rdoc_files: []
76
89
  files:
77
- - .document
78
- - .rspec
90
+ - ".document"
91
+ - ".gitignore"
92
+ - ".rspec"
79
93
  - Gemfile
80
- - Gemfile.lock
81
94
  - LICENSE.txt
82
95
  - README.rdoc
83
96
  - Rakefile
84
- - VERSION
97
+ - bin/console
98
+ - bin/setup
85
99
  - lib/rtm-time.rb
86
100
  - lib/rtm_time.rb
87
101
  - lib/rtm_time/estimate/en.rb
88
102
  - lib/rtm_time/estimate/ja.rb
89
103
  - lib/rtm_time/iso8601.rb
90
- - spec/rtm_time/en_spec.rb
91
- - spec/rtm_time/iso8601_spec.rb
92
- - spec/rtm_time/ja_spec.rb
93
- - spec/spec_helper.rb
104
+ - lib/rtm_time/version.rb
105
+ - rtm-time.gemspec
94
106
  - tasks/git.rake
95
- homepage: http://github.com/wtnabe/rtm-time
96
- licenses:
97
- - BSD
107
+ homepage: https://github.com/wtnabe/rtm-time
108
+ licenses: []
109
+ metadata: {}
98
110
  post_install_message:
99
111
  rdoc_options: []
100
112
  require_paths:
101
113
  - lib
102
114
  required_ruby_version: !ruby/object:Gem::Requirement
103
- none: false
104
115
  requirements:
105
- - - ! '>='
116
+ - - ">="
106
117
  - !ruby/object:Gem::Version
107
118
  version: '0'
108
- segments:
109
- - 0
110
- hash: 244705713
111
119
  required_rubygems_version: !ruby/object:Gem::Requirement
112
- none: false
113
120
  requirements:
114
- - - ! '>='
121
+ - - ">="
115
122
  - !ruby/object:Gem::Version
116
123
  version: '0'
117
124
  requirements: []
118
125
  rubyforge_project:
119
- rubygems_version: 1.8.6
126
+ rubygems_version: 2.4.5.1
120
127
  signing_key:
121
- specification_version: 3
122
- summary: A parser for RTM's estimate time
128
+ specification_version: 4
129
+ summary: parse and inspect RTM's estimate time
123
130
  test_files: []
@@ -1,30 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- diff-lcs (1.1.3)
5
- git (1.2.5)
6
- jeweler (1.6.4)
7
- bundler (~> 1.0)
8
- git (>= 1.2.5)
9
- rake
10
- rake (0.9.2.2)
11
- rcov (0.9.11)
12
- rr (1.0.4)
13
- rspec (2.7.0)
14
- rspec-core (~> 2.7.0)
15
- rspec-expectations (~> 2.7.0)
16
- rspec-mocks (~> 2.7.0)
17
- rspec-core (2.7.1)
18
- rspec-expectations (2.7.0)
19
- diff-lcs (~> 1.1.2)
20
- rspec-mocks (2.7.0)
21
-
22
- PLATFORMS
23
- ruby
24
-
25
- DEPENDENCIES
26
- bundler
27
- jeweler
28
- rcov
29
- rr
30
- rspec
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.0
@@ -1,82 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
3
-
4
- describe RtmTime::En do
5
- describe 'only integer' do
6
- context '2h15m' do
7
- subject {
8
- RtmTime::En.parse( '2h15m' )
9
- }
10
- it {
11
- subject.to_hash.should == {:day => 0, :hour => 2, :min => 15}
12
- }
13
- it {
14
- subject.to_a.should == [0, 2, 15]
15
- }
16
- end
17
-
18
- context ' 2 hrs 15 min ' do
19
- subject {
20
- RtmTime::En.parse( ' 2 hrs 15 min ' )
21
- }
22
- it {
23
- subject.to_h.should == {:day => 0, :hour => 2, :min => 15}
24
- }
25
- it {
26
- subject.to_a.should == [0, 2, 15]
27
- }
28
- end
29
-
30
- context '1d 2h' do
31
- subject {
32
- RtmTime::En.parse('1d 2h')
33
- }
34
- it {
35
- subject.to_h.should == {:day => 1, :hour => 2, :min => 0}
36
- }
37
- it {
38
- subject.to_a.should == [1, 2, 0]
39
- }
40
- end
41
- end
42
-
43
- describe 'float' do
44
- context '1.2h' do
45
- subject {
46
- RtmTime::En.parse( '1.2h' ).to_h
47
- }
48
- it {
49
- should == {:day => 0, :hour => 1, :min => 12}
50
- }
51
- end
52
-
53
- context '1h' do
54
- subject {
55
- RtmTime::En.parse( '1h' ).to_h
56
- }
57
- it {
58
- should == {:day => 0, :hour => 1, :min => 0}
59
- }
60
- end
61
-
62
- context '10m 1.5h ' do
63
- subject {
64
- RtmTime::En.parse( '10m 1.5h ' ).to_h
65
- }
66
- it {
67
- should = {:day => 0, :hour => 1, :min => 40}
68
- }
69
- end
70
- end
71
-
72
- describe 'unsupported' do
73
- context '1.2時間' do
74
- subject {
75
- RtmTime::En.parse( '1.2時間' ).to_h
76
- }
77
- it {
78
- should == {:day => 0, :hour => 0, :min => 0}
79
- }
80
- end
81
- end
82
- end
@@ -1,58 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe RtmTime do
4
- describe 'iso8601' do
5
- before {
6
- ENV['TZ'] = 'JST-9'
7
- }
8
-
9
- context 'with no args' do
10
- subject {
11
- RtmTime.iso8601
12
- }
13
- it {
14
- should == Time.now.utc.iso8601
15
- }
16
- end
17
- context 'with string' do
18
- subject {
19
- RtmTime.iso8601( '2011-12-01' )
20
- }
21
- it {
22
- should == '2011-11-30T15:00:00Z'
23
- }
24
- end
25
- context 'with integer' do
26
- subject {
27
- RtmTime.iso8601(1322665200)
28
- }
29
- it {
30
- should == '2011-11-30T15:00:00Z'
31
- }
32
- end
33
- context 'with time object' do
34
- subject {
35
- RtmTime.iso8601(Time.parse('2011-12-01'))
36
- }
37
- it {
38
- should == '2011-11-30T15:00:00Z'
39
- }
40
- end
41
- context 'with other object respond_to :to_time' do
42
- subject {
43
- RtmTime.iso8601(Date.parse('2011-12-01'))
44
- }
45
- it {
46
- should == '2011-11-30T15:00:00Z'
47
- }
48
- end
49
- context 'with other object not respond_to :to_time' do
50
- subject {
51
- RtmTime.iso8601( %w(2011-12-01) )
52
- }
53
- it {
54
- lambda { subject }.should raise_error(RtmTime::InvalidTime)
55
- }
56
- end
57
- end
58
- end
@@ -1,34 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
3
-
4
- describe RtmTime::Ja do
5
- describe 'onle integer' do
6
- context '2時間および15分' do
7
- subject {
8
- RtmTime::Ja.parse( '2時間および15分' ).to_h
9
- }
10
- it {
11
- should == {:day => 0, :hour => 2 , :min => 15}
12
- }
13
- end
14
-
15
- context '15分と2時間' do
16
- subject {
17
- RtmTime::Ja.parse( '15分と2時間' ).to_h
18
- }
19
- it {
20
- should == {:day => 0, :hour => 2, :min => 15}
21
- }
22
- end
23
-
24
- context '8h分と2m時間' do
25
- subject {
26
- RtmTime::Ja.parse( '8h分と2時間m' ).to_h
27
- }
28
- # first in
29
- it {
30
- should == {:day => 0, :hour => 8, :min => 0}
31
- }
32
- end
33
- end
34
- end
@@ -1,12 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
- require 'rspec'
4
- require 'rtm-time'
5
-
6
- # Requires supporting files with custom matchers and macros, etc,
7
- # in ./support/ and its subdirectories.
8
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
-
10
- RSpec.configure do |config|
11
- config.mock_with :rr
12
- end