rake-benchmark 1.0.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 +15 -0
- data/.gitignore +17 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +58 -0
- data/Rakefile +7 -0
- data/lib/rake/benchmark.rb +14 -0
- data/lib/rake/benchmark/version.rb +5 -0
- data/rake-benchmark.gemspec +30 -0
- data/spec/rake_benchmark_spec.rb +15 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/tasks/benchmarked.rake +4 -0
- metadata +172 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YzY3Mzk3YjA0MzU1ZDRhNTk3MzkyYzQ1ODE4M2U4MDFjNTM1NDI5Mw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NjdmN2I2YTFkNTBhMGJjMzk4NzQwMDNhYjcxMzRmMmFkMjAwMTA4Mw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZmM1YTY0MTAxOTAxNGE3NjRiOGI3M2MzMmFlMTEwY2MxYWQ4YTA4MDgxMjcz
|
10
|
+
MzAxMzA3Y2Y2NTI0MGE0NzljOGZjZGQ4MDU0MjUzNTY0NDc1YzU2ZWU1ZjA3
|
11
|
+
ZDY4ODk0N2VjNjkwZTk3NGNiZmUxYzAxYjQ1NzQ2Y2VjNTAwNWY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YzVkYjIyMDNiYTFjYWEyZjdlOGExZDJiNjE1MTU0YmY1OWJhZTEwMmM5MzAw
|
14
|
+
Yzc3OGNlMzE0MjVmMGMxYzM5ZjM2ZmUxMmYwY2EzZDUwZGVmMTU2OTFmNjhh
|
15
|
+
MTNhZGEzN2Q5MmVlYzQ0YWFlNGZlYjQ2NGNhNTdiY2UxMjEwYjY=
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Eric Marden
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Rake::Benchmark
|
2
|
+
|
3
|
+
Intercepts all calls to `Rake::Task.execute` and wraps them with `Benchmark`, outputting the timing informtion after the rake task completes.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add it to your Gemfile:
|
8
|
+
|
9
|
+
gem 'rake-benchmark', require: false
|
10
|
+
|
11
|
+
And install it:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Then, require it in your `Rakefile` like this:
|
16
|
+
|
17
|
+
require 'rake/benchmark'
|
18
|
+
|
19
|
+
|
20
|
+
## Example Rakefile
|
21
|
+
|
22
|
+
````ruby
|
23
|
+
#!/usr/bin/env rake
|
24
|
+
require 'rake/benchmark'
|
25
|
+
|
26
|
+
desc "A sleepy rake task"
|
27
|
+
task :sleepy do
|
28
|
+
puts "zzZZZzz"
|
29
|
+
sleep(3)
|
30
|
+
end
|
31
|
+
````
|
32
|
+
|
33
|
+
#### Outputs:
|
34
|
+
|
35
|
+
$ rake sleepy
|
36
|
+
zzZZZzz
|
37
|
+
sleepy --> 0.000000 0.000000 0.000000 ( 3.001075)
|
38
|
+
|
39
|
+
|
40
|
+
## Project Status
|
41
|
+
|
42
|
+
- Build: [](https://travis-ci.org/styleseek/rake-benchmark)
|
43
|
+
- Code Quality: [](https://codeclimate.com/github/styleseek/rake-benchmark)
|
44
|
+
- Dependencies: [](https://gemnasium.com/styleseek/rake-benchmark)
|
45
|
+
|
46
|
+
|
47
|
+
## Special Thanks
|
48
|
+
|
49
|
+
Inspired by a [blog post](http://darwinweb.net/articles/benchmarking-rake-tasks-and-trivial-rails-testing-) by [Gabe de Silveira](https://github.com/gtd).
|
50
|
+
|
51
|
+
|
52
|
+
## Contributing
|
53
|
+
|
54
|
+
1. Fork it
|
55
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
56
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
57
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
58
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'benchmark'
|
3
|
+
require "rake/benchmark/version"
|
4
|
+
|
5
|
+
class Rake::Task
|
6
|
+
def execute_with_benchmark(*args)
|
7
|
+
bench = Benchmark.measure do
|
8
|
+
execute_without_benchmark(*args)
|
9
|
+
end
|
10
|
+
puts " #{name} --> #{bench}"
|
11
|
+
end
|
12
|
+
alias_method :execute_without_benchmark, :execute
|
13
|
+
alias_method :execute, :execute_with_benchmark
|
14
|
+
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 'rake/benchmark/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "rake-benchmark"
|
8
|
+
gem.version = Rake::Benchmark::VERSION
|
9
|
+
gem.authors = ["StyleSeek Engineering"]
|
10
|
+
gem.email = ["engineering@styleseek.com"]
|
11
|
+
gem.description = %q{Benchmarks your rake tasks and automatically outputs the timing information after it completes.}
|
12
|
+
gem.summary = %q{Benchmark your Rake tasks.}
|
13
|
+
gem.homepage = "https://github.com/styleseek/rake-benchmark"
|
14
|
+
gem.license = "MIT"
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
gem.test_files = gem.files.grep(%r{^(spec)/})
|
19
|
+
gem.require_paths = ["lib"]
|
20
|
+
|
21
|
+
gem.add_dependency "rake"
|
22
|
+
|
23
|
+
gem.add_development_dependency('bundler', '~> 1.3')
|
24
|
+
gem.add_development_dependency('minitest', '~> 4.2')
|
25
|
+
gem.add_development_dependency('ansi', '~> 1.4')
|
26
|
+
gem.add_development_dependency('turn', '~> 0.9')
|
27
|
+
gem.add_development_dependency('pry', '~> 0.9')
|
28
|
+
gem.add_development_dependency('mocha', '~> 0.13')
|
29
|
+
gem.add_development_dependency('gem-release', '~> 0.4')
|
30
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rake::Benchmark do
|
4
|
+
before do
|
5
|
+
@rake = Rake::Application.new
|
6
|
+
Rake.application = @rake
|
7
|
+
Rake.application.rake_require "tasks/benchmarked"
|
8
|
+
end
|
9
|
+
|
10
|
+
it "can output benchmark information" do
|
11
|
+
capture_stdout do
|
12
|
+
@rake['benchmarked'].execute
|
13
|
+
end.must_match ' benchmarked --> '
|
14
|
+
end
|
15
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
require 'rake/benchmark'
|
3
|
+
begin; require 'turn/autorun'; rescue LoadError; end
|
4
|
+
Turn.config do |c|
|
5
|
+
c.natural = true
|
6
|
+
c.ansi = true
|
7
|
+
c.format = :pretty
|
8
|
+
end
|
9
|
+
|
10
|
+
def capture_stdout
|
11
|
+
buffer = StringIO.new
|
12
|
+
$stdout = buffer
|
13
|
+
yield
|
14
|
+
$stdout = STDOUT
|
15
|
+
buffer.rewind
|
16
|
+
buffer.string
|
17
|
+
end
|
18
|
+
|
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rake-benchmark
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- StyleSeek Engineering
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-04-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
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'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: ansi
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.4'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: turn
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.9'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.9'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.9'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.9'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: mocha
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.13'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.13'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: gem-release
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.4'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.4'
|
125
|
+
description: Benchmarks your rake tasks and automatically outputs the timing information
|
126
|
+
after it completes.
|
127
|
+
email:
|
128
|
+
- engineering@styleseek.com
|
129
|
+
executables: []
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- .gitignore
|
134
|
+
- .travis.yml
|
135
|
+
- Gemfile
|
136
|
+
- LICENSE.txt
|
137
|
+
- README.md
|
138
|
+
- Rakefile
|
139
|
+
- lib/rake/benchmark.rb
|
140
|
+
- lib/rake/benchmark/version.rb
|
141
|
+
- rake-benchmark.gemspec
|
142
|
+
- spec/rake_benchmark_spec.rb
|
143
|
+
- spec/spec_helper.rb
|
144
|
+
- spec/tasks/benchmarked.rake
|
145
|
+
homepage: https://github.com/styleseek/rake-benchmark
|
146
|
+
licenses:
|
147
|
+
- MIT
|
148
|
+
metadata: {}
|
149
|
+
post_install_message:
|
150
|
+
rdoc_options: []
|
151
|
+
require_paths:
|
152
|
+
- lib
|
153
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - ! '>='
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
163
|
+
requirements: []
|
164
|
+
rubyforge_project:
|
165
|
+
rubygems_version: 2.0.3
|
166
|
+
signing_key:
|
167
|
+
specification_version: 4
|
168
|
+
summary: Benchmark your Rake tasks.
|
169
|
+
test_files:
|
170
|
+
- spec/rake_benchmark_spec.rb
|
171
|
+
- spec/spec_helper.rb
|
172
|
+
- spec/tasks/benchmarked.rake
|