cucumber-relizy 0.0.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.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +36 -0
- data/Rakefile +2 -0
- data/bin/cucumber-relizy +13 -0
- data/cucumber-relizy.gemspec +22 -0
- data/lib/cucumber/relizy/assets/cucumber-relizy.css +20 -0
- data/lib/cucumber/relizy/assets/cucumber-relizy.js.coffee +63 -0
- data/lib/cucumber/relizy/cli.rb +33 -0
- data/lib/cucumber/relizy/version.rb +5 -0
- metadata +90 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2012 wynst
|
|
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,36 @@
|
|
|
1
|
+
# Cucumber::Relizy
|
|
2
|
+
|
|
3
|
+
Patch existing cucumber html output with navigation for features
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
$ gem install cucumber-relizy
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
1. command-line
|
|
12
|
+
`cucumber-relizy FILENAME`
|
|
13
|
+
will create `FILENAME.relizy.html`
|
|
14
|
+
|
|
15
|
+
2. thor task
|
|
16
|
+
* add this to your Thorfile in a Rails app
|
|
17
|
+
|
|
18
|
+
```ruby
|
|
19
|
+
class App < Thor
|
|
20
|
+
desc "features", "run cucumber and browse features"
|
|
21
|
+
def features
|
|
22
|
+
system "rm tmp/features.html"
|
|
23
|
+
system "rm tmp/features.relizy.html"
|
|
24
|
+
system "bundle exec cucumber --drb features/ --format=html -o tmp/features.html"
|
|
25
|
+
system "cucumber-relizy tmp/features.html"
|
|
26
|
+
system "open tmp/features.relizy.html"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
* run `thor app:features` to run cucumber, and browse the features.
|
|
32
|
+
|
|
33
|
+
## Similar library
|
|
34
|
+
* [http://relishapp.com](Relish) : this library is inspired by Relish
|
|
35
|
+
feature navigation.
|
|
36
|
+
|
data/Rakefile
ADDED
data/bin/cucumber-relizy
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
require File.expand_path('../lib/cucumber/relizy/version', __FILE__)
|
|
3
|
+
|
|
4
|
+
Gem::Specification.new do |gem|
|
|
5
|
+
gem.authors = ["wynst"]
|
|
6
|
+
gem.email = ["wynst.uei@gmail.com"]
|
|
7
|
+
gem.description = %q{Patch your cucumber html output with features navigation}
|
|
8
|
+
gem.summary = %q{Patch your cucumber html output with features navigation}
|
|
9
|
+
gem.homepage = "https://github.com/wynst/cucumber-relizy"
|
|
10
|
+
|
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
14
|
+
gem.name = "cucumber-relizy"
|
|
15
|
+
gem.require_paths = ["lib"]
|
|
16
|
+
gem.version = Cucumber::Relizy::VERSION
|
|
17
|
+
|
|
18
|
+
gem.add_dependency 'coffee-script'
|
|
19
|
+
gem.add_dependency 'nokogiri'
|
|
20
|
+
|
|
21
|
+
gem.add_development_dependency 'rake'
|
|
22
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#relizy-sidebar {
|
|
2
|
+
clear: none;
|
|
3
|
+
float: left;
|
|
4
|
+
width: 25%;
|
|
5
|
+
padding: 2px;
|
|
6
|
+
margin: 0px 10px 5px 10px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.cucumber div.feature {
|
|
10
|
+
float: left;
|
|
11
|
+
width: 70%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#relizy-sidebar ul#root > li {
|
|
15
|
+
margin-bottom: 10px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#relizy-sidebar ul#root ul {
|
|
19
|
+
padding-left: 15px;
|
|
20
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
class Feature
|
|
2
|
+
constructor: (@index, el) ->
|
|
3
|
+
@name = $(el).children('h2').text().replace "Feature: ", ""
|
|
4
|
+
@tags = []
|
|
5
|
+
@tags.push($(node).text()) for node in $('.tag', el)
|
|
6
|
+
# get filename
|
|
7
|
+
@file = $('span.scenario_file:first', el).text()
|
|
8
|
+
# remove line numbers
|
|
9
|
+
@path = @file.replace(/\.feature:\d+?$/,'')
|
|
10
|
+
# remove features/ path
|
|
11
|
+
@path = @path.split('/')
|
|
12
|
+
@path.shift()
|
|
13
|
+
# remove feature name
|
|
14
|
+
@path.pop()
|
|
15
|
+
|
|
16
|
+
jQuery ($) ->
|
|
17
|
+
@active = null
|
|
18
|
+
|
|
19
|
+
html = '<div id="relizy-sidebar"></div>'
|
|
20
|
+
$(html).insertAfter "#cucumber-header"
|
|
21
|
+
|
|
22
|
+
a = $('<h3><a href="#">all features (toggle)</a></h3>').appendTo("#relizy-sidebar")
|
|
23
|
+
$(a).click (event) =>
|
|
24
|
+
$('.feature').toggle()
|
|
25
|
+
|
|
26
|
+
# hide all features
|
|
27
|
+
$(a).trigger('click')
|
|
28
|
+
|
|
29
|
+
$('<ul id="root" />').appendTo("#relizy-sidebar")
|
|
30
|
+
|
|
31
|
+
$.each $('.feature'), (index, item) ->
|
|
32
|
+
feature = new Feature(index, item)
|
|
33
|
+
# console.log feature
|
|
34
|
+
parent = $('#relizy-sidebar ul#root')
|
|
35
|
+
if feature.path && feature.path.length > 0
|
|
36
|
+
for folder in feature.path
|
|
37
|
+
el = $('ul[rel="'+folder+'"]', parent)
|
|
38
|
+
if el.length > 0
|
|
39
|
+
parent = el
|
|
40
|
+
else
|
|
41
|
+
$('<li>' + folder + '<ul rel="' + folder + '"></ul></li>').appendTo($(parent))
|
|
42
|
+
parent = $('ul[rel="'+folder+'"]', parent)
|
|
43
|
+
|
|
44
|
+
li = $('<li><a href="#">'+ feature.name + '</a></li>').appendTo $(parent)
|
|
45
|
+
# console.log li
|
|
46
|
+
$(li).children('a:first').data('feature', feature)
|
|
47
|
+
|
|
48
|
+
$('#relizy-sidebar ul a').click (event) =>
|
|
49
|
+
|
|
50
|
+
if @active >= 0
|
|
51
|
+
$el = $($('.feature')[@active])
|
|
52
|
+
$el.hide()
|
|
53
|
+
$('#relizy-sidebar ul a').css('font-weight', 'normal')
|
|
54
|
+
|
|
55
|
+
# console.log $(event.target).data('feature')
|
|
56
|
+
index = $(event.target).data('feature').index
|
|
57
|
+
@active = index
|
|
58
|
+
|
|
59
|
+
$el = $($('.feature')[index])
|
|
60
|
+
$el.show()
|
|
61
|
+
$link = $(event.target)
|
|
62
|
+
$link.css('font-weight', 'bold')
|
|
63
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Cucumber
|
|
2
|
+
module Relizy
|
|
3
|
+
# Your code goes here...
|
|
4
|
+
module CLI
|
|
5
|
+
def self.execute(filename)
|
|
6
|
+
doc = Nokogiri::HTML File.read(filename)
|
|
7
|
+
|
|
8
|
+
a = doc.css("#cucumber-relizy")
|
|
9
|
+
if a && a.size>0
|
|
10
|
+
a.remove
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
script = File.expand_path('../assets/cucumber-relizy.css', __FILE__)
|
|
14
|
+
script = File.read(script)
|
|
15
|
+
a = doc.css("head").first
|
|
16
|
+
a.add_child("<style type='text/css'>\n#{ script }\n</style>")
|
|
17
|
+
|
|
18
|
+
script = File.expand_path('../assets/cucumber-relizy.js.coffee', __FILE__)
|
|
19
|
+
script = CoffeeScript.compile File.read(script)
|
|
20
|
+
a = doc.css("body").first
|
|
21
|
+
a.add_child("<script type='text/javascript' id='cucumber-relizy'>\n#{ script }\n</script>")
|
|
22
|
+
|
|
23
|
+
output = filename.gsub(/html$/, 'relizy.html')
|
|
24
|
+
File.open(output,"w+") do |f|
|
|
25
|
+
doc.write_to f
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
metadata
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: cucumber-relizy
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- wynst
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2012-03-02 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: coffee-script
|
|
16
|
+
requirement: &2156207360 !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
18
|
+
requirements:
|
|
19
|
+
- - ! '>='
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '0'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: *2156207360
|
|
25
|
+
- !ruby/object:Gem::Dependency
|
|
26
|
+
name: nokogiri
|
|
27
|
+
requirement: &2156206840 !ruby/object:Gem::Requirement
|
|
28
|
+
none: false
|
|
29
|
+
requirements:
|
|
30
|
+
- - ! '>='
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: *2156206840
|
|
36
|
+
- !ruby/object:Gem::Dependency
|
|
37
|
+
name: rake
|
|
38
|
+
requirement: &2156206240 !ruby/object:Gem::Requirement
|
|
39
|
+
none: false
|
|
40
|
+
requirements:
|
|
41
|
+
- - ! '>='
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: '0'
|
|
44
|
+
type: :development
|
|
45
|
+
prerelease: false
|
|
46
|
+
version_requirements: *2156206240
|
|
47
|
+
description: Patch your cucumber html output with features navigation
|
|
48
|
+
email:
|
|
49
|
+
- wynst.uei@gmail.com
|
|
50
|
+
executables:
|
|
51
|
+
- cucumber-relizy
|
|
52
|
+
extensions: []
|
|
53
|
+
extra_rdoc_files: []
|
|
54
|
+
files:
|
|
55
|
+
- .gitignore
|
|
56
|
+
- Gemfile
|
|
57
|
+
- LICENSE
|
|
58
|
+
- README.md
|
|
59
|
+
- Rakefile
|
|
60
|
+
- bin/cucumber-relizy
|
|
61
|
+
- cucumber-relizy.gemspec
|
|
62
|
+
- lib/cucumber/relizy/assets/cucumber-relizy.css
|
|
63
|
+
- lib/cucumber/relizy/assets/cucumber-relizy.js.coffee
|
|
64
|
+
- lib/cucumber/relizy/cli.rb
|
|
65
|
+
- lib/cucumber/relizy/version.rb
|
|
66
|
+
homepage: https://github.com/wynst/cucumber-relizy
|
|
67
|
+
licenses: []
|
|
68
|
+
post_install_message:
|
|
69
|
+
rdoc_options: []
|
|
70
|
+
require_paths:
|
|
71
|
+
- lib
|
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
|
+
none: false
|
|
74
|
+
requirements:
|
|
75
|
+
- - ! '>='
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: '0'
|
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
|
+
none: false
|
|
80
|
+
requirements:
|
|
81
|
+
- - ! '>='
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: '0'
|
|
84
|
+
requirements: []
|
|
85
|
+
rubyforge_project:
|
|
86
|
+
rubygems_version: 1.8.17
|
|
87
|
+
signing_key:
|
|
88
|
+
specification_version: 3
|
|
89
|
+
summary: Patch your cucumber html output with features navigation
|
|
90
|
+
test_files: []
|