timer 0.2 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7e707efa2b6a2d8f76a47ec74549db9c4f0d4d7f
4
- data.tar.gz: 37317d1f4122e99e38a68b9d82dc8b873726ddc1
2
+ SHA256:
3
+ metadata.gz: d14a0565d017071e4fe031695184c65f1d561f81309c7dbad3178d13491ff177
4
+ data.tar.gz: b8a8bc6909ee7ef3a8866a0d2701b75e4ba9e3f7b1220810ca2b989d11a76267
5
5
  SHA512:
6
- metadata.gz: 1435e5c0214e51a2f8a0819716e7c9f59f6d1ba714ade3ddb84786575c50c19ff5f2d7b024823663ed120086257da17f32ec10d00d3fb3b592d55ed35e75bc28
7
- data.tar.gz: efec1857aa48d6c361a8b726bf41cb0aa3e7572a7b3294afae9abea6a722cd974c42efc6f771c9c818d61af75da7df5767d5dcf53c9dee1a5485d0fd5e18b22e
6
+ metadata.gz: 2c75ba50d98a6a06ee4da1c6a09182060839ae068c8a83fac23f0403eb28829436f9029ffcccaaffe689b84cb61241b188980bcb625e0a59a9281a639528f16e
7
+ data.tar.gz: 6fead0c6a40326961572139ee7bde8d8b5ab82c4906e7a7a6a0d7279612c0404e3c680e4cf0504fc6bddf28d7a44ed6c7489b1b635e7846950992d274d01d06d
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler -v 1.16.1
data/Gemfile CHANGED
@@ -1,9 +1,6 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
- gem "activesupport", :require => "active_support"
4
- gem "natural_time", ">= 0"
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
4
 
