Skip to content

Commit d18dcf4

Browse files
committed
Refactor & normalize Guardfile format.
1 parent 6d4cbae commit d18dcf4

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

Guardfile

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,41 @@
11
ignore %r{^\.gem/}
22

3-
group :red_green_refactor, halt_on_fail: true do
4-
guard "minitest" do
3+
def rubocop_opts
4+
{ :all_on_start => false, :keep_failed => false, :cli => "-r finstyle" }
5+
end
6+
7+
def cucumber_opts
8+
cucumber_cli = "--no-profile --color --format progress --strict"
9+
cucumber_cli += " --tags ~@spawn" if RUBY_PLATFORM =~ /mswin|mingw|windows/
10+
11+
{ :all_on_start => false, :cli => cucumber_cli }
12+
end
13+
14+
def yard_opts
15+
{ :port => "8808" }
16+
end
17+
18+
group :red_green_refactor, :halt_on_fail => true do
19+
guard :minitest do
520
watch(%r{^spec/(.*)_spec\.rb})
621
watch(%r{^lib/(.*)([^/]+)\.rb}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
722
watch(%r{^spec/spec_helper\.rb}) { "spec" }
823
end
924

10-
guard :rubocop, all_on_start: false, keep_failed: false, cli: "-r finstyle" do
25+
guard :rubocop, rubocop_opts do
1126
watch(%r{.+\.rb$})
1227
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
1328
end
1429
end
1530

16-
cucumber_cli = "--no-profile --color --format progress --strict"
17-
cucumber_cli += " --tags ~@spawn" if RUBY_PLATFORM =~ /mswin|mingw|windows/
18-
guard "cucumber", all_on_start: false, cli: cucumber_cli do
31+
guard :cucumber, cucumber_opts do
1932
watch(%r{^features/.+\.feature$})
20-
watch(%r{^features/support/.+$}) { "features" }
33+
watch(%r{^features/support/.+$}) { "features" }
2134
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) do |m|
2235
Dir[File.join("**/#{m[1]}.feature")][0] || "features"
2336
end
2437
end
2538

26-
guard "yard", port: "8808" do
39+
guard :yard, yard_opts do
2740
watch(%r{lib/.+\.rb})
2841
end

0 commit comments

Comments
 (0)