marcinbunsch-bolt 0.2.4 → 0.2.5
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/.bolt.sample +14 -1
- data/README.textile +11 -0
- data/lib/bolt/notifiers/growl.rb +2 -0
- data/lib/bolt/runners/cucumber.rb +59 -34
- metadata +1 -1
data/.bolt.sample
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
# possible choices:
|
|
1
|
+
# possible choices: generic, osx
|
|
2
|
+
listener: generic
|
|
3
|
+
# possible choices: test_unit, rspec, cucumber
|
|
2
4
|
runner: rspec
|
|
5
|
+
# possible choices: growl, notify_osd
|
|
6
|
+
notifier: growl
|
|
7
|
+
verbose: true
|
|
8
|
+
# this is only required if you're using cucumber
|
|
9
|
+
feature_map:
|
|
10
|
+
other:
|
|
11
|
+
controllers: application
|
|
12
|
+
models: post
|
|
13
|
+
posts:
|
|
14
|
+
controllers: posts, application
|
|
15
|
+
models: post
|
data/README.textile
CHANGED
|
@@ -17,6 +17,17 @@ It takes solutions from several gems:
|
|
|
17
17
|
* *autotest* - obviously. Whole concept, parts of generic listener
|
|
18
18
|
* *Roman2K-rails_test_serving* - concept of running tests with preloaded environment, elements of test::unit runner
|
|
19
19
|
|
|
20
|
+
h2. Installation
|
|
21
|
+
|
|
22
|
+
<pre>
|
|
23
|
+
gem sources -a http://gems.github.com
|
|
24
|
+
sudo gem install marcinbunsch-bolt
|
|
25
|
+
</pre>
|
|
26
|
+
|
|
27
|
+
h2. Running
|
|
28
|
+
|
|
29
|
+
Cd into the folder you want bolt to run in and type 'bolt'
|
|
30
|
+
|
|
20
31
|
h2. Contributors
|
|
21
32
|
|
|
22
33
|
* *cziko* - http://github.com/cziko - Growl Notifier network support (via ruby-growl)
|
data/lib/bolt/notifiers/growl.rb
CHANGED
|
@@ -63,6 +63,8 @@ module Bolt
|
|
|
63
63
|
end
|
|
64
64
|
elsif (results.match('0 failures, 0 errors')) # test::unit
|
|
65
65
|
icon = 'success'
|
|
66
|
+
elsif (results.match(/([0-9]*) scenario(s*) \([0-9]+ passed\) ([0-9]*) step(s*) \([0-9]+ passed\)/)) # cucumber
|
|
67
|
+
icon = 'success'
|
|
66
68
|
else
|
|
67
69
|
icon = 'failed'
|
|
68
70
|
end
|
|
@@ -13,7 +13,7 @@ module Bolt
|
|
|
13
13
|
# class map specifies the folders holding classes that can be reloaded
|
|
14
14
|
CLASS_MAP = /(app\/controllers\/|app\/models\/|lib\/)/
|
|
15
15
|
|
|
16
|
-
attr_accessor :notifier, :test_io, :heard
|
|
16
|
+
attr_accessor :notifier, :test_io, :heard, :controllers, :models
|
|
17
17
|
|
|
18
18
|
# step mother storage
|
|
19
19
|
@@mother = nil
|
|
@@ -26,51 +26,76 @@ module Bolt
|
|
|
26
26
|
@@mother
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
self.
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
def initialize
|
|
30
|
+
self.controllers = {}
|
|
31
|
+
self.models = {}
|
|
32
|
+
read_map
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def read_map
|
|
36
|
+
if !Bolt['feature_map']
|
|
37
|
+
puts "** ERROR: could not find feature_map in .bolt"
|
|
34
38
|
else
|
|
35
|
-
|
|
39
|
+
Bolt['feature_map'].each do |feature, map|
|
|
40
|
+
# controllers
|
|
41
|
+
if map["controllers"].include?(',')
|
|
42
|
+
map["controllers"].split(',').each { |controller|
|
|
43
|
+
name = controller.strip
|
|
44
|
+
self.controllers[name] = [] if !self.controllers[name]
|
|
45
|
+
self.controllers[name] << feature
|
|
46
|
+
}
|
|
47
|
+
else
|
|
48
|
+
name = map["controllers"]
|
|
49
|
+
self.controllers[name] = [] if !self.controllers[name]
|
|
50
|
+
self.controllers[name] << feature
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# models
|
|
54
|
+
if map["models"].include?(',')
|
|
55
|
+
map["models"].split(',').each { |model|
|
|
56
|
+
name = model.strip
|
|
57
|
+
self.models[name] = [] if !self.models[name]
|
|
58
|
+
self.models[name] << feature
|
|
59
|
+
}
|
|
60
|
+
else
|
|
61
|
+
name = map["models"]
|
|
62
|
+
self.models[name] = [] if !self.models[name]
|
|
63
|
+
self.models[name] << feature
|
|
64
|
+
end
|
|
65
|
+
end
|
|
36
66
|
end
|
|
37
67
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
68
|
+
end
|
|
69
|
+
# mapping is a copied and modified version of mislav/rspactor Inspector#translate
|
|
70
|
+
def translate(file)
|
|
71
|
+
self.heard = file
|
|
72
|
+
|
|
41
73
|
case file
|
|
42
74
|
when %r:^app/controllers/:
|
|
43
|
-
|
|
75
|
+
name = file.sub('_controller.rb', '').sub('app/controllers/', '')
|
|
76
|
+
features = self.controllers[name]
|
|
44
77
|
when %r:^app/models/:
|
|
45
|
-
|
|
78
|
+
name = file.sub('.rb', '').sub('app/models/', '')
|
|
79
|
+
features = self.models[name]
|
|
80
|
+
#
|
|
46
81
|
when %r:^app/views/:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
when %r:^spec/:
|
|
51
|
-
test_filename = file
|
|
82
|
+
file = file.sub('app/views/', '')
|
|
83
|
+
directory = file.split('/')[0..-2].compact.join('/')
|
|
84
|
+
features = self.controllers[directory]
|
|
52
85
|
when %r:^lib/:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
when 'config/routes.rb'
|
|
56
|
-
test_filename = "spec/controllers/#{basename.sub('.rb', '_spec.rb')}"
|
|
57
|
-
when 'config/database.yml', 'db/schema.rb'
|
|
58
|
-
#candidates << 'models'
|
|
86
|
+
name = file.sub('.rb', '').sub('lib/', '')
|
|
87
|
+
features = self.models[name]
|
|
59
88
|
else
|
|
60
|
-
|
|
61
|
-
end
|
|
62
|
-
if test_filename and file_verified?(test_filename)
|
|
63
|
-
candidates << test_filename
|
|
64
|
-
end
|
|
65
|
-
if candidates == []
|
|
66
|
-
puts "=> NOTICE: could not find feature file for: #{file}"
|
|
89
|
+
#
|
|
67
90
|
end
|
|
91
|
+
|
|
92
|
+
features = [] if !features
|
|
93
|
+
|
|
94
|
+
return features.collect { |name| "features/#{name}.feature" }
|
|
68
95
|
|
|
69
|
-
candidates
|
|
70
96
|
end
|
|
71
97
|
|
|
72
98
|
def run(files)
|
|
73
|
-
file = files.first
|
|
74
99
|
|
|
75
100
|
# redirect spec output to StringIO
|
|
76
101
|
io = StringIO.new
|
|
@@ -82,7 +107,7 @@ module Bolt
|
|
|
82
107
|
|
|
83
108
|
Bolt::Runners::Cucumber.mother.reload_definitions! if Bolt::Runners::Cucumber.mother and self.heard.match('_steps.rb')
|
|
84
109
|
|
|
85
|
-
::Cucumber::Cli::Main.execute(
|
|
110
|
+
::Cucumber::Cli::Main.execute(files)
|
|
86
111
|
|
|
87
112
|
Bolt::Runners::Cucumber.mother.clear_steps_and_scenarios!
|
|
88
113
|
# read the buffer
|
|
@@ -97,7 +122,7 @@ module Bolt
|
|
|
97
122
|
last_three = last_three.gsub("\e[32m", '').gsub("\e[0m", '').gsub("\e[36m", '').gsub("\e[31m", '') # get ri of the color codes
|
|
98
123
|
|
|
99
124
|
# sent result to notifier
|
|
100
|
-
notifier.result(
|
|
125
|
+
notifier.result(files.join(' '), last_three)
|
|
101
126
|
|
|
102
127
|
end
|
|
103
128
|
|