stepdown 0.6.1 → 0.6.2

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.
data/Gemfile.lock CHANGED
@@ -21,6 +21,7 @@ PLATFORMS
21
21
  ruby
22
22
 
23
23
  DEPENDENCIES
24
+ bundler (~> 1.0)
24
25
  gherkin (~> 2.3)
25
26
  haml (> 2.0.0)
26
27
  rake
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.6.2 2011-06-26
2
+ * Only show top 10 items on page load
3
+
1
4
  == 0.6.1 2011-06-23
2
5
  * fix issue with Ruby 1.9.2
3
6
  * update jQuery
@@ -11,12 +11,7 @@ module Stepdown
11
11
  FileUtils.mkdir_p(Stepdown.output_directory)
12
12
  copy_files
13
13
 
14
- template = File.open(File.expand_path(File.dirname(__FILE__)) + '/../../templates/main.html.haml').read()
15
- engine = Haml::Engine.new(template)
16
-
17
- out = File.new(Stepdown.output_directory + '/analysis.html','w+')
18
- out.puts engine.render(self)
19
- out.close
14
+ ["index", "_unused", "_grouping", "_empty", "_usages"].each{ |template| write_html(template) }
20
15
 
21
16
  template = File.open(File.expand_path(File.dirname(__FILE__)) + '/../../templates/style.sass').read
22
17
  sass_engine = Sass::Engine.new(template)
@@ -26,11 +21,20 @@ module Stepdown
26
21
 
27
22
  out.close
28
23
 
29
- puts "\nReport output to #{Stepdown.output_directory}/analysis.html" unless Stepdown.quiet
24
+ puts "\nReport output to #{Stepdown.output_directory}/index.html" unless Stepdown.quiet
30
25
  end
31
26
 
32
27
  protected
33
28
 
29
+ def write_html(template)
30
+ file = File.open(File.expand_path(File.dirname(__FILE__)) + "/../../templates/#{template}.html.haml").read()
31
+ engine = Haml::Engine.new(file)
32
+
33
+ out = File.new(Stepdown.output_directory + "/#{template}.html",'w+')
34
+ out.puts engine.render(self)
35
+ out.close
36
+ end
37
+
34
38
  def copy_files
35
39
  ['step_down.js', 'jquery-1.6.1.min.js', 'bluff-min.js', 'excanvas.js', 'js-class.js'].each do |file|
36
40
  src = File.expand_path("#{File.dirname(__FILE__)}/../../public/#{file}")
@@ -17,6 +17,14 @@ module Stepdown
17
17
  stats
18
18
  end
19
19
 
20
+ def groupings_rest
21
+ groupings[10..groupings.length]
22
+ end
23
+
24
+ def groupings_top_10
25
+ groupings[0..10]
26
+ end
27
+
20
28
  def groupings
21
29
  @groupings ||= grouping(@scenarios)
22
30
  end
@@ -76,6 +84,14 @@ module Stepdown
76
84
  usages.sort{|a,b| b.total_usage <=> a.total_usage}
77
85
  end
78
86
 
87
+ def usages_top_10
88
+ step_usages[0..10]
89
+ end
90
+
91
+ def usages_rest
92
+ step_usages[10..step_usages.length]
93
+ end
94
+
79
95
  def step_usages
80
96
  @step_usages ||= step_usage(@scenarios)
81
97
  end
@@ -84,6 +100,14 @@ module Stepdown
84
100
  step_usages.select{|use| use.total_usage > 0 }
85
101
  end
86
102
 
103
+ def unused_rest
104
+ unused_steps[10..unused_steps.length]
105
+ end
106
+
107
+ def unused_top_10
108
+ unused_steps[0..10]
109
+ end
110
+
87
111
  def unused_steps
88
112
  step_usages.select{|use| use.total_usage == 0}
89
113
  end
@@ -111,10 +135,19 @@ module Stepdown
111
135
  sprintf "%.2f", (step_count / scen_count)
112
136
  end
113
137
 
138
+ def empty_rest
139
+ empty_scenarios[10..empty_scenarios.length]
140
+ end
141
+
142
+ def empty_top_10
143
+ empty_scenarios[0..10]
144
+ end
145
+
114
146
  def empty_scenarios
115
- @scenarios.select do |scen|
147
+ @empty_scenarios ||= @scenarios.select do |scen|
116
148
  scen.steps.empty?
117
149
  end
150
+ @empty_scenarios
118
151
  end
119
152
  end
120
- end
153
+ end
@@ -1,3 +1,3 @@
1
1
  module Stepdown
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
data/public/step_down.js CHANGED
@@ -1,6 +1,5 @@
1
1
 
