Skip to content

Commit

Permalink
add Guard support (#4)
Browse files Browse the repository at this point in the history
Fixes #4.
  • Loading branch information
Adam Spiers committed Feb 16, 2018
1 parent 8e6c205 commit 3e0d541
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ PATH
remote: .
specs:
ansible-viz (0.1.0)
guard
guard-minitest
guard-rspec
mustache (~> 0.99.4)
rake
word_wrap
Expand All @@ -14,7 +17,31 @@ GEM
coderay (1.1.2)
diff-lcs (1.3)
docile (1.1.5)
ffi (1.9.21)
formatador (0.2.5)
guard (2.14.2)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-minitest (2.4.6)
guard-compat (~> 1.2)
minitest (>= 3.0)
guard-rspec (4.7.3)
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
json (2.1.0)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
lumberjack (1.0.12)
method_source (0.9.0)
minitest (5.11.3)
minitest-reporters (1.1.19)
Expand All @@ -23,10 +50,17 @@ GEM
minitest (>= 5.0)
ruby-progressbar
mustache (0.99.8)
nenv (0.3.0)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
rake (12.3.0)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
Expand All @@ -41,11 +75,14 @@ GEM
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
ruby-progressbar (1.9.0)
ruby_dep (1.5.0)
shellany (0.0.1)
simplecov (0.15.1)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
thor (0.20.0)
word_wrap (1.0.0)

PLATFORMS
Expand Down
24 changes: 24 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
directories %w(test spec) \
.select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}

guard :rspec, cmd: "bundle exec rspec", all_on_start: false do
require "guard/rspec/dsl"
dsl = Guard::RSpec::Dsl.new(self)

# RSpec files
rspec = dsl.rspec
watch(rspec.spec_helper) { rspec.spec_dir }
watch(rspec.spec_support) { rspec.spec_dir }
watch(rspec.spec_files)

# Ruby files
ruby = dsl.ruby
dsl.watch_spec_files_for(ruby.lib_files)
end

guard :minitest, all_on_start: false do
# with Minitest::Unit
watch(%r{^test/(.*)\/?test_(.*)\.rb$})
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
watch(%r{^test/test_helper\.rb$}) { 'test' }
end
3 changes: 3 additions & 0 deletions ansible-viz.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Gem::Specification.new do |s|
s.add_development_dependency "minitest", "~> 5.0"
s.add_development_dependency "minitest-reporters"
s.add_development_dependency "simplecov"
s.add_dependency "guard"
s.add_dependency "guard-rspec"
s.add_dependency "guard-minitest"

s.bindir = "bin"
s.files = %w(README.md LICENSE)
Expand Down
4 changes: 4 additions & 0 deletions spec/loader_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This seems to be required for guard-rspec to work; presumably it
# ignores .rspec in some rspec runs.
require "spec_helper"

require "ansible_viz/loader"

RSpec.describe Loader do
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'rspec'

# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
Expand Down

0 comments on commit 3e0d541

Please sign in to comment.