nuker 0.0.47 → 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.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -0
  3. data/.ruby-version +1 -0
  4. data/.rvmrc +62 -0
  5. data/.rvmrc.08.13.2014-14:58:37 +1 -0
  6. data/.travis.yml +3 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE +165 -0
  9. data/Rakefile +5 -0
  10. data/bin/nuker +26 -0
  11. data/config.ru +2 -0
  12. data/example-features/generic/example-with-background.feature +11 -0
  13. data/example-features/generic/example-with-data-table.feature +7 -0
  14. data/example-features/generic/example-with-scenario-outline-examples.feature +11 -0
  15. data/example-features/generic/example_with_tags.feature +8 -0
  16. data/example-features/generic/has-lots-of-tags.feature +5 -0
  17. data/example-features/generic/multiple-scenarios.feature +7 -0
  18. data/example-features/too-many-wip-tags/too-many-wip-tags.feature +21 -0
  19. data/features/counts.feature +25 -0
  20. data/features/feature_page.feature +69 -0
  21. data/features/list_tags.feature +31 -0
  22. data/features/notifications.feature +9 -0
  23. data/features/progress_bar.feature +21 -0
  24. data/features/project_home.feature +25 -0
  25. data/features/projects.feature +19 -0
  26. data/features/push_features.feature +34 -0
  27. data/features/scenario_page.feature +84 -0
  28. data/features/search_features.feature +100 -0
  29. data/features/step_definitions/feature_page_steps.rb +15 -0
  30. data/features/step_definitions/notifications_steps.rb +11 -0
  31. data/features/step_definitions/project_home_steps.rb +10 -0
  32. data/features/step_definitions/projects_steps.rb +28 -0
  33. data/features/step_definitions/push_features_steps.rb +48 -0
  34. data/features/step_definitions/scenario_page_steps.rb +29 -0
  35. data/features/step_definitions/search_features_steps.rb +24 -0
  36. data/features/step_definitions/steps.rb +35 -0
  37. data/features/step_definitions/welcome_page.rb +19 -0
  38. data/features/support/env.rb +33 -0
  39. data/features/welcome_page.feature +30 -0
  40. data/lib/nuker/application.rb +161 -0
  41. data/lib/nuker/counts_tags.rb +27 -0
  42. data/lib/nuker/feature.rb +16 -0
  43. data/lib/nuker/parses_features.rb +30 -0
  44. data/lib/nuker/project.rb +8 -0
  45. data/lib/nuker/public/bootstrap.min.css +356 -0
  46. data/lib/nuker/public/nuker-logo.png +0 -0
  47. data/lib/nuker/public/scripts/projects.js +6 -0
  48. data/lib/nuker/public/skin.css +208 -0
  49. data/lib/nuker/public/wally-logo.png +0 -0
  50. data/lib/nuker/search_features.rb +47 -0
  51. data/lib/nuker/version.rb +3 -0
  52. data/lib/nuker/views/feature.haml +19 -0
  53. data/lib/nuker/views/feature_link.haml +6 -0
  54. data/lib/nuker/views/layout.haml +53 -0
  55. data/lib/nuker/views/progress.haml +15 -0
  56. data/lib/nuker/views/project.haml +0 -0
  57. data/lib/nuker/views/scenario.haml +31 -0
  58. data/lib/nuker/views/search.haml +36 -0
  59. data/lib/nuker/views/table.haml +10 -0
  60. data/lib/nuker/views/tag_links.haml +4 -0
  61. data/lib/nuker.rb +7 -0
  62. data/nuker.gemspec +37 -0
  63. data/spec/spec_helper.rb +35 -0
  64. metadata +88 -3
