Permalink
Browse files

Add simple Guardfile

  • Loading branch information...
1 parent e7d350b commit 981f12ddc2ea369350af0a83e8fb87c8514e848b @rf- rf- committed Sep 9, 2012
Showing with 58 additions and 2 deletions.
  1. +8 −0 Gemfile
  2. +44 −0 Guardfile
  3. +2 −1 Rakefile
  4. +4 −1 pry.gemspec
View
@@ -1,2 +1,10 @@
source :rubygems
gemspec
+
+# For Guard
+case RUBY_PLATFORM
+when /linux/i
+ gem 'rb-inotify'
+when /darwin/i
+ gem 'rb-fsevent'
+end
View
@@ -0,0 +1,44 @@
+require 'guard/guard'
+
+module ::Guard
+ class Bacon < Guard
+ def run_all
+ system "bundle exec bacon -Itest -q -a"
+ puts
+ true
+ end
+
+ def run_spec(path)
+ if File.exists?(path)
+ system "bundle exec bacon -Itest -q #{path}"
+ puts
+ end
+ end
+
+ def file_changed(path)
+ run_spec(path)
+ end
+
+ def run_on_changes(paths)
+ paths.delete(:all)
+
+ paths.each do |path|
+ file_changed(path)
+ end
+
+ run_all
+ end
+ end
+end
+
+guard 'bacon' do
+ # Example of mapping a lib file to one or more test files
+ watch('lib/pry/indent.rb') { 'test/test_indent.rb' }
+
+ # If no such mapping exists, just run all of them
+ watch(%r{^lib/}) { :all }
+
+ # If we modified one test file, run it
+ watch(%r{^test.*/test_.+\.rb$})
+end
+
View
@@ -24,7 +24,8 @@ def apply_spec_defaults(s)
s.add_dependency('method_source','~> 0.8')
s.add_development_dependency('bacon', '~> 1.1')
s.add_development_dependency('open4', '~> 1.3')
- s.add_development_dependency('rake', '~> 0.9')
+ s.add_development_dependency('rake', '~> 0.9')
+ s.add_development_dependency('guard', '~> 1.3.2')
# TODO: make this a plain dependency:
s.add_development_dependency('bond', '~> 0.4.2')
end
View
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["John Mair (banisterfiend)", "Conrad Irwin", "Ryan Fitzgerald"]
- s.date = "2012-09-07"
+ s.date = "2012-09-08"
s.description = "An IRB alternative and runtime developer console"
s.email = ["jrmair@gmail.com", "conrad.irwin@gmail.com", "rwfitzge@gmail.com"]
s.executables = ["pry"]
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
s.add_development_dependency(%q<bacon>, ["~> 1.1"])
s.add_development_dependency(%q<open4>, ["~> 1.3"])
s.add_development_dependency(%q<rake>, ["~> 0.9"])
+ s.add_development_dependency(%q<guard>, ["~> 1.3.2"])
s.add_development_dependency(%q<bond>, ["~> 0.4.2"])
else
s.add_dependency(%q<coderay>, ["~> 1.0.5"])
@@ -35,6 +36,7 @@ Gem::Specification.new do |s|
s.add_dependency(%q<bacon>, ["~> 1.1"])
s.add_dependency(%q<open4>, ["~> 1.3"])
s.add_dependency(%q<rake>, ["~> 0.9"])
+ s.add_dependency(%q<guard>, ["~> 1.3.2"])
s.add_dependency(%q<bond>, ["~> 0.4.2"])
end
else
@@ -44,6 +46,7 @@ Gem::Specification.new do |s|
s.add_dependency(%q<bacon>, ["~> 1.1"])
s.add_dependency(%q<open4>, ["~> 1.3"])
s.add_dependency(%q<rake>, ["~> 0.9"])
+ s.add_dependency(%q<guard>, ["~> 1.3.2"])
s.add_dependency(%q<bond>, ["~> 0.4.2"])
end
end

0 comments on commit 981f12d

Please sign in to comment.