2
2
  $(document).ready(function(){
3
- //filter("<100",$("#usages tr"));
4
3
 
5
4
  $("#use_filter").change(function(){
6
5
  filter(this.options[this.selectedIndex].value, 1, $("#usages tr"));
@@ -14,6 +13,17 @@ $(document).ready(function(){
14
13
  $('.' + this.getAttribute("class")).show();
15
14
  return false;
16
15
  });
16
+
17
+ $(".more").click(function(e){
18
+ link = $(this);
19
+ partial = link.attr("partial");
20
+ $.get('_' + partial + '.html',function(data){
21
+ link.parents("tr").before(data);
22
+ link.parents("tr").remove();
23
+ }, 'html');
24
+ return false;
25
+ });
26
+
17
27
  });
18
28
 
19
29
 
@@ -0,0 +1,3 @@
1
+ - empty_rest.each do |scen|
2
+ %tr
3
+ %td= scen.name
@@ -0,0 +1,19 @@
1
+ - groupings_rest.each_with_index do |grouping, i|
2
+ - next if grouping.use_count == 0
3
+ %tr
4
+ %td
5
+ = grouping.regex.inspect
6
+ %br
7
+ %a{:href => '#', :class => "g#{i}"}Show associated steps
8
+ %td= grouping.use_count
9
+ %tr{:class => "g#{i}", :style => "display: none;"}
10
+ %td{:colspan => 2}
11
+ %table
12
+ %tr
13
+ %th Association count
14
+ %th Step
15
+ %tbody
16
+ - grouping.step_collection.each do |step|
17
+ %tr
18
+ %td= step.count
19
+ %td= CGI.escapeHTML step.regex.inspect
@@ -0,0 +1,3 @@
1
+ - empty_rest.each do |scen|
2
+ %tr
3
+ %td= scen.name
@@ -0,0 +1,6 @@
1
+ - usages_rest.each do |use|
2
+ %tr
3
+ %td= use.step.regex.inspect
4
+ %td= use.total_usage
5
+ %td= use.number_scenarios
6
+ %td= use.use_scenario
@@ -4,7 +4,7 @@
4
4
  %head
5
5
  %title Step down - Cucumber analysis
6
6
  %link{:type => 'text/css', :rel => 'stylesheet', :href => 'style.css'}
7
- %script{:src => 'jquery-1.4.3.min.js'}
7
+ %script{:src => 'jquery-1.6.1.min.js'}
8
8
  %script{:src => 'js-class.js'}
9
9
  %script{:src => 'bluff-min.js'}
10
10
  %script{:src => 'excanvas.js'}
@@ -89,39 +89,48 @@
89
89
  %th Scenarios
90
90
  %th Use per scenario
91
91
 
92
- - usages.each do |use|
92
+ - usages_top_10.each do |use|
93
93
  %tr
94
94
  %td= use.step.regex.inspect
95
95
  %td= use.total_usage
96
96
  %td= use.number_scenarios
97
97
  %td= use.use_scenario
98
+ %tr
99
+ %td{:colspan => "4"}
100
+ %a{:href => "#", :class => "more", :partial => 'usages'}See all
98
101
 
99
102
  %h2
100
103
  %a{:name => 'unused'} Unused steps
101
- %table
104
+ %table#unused
102
105
  %tbody
103
106
  %th Step
104
107
 
105
- - unused_steps.each do |use|
108
+ - unused_top_10.each do |use|
106
109
  %tr
107
110
  %td= use.step.regex.inspect
111
+ %tr
112
+ %td{:colspan => "4"}
113
+ %a{:href => "#", :class => "more", :partial => 'unused'}See all
108
114
  %h2
109
115
  %a{:name => 'empty'} Empty scenarios
110
- %table
116
+ %table#empty
111
117
  %tbody
112
118
  %th Scenarios
113
119
 
114
- - empty_scenarios.each do |scen|
120
+ - empty_top_10.each do |scen|
115
121
  %tr
116
122
  %td= scen.name
123
+ %tr
124
+ %td{:colspan => "4"}
125
+ %a{:href => "#", :class => "more", :partial => 'empty'}See all
117
126
  %h2
118
127
  %a{:name => 'grouping'} Step grouping
119
- %table
128
+ %table#grouping
120
129
  %tbody
121
130
  %th Step
122
131
  %th Total step associations
123
132
 
124
- - groupings.each_with_index do |grouping, i|
133
+ - groupings_top_10.each_with_index do |grouping, i|
125
134
  - next if grouping.use_count == 0
126
135
  %tr
127
136
  %td
@@ -140,4 +149,7 @@
140
149
  %tr
141
150
  %td= step.count
142
151
  %td= CGI.escapeHTML step.regex.inspect
152
+ %tr
153
+ %td{:colspan => "4"}
154
+ %a{:href => "#", :class => "more", :partial => 'grouping'}See all
143
155
  %script{:src => 'stepdown.js'}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stepdown
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 1
10
- version: 0.6.1
9
+ - 2
10
+ version: 0.6.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sean Caffery
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-23 00:00:00 +10:00
18
+ date: 2011-06-26 00:00:00 +10:00
19
19
  default_executable: stepdown
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -146,7 +146,11 @@ files:
146
146
  - spec/lib/stepdown/step_instance_spec.rb
147
147
  - spec/spec_helper.rb
148
148
  - stepdown.gemspec
149
- - templates/main.html.haml
149
+ - templates/_empty.html.haml
150
+ - templates/_grouping.html.haml
151
+ - templates/_unused.html.haml
152
+ - templates/_usages.html.haml
153
+ - templates/index.html.haml
150
154
  - templates/style.sass
151
155
  has_rdoc: true
152
156
  homepage: http://stepdown.lineonpoint.com