@@ -0,0 +1,47 @@
1
+ require "komainu"
2
+
3
+ module Nuker
4
+ class SearchFeatures
5
+ def initialize lists_features
6
+ @lists_features = lists_features
7
+ end
8
+
9
+ def find(query)
10
+ searchables = []
11
+
12
+ @lists_features.features.each do |feature|
13
+ feature_text = feature.gherkin["name"]
14
+ if feature.gherkin["tags"]
15
+ feature_text += " " + feature.gherkin["tags"].map { |tag| tag["name"] }.join(" ")
16
+ end
17
+ if feature.gherkin["description"]
18
+ feature_text += " " + feature.gherkin["description"]
19
+ end
20
+ feature_data = OpenStruct.new
21
+ feature_data.feature = feature.gherkin
22
+ feature_data.text = feature_text
23
+ searchables << feature_data
24
+
25
+ if feature.gherkin["elements"]
26
+ feature.gherkin["elements"].each do |element|
27
+ element_text = [element["name"]]
28
+ if element["steps"]
29
+ element_text << element["steps"].map { |s| s["name"] }
30
+ end
31
+ if element["tags"]
32
+ element_text << element["tags"].map { |t| t["name"] }
33
+ end
34
+ scenario_data = OpenStruct.new
35
+ scenario_data.feature = feature.gherkin
36
+ scenario_data.scenario = element
37
+ scenario_data.text = element_text.join(" ")
38
+ searchables << scenario_data
39
+ end
40
+ end
41
+ end
42
+
43
+ searches_text = Komainu::SearchesText.new(searchables)
44
+ searches_text.search(query[:query])
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,3 @@
1
+ module Nuker
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,19 @@
1
+ %h2
2
+ = @feature.gherkin["name"]
3
+ %p
4
+ from
5
+ %em
6
+ = @feature.path
7
+ %section{:class=>"scenarios"}
8
+ %section{:class => 'feature'}
9
+ :markdown
10
+ #{@feature.gherkin["description"]}
11
+ - if @feature.gherkin["description"]
12
+ %h2 Scenarios
13
+ %ul
14
+ - get_sorted_scenarios(@feature).each do |scenario|
15
+ %li
16
+ %a{:href => get_scenario_url(scenario)}
17
+ = scenario["name"]
18
+ - if scenario["tags"]
19
+ = haml :tag_links, {:locals => {:tags => scenario["tags"]}, :layout => false}
@@ -0,0 +1,6 @@
1
+ %li
2
+ %a{:href => "/projects/#{current_project.name}/features/#{feature.gherkin["id"]}"}
3
+ = feature.gherkin["name"]
4
+ - if feature.gherkin["tags"]
5
+ - tags = feature.gherkin["tags"]
6
+ = haml :tag_links, {:locals => {:tags => tags}, :layout => false}
@@ -0,0 +1,53 @@
1
+ !!! 5
2
+ %html
3
+ %head
4
+ %title Nuker
5
+ %link{:rel => 'stylesheet', :type => 'text/css', :href => '/bootstrap.min.css'}
6
+ %link{:rel => 'stylesheet', :type => 'text/css', :href => '/skin.css'}
7
+ %script{:type => "text/javascript", :src => "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"}
8
+ %script{:type => "text/javascript", :src => "/scripts/projects.js"}
9
+ %meta{:'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'}
10
+ %meta{:name => 'viewport', :content => 'width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;'}
11
+ %body
12
+ %div.container-fluid
13
+ %div.logo
14
+ %h1
15
+ %a{:href => "/#{current_project ? "projects/" + current_project.name : nil}"} Nuker
16
+
17
+ %div.project-list
18
+ %select#projects{:name => "projects"}
19
+ - Nuker::Project.all.each do |project|
20
+ %option{ :value => project.name, :selected => project == current_project }
21
+ = project.name
22
+
23
+ %div.search-bar
24
+ %form{:method => "GET", :action => "/projects/#{current_project.name}/search", :id => "search"}
25
+ %input{:type => "text", :id => "q", :name => "q", :placeholder => 'text, @tags etc.', :value => @q }
26
+ %input.btn{:type => "submit", :id => "search", :value => "Search"}
27
+ %div.container-fluid
28
+ %div.sidebar
29
+ %ul
30
+ %li
31
+ %a{:href => "/projects/#{current_project.name}/progress"}
32
+ Progress
33
+ %h2
34
+ = "Features (#{current_project.features.count})"
35
+ %ul
36
+ - current_project.features.sort{|a,b| a.name <=> b.name}.each do |feature|
37
+ = haml :feature_link, {:locals => {:feature => feature}, :layout => false}
38
+
39
+ %h2
40
+ = "Tags (#{tag_count.values.sum})"
41
+ %ul
42
+ - tag_count.each do |tag, count|
43
+ %li
44
+ %a{:href => "/projects/#{current_project.name}/search?q=#{tag}", :class => "tag-#{tag.delete('@')}"}
45
+ = "#{tag} (#{count})"
46
+
47
+ %div.content
48
+ - if excessive_wip_tags
49
+ %div.alert-message.error
50
+ %p
51
+ = "You have #{tag_count["@wip"]} @wip tags :("
52
+ = yield
53
+
@@ -0,0 +1,15 @@
1
+ %h2
2
+ Progress
3
+ - if tag_count
4
+ %p
5
+ This project has #{scenario_count} scenarios, of which :-
6
+ %ul{:class => 'chartlist'}
7
+ - tag_count.each do |tag, count|
8
+ - ratio = (count.to_f / scenario_count) * 100
9
+ %li{:class => "#{tag.downcase.gsub("@", "")}"}
10
+ %a{:href => "/projects/#{current_project.name}/search?q=#{tag}"}
11
+ = "#{tag} (#{ratio.ceil}%)"
12
+ %span{:class => "count #{tag}"}
13
+ = ratio.ceil
14
+ %span{:class => "index", :style => "width: #{ratio.ceil}%"}
15
+ = ratio
File without changes
@@ -0,0 +1,31 @@
1
+ %h2
2
+ %a{"href" => '../'}
3
+ = @feature.gherkin["name"]
4
+ %h2
5
+ = @scenario["name"]
6
+ - if @scenario["tags"]
7
+ = haml :tag_links, {:locals => {:tags => @scenario["tags"]}, :layout => false}
8
+ - if @background
9
+ %h3
10
+ = @background["keyword"] + ":"
11
+ - @background["steps"].each do |step|
12
+ %p
13
+ %span.step-keyword
14
+ &= step["keyword"]
15
+ = step["name"]
16
+ - if @scenario["steps"]
17
+ %h3 Steps:
18
+ - @scenario["steps"].each do |step|
19
+ %p
20
+ %span.step-keyword
21
+ = step["keyword"]
22
+ = escape_once(step["name"])
23
+ - if step["rows"]
24
+ = haml :table, {:locals => {:rows => step["rows"]}, :layout => false}
25
+ - else
26
+ %p{:class => 'alert-message error'}
27
+ = "Where's Nuker? This scenario has no steps!?"
28
+ - if @scenario["examples"]
29
+ %h3 Examples:
30
+ = haml :table, {:locals => {:rows => @scenario["examples"].first["rows"]}, :layout => false}
31
+
@@ -0,0 +1,36 @@
1
+ - if params[:q]
2
+ - if params[:q].length > 0
3
+ %h2
4
+ = "Search for '#{params[:q]}'"
5
+ - if @search_results.suggestion
6
+ %p
7
+ Did you mean
8
+ %a{:href => "/projects/#{current_project.name}/search?q=#{@search_results.suggestion}"}
9
+ = @search_results.suggestion
10
+ %ul
11
+ - @search_results.items.map {|i| i.object.feature["id"] }.uniq.each do |current_feature_id|
12
+ - root_search_result = @search_results.items.find { |r| r.object.feature["id"] == current_feature_id }
13
+ %li
14
+ %a{:href => "/projects/#{current_project.name}/features/#{root_search_result.object.feature["id"]}"}
15
+ = root_search_result.object.feature["name"]
16
+ - if root_search_result.object.feature["tags"]
17
+ = haml :tag_links, {:locals => {:tags => root_search_result.object.feature["tags"]}, :layout => false}
18
+ %p
19
+ != highlighted_search_result_blurb root_search_result
20
+ %ul
21
+ - @search_results.items.select { |r| r.object.feature["id"] == current_feature_id }.each do |search_result|
22
+ - if search_result.object.scenario && search_result.object.scenario["id"]
23
+ %li
24
+ %a{:href => "/projects/#{current_project.name}/features/#{search_result.object.scenario["id"].gsub(";", "/scenario/")}"}
25
+ = search_result.object.scenario["name"]
26
+ - if search_result.object.scenario["tags"]
27
+ = haml :tag_links, {:locals => {:tags => search_result.object.scenario["tags"]}, :layout => false}
28
+ %p
29
+ != highlighted_search_result_blurb(search_result)
30
+ - if @search_results.items.empty?
31
+ %p{:class => 'alert-message error'}
32
+ Where's Nuker? This search returned no results.
33
+
34
+ - else
35
+ %p{:class => 'alert-message error'}
36
+ Where's Nuker? This search returned no results.
@@ -0,0 +1,10 @@
1
+ %table{:class => 'zebra-striped'}
2
+ - rows.each_with_index do |row, index|
3
+ %tr
4
+ - row["cells"].each do |cell|
5
+ - if index === 0
6
+ %th
7
+ = escape_once(cell)
8
+ - else
9
+ %td
10
+ = escape_once(cell)
@@ -0,0 +1,4 @@
1
+ - tags.each do |tag|
2
+ %span.label.notice
3
+ %a{:href => "/projects/#{current_project.name}/search?q=#{tag["name"]}", :class => "tag-#{tag["name"].delete('@')}"}
4
+ = tag["name"]
data/lib/nuker.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "rubygems"
2
+ require "bundler/setup"
3
+
4
+ $:.unshift(File.expand_path(File.dirname(__FILE__)))
5
+
6
+ require "nuker/version"
7
+ require "nuker/application"
data/nuker.gemspec ADDED
@@ -0,0 +1,37 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "nuker/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "nuker"
7
+ s.version = Nuker::VERSION
8
+ s.authors = ["Marc Bluemner"]
9
+ s.email = ["m.bluemner@liquidlabs.de"]
10
+ s.homepage = "https://github.com/rocknrollmarc/nuker"
11
+ s.summary = %q{Cucumber feature viewer and navigator}
12
+ s.description = %q{Cucumber feature viewer and navigator}
13
+
14
+ s.rubyforge_project = "nuker"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.files << "README.md"
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_runtime_dependency "rest-client"
23
+ s.add_runtime_dependency "sinatra"
24
+ s.add_runtime_dependency "haml"
25
+ s.add_runtime_dependency "rdiscount"
26
+ s.add_runtime_dependency "gherkin"
27
+ s.add_runtime_dependency "komainu"
28
+ s.add_runtime_dependency "mongo_mapper"
29
+ s.add_runtime_dependency "bson_ext"
30
+
31
+ s.add_development_dependency "cucumber"
32
+ s.add_development_dependency "capybara"
33
+ s.add_development_dependency "rspec"
34
+ s.add_development_dependency "fakefs"
35
+ s.add_development_dependency "launchy"
36
+ s.add_development_dependency "pry"
37
+ end
@@ -0,0 +1,35 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), "../lib"))
2
+ ENV['RACK_ENV'] = 'test'
3
+ require "rack/test"
4
+ require "fakefs/spec_helpers"
5
+ require "fileutils"
6
+ require "nuker"
7
+
8
+ before do
9
+ ARGV.clear
10
+ ARGV << "application-features"
11
+ end
12
+
13
+ RSpec.configure do |config|
14
+ config.after :each do
15
+ Nuker::Project.delete_all
16
+ end
17
+ end
18
+
19
+ def project name
20
+ project = Nuker::Project.first(:name => name)
21
+ unless project
22
+ project = Nuker::Project.create(:name => name)
23
+ end
24
+ project
25
+ end
26
+
27
+ def create_feature project_name, path, content
28
+ project = project(project_name)
29
+ feature = Nuker::Feature.new({
30
+ :path => path,
31
+ :gherkin => Nuker::ParsesFeatures.new.parse(content)
32
+ })
33
+ project.features << feature
34
+ project.save
35
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nuker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.47
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc Bluemner
@@ -209,11 +209,74 @@ dependencies:
209
209
  description: Cucumber feature viewer and navigator
