cuukie 0.1.4 → 0.2.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.
- data/Gemfile +4 -3
- data/README.markdown +20 -20
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/bin/cuukie +42 -0
- data/cuukie.gemspec +21 -16
- data/doc/backlog.txt +10 -7
- data/doc/pomodoro.txt +22 -0
- data/lib/cuukie.rb +1 -1
- data/lib/cuukie/cli.rb +48 -0
- data/lib/cuukie/code_snippets.rb +25 -0
- data/lib/cuukie/formatter.rb +88 -0
- data/lib/cuukie/public/cucumber.css +1 -1
- data/lib/cuukie/public/cuukie.js +4 -0
- data/lib/cuukie/server.rb +98 -67
- data/lib/cuukie/views/index.erb +20 -21
- data/spec/cli_spec.rb +86 -0
- data/spec/code_snippets_spec.rb +4 -4
- data/spec/commands_spec.rb +73 -22
- data/spec/cuukie_spec.rb +109 -21
- data/spec/spec_helper.rb +7 -2
- data/spec/test_project/features/1_show_scenarios.feature +3 -3
- data/spec/test_project/features/2_show_multiline_args.feature +1 -1
- data/spec/test_project/features/3_failed_background.feature +5 -7
- data/spec/test_project/features/step_definitions/main_steps.rb +5 -4
- metadata +39 -25
- data/bin/cuukie_server +0 -9
- data/lib/cuukie/cucumber/formatter/code_snippets.rb +0 -23
- data/lib/cuukie/cucumber/formatter/cuukie.rb +0 -90
data/bin/cuukie_server
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
module Cuukie
|
2
|
-
module CodeSnippets
|
3
|
-
NULL_SNIPPET = Hash.new
|
4
|
-
|
5
|
-
def code_snippet(file, line)
|
6
|
-
return NULL_SNIPPET unless File.exist? file
|
7
|
-
|
8
|
-
all_lines = File.open(file) {|f| f.readlines}
|
9
|
-
return NULL_SNIPPET unless line <= all_lines.size
|
10
|
-
|
11
|
-
first_line = [1, line - 2].max
|
12
|
-
|
13
|
-
{:first_line => first_line,
|
14
|
-
:marked_line => line,
|
15
|
-
:raw_lines => all_lines[(first_line - 1)..line].join }
|
16
|
-
end
|
17
|
-
|
18
|
-
def backtrace_to_snippet(backtrace)
|
19
|
-
return NULL_SNIPPET unless backtrace[0] =~ /(.*):(\d+)/
|
20
|
-
code_snippet $1, $2.to_i
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/code_snippets"
|
2
|
-
require 'rest-client'
|
3
|
-
require 'json'
|
4
|
-
|
5
|
-
module Cucumber
|
6
|
-
module Formatter
|
7
|
-
class Cuukie
|
8
|
-
include ::Cuukie::CodeSnippets
|
9
|
-
|
10
|
-
def initialize(step_mother, path_or_io, options)
|
11
|
-
@server = ENV['CUUKIE_SERVER'] || 'http://localhost:4569'
|
12
|
-
ping
|
13
|
-
rescue
|
14
|
-
puts "I cannot find the cuukie_server on #{@server}."
|
15
|
-
puts "Please start the server with the cuukie_server command."
|
16
|
-
exit
|
17
|
-
end
|
18
|
-
|
19
|
-
def before_features(features)
|
20
|
-
post 'before_features'
|
21
|
-
end
|
22
|
-
|
23
|
-
def before_feature(feature)
|
24
|
-
post 'before_feature', { :short_name => feature.short_name,
|
25
|
-
:description => feature.description }
|
26
|
-
end
|
27
|
-
|
28
|
-
def scenario_name(keyword, name, file_colon_line, source_indent)
|
29
|
-
post 'scenario_name', { :keyword => keyword,
|
30
|
-
:name => name,
|
31
|
-
:file_colon_line => file_colon_line }
|
32
|
-
end
|
33
|
-
|
34
|
-
def before_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
|
35
|
-
post 'before_step_result', { :keyword => keyword,
|
36
|
-
:name => step_match.format_args,
|
37
|
-
:file_colon_line => step_match.file_colon_line }
|
38
|
-
end
|
39
|
-
|
40
|
-
def exception(exception, status)
|
41
|
-
source = backtrace_to_snippet(exception.backtrace)
|
42
|
-
post 'exception', { :message => exception.message,
|
43
|
-
:backtrace => exception.backtrace.join('\n'),
|
44
|
-
:first_line => source[:first_line],
|
45
|
-
:marked_line => source[:marked_line],
|
46
|
-
:raw_lines => source[:raw_lines] }
|
47
|
-
end
|
48
|
-
|
49
|
-
def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
|
50
|
-
post 'after_step_result', { :status => status }
|
51
|
-
end
|
52
|
-
|
53
|
-
def after_steps(*)
|
54
|
-
post 'after_steps'
|
55
|
-
end
|
56
|
-
|
57
|
-
def before_table_row(table_row)
|
58
|
-
post 'before_table_row'
|
59
|
-
end
|
60
|
-
|
61
|
-
def table_cell_value(value, status)
|
62
|
-
post 'table_cell_value', { :value => value }
|
63
|
-
end
|
64
|
-
|
65
|
-
def doc_string(string)
|
66
|
-
post 'doc_string', { :multiline_string => string }
|
67
|
-
end
|
68
|
-
|
69
|
-
def after_features(features)
|
70
|
-
post 'after_features', { :duration => features.duration }
|
71
|
-
end
|
72
|
-
|
73
|
-
private
|
74
|
-
|
75
|
-
def post(url, params = {})
|
76
|
-
RestClient.post "#{@server}/#{url}", params.to_json
|
77
|
-
end
|
78
|
-
|
79
|
-
def ping
|
80
|
-
RestClient.get "#{@server}/ping"
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
require 'cucumber/cli/options'
|
87
|
-
Cucumber::Cli::Options::BUILTIN_FORMATS['cuukie'] = [
|
88
|
-
'Cucumber::Formatter::Cuukie',
|
89
|
-
'Shows Cucumber results on a web page as they run'
|
90
|
-
]
|