mach5-tools 0.2.0 → 0.2.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: d531491376f7d66a0280e9383c5ad05cb2370ba1
4
- data.tar.gz: ed0e957e907164e64b17317f7ade8f8e09034433
3
+ metadata.gz: bc58b2a9854f51ce02d29f53e1da689596a8e053
4
+ data.tar.gz: eb535dcde3b1b2d4758f5411ffad2ec2f5d6fb6a
5
5
  SHA512:
6
- metadata.gz: 6bbfe9364b097465db0285a1ae7f2f0dd9beccba1613376783f3924ec2c5d0375ca244bc8f8f6281e50651c4cac2a954bad7ae36987f961a7e8a7e341fd59fcf
7
- data.tar.gz: 85c0f626d38a433c5df81684e4f90524cf7e0a3651a3ba0f1c5c5ab11f93bc3debac5343d922702153b0b12c14d0bf9df52c713252c28e9faef5ed3b21354733
6
+ metadata.gz: 70455af7983728b62d62d069b2a3d33e554c634d0bddb8314d32da6df1068a78359a6de9b18b5fe7b81ff51e2169eb0b7f1f3c367ac4326e80fc1950b57ac3dd
7
+ data.tar.gz: c8a15833738b4c640c54bb80272be3d25b5870cbfe0f33cd1103a2ec55f6ac77e45d107cf5a681e7ad0c5fe5403f648f840dd1ca36eb328cbf7d181f9e5506f0
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.3"
4
+ - "2.0.0"
5
+ script: bundle exec rake
data/TODO CHANGED
@@ -12,8 +12,12 @@ v0.2.0
12
12
  [x] mais opções para x_axis e y_axis
13
13
  [x] definir o tipo do grafico (line ou bar)
14
14
 
15
+ v0.2.1
16
+ [x] 100% cobertura de testes
17
+ [x] travis-ci
18
+ [x] refatorar
19
+ [x] BUG: quando não existe a pasta de output, "mach5 chart" quebra
20
+
15
21
  v0.3.0
16
22
  [ ] mach5 init (cria o Mach5file)
17
- [ ] mach5 generate benchmark filename benchmark1 benchmark2
18
- [ ] mach5 generate benchmark filename benchmark1 benchmark2 --fixture fixture_name
19
23
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -109,6 +109,7 @@ module Mach5
109
109
  chart.series.each do |benchmark|
110
110
  benchmarks << "#{benchmark[:commit_id]}.#{benchmark[:benchmark_id]}" unless File.exists?("#{File.join(@config.output_folder, benchmark[:commit_id])}.#{benchmark[:benchmark_id]}.json")
111
111
  end
112
+ benchmarks
112
113
  end
113
114
 
114
115
  def find_new_benchmarks(benchmarks, commit)