6
- group :test do
7
- gem "rspec", ">= 0"
8
- gem "timecop", ">= 0"
9
- end
5
+ # Specify your gem's dependencies in timer.gemspec
6
+ gemspec
@@ -0,0 +1,52 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ timer (0.3.0)
5
+ natural_time (~> 0.3.0)
6
+ timecop (~> 0.9.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (5.1.4)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (~> 0.7)
14
+ minitest (~> 5.1)
15
+ tzinfo (~> 1.1)
16
+ concurrent-ruby (1.0.5)
17
+ diff-lcs (1.3)
18
+ i18n (0.9.1)
19
+ concurrent-ruby (~> 1.0)
20
+ minitest (5.11.0)
21
+ natural_time (0.3.0)
22
+ activesupport (~> 5.1.4)
23
+ rake (10.5.0)
24
+ rspec (3.7.0)
25
+ rspec-core (~> 3.7.0)
26
+ rspec-expectations (~> 3.7.0)
27
+ rspec-mocks (~> 3.7.0)
28
+ rspec-core (3.7.0)
29
+ rspec-support (~> 3.7.0)
30
+ rspec-expectations (3.7.0)
31
+ diff-lcs (>= 1.2.0, < 2.0)
32
+ rspec-support (~> 3.7.0)
33
+ rspec-mocks (3.7.0)
34
+ diff-lcs (>= 1.2.0, < 2.0)
35
+ rspec-support (~> 3.7.0)
36
+ rspec-support (3.7.0)
37
+ thread_safe (0.3.6)
38
+ timecop (0.9.1)
39
+ tzinfo (1.2.4)
40
+ thread_safe (~> 0.1)
41
+
42
+ PLATFORMS
43
+ ruby
44
+
45
+ DEPENDENCIES
46
+ bundler (~> 1.16)
47
+ rake (~> 10.0)
48
+ rspec (~> 3.0)
49
+ timer!
50
+
51
+ BUNDLED WITH
52
+ 1.16.1
@@ -1,8 +1,11 @@
1
- == 0.1.5 2010-01-16
1
+ ## 0.3.0 2018-01-02
2
+ * update gem to more recent dependencies
3
+
4
+ ## 0.1.5 2010-01-16
2
5
  * minor enhancements
3
6
  * when an exception occurs during a timed block, output the exception message
4
7
 
5
- == 0.1.4 2010-01-13
8
+ ## 0.1.4 2010-01-13
6
9
  * minor enhancements
7
10
  * extracted natural time output into 'natural_time' gem
8
11
  * when an exception occurs during a timed block, output the elapsed time and re-raise
@@ -1,20 +1,20 @@
1
- = timer
1
+ # Timer
2
2
 
3
3
  Simple timer to display elapsed time of a block.
4
4
 
5
- == Usage
5
+ ## Usage
6
6
 
7
- 1. Instantiate timer with optional Growl message timer.
7
+ Instantiate timer with optional Growl message timer.
8
8
 
9
- timer = Timer.new(:title => "My Timer")
9
+ timer = Timer.new(:title => "My Timer")
10
10
 
11
- 2. Call the timer with a block and optional message to output.
11
+ Call the timer with a block and optional message to output.
12
12
 
13
- timer.time("The block has finished executing!") do
14
- # some code in here
15
- end
13
+ timer.time("The block has finished executing!") do
14
+ # some code in here
15
+ end
16
16
 
17
- == Note on Patches/Pull Requests
17
+ ## Note on Patches/Pull Requests
18
18
 
19
19
  * Fork the project.
20
20
  * Make your feature addition or bug fix.
@@ -24,6 +24,6 @@ Simple timer to display elapsed time of a block.
24
24
  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
25
25
  * Send me a pull request. Bonus points for topic branches.
26
26
 
27
- == Copyright
27
+ ## Copyright
28
28
 
29
- Copyright (c) 2013 Isaac Priestley. See LICENSE for details.
29
+ Copyright (c) 2018 Isaac Priestley. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,2 +1,6 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "timer"
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(__FILE__)
@@ -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
@@ -1,5 +1,5 @@
1
- require 'rubygems'
2
- require 'natural_time'
1
+ require "timer/version"
2
+ require "natural_time"
3
3
 
4
4
  class Timer
5
5
  attr_accessor :title
@@ -0,0 +1,3 @@
1
+ class Timer
2
+ VERSION = "0.3.0"
3
+ end
@@ -1,50 +1,28 @@
1
- Gem::Specification.new do |s|
2
- s.name = %q{timer}
3
- s.version = "0.2"
4
1
 
5
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
- s.authors = ["Isaac Priestley"]
7
- s.date = %q{2013-10-14}
8
- s.description = %q{Simple timer to perform a block and display the elapsed time.}
9
- s.email = %q{progressions@gmail.com}
10
- s.extra_rdoc_files = [
11
- "LICENSE",
12
- "README.rdoc"
13
- ]
14
- s.files = [
15
- ".document",
16
- "Gemfile",
17
- "History.txt",
18
- "LICENSE",
19
- "README.rdoc",
20
- "Rakefile",
21
- "VERSION",
22
- "lib/timer.rb",
23
- "spec/timer_spec.rb",
24
- "timer.gemspec"
25
- ]
26
- s.homepage = %q{http://github.com/progressions/timer}
27
- s.require_paths = ["lib"]
28
- s.rubygems_version = %q{1.3.7}
29
- s.summary = %q{Simple timer to perform a block and display the elapsed time}
30
- s.test_files = [
31
- "spec/timer_spec.rb"
32
- ]
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "timer/version"
33
5
 
34
- if s.respond_to? :specification_version then
35
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
36
- s.specification_version = 3
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "timer"
8
+ spec.version = Timer::VERSION
9
+ spec.authors = ["Isaac Priestley"]
10
+ spec.email = ["progressions@gmail.com"]
37
11
 
38
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
39
- s.add_runtime_dependency(%q<activesupport>, [">= 0"])
40
- s.add_runtime_dependency(%q<natural_time>, [">= 0"])
41
- else
42
- s.add_dependency(%q<activesupport>, [">= 0"])
43
- s.add_dependency(%q<natural_time>, [">= 0"])
44
- end
45
- else
46
- s.add_dependency(%q<activesupport>, [">= 0"])
47
- s.add_dependency(%q<natural_time>, [">= 0"])
12
+ spec.summary = %q{Simple timer to perform a block and display the elapsed time}
13
+ spec.description = %q{Simple timer to perform a block and display the elapsed time.}
14
+ spec.homepage = %q{http://github.com/progressions/timer}
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
48
18
  end
49
- end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
50
22
 
23
+ spec.add_development_dependency "bundler", "~> 1.16"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec", "~> 3.0"
26
+ spec.add_dependency "natural_time", "~> 0.3.0"
27
+ spec.add_dependency "timecop", "~> 0.9.1"
28
+ end
metadata CHANGED
@@ -1,60 +1,104 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timer
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Isaac Priestley
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2013-10-14 00:00:00.000000000 Z
11
+ date: 2018-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activesupport
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
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
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
21
49
  prerelease: false
22
50
  version_requirements: !ruby/object:Gem::Requirement
23
51
  requirements:
24
- - - '>='
52
+ - - "~>"
25
53
  - !ruby/object:Gem::Version
26
- version: '0'
54
+ version: '3.0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: natural_time
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
- - - '>='
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.3.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.3.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: timecop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
32
74
  - !ruby/object:Gem::Version
33
- version: '0'
75
+ version: 0.9.1
34
76
  type: :runtime
35
77
  prerelease: false
36
78
  version_requirements: !ruby/object:Gem::Requirement
37
79
  requirements:
38
- - - '>='
80
+ - - "~>"
39
81
  - !ruby/object:Gem::Version
40
- version: '0'
82
+ version: 0.9.1
41
83
  description: Simple timer to perform a block and display the elapsed time.
42
- email: progressions@gmail.com
84
+ email:
85
+ - progressions@gmail.com
43
86
  executables: []
44
87
  extensions: []
45
- extra_rdoc_files:
46
- - LICENSE
47
- - README.rdoc
88
+ extra_rdoc_files: []
48
89
  files:
49
- - .document
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".travis.yml"
50
93
  - Gemfile
51
- - History.txt
52
- - LICENSE
53
- - README.rdoc
94
+ - Gemfile.lock
95
+ - History.md
96
+ - README.md
54
97
  - Rakefile
55
- - VERSION
98
+ - bin/console
99
+ - bin/setup
56
100
  - lib/timer.rb
57
- - spec/timer_spec.rb
101
+ - lib/timer/version.rb
58
102
  - timer.gemspec
59
103
  homepage: http://github.com/progressions/timer
60
104
  licenses: []
@@ -65,19 +109,18 @@ require_paths:
65
109
  - lib
66
110
  required_ruby_version: !ruby/object:Gem::Requirement
67
111
  requirements:
68
- - - '>='
112
+ - - ">="
69
113
  - !ruby/object:Gem::Version
70
114
  version: '0'
71
115
  required_rubygems_version: !ruby/object:Gem::Requirement
72
116
  requirements:
73
- - - '>='
117
+ - - ">="
74
118
  - !ruby/object:Gem::Version
75
119
  version: '0'
76
120
  requirements: []
77
121
  rubyforge_project:
78
- rubygems_version: 2.0.6
122
+ rubygems_version: 2.7.3
79
123
  signing_key:
80
- specification_version: 3
124
+ specification_version: 4
81
125
  summary: Simple timer to perform a block and display the elapsed time
82
- test_files:
83
- - spec/timer_spec.rb
126
+ test_files: []
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2009 Jeff Coleman
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.6
@@ -1,167 +0,0 @@
1
- $:.unshift File.dirname(__FILE__) + '/../lib'
2
- require 'rubygems'
3
- require 'timecop'
4
- require 'timer'
5
-
6
- describe "Timer" do
7
- before do
8
- $stdout.stub!(:puts).as_null_object
9
- @g = Object.new
10
- Growl.stub(:new).and_return(@g)
11
- @g.stub(:notify).as_null_object
12
- end
13
-
14
- describe "growl" do
15
- it "should growl a message" do
16
- @g.should_receive(:notify).with(anything, anything, /hello/, anything, anything)
17
- Timer.new.time("hello") do
18
- x = 1
19
- end
20
- end
21
-
22
- it "should growl a title" do
23
- @g.should_receive(:notify).with(anything, /word/, anything, anything, anything)
24
- Timer.new(:title => "word").time("hello") do
25
- x = 1
26
- end
27
- end
28
-
29
- it "should turn off growl" do
30
- @timer = Timer.new(:growl => false)
31
- @timer.growl?.should be_false
32
- end
33
-
34
- it "shouldn't growl a message" do
35
- Growl.should_not_receive(:new)
36
- Timer.new(:growl => false).time("hello") do
37
- x = 1
38
- end
39
- end
40
-
41
- it "should fail gracefully if growl is off" do
42
- @g.should_receive(:notify).and_raise("Connection refused: send(2)")
43
- lambda {
44
- Timer.new.time("hello") do
45
- x = 1
46
- end
47
- }.should_not raise_error
48
- end
49
-
50
- it "should raise other exceptions" do
51
- @g.should_receive(:notify).and_raise("Something else")
52
- lambda {
53
- Timer.new.time("hello") do
54
- x = 1
55
- end
56
- }.should raise_error("Something else")
57
- end
58
- end
59
-
60
- it "should put a message" do
61
- $stdout.should_receive(:puts).with(/hello/)
62
- Timer.new.time("hello") do
63
- x = 1
64
- end
65
- end
66
-
67
- describe "title" do
68
- it "should set the title" do
69
- Timer.new(:title => "YO").title.should == "YO"
70
- end
71
-
72
- it "shuld reset the title" do
73
- @timer = Timer.new(:title => "YO")
74
- @timer.title = "HEY"
75
- @timer.title.should == "HEY"
76
- end
77
-
78
- it "should override the title" do
79
- @g.should_receive(:notify).with(anything, /YEAH/, anything, anything, anything)
80
- @timer = Timer.new(:title => "word")
81
- @timer.time("hello", :title => "YEAH") do
82
- x = 1
83
- end
84
- end
85
- end
86
-
87
- describe "raising exceptions" do
88
- before(:each) do
89
- @timer = Timer.new
90
- end
91
-
92
- it "should re-raise an exception" do
93
- lambda {
94
- @timer.time("hello") do
95
- raise "Exception"
96
- end
97
- }.should raise_error("Exception")
98
- end
99
-
100
- it "should growl a message" do
101
- @g.should_receive(:notify).with(anything, anything, /hello/, anything, anything)
102
- lambda {
103
- @timer.time("hello") do
104
- raise "Exception"
105
- end
106
- }.should raise_error("Exception")
107
- end
108
-
109
- it "should growl a title" do
110
- @g.should_receive(:notify).with(anything, /word/, anything, anything, anything)
111
- lambda {
112
- Timer.new(:title => "word").time("hello") do
113
- raise "Exception"
114
- end
115
- }.should raise_error("Exception")
116
- end
117
-
118
- it "should put the exception" do
119
- $stdout.should_receive(:puts).with(/Exception/)
120
- lambda {
121
- @timer.time("hello") do
122
- raise "Exception"
123
- end
124
- }.should raise_error("Exception")
125
- end
126
-
127
- it "should report elapsed time" do
128
- Timecop.return
129
- @g.should_receive(:notify).with(anything, anything, /Elapsed time: 2 minutes\"\n$/, anything, anything)
130
- lambda {
131
- @timer.time("hello") do
132
- Timecop.freeze(Time.now + 120)
133
- raise "Exception"
134
- end
135
- }.should raise_error("Exception")
136
- Timecop.return
137
- end
138
- end
139
-
140
- describe "timing the action" do
141
- before(:each) do
142
- Timecop.return
143
- @timer = Timer.new
144
- end
145
-
146
- it "should report seconds" do
147
- @g.should_receive(:notify).with(anything, anything, /Elapsed time: 3 seconds\"\n$/, anything, anything)
148
- @timer.time("hello") do
149
- Timecop.freeze(Time.now + 3)
150
- end
151
- end
152
-
153
- it "should report only minutes when it's even" do
154
- @g.should_receive(:notify).with(anything, anything, /Elapsed time: 2 minutes\"\n$/, anything, anything)
155
- @timer.time("hello") do
156
- Timecop.freeze(Time.now + 120)
157
- end
158
- end
159
-
160
- it "should report minutes and seconds" do
161
- @g.should_receive(:notify).with(anything, anything, /Elapsed time: 1 minute and 14 seconds\"\n$/, anything, anything)
162
- @timer.time("hello") do
163
- Timecop.freeze(Time.now + 74)
164
- end
165
- end
166
- end
167
- end