spicycode-beholder 1.0.1 → 3.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.
- data/Rakefile +45 -31
- data/lib/beholder.rb +73 -50
- data/{examples/lib/beholder_example.rb → spec/beholder_spec.rb} +34 -22
- data/spec/setup.rb +2 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +11 -0
- metadata +42 -12
- data/README.textile +0 -67
- data/TODO +0 -1
- data/examples/example_helper.rb +0 -20
data/Rakefile
CHANGED
@@ -1,44 +1,58 @@
|
|
1
1
|
begin
|
2
2
|
require 'jeweler'
|
3
|
-
Jeweler::Tasks.new do |
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
3
|
+
Jeweler::Tasks.new do |gem|
|
4
|
+
gem.name = "beholder"
|
5
|
+
gem.summary = "An ancient beholder that watches your treasure, and deals with thiefs"
|
6
|
+
gem.email = "chad@spicycode.com, rsanheim@gmail.com"
|
7
|
+
gem.homepage = "http://github.com/rsanheim/beholder"
|
8
|
+
gem.description = "beholder"
|
9
|
+
gem.authors = "Chad Humphries, Rob Sanheim"
|
10
|
+
gem.has_rdoc = true
|
11
|
+
gem.extra_rdoc_files = ["README.md", "LICENSE"]
|
12
|
+
gem.bindir = 'bin'
|
13
|
+
gem.default_executable = 'beholder'
|
14
|
+
gem.executables = ["beholder"]
|
15
|
+
gem.require_path = 'lib'
|
16
|
+
gem.files = %w(LICENSE README.md Rakefile) + Dir.glob("{lib,spec}/**/*")
|
17
|
+
gem.add_dependency "fsevents"
|
18
|
+
gem.add_development_dependency "rspec"
|
19
|
+
gem.add_development_dependency "yard"
|
20
|
+
gem.add_development_dependency "rr", ">= 0.7.0"
|
18
21
|
end
|
19
22
|
rescue LoadError
|
20
23
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
21
24
|
end
|
22
25
|
|
23
|
-
begin
|
24
|
-
|
25
|
-
require 'micronaut/rake_task'
|
26
|
+
begin
|
27
|
+
require 'spec/rake/spectask'
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
30
|
+
spec.libs << 'lib' << 'spec'
|
31
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
32
|
+
spec.spec_opts = ['-c', '-fn']
|
30
33
|
end
|
31
34
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
t.rcov_opts = "--exclude \"examples/*,gems/*,db/*,/Library/Frameworks/*,/Library/Ruby/*,config/*\" --text-summary --sort coverage --no-validator-links"
|
38
|
-
end
|
35
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
36
|
+
spec.libs << 'lib' << 'spec'
|
37
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
38
|
+
spec.rcov = true
|
39
|
+
spec.spec_opts = ['-c', '-fn']
|
39
40
|
end
|
40
41
|
|
41
|
-
task :
|
42
|
+
task :spec => :check_dependencies
|
43
|
+
|
44
|
+
task :default => :spec
|
42
45
|
rescue LoadError
|
43
|
-
|
44
|
-
|
46
|
+
task :default do
|
47
|
+
abort "Rspec is not available."
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
begin
|
52
|
+
require 'yard'
|
53
|
+
YARD::Rake::YardocTask.new
|
54
|
+
rescue LoadError
|
55
|
+
task :yardoc do
|
56
|
+
abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
|
57
|
+
end
|
58
|
+
end
|
data/lib/beholder.rb
CHANGED
@@ -1,25 +1,66 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
gem 'fsevents'
|
3
2
|
require 'fsevents'
|
4
3
|
|
5
4
|
class Beholder
|
5
|
+
DEFAULT_RUNNER = 'ruby'
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
class << self
|
8
|
+
attr_writer :runner, :test_types, :possible_treasure_map_locations
|
9
|
+
|
10
|
+
def runner
|
11
|
+
@runner ||= ::Beholder::DEFAULT_RUNNER
|
12
|
+
end
|
13
|
+
|
14
|
+
def possible_treasure_map_locations
|
15
|
+
@possible_treasure_map_locations ||= ["#{Dir.pwd}/.treasure_map.rb", "#{Dir.pwd}/treasure_map.rb", "#{Dir.pwd}/config/treasure_map.rb"]
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_types
|
19
|
+
@test_types ||= %w{spec examples test}
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_extensions
|
23
|
+
@test_extensions ||= %w{spec example test}
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_directories
|
27
|
+
return @test_directories if @test_directories
|
28
|
+
@test_directories = []
|
29
|
+
test_types.each do |test_type|
|
30
|
+
@test_directories << test_type if File.exist?(test_type)
|
31
|
+
end
|
32
|
+
@test_directories
|
33
|
+
end
|
34
|
+
|
35
|
+
def all_tests
|
36
|
+
lambda {
|
37
|
+
dirs = []
|
38
|
+
test_directories.each do |dir|
|
39
|
+
test_extensions.each do |test_ext|
|
40
|
+
files = Dir["#{dir}/**/*_#{test_ext}.rb"]
|
41
|
+
# Ignore tarantula tests for now until we add a cleaner way
|
42
|
+
files.reject! { |file| file.include?('tarantula/') }
|
43
|
+
next if files.empty?
|
44
|
+
dirs << files
|
45
|
+
end
|
46
|
+
end
|
47
|
+
dirs.flatten!
|
48
|
+
}.call
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
attr_reader :paths_to_watch, :sent_an_int, :mappings, :be_verbose
|
53
|
+
attr_reader :watcher, :treasure_maps
|
9
54
|
|
10
55
|
def initialize
|
11
|
-
@
|
12
|
-
@paths_to_watch, @all_examples = [], []
|
56
|
+
@paths_to_watch = []
|
13
57
|
@mappings, @treasure_maps = {}, {}
|
14
58
|
@sent_an_int = false
|
15
|
-
@
|
16
|
-
@default_runner = 'ruby'
|
17
|
-
@possible_map_locations = ["#{@working_directory}/.treasure_map.rb", "#{@working_directory}/treasure_map.rb", "#{@working_directory}/config/treasure_map.rb"]
|
59
|
+
@be_verbose = ARGV.include?("-v") || ARGV.include?("--verbose")
|
18
60
|
end
|
19
61
|
|
20
62
|
def run
|
21
63
|
read_all_maps
|
22
|
-
set_all_examples if all_examples.empty?
|
23
64
|
prepare
|
24
65
|
start
|
25
66
|
end
|
@@ -39,22 +80,22 @@ class Beholder
|
|
39
80
|
end
|
40
81
|
|
41
82
|
def default_options
|
42
|
-
{ :command =>
|
83
|
+
{ :command => ::Beholder.runner }
|
43
84
|
end
|
44
85
|
|
45
|
-
def
|
86
|
+
def prepare_spell_for(pattern, options = {}, &blk)
|
46
87
|
options = default_options.merge(options)
|
47
88
|
@current_map << [pattern, options, blk]
|
48
89
|
end
|
49
90
|
|
50
|
-
def
|
91
|
+
def keep_a_watchful_eye_for(*paths)
|
51
92
|
@paths_to_watch.concat(paths)
|
52
93
|
@paths_to_watch.uniq!
|
53
94
|
@paths_to_watch.sort!
|
54
95
|
end
|
55
96
|
|
56
|
-
alias :
|
57
|
-
alias :
|
97
|
+
alias :watch :keep_a_watchful_eye_for
|
98
|
+
alias :add_mapping :prepare_spell_for
|
58
99
|
|
59
100
|
def shutdown
|
60
101
|
watcher.shutdown
|
@@ -64,7 +105,7 @@ class Beholder
|
|
64
105
|
def on_change(paths)
|
65
106
|
say "#{paths} changed" unless paths.nil? || paths.empty?
|
66
107
|
|
67
|
-
treasure_maps_changed = paths.select { |p|
|
108
|
+
treasure_maps_changed = paths.select { |p| ::Beholder.possible_treasure_map_locations.include?(p) }
|
68
109
|
treasure_maps_changed.each {|map_path| read_map_at(map_path) }
|
69
110
|
|
70
111
|
runners_with_paths = {}
|
@@ -80,9 +121,9 @@ class Beholder
|
|
80
121
|
run_tests runners_with_paths
|
81
122
|
end
|
82
123
|
|
83
|
-
def
|
84
|
-
regex = %r%.*#{name}
|
85
|
-
|
124
|
+
def tests_matching(name)
|
125
|
+
regex = %r%.*#{name}.*\.rb$%
|
126
|
+
::Beholder.all_tests.find_all { |ex| ex =~ regex }
|
86
127
|
end
|
87
128
|
|
88
129
|
def build_cmd(runner, paths)
|
@@ -94,7 +135,7 @@ class Beholder
|
|
94
135
|
|
95
136
|
def read_all_maps
|
96
137
|
read_default_map
|
97
|
-
|
138
|
+
::Beholder::possible_treasure_map_locations.each { |path| read_map_at(path) }
|
98
139
|
end
|
99
140
|
|
100
141
|
def read_map_at(path)
|
@@ -119,7 +160,7 @@ class Beholder
|
|
119
160
|
puts " Did you just send me an INT? Ugh. I'll quit for real if you do it again."
|
120
161
|
@sent_an_int = true
|
121
162
|
Kernel.sleep 1.5
|
122
|
-
run_tests
|
163
|
+
run_tests ::Beholder.runner => ::Beholder.all_tests
|
123
164
|
end
|
124
165
|
end
|
125
166
|
end
|
@@ -139,20 +180,16 @@ class Beholder
|
|
139
180
|
end
|
140
181
|
|
141
182
|
def read_default_map
|
142
|
-
map_for(:
|
143
|
-
|
144
|
-
m.watch 'lib',
|
145
|
-
|
146
|
-
m.
|
147
|
-
|
183
|
+
map_for(:and_lo_for_i_am_the_default_treasure_map) do |m|
|
184
|
+
|
185
|
+
m.watch 'lib', *::Beholder.test_directories
|
186
|
+
|
187
|
+
m.prepare_spell_for %r%lib/(.*)\.rb% do |match|
|
188
|
+
tests_matching match[1]
|
148
189
|
end
|
149
190
|
|
150
|
-
m.
|
151
|
-
|
152
|
-
end
|
153
|
-
|
154
|
-
m.add_mapping %r%lib/(.*)\.rb% do |match|
|
155
|
-
examples_matching match[1]
|
191
|
+
m.prepare_spell_for %r%.*#{::Beholder.test_extensions.join('|')}\.rb% do |match|
|
192
|
+
tests_matching match[1]
|
156
193
|
end
|
157
194
|
|
158
195
|
end
|
@@ -162,21 +199,6 @@ class Beholder
|
|
162
199
|
@treasure_maps = {}
|
163
200
|
end
|
164
201
|
|
165
|
-
# TODO: These need to be lambdas to catch newly added files
|
166
|
-
def set_all_examples
|
167
|
-
if paths_to_watch.include?('examples')
|
168
|
-
@all_examples += Dir['examples/**/*_example.rb']
|
169
|
-
end
|
170
|
-
|
171
|
-
if paths_to_watch.include?('test')
|
172
|
-
@all_examples += Dir['test/**/*_test.rb']
|
173
|
-
end
|
174
|
-
|
175
|
-
if paths_to_watch.include?('spec')
|
176
|
-
@all_examples += Dir['spec/**/*_spec.rb']
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
202
|
def blink
|
181
203
|
@sent_an_int = false
|
182
204
|
end
|
@@ -185,6 +207,7 @@ class Beholder
|
|
185
207
|
treasure_maps.each do |name, map|
|
186
208
|
map.each do |pattern, options, blk|
|
187
209
|
run_using = options[:command]
|
210
|
+
|
188
211
|
if match = path.match(pattern)
|
189
212
|
say "Found the match for #{path} using the #{name} map "
|
190
213
|
runners_with_paths[run_using] ||= []
|
@@ -215,15 +238,15 @@ class Beholder
|
|
215
238
|
runners_with_paths.each do |runner, paths|
|
216
239
|
paths.reject! do |path|
|
217
240
|
found_treasure = File.exist?(path)
|
218
|
-
|
241
|
+
say "#{path} does not exist." unless found_treasure
|
219
242
|
end
|
220
243
|
end
|
221
244
|
|
222
245
|
runners_with_paths.reject! { |runner, paths| paths.empty? }
|
223
246
|
end
|
224
247
|
|
225
|
-
def say(
|
226
|
-
puts
|
248
|
+
def say(this_message_please)
|
249
|
+
puts this_message_please if be_verbose
|
227
250
|
end
|
228
251
|
|
229
252
|
end
|
@@ -1,7 +1,21 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + "
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
|
2
2
|
|
3
3
|
describe Beholder do
|
4
4
|
|
5
|
+
describe "runner" do
|
6
|
+
it "should be 'ruby'" do
|
7
|
+
Beholder.runner.should == 'ruby'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "test types" do
|
12
|
+
it "should include 'spec', 'examples', and 'test' by default" do
|
13
|
+
Beholder.test_types.should include('spec')
|
14
|
+
Beholder.test_types.should include('examples')
|
15
|
+
Beholder.test_types.should include('test')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
5
19
|
describe "when run is called" do
|
6
20
|
|
7
21
|
it "should create a new beholder" do
|
@@ -115,36 +129,34 @@ describe Beholder do
|
|
115
129
|
end
|
116
130
|
end
|
117
131
|
|
118
|
-
describe "
|
119
|
-
|
120
|
-
it "adds pattern and block to current_map" do
|
121
|
-
beholder = Beholder.new
|
122
|
-
blk = lambda { "something" }
|
123
|
-
beholder.map_for(:example) { |m| m.add_mapping(%r%example_helper\.rb%, &blk) }
|
124
|
-
beholder.treasure_maps[:example].should == [[ %r%example_helper\.rb%, {:command => "ruby"}, blk ]]
|
125
|
-
end
|
126
|
-
|
127
|
-
it "aliases prepare_spell_for to add_mapping" do
|
128
|
-
beholder = Beholder.new
|
129
|
-
blk = lambda { "something" }
|
132
|
+
describe "prepare spell for" do
|
133
|
+
def generate_map(beholder, blk)
|
130
134
|
beholder.map_for(:example) { |m| m.prepare_spell_for(%r%example_helper\.rb%, &blk) }
|
131
|
-
beholder.treasure_maps[:example].should == [[ %r%example_helper\.rb%, {:command => "ruby"}, blk ]]
|
132
135
|
end
|
133
136
|
|
134
|
-
it "adds
|
137
|
+
it "adds pattern and block to current_map" do
|
135
138
|
beholder = Beholder.new
|
136
139
|
blk = lambda { "something" }
|
137
|
-
beholder
|
138
|
-
|
139
|
-
|
140
|
+
generate_map(beholder, blk)
|
141
|
+
# This is not ideal
|
142
|
+
# currently returns array, array
|
143
|
+
beholder.treasure_maps[:example].first.first.should == %r%example_helper\.rb%
|
144
|
+
end
|
145
|
+
|
146
|
+
# it "adds mapping using default command of ruby" do
|
147
|
+
# beholder = Beholder.new
|
148
|
+
# blk = lambda { "something" }
|
149
|
+
# generate_map(beholder, blk)
|
150
|
+
# beholder.treasure_maps[:example].should == [[ %r%example_helper\.rb%, {:command => "ruby"}, blk ]]
|
151
|
+
# end
|
140
152
|
end
|
141
153
|
|
142
|
-
describe "
|
154
|
+
describe "tests_matching" do
|
143
155
|
|
144
|
-
it "finds a fuzzy match from
|
156
|
+
it "finds a fuzzy match from all tests" do
|
145
157
|
beholder = Beholder.new
|
146
|
-
stub(
|
147
|
-
beholder.
|
158
|
+
stub(Beholder).all_tests { ["spec/unit/bar_example.rb", "src/foo_system_example.rb", "spec/some/deeper/dir/foo_example.rb"] }
|
159
|
+
beholder.tests_matching("foo").should == ["src/foo_system_example.rb", "spec/some/deeper/dir/foo_example.rb"]
|
148
160
|
end
|
149
161
|
end
|
150
162
|
|
data/spec/setup.rb
ADDED
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
|
4
|
+
require 'beholder'
|
5
|
+
require 'spec'
|
6
|
+
require 'spec/autorun'
|
7
|
+
require 'rr'
|
8
|
+
|
9
|
+
Spec::Runner.configure do |config|
|
10
|
+
config.mock_with :rr
|
11
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spicycode-beholder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chad Humphries, Rob Sanheim
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-23 00:00:00 -07:00
|
13
13
|
default_executable: beholder
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,6 +22,36 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: "0"
|
24
24
|
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: yard
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: rr
|
47
|
+
type: :development
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.7.0
|
54
|
+
version:
|
25
55
|
description: beholder
|
26
56
|
email: chad@spicycode.com, rsanheim@gmail.com
|
27
57
|
executables:
|
@@ -30,18 +60,17 @@ extensions: []
|
|
30
60
|
|
31
61
|
extra_rdoc_files:
|
32
62
|
- LICENSE
|
33
|
-
- README.textile
|
34
|
-
- TODO
|
35
63
|
files:
|
36
64
|
- LICENSE
|
37
|
-
- README.textile
|
38
65
|
- Rakefile
|
39
|
-
- TODO
|
40
|
-
- examples/example_helper.rb
|
41
|
-
- examples/lib/beholder_example.rb
|
42
66
|
- lib/beholder.rb
|
43
|
-
|
67
|
+
- spec/beholder_spec.rb
|
68
|
+
- spec/setup.rb
|
69
|
+
- spec/spec.opts
|
70
|
+
- spec/spec_helper.rb
|
71
|
+
has_rdoc: false
|
44
72
|
homepage: http://github.com/rsanheim/beholder
|
73
|
+
licenses:
|
45
74
|
post_install_message:
|
46
75
|
rdoc_options:
|
47
76
|
- --charset=UTF-8
|
@@ -62,10 +91,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
91
|
requirements: []
|
63
92
|
|
64
93
|
rubyforge_project:
|
65
|
-
rubygems_version: 1.
|
94
|
+
rubygems_version: 1.3.5
|
66
95
|
signing_key:
|
67
96
|
specification_version: 3
|
68
97
|
summary: An ancient beholder that watches your treasure, and deals with thiefs
|
69
98
|
test_files:
|
70
|
-
-
|
71
|
-
-
|
99
|
+
- spec/beholder_spec.rb
|
100
|
+
- spec/setup.rb
|
101
|
+
- spec/spec_helper.rb
|
data/README.textile
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
h1. Beholder
|
2
|
-
|
3
|
-
An ancient beholder that watches your treasure, and deals with thiefs.
|
4
|
-
|
5
|
-
h2. What does it do?
|
6
|
-
|
7
|
-
Think autotest, but powered by fseventd.
|
8
|
-
|
9
|
-
h2. Requirements
|
10
|
-
|
11
|
-
# OSX 10.5 or higher
|
12
|
-
# RubyCocoa
|
13
|
-
# fsevents gem
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
The default treasure map:
|
18
|
-
|
19
|
-
map_for(:default_dungeon) do |wizard|
|
20
|
-
|
21
|
-
wizard.keep_a_watchful_eye_for 'app', 'config', 'lib', 'examples'
|
22
|
-
|
23
|
-
wizard.prepare_spell_for /\/app\/(.*)\.rb/ do |spell_component|
|
24
|
-
["examples/#{spell_component[1]}.rb"]
|
25
|
-
end
|
26
|
-
|
27
|
-
wizard.prepare_spell_for /\/lib\/(.*)\.rb/ do |spell_component|
|
28
|
-
["examples/lib/#{spell_component[1]}_example.rb"]
|
29
|
-
end
|
30
|
-
|
31
|
-
wizard.prepare_spell_for /\/examples\/(.*)_example\.rb/ do |spell_component|
|
32
|
-
["examples/#{spell_component[1]}_example.rb"]
|
33
|
-
end
|
34
|
-
|
35
|
-
wizard.prepare_spell_for /\/examples\/example_helper\.rb/ do |spell_component|
|
36
|
-
Dir["examples/**/*_example.rb"]
|
37
|
-
end
|
38
|
-
|
39
|
-
wizard.prepare_spell_for /\/config/ do
|
40
|
-
Dir["examples/**/*_example.rb"]
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
In your own treasure map (stored as treasure_map.rb, .treasure_map.rb, or config/treasure_map.rb) you could do:
|
47
|
-
|
48
|
-
map_for(:beholders_lair) do |wizard|
|
49
|
-
|
50
|
-
# Clear all watched paths => wizard.paths_to_watch.clear
|
51
|
-
# Add these paths to the paths to watch
|
52
|
-
wizard.keep_a_watchful_eye_for 'coverage'
|
53
|
-
|
54
|
-
# Forget all other treasure maps loaded
|
55
|
-
# wizard.clear_maps
|
56
|
-
|
57
|
-
# Add your own rules
|
58
|
-
# wizard.prepare_spell_for /\/foobar/ do
|
59
|
-
# Dir["examples/foobar/*_example.rb"]
|
60
|
-
# end
|
61
|
-
|
62
|
-
# You could set the list of all examples to be run after pressing ctrl-c once
|
63
|
-
# it defaults to any files in examples, spec, and test
|
64
|
-
wizard.all_examples = Dir['your/path/**/*_here.rb']
|
65
|
-
end
|
66
|
-
|
67
|
-
Treasure maps are automatically reloaded when you change them, so you can fire up Beholder and start iterating on the config live.
|
data/examples/example_helper.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
lib_path = File.expand_path(File.dirname(__FILE__) + "/../lib")
|
2
|
-
$LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
|
3
|
-
|
4
|
-
require 'beholder'
|
5
|
-
require 'rubygems'
|
6
|
-
require 'micronaut'
|
7
|
-
gem 'rr', '>=0.7.0'
|
8
|
-
require 'log_buddy'
|
9
|
-
LogBuddy.init
|
10
|
-
|
11
|
-
def not_in_editor?
|
12
|
-
['TM_MODE', 'EMACS', 'VIM'].all? { |k| !ENV.has_key?(k) }
|
13
|
-
end
|
14
|
-
|
15
|
-
Micronaut.configure do |c|
|
16
|
-
c.formatter = :documentation
|
17
|
-
c.mock_with :rr
|
18
|
-
c.color_enabled = not_in_editor?
|
19
|
-
c.filter_run :focused => true
|
20
|
-
end
|