210
210
  email:
211
211
  - m.bluemner@liquidlabs.de
212
- executables: []
212
+ executables:
213
+ - nuker
213
214
  extensions: []
214
215
  extra_rdoc_files: []
215
216
  files:
217
+ - .gitignore
218
+ - .ruby-version
219
+ - .rvmrc
220
+ - .rvmrc.08.13.2014-14:58:37
221
+ - .travis.yml
222
+ - Gemfile
223
+ - LICENSE
216
224
  - README.md
225
+ - Rakefile
226
+ - bin/nuker
227
+ - config.ru
228
+ - example-features/generic/example-with-background.feature
229
+ - example-features/generic/example-with-data-table.feature
230
+ - example-features/generic/example-with-scenario-outline-examples.feature
231
+ - example-features/generic/example_with_tags.feature
232
+ - example-features/generic/has-lots-of-tags.feature
233
+ - example-features/generic/multiple-scenarios.feature
234
+ - example-features/too-many-wip-tags/too-many-wip-tags.feature
235
+ - features/counts.feature
236
+ - features/feature_page.feature
237
+ - features/list_tags.feature
238
+ - features/notifications.feature
239
+ - features/progress_bar.feature
240
+ - features/project_home.feature
241
+ - features/projects.feature
242
+ - features/push_features.feature
243
+ - features/scenario_page.feature
244
+ - features/search_features.feature
245
+ - features/step_definitions/feature_page_steps.rb
246
+ - features/step_definitions/notifications_steps.rb
247
+ - features/step_definitions/project_home_steps.rb
248
+ - features/step_definitions/projects_steps.rb
249
+ - features/step_definitions/push_features_steps.rb
250
+ - features/step_definitions/scenario_page_steps.rb
251
+ - features/step_definitions/search_features_steps.rb
252
+ - features/step_definitions/steps.rb
253
+ - features/step_definitions/welcome_page.rb
254
+ - features/support/env.rb
255
+ - features/welcome_page.feature
256
+ - lib/nuker.rb
257
+ - lib/nuker/application.rb
258
+ - lib/nuker/counts_tags.rb
259
+ - lib/nuker/feature.rb
260
+ - lib/nuker/parses_features.rb
261
+ - lib/nuker/project.rb
262
+ - lib/nuker/public/bootstrap.min.css
263
+ - lib/nuker/public/nuker-logo.png
264
+ - lib/nuker/public/scripts/projects.js
265
+ - lib/nuker/public/skin.css
266
+ - lib/nuker/public/wally-logo.png
267
+ - lib/nuker/search_features.rb
268
+ - lib/nuker/version.rb
269
+ - lib/nuker/views/feature.haml
270
+ - lib/nuker/views/feature_link.haml
271
+ - lib/nuker/views/layout.haml
272
+ - lib/nuker/views/progress.haml
273
+ - lib/nuker/views/project.haml
274
+ - lib/nuker/views/scenario.haml
275
+ - lib/nuker/views/search.haml
276
+ - lib/nuker/views/table.haml
277
+ - lib/nuker/views/tag_links.haml
278
+ - nuker.gemspec
279
+ - spec/spec_helper.rb
217
280
  homepage: https://github.com/rocknrollmarc/nuker
