rake_report 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 +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +42 -0
- data/Rakefile +8 -0
- data/lib/rake_report.rb +38 -0
- data/lib/rake_report/override.rb +22 -0
- data/lib/rake_report/template.rb +64 -0
- data/lib/rake_report/version.rb +3 -0
- data/rake_report.gemspec +23 -0
- metadata +111 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 582c706a204224045d68a5198235d991df33a893
|
4
|
+
data.tar.gz: a4b6bc79eaeeeecdc640e785490b0e296559094b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6691a3e8f13db4b29df9452ef187456283e8638556459bcc2ffe5b3f2cb31ef99dbbd0ee316dcfb96f2c34ebaf878e793d477e0c795ec12040b1d651524fd415
|
7
|
+
data.tar.gz: 4e0efb7e3899d5a8372f9a943c99505b6e118da64385523be33e1db457058ea504c9cb4ee5466caf78b2d4ab42710a1154118a235ca0bb1239aea929324dae49
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Steve Adams
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# RakeReport
|
2
|
+
|
3
|
+
Generates timeline reports of rake runs. Useful for debugging parallelization
|
4
|
+
and performance issues in complex rake configurations
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'rake_report'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install rake_report
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Add the following two lines to the top of your Rakefile:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require 'rake_report'
|
28
|
+
RakeReport.html("rake_report_#{ARGV.join('_').gsub(/:/, '-')}.html")
|
29
|
+
```
|
30
|
+
|
31
|
+
Rake will then output an html file (rake_report_*.html) that includes a Google
|
32
|
+
DataTable formatted for the Timeline visualization API:
|
33
|
+
|
34
|
+
https://developers.google.com/chart/interactive/docs/gallery/timeline#data-format
|
35
|
+
|
36
|
+
## Contributing
|
37
|
+
|
38
|
+
1. Fork it ( https://github.com/optimizely/rake_report/fork )
|
39
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
40
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
41
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
42
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/lib/rake_report.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake_report/version'
|
4
|
+
require 'rake_report/template'
|
5
|
+
require 'rake_report/override'
|
6
|
+
|
7
|
+
module RakeReport
|
8
|
+
@@times ||= {
|
9
|
+
cols: [{label: 'task', type: 'string'},
|
10
|
+
{label: 'type', type: 'string'},
|
11
|
+
{label: 'start', type: 'datetime'},
|
12
|
+
{label: 'end', type: 'datetime'}],
|
13
|
+
rows: []
|
14
|
+
}
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def html(filename='rake_report.html')
|
18
|
+
at_exit do
|
19
|
+
RakeReportTemplate.new(@@times).save(filename)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def add_time(label, type, start, finish)
|
24
|
+
@@times[:rows].push({c:[{v:label},
|
25
|
+
{v:type},
|
26
|
+
{v:start.strftime("Date(%Y, %-m, %-d, %k, %M, %S, %L)")},
|
27
|
+
{v:finish.strftime("Date(%Y, %-m, %-d, %k, %M, %S, %L)")}]})
|
28
|
+
end
|
29
|
+
|
30
|
+
def times
|
31
|
+
@@times
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_json
|
35
|
+
JSON.generate(@@times)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Rake
|
2
|
+
class Task
|
3
|
+
def execute_with_time(*args)
|
4
|
+
start = Time.now
|
5
|
+
execute_without_time(*args)
|
6
|
+
finish = Time.now
|
7
|
+
RakeReport.add_time(name, 'execute', start, finish)
|
8
|
+
end
|
9
|
+
|
10
|
+
def invoke_with_time(*args)
|
11
|
+
start = Time.now
|
12
|
+
invoke_without_time(*args)
|
13
|
+
finish = Time.now
|
14
|
+
RakeReport.add_time(name, 'invoke', start, finish)
|
15
|
+
end
|
16
|
+
|
17
|
+
alias :execute_without_time :execute
|
18
|
+
alias :execute :execute_with_time
|
19
|
+
alias :invoke_without_time :invoke
|
20
|
+
alias :invoke :invoke_with_time
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
class RakeReportTemplate
|
4
|
+
attr_accessor :colors, :template, :timers
|
5
|
+
def initialize(timers)
|
6
|
+
@colors = %w(#50ABD2 #78B653 #CAD04F #ED913D #E8182E)
|
7
|
+
@template = template
|
8
|
+
@timers = timers
|
9
|
+
end
|
10
|
+
|
11
|
+
def template
|
12
|
+
%q{
|
13
|
+
<html>
|
14
|
+
<head>
|
15
|
+
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
16
|
+
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
17
|
+
<script type="text/javascript">
|
18
|
+
var jsonData = <%= timers.to_json %>;
|
19
|
+
|
20
|
+
google.load("visualization", "1", {packages:["timeline"]});
|
21
|
+
google.setOnLoadCallback(drawChart);
|
22
|
+
|
23
|
+
function drawChart() {
|
24
|
+
var dataTable = new google.visualization.DataTable(jsonData);
|
25
|
+
var container = document.getElementById('timeline');
|
26
|
+
var chart = new google.visualization.Timeline(container);
|
27
|
+
|
28
|
+
// If the number of rows exceeds the length of the color array
|
29
|
+
// the chart shows every row with the same color. This is prettier.
|
30
|
+
var color_palatte = <%= colors.to_json %>;
|
31
|
+
var colors = new Array();
|
32
|
+
for(var i=0; i < dataTable.getNumberOfRows(); i++) {
|
33
|
+
colors.push(color_palatte[i % color_palatte.length]);
|
34
|
+
}
|
35
|
+
var options = {
|
36
|
+
colors: colors,
|
37
|
+
timeline: {
|
38
|
+
showBarLabels: false,
|
39
|
+
colorByRowLabel: true,
|
40
|
+
groupByRowLabel: true
|
41
|
+
}
|
42
|
+
};
|
43
|
+
|
44
|
+
chart.draw(dataTable, options);
|
45
|
+
}
|
46
|
+
</script>
|
47
|
+
</head>
|
48
|
+
<body>
|
49
|
+
<div id="timeline" style="height: 100%"></div>
|
50
|
+
</body>
|
51
|
+
</html>
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
def render
|
56
|
+
ERB.new(@template).result(binding)
|
57
|
+
end
|
58
|
+
|
59
|
+
def save(file)
|
60
|
+
File.open(file, 'w') do |f|
|
61
|
+
f.write(render)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/rake_report.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rake_report/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rake_report"
|
8
|
+
spec.version = RakeReport::VERSION
|
9
|
+
spec.authors = ["Steve Adams"]
|
10
|
+
spec.email = ["steve.adams@optimizely.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Generate timing reports for rake tasks.}
|
13
|
+
spec.homepage = "https://github.com/optimizely/rake_report"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
20
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
21
|
+
spec.add_development_dependency "rspec", "~> 3.3.0"
|
22
|
+
spec.add_development_dependency "json-schema", "~> 2.5.1"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rake_report
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Steve Adams
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-06 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.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
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.3.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.3.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json-schema
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.5.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.5.1
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- steve.adams@optimizely.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- lib/rake_report.rb
|
83
|
+
- lib/rake_report/override.rb
|
84
|
+
- lib/rake_report/template.rb
|
85
|
+
- lib/rake_report/version.rb
|
86
|
+
- rake_report.gemspec
|
87
|
+
homepage: https://github.com/optimizely/rake_report
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.4.6
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: Generate timing reports for rake tasks.
|
111
|
+
test_files: []
|