data/mach5-tools.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: mach5-tools 0.2.0 ruby lib
5
+ # stub: mach5-tools 0.2.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "mach5-tools"
9
- s.version = "0.2.0"
9
+ s.version = "0.2.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Igor Bonadio"]
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.files = [
23
23
  ".document",
24
24
  ".rspec",
25
+ ".travis.yml",
25
26
  "Gemfile",
26
27
  "Gemfile.lock",
27
28
  "LICENSE.txt",
@@ -3,8 +3,8 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  module Mach5
4
4
  describe Benchmark do
5
5
  before(:each) do
6
- @memory = double('Memory')
7
- @tags = double('Tags')
6
+ @memory = Hash.new
7
+ @tags = Hash.new
8
8
  @benchmark = Benchmark.new(@memory, @tags)
9
9
  end
10
10
 
@@ -31,5 +31,10 @@ module Mach5
31
31
  @tags.should_receive("[]=").with("v1.0.1", "ab7c4351a13b29ea4c21e3662f9f567ff19a854d")
32
32
  @benchmark.tag("ab7c4351a13b29ea4c21e3662f9f567ff19a854d", "v1.0.1")
33
33
  end
34
+
35
+ it "should verify if there is the given tag" do
36
+ @benchmark.tag("ab7c4351a13b29ea4c21e3662f9f567ff19a854d", "v1.0.1")
37
+ @benchmark.has_tag?("ab7c4351a13b29ea4c21e3662f9f567ff19a854d").should be == "v1.0.1"
38
+ end
34
39
  end
35
40
  end
data/spec/config_spec.rb CHANGED
@@ -71,11 +71,18 @@ module Mach5
71
71
  config = Mach5::configure("MyProject") do
72
72
  chart "viterbi_vs_pd" do
73
73
  title "Viterbi vs Posterior Decoding"
74
- add_serie "edd0982eed0c414631991aa1dea67c811d95373f" => "DishonestCasinoHMM.Viterbi"
74
+ add_serie "edd0982eed0c414631991aa1dea67c811d95373f" => "DishonestCasinoHMM.Viterbi" do
75
+ color "#00FF00"
76
+ label "Test"
77
+ end
75
78
  add_serie "edd0982eed0c414631991aa1dea67c811d95373f" => "DishonestCasinoHMM.PosteriorDecoding"
76
- x_axis "Sequence Size"
79
+ x_axis "Sequence Size" do
80
+ categories [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
81
+ end
77
82
  y_axis "Time (s)"
78
83
  size "100x200"
84
+ data_type "runs_total_time"
85
+ type "line"
79
86
  end
80
87
  output "_benchmark"
81
88
  end
@@ -93,7 +100,8 @@ module Mach5
93
100
  "xAxis" => {
94
101
  "title" => {
95
102
  "text" => "Sequence Size"
96
- }
103
+ },
104
+ "categories" => [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
97
105
  },
98
106
  "yAxis" => {
99
107
  "title" => {
@@ -101,8 +109,9 @@ module Mach5
101
109
  }
102
110
  },
103
111
  "series" => [{
104
- "label" => "edd0982eed0c414631991aa1dea67c811d95373f.DishonestCasinoHMM.Viterbi",
105
- "file" => "/_benchmark/edd0982eed0c414631991aa1dea67c811d95373f.DishonestCasinoHMM.Viterbi.json"
112
+ "label" => "Test",
113
+ "file" => "/_benchmark/edd0982eed0c414631991aa1dea67c811d95373f.DishonestCasinoHMM.Viterbi.json",
114
+ "color" => "#00FF00"
106
115
  },{
107
116
  "label" => "edd0982eed0c414631991aa1dea67c811d95373f.DishonestCasinoHMM.PosteriorDecoding",
108
117
  "file" => "/_benchmark/edd0982eed0c414631991aa1dea67c811d95373f.DishonestCasinoHMM.PosteriorDecoding.json"
data/spec/runner_spec.rb CHANGED
@@ -34,7 +34,16 @@ module Mach5
34
34
  chart "viterbi_vs_pd" do
35
35
  title "Viterbi vs Posterior Decoding"
36
36
  add_serie "v1.0.0" => "DishonestCasinoHMM.Viterbi"
37
- add_serie "edd0982eed0c414631991aa1dea67c811d95373f" => "DishonestCasinoHMM.PosteriorDecoding"
37
+ add_serie "c031c8e9afe1493a81274adbdb61b81bc30ef522" => "DishonestCasinoHMM.PosteriorDecoding"
38
+ x_axis "Sequence Size"
39
+ y_axis "Time (s)"
40
+ size "100x100"
41
+ end
42
+
43
+ chart "viterbi_vs_forward" do
44
+ title "Viterbi vs Posterior Forward"
45
+ add_serie "v1.0.0" => "DishonestCasinoHMM.Viterbi"
46
+ add_serie "c031c8e9afe1493a81274adbdb61b81bc30ef522" => "DishonestCasinoHMM.Forward"
38
47
  x_axis "Sequence Size"
39
48
  y_axis "Time (s)"
40
49
  size "100x100"
@@ -94,5 +103,59 @@ module Mach5
94
103
  @runner.should_receive(:after)
95
104
  @runner.benchmark({})
96
105
  end
106
+
107
+ it "should run only selected benchmarks" do
108
+ Kernel.should_receive(:system).with("git checkout c031c8e9afe1493a81274adbdb61b81bc30ef522")
109
+ @runner.should_receive(:before)
110
+ @runner.should_receive(:run).with(["DishonestCasinoHMM.PosteriorDecoding"]).and_return({})
111
+ @runner.should_receive(:after)
112
+ @runner.benchmark({only: ["c031c8e9afe1493a81274adbdb61b81bc30ef522.DishonestCasinoHMM.PosteriorDecoding"]})
113
+ end
114
+
115
+ it "should list benchmarks" do
116
+ @runner.list_benchmarks.should be == ["v1.0.0.DishonestCasinoHMM.Evaluate", "v1.0.0.DishonestCasinoHMM.Viterbi", "c031c8e9afe1493a81274adbdb61b81bc30ef522.DishonestCasinoHMM.Forward", "c031c8e9afe1493a81274adbdb61b81bc30ef522.DishonestCasinoHMM.Backward", "c031c8e9afe1493a81274adbdb61b81bc30ef522.DishonestCasinoHMM.PosteriorDecoding"]
117
+ end
118
+
119
+ it "should generate all charts" do
120
+ @runner.should_receive(:_generate_chart).twice
121
+ @runner.chart({all: true})
122
+ end
123
+
124
+ it "should generate only selected charts" do
125
+ @runner.should_receive(:_generate_chart)
126
+ @runner.chart({only: "viterbi_vs_pd"})
127
+ end
128
+
129
+ it "should generate only new charts" do
130
+ File.should_receive("exists?").with("_benchmark/viterbi_vs_pd.png").and_return(true)
131
+ File.should_receive("exists?").with("_benchmark/viterbi_vs_forward.png").and_return(false)
132
+ @runner.should_receive(:_generate_chart)
133
+ @runner.chart({})
134
+ end
135
+
136
+ it "should list benchmarks" do
137
+ @runner.list_charts.should be == ["viterbi_vs_pd", "viterbi_vs_forward"]
138
+ end
139
+
140
+ it "should generate charts" do
141
+ chart = double("Chart")
142
+ chart.stub(:build).and_return("chart.build")
143
+ chart.stub(:id).and_return("chart.id")
144
+ @runner.should_receive(:_check_benchmarks).with(chart).and_return([])
145
+ Kernel.should_receive(:system).with("phantomjs /Users/igorbonadio/Projetos/mach5-tools/lib/mach5-tools/js/chart.js /Users/igorbonadio/Projetos/mach5-tools/lib/mach5-tools/js \"[\\\"chart.build\\\"]\" _benchmark/chart.id.png")
146
+ @runner._generate_chart(chart)
147
+ end
148
+
149
+ it "should check if a benchmark needs to run" do
150
+ chart = double("Chart")
151
+ serie1 = double("Serie1")
152
+ serie1.stub(:[]).and_return("serie1.at")
153
+ serie2 = double("Serie2")
154
+ serie2.stub(:[]).and_return("serie2.at")
155
+ chart.stub(:series).and_return([serie1, serie2])
156
+ File.should_receive("exists?").with("_benchmark/serie1.at.serie1.at.json").and_return(false)
157
+ File.should_receive("exists?").with("_benchmark/serie2.at.serie2.at.json").and_return(true)
158
+ @runner._check_benchmarks(chart).size.should be == 1
159
+ end
97
160
  end
98
161
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,8 @@
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ add_filter "/spec/"
4
+ end
5
+
1
6
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
7
  $LOAD_PATH.unshift(File.dirname(__FILE__))
3
8
  require 'rspec'
@@ -8,5 +13,5 @@ require 'mach5-tools'
8
13
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
14
 
10
15
  RSpec.configure do |config|
11
-
16
+
12
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mach5-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Bonadio
@@ -106,6 +106,7 @@ extra_rdoc_files:
106
106
  files:
107
107
  - .document
108
108
  - .rspec
109
+ - .travis.yml
109
110
  - Gemfile
110
111
  - Gemfile.lock
111
112
  - LICENSE.txt