218
281
  licenses: []
219
282
  metadata: {}
@@ -237,4 +300,26 @@ rubygems_version: 2.2.2
237
300
  signing_key:
238
301
  specification_version: 4
239
302
  summary: Cucumber feature viewer and navigator
240
- test_files: []
303
+ test_files:
304
+ - features/counts.feature
305
+ - features/feature_page.feature
306
+ - features/list_tags.feature
307
+ - features/notifications.feature
308
+ - features/progress_bar.feature
309
+ - features/project_home.feature
310
+ - features/projects.feature
311
+ - features/push_features.feature
312
+ - features/scenario_page.feature
313
+ - features/search_features.feature
314
+ - features/step_definitions/feature_page_steps.rb
315
+ - features/step_definitions/notifications_steps.rb
316
+ - features/step_definitions/project_home_steps.rb
317
+ - features/step_definitions/projects_steps.rb
318
+ - features/step_definitions/push_features_steps.rb
319
+ - features/step_definitions/scenario_page_steps.rb
320
+ - features/step_definitions/search_features_steps.rb
321
+ - features/step_definitions/steps.rb
322
+ - features/step_definitions/welcome_page.rb
323
+ - features/support/env.rb
324
+ - features/welcome_page.feature
325
+ - spec/spec_helper.rb