guard-motion 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+
19
+ .DS_Store
@@ -0,0 +1,2 @@
1
+ rvm:
2
+ - 1.9.3
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in guard-motion.gemspec
4
+ gemspec
5
+
6
+ platforms :ruby do
7
+ gem 'rb-readline'
8
+ end
@@ -0,0 +1,9 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec', :version => 2 do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+ end
9
+
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Fabio Kuhn
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,99 @@
1
+ # Guard::Motion [![Build Status](https://secure.travis-ci.org/mordaroso/guard-motion.png?branch=master)](http://travis-ci.org/mordaroso/guard-motion)
2
+
3
+ Motion guard allows to automatically & intelligently launch [RubyMotion](http://www.rubymotion.com/) specs when files are modified.
4
+
5
+ ## Install
6
+
7
+ Please be sure to have [Guard](https://github.com/guard/guard) installed before continue.
8
+
9
+ Install the gem:
10
+
11
+ ```
12
+ $ gem install guard-motion
13
+ ```
14
+
15
+ Add it to your Gemfile (inside development group):
16
+
17
+ ``` ruby
18
+ gem 'guard-motion'
19
+ ```
20
+
21
+ Add guard definition to your Guardfile by running this command:
22
+
23
+ ```
24
+ $ guard init motion
25
+ ```
26
+
27
+ Make sure Guard::Motion is loaded in your project Rakefile:
28
+
29
+ ``` ruby
30
+ require 'guard/motion'
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ Please read [Guard usage doc](https://github.com/guard/guard#readme)
36
+
37
+ ## Guardfile
38
+
39
+ Motion guard can be really adapted to all kind of project setup.
40
+
41
+ ### Typical RubyMotion App
42
+
43
+ ``` ruby
44
+ guard 'motion' do
45
+ watch(%r{^spec/.+_spec\.rb$})
46
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
47
+ end
48
+ ```
49
+
50
+ ### Typical RubyMotion library
51
+
52
+ ``` ruby
53
+ guard 'motion' do
54
+ watch(%r{^spec/.+_spec\.rb$})
55
+ watch(%r{^lib/[^/]+/(.+)\.rb$}) { |m| "./spec/#{m[1]}_spec.rb" }
56
+ end
57
+ ```
58
+
59
+ Please read [Guard doc](https://github.com/guard/guard#readme) for more information about the Guardfile DSL.
60
+
61
+ ## Options
62
+
63
+ By default, Guard::Motion will only look for spec files within `spec` in your project root. You can configure Guard::Motion to look in additional paths by using the `:spec_paths` option:
64
+
65
+ ``` ruby
66
+ guard 'motion', :spec_paths => ["spec", "vendor/other_project/spec"] do
67
+ # ...
68
+ end
69
+ ```
70
+ If you have only one path to look, you can configure `:spec_paths` option with a string:
71
+
72
+ ``` ruby
73
+ guard 'motion', :spec_paths => "test" do
74
+ # ...
75
+ end
76
+ ```
77
+
78
+ ### List of available options:
79
+
80
+ ``` ruby
81
+ :bundler => false # use "bundle exec" to run the rake command, default: true
82
+ :binstubs => true # use "bin/rake" to run the rake command (takes precedence over :bundle), default: false
83
+ :notification => false # display Growl (or Libnotify) notification after the specs are done running, default: true
84
+ :all_after_pass => false # run all specs after changed specs pass, default: true
85
+ :all_on_start => false # run all the specs at startup, default: true
86
+ :keep_failed => false # keep failed specs until they pass, default: true
87
+ :spec_paths => ["spec"] # specify an array of paths that contain spec files
88
+ ```
89
+
90
+ You can also use a custom binstubs directory using `:binstubs => 'some-dir'`.
91
+
92
+ Development
93
+ -----------
94
+
95
+ * Source hosted at [GitHub](https://github.com/mordaroso/guard-motion)
96
+ * Report issues/Questions/Feature requests on [GitHub Issues](https://github.com/mordaroso/guard-motion/issues)
97
+
98
+ Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
99
+ you make.
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler'
3
+ Bundler::GemHelper.install_tasks
4
+
5
+ require 'rspec/core/rake_task'
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ task :default => :spec
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/guard/motion/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["mordaroso"]
6
+ gem.email = ["mordaroso@gmail.com"]
7
+ gem.homepage = 'http://rubygems.org/gems/guard-motion'
8
+ gem.summary = 'Guard gem for RubyMotion'
9
+ gem.description = 'Guard::Motion automatically run your specs (much like autotest).'
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "guard-motion"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Guard::MotionVersion::VERSION
17
+
18
+ gem.add_dependency 'guard', '>= 1.1.0'
19
+ gem.add_dependency 'rake', '>= 0.9'
20
+
21
+ gem.add_development_dependency 'bundler', '~> 1.1.0'
22
+ gem.add_development_dependency 'rspec', '~> 2.10'
23
+ gem.add_development_dependency 'guard-rspec', '~> 1.1'
24
+ end
@@ -0,0 +1,87 @@
1
+ require 'guard'
2
+ require 'guard/guard'
3
+
4
+ require 'guard/motion/tasks'
5
+
6
+ module Guard
7
+ class Motion < Guard
8
+ autoload :Runner, 'guard/motion/runner'
9
+
10
+ # Initialize a Guard.
11
+ # @param [Array<Guard::Watcher>] watchers the Guard file watchers
12
+ # @param [Hash] options the custom Guard options
13
+ def initialize(watchers = [], options = {})
14
+ super
15
+ @options = {
16
+ :all_after_pass => true,
17
+ :all_on_start => true,
18
+ :keep_failed => true,
19
+ :spec_paths => ["spec"]
20
+ }.merge(options)
21
+ @last_failed = false
22
+ @failed_paths = []
23
+
24
+ @runner = Runner.new(@options)
25
+ end
26
+
27
+ # Call once when Guard starts. Please override initialize method to init stuff.
28
+ # @raise [:task_has_failed] when start has failed
29
+ def start
30
+ UI.info "Guard::Motion is running"
31
+ run_all if @options[:all_on_start]
32
+ end
33
+
34
+ # Called when `reload|r|z + enter` is pressed.
35
+ # This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
36
+ # @raise [:task_has_failed] when reload has failed
37
+ def reload
38
+ @failed_paths = []
39
+ end
40
+
41
+ # Called when just `enter` is pressed
42
+ # This method should be principally used for long action like running all specs/tests/...
43
+ # @raise [:task_has_failed] when run_all has failed
44
+ def run_all
45
+ passed = @runner.run
46
+
47
+ unless @last_failed = !passed
48
+ @failed_paths = []
49
+ else
50
+ throw :task_has_failed
51
+ end
52
+ end
53
+
54
+ # Called on file(s) modifications that the Guard watches.
55
+ # @param [Array<String>] paths the changes files or paths
56
+ # @raise [:task_has_failed] when run_on_change has failed
57
+ def run_on_changes(paths)
58
+ paths += @failed_paths if @options[:keep_failed]
59
+ paths.uniq!
60
+
61
+ if passed = @runner.run(paths)
62
+ remove_failed(paths)
63
+
64
+ # run all the specs if the run before this one failed
65
+ if @last_failed && @options[:all_after_pass]
66
+ @last_failed = false
67
+ run_all
68
+ end
69
+ else
70
+ @last_failed = true
71
+ add_failed(paths)
72
+
73
+ throw :task_has_failed
74
+ end
75
+ end
76
+
77
+ private
78
+ def remove_failed(paths)
79
+ @failed_paths -= paths if @options[:keep_failed]
80
+ end
81
+
82
+ def add_failed(paths)
83
+ @failed_paths += paths if @options[:keep_failed]
84
+ end
85
+
86
+ end
87
+ end
@@ -0,0 +1,95 @@
1
+ module Guard
2
+ class Motion
3
+ class Runner
4
+
5
+ def initialize(options = {})
6
+ @options = {
7
+ :bundler => true,
8
+ :binstubs => false,
9
+ :notification => true,
10
+ }.merge(options)
11
+ end
12
+
13
+ def run(paths = nil, options = {})
14
+ if paths.nil?
15
+ paths = all_spec_paths
16
+ message = options[:message] || "Running all specs"
17
+ else
18
+ message = options[:message] || "Running: #{paths.join(' ')}"
19
+ end
20
+
21
+ return false if paths.empty?
22
+
23
+ UI.info(message, :reset => true)
24
+
25
+ run_via_shell rake_command(paths)
26
+ end
27
+
28
+ def rake_executable
29
+ @rake_executable ||= begin
30
+ binstubs? ? "#{binstubs}/rake" : 'rake'
31
+ end
32
+ end
33
+
34
+ def rake_command(paths)
35
+ cmd_parts = []
36
+ cmd_parts << "bundle exec" if bundle_exec?
37
+ cmd_parts << rake_executable
38
+ cmd_parts << "spec:specific[\"#{paths.join(';')}\"]"
39
+ cmd_parts.compact.join(' ')
40
+ end
41
+
42
+ def run_via_shell(command)
43
+ success = system(command)
44
+
45
+ if @options[:notification] && !success
46
+ Notifier.notify("Failed", :title => "Motion spec results", :image => :failed, :priority => 2)
47
+ end
48
+
49
+ success
50
+ end
51
+
52
+ def all_spec_paths
53
+ @options[:spec_paths].map { |spec_path|
54
+ Dir.glob("#{spec_path}/**/*_spec.rb")
55
+ }.flatten
56
+ end
57
+
58
+ def bundler_allowed?
59
+ if @bundler_allowed.nil?
60
+ @bundler_allowed = File.exist?("#{Dir.pwd}/Gemfile")
61
+ else
62
+ @bundler_allowed
63
+ end
64
+ end
65
+
66
+ def bundler?
67
+ if @bundler.nil?
68
+ @bundler = bundler_allowed? && @options[:bundler]
69
+ else
70
+ @bundler
71
+ end
72
+ end
73
+
74
+ def binstubs?
75
+ if @binstubs.nil?
76
+ @binstubs = !!@options[:binstubs]
77
+ else
78
+ @binstubs
79
+ end
80
+ end
81
+
82
+ def binstubs
83
+ if @options[:binstubs] == true
84
+ "bin"
85
+ else
86
+ @options[:binstubs]
87
+ end
88
+ end
89
+
90
+ def bundle_exec?
91
+ bundler? && !binstubs?
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,21 @@
1
+ # include rake task spec:specific only if included in a rake file
2
+ if Kernel.const_defined?(:Rake)
3
+ desc "Run a specific list of motion specs"
4
+ namespace :spec do
5
+ task :specific, :files do |task, args|
6
+ files = args[:files]
7
+
8
+ if files.nil? || files.empty?
9
+ puts "No spec file passed to the task."
10
+ puts "Please run the task like this: `rake spec:specific[./spec/app_delegate_spec.rb;./spec/other_spec.rb]`"
11
+ exit 1
12
+ end
13
+
14
+ App.config.spec_mode = true
15
+ spec_files = App.config.spec_files.select{|file_path| !(file_path =~ /_spec.rb$/)}
16
+ spec_files += files.split(';')
17
+ App.config.instance_variable_set("@spec_files", spec_files)
18
+ Rake::Task["simulator"].invoke
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ guard 'motion' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+
4
+ # RubyMotion App example
5
+ watch(%r{^app/(.+)\.rb$}) { |m| "./spec/#{m[1]}_spec.rb" }
6
+
7
+ # RubyMotion gem example
8
+ watch(%r{^lib/[^/]+/(.+)\.rb$}) { |m| "./spec/#{m[1]}_spec.rb" }
9
+ end
@@ -0,0 +1,5 @@
1
+ module Guard
2
+ module MotionVersion
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "rake"
@@ -0,0 +1,140 @@
1
+ require 'spec_helper'
2
+
3
+ module Guard
4
+ class Motion
5
+
6
+ describe Runner do
7
+ subject { described_class.new }
8
+
9
+ describe '#run' do
10
+ context 'when passed an empty paths list' do
11
+ it 'returns false' do
12
+ subject.run([]).should be_false
13
+ end
14
+ end
15
+
16
+ context 'in a folder without Bundler' do
17
+ before do
18
+ Dir.stub(:pwd).and_return(@fixture_path.join('empty'))
19
+ end
20
+
21
+ it 'runs without bundler' do
22
+ subject.should_receive(:system).with(
23
+ "rake spec:specific[\"something\"]"
24
+ ).and_return(true)
25
+
26
+ subject.run(['something'])
27
+ end
28
+ end
29
+
30
+ context 'in a folder with Bundler' do
31
+ before do
32
+ Dir.stub(:pwd).and_return(@fixture_path.join('bundler'))
33
+ end
34
+
35
+ it 'runs with Bundler' do
36
+ subject.should_receive(:system).with(
37
+ "bundle exec rake spec:specific[\"something\"]"
38
+ ).and_return(true)
39
+
40
+ subject.run(['something'])
41
+ end
42
+
43
+ describe 'notification' do
44
+ it 'notifies when Motion specs fails to execute' do
45
+ subject.should_receive(:rake_command) { "`exit 1`" }
46
+ ::Guard::Notifier.should_receive(:notify).with(
47
+ 'Failed', :title => 'Motion spec results', :image => :failed, :priority => 2
48
+ )
49
+
50
+ subject.run(['spec'])
51
+ end
52
+
53
+ it 'does not notify that Motion specs failed when the specs pass' do
54
+ subject.should_receive(:rake_command) { "`exit 0`" }
55
+ ::Guard::Notifier.should_not_receive(:notify)
56
+
57
+ subject.run(['spec'])
58
+ end
59
+ end
60
+
61
+ describe 'options' do
62
+
63
+ describe ':bundler' do
64
+ context ':bundler => false' do
65
+ subject { described_class.new(:bundler => false) }
66
+
67
+ it 'runs without Bundler' do
68
+ subject.should_receive(:system).with(
69
+ "rake spec:specific[\"spec\"]"
70
+ ).and_return(true)
71
+
72
+ subject.run(['spec'])
73
+ end
74
+ end
75
+ end
76
+
77
+ describe ':binstubs' do
78
+ context ':bundler => false, :binstubs => true' do
79
+ subject { described_class.new(:bundler => false, :binstubs => true) }
80
+
81
+ it 'runs without Bundler and with binstubs' do
82
+ subject.should_receive(:system).with(
83
+ "bin/rake spec:specific[\"spec\"]"
84
+ ).and_return(true)
85
+
86
+ subject.run(['spec'])
87
+ end
88
+ end
89
+
90
+ context ':bundler => true, :binstubs => true' do
91
+ subject { described_class.new(:bundler => true, :binstubs => true) }
92
+
93
+ it 'runs without Bundler and binstubs' do
94
+ subject.should_receive(:system).with(
95
+ "bin/rake spec:specific[\"spec\"]"
96
+ ).and_return(true)
97
+
98
+ subject.run(['spec'])
99
+ end
100
+ end
101
+
102
+ context ':bundler => true, :binstubs => "dir"' do
103
+ subject { described_class.new(:bundler => true, :binstubs => 'dir') }
104
+
105
+ it 'runs without Bundler and binstubs in custom directory' do
106
+ subject.should_receive(:system).with(
107
+ "dir/rake spec:specific[\"spec\"]"
108
+ ).and_return(true)
109
+
110
+ subject.run(['spec'])
111
+ end
112
+ end
113
+ end
114
+
115
+ describe ':notification' do
116
+ context ':notification => false' do
117
+ subject { described_class.new(:notification => false) }
118
+
119
+ it 'runs without notification formatter' do
120
+ subject.should_receive(:system).with(
121
+ "bundle exec rake spec:specific[\"spec\"]"
122
+ ).and_return(true)
123
+
124
+ subject.run(['spec'])
125
+ end
126
+
127
+ it "doesn't notify when specs fails" do
128
+ subject.should_receive(:system) { mock('res', :success? => false, :exitstatus => 2) }
129
+ ::Guard::Notifier.should_not_receive(:notify)
130
+
131
+ subject.run(['spec'])
132
+ end
133
+ end
134
+ end
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end
140
+ end
@@ -0,0 +1,145 @@
1
+ require 'spec_helper'
2
+
3
+ module Guard
4
+ describe Motion do
5
+ let(:default_options) do
6
+ {
7
+ :all_after_pass => true, :all_on_start => true, :keep_failed => true,
8
+ :spec_paths => ['spec']
9
+ }
10
+ end
11
+ subject { described_class.new }
12
+
13
+ let(:runner) { mock(described_class::Runner) }
14
+
15
+ before do
16
+ described_class::Runner.stub(:new => runner)
17
+ end
18
+
19
+ shared_examples_for 'clear failed paths' do
20
+ it 'should clear the previously failed paths' do
21
+ runner.should_receive(:run).with(['spec/foo']) { false }
22
+ expect { subject.run_on_changes(['spec/foo']) }.to throw_symbol :task_has_failed
23
+
24
+ runner.should_receive(:run) { true }
25
+ expect { subject.run_all }.to_not throw_symbol # this actually clears the failed paths
26
+
27
+ runner.should_receive(:run).with(['spec/bar']) { true }
28
+ subject.run_on_changes(['spec/bar'])
29
+ end
30
+ end
31
+
32
+ describe '.initialize' do
33
+ it 'creates a runner' do
34
+ described_class::Runner.should_receive(:new).with(default_options.merge(:foo => :bar))
35
+
36
+ described_class.new([], :foo => :bar)
37
+ end
38
+ end
39
+
40
+ describe '#start' do
41
+ it 'calls #run_all' do
42
+ subject.should_receive(:run_all)
43
+ subject.start
44
+ end
45
+
46
+ context ':all_on_start option is false' do
47
+ let(:subject) { subject = described_class.new([], :all_on_start => false) }
48
+
49
+ it "doesn't call #run_all" do
50
+ subject.should_not_receive(:run_all)
51
+ subject.start
52
+ end
53
+ end
54
+ end
55
+
56
+ describe '#run_all' do
57
+ it "runs all specs specified by the default 'spec_paths' option" do
58
+ runner.should_receive(:run) { true }
59
+
60
+ subject.run_all
61
+ end
62
+
63
+ it "throws task_has_failed if specs don't passed" do
64
+ runner.should_receive(:run) { false }
65
+
66
+ expect { subject.run_all }.to throw_symbol :task_has_failed
67
+ end
68
+
69
+ it_should_behave_like 'clear failed paths'
70
+ end
71
+
72
+ describe '#reload' do
73
+ it_should_behave_like 'clear failed paths'
74
+ end
75
+
76
+ describe '#run_on_changes' do
77
+ it 'runs rspec with paths' do
78
+ runner.should_receive(:run).with(['spec/foo']) { true }
79
+
80
+ subject.run_on_changes(['spec/foo'])
81
+ end
82
+
83
+ context 'the changed specs pass after failing' do
84
+ it 'calls #run_all' do
85
+ runner.should_receive(:run).with(['spec/foo']) { false }
86
+
87
+ expect { subject.run_on_changes(['spec/foo']) }.to throw_symbol :task_has_failed
88
+
89
+ runner.should_receive(:run).with(['spec/foo']) { true }
90
+ subject.should_receive(:run_all)
91
+
92
+ expect { subject.run_on_changes(['spec/foo']) }.to_not throw_symbol
93
+ end
94
+
95
+ context ':all_after_pass option is false' do
96
+ subject { described_class.new([], :all_after_pass => false) }
97
+
98
+ it "doesn't call #run_all" do
99
+ runner.should_receive(:run).with(['spec/foo']) { false }
100
+
101
+ expect { subject.run_on_changes(['spec/foo']) }.to throw_symbol :task_has_failed
102
+
103
+ runner.should_receive(:run).with(['spec/foo']) { true }
104
+ subject.should_not_receive(:run_all)
105
+
106
+ expect { subject.run_on_changes(['spec/foo']) }.to_not throw_symbol
107
+ end
108
+ end
109
+ end
110
+
111
+ context 'the changed specs pass without failing' do
112
+ it "doesn't call #run_all" do
113
+ runner.should_receive(:run).with(['spec/foo']) { true }
114
+
115
+ subject.should_not_receive(:run_all)
116
+
117
+ subject.run_on_changes(['spec/foo'])
118
+ end
119
+ end
120
+
121
+ it 'keeps failed spec and rerun them later' do
122
+ subject = described_class.new([], :all_after_pass => false)
123
+
124
+ runner.should_receive(:run).with(['spec/bar']) { false }
125
+
126
+ expect { subject.run_on_changes(['spec/bar']) }.to throw_symbol :task_has_failed
127
+
128
+ runner.should_receive(:run).with(['spec/foo', 'spec/bar']) { true }
129
+
130
+ subject.run_on_changes(['spec/foo'])
131
+
132
+ runner.should_receive(:run).with(['spec/foo']) { true }
133
+
134
+ subject.run_on_changes(['spec/foo'])
135
+ end
136
+
137
+ it "throws task_has_failed if specs doesn't pass" do
138
+ runner.should_receive(:run).with(['spec/foo']) { false }
139
+
140
+ expect { subject.run_on_changes(['spec/foo']) }.to throw_symbol :task_has_failed
141
+ end
142
+ end
143
+
144
+ end
145
+ end
@@ -0,0 +1,17 @@
1
+ require 'guard/motion'
2
+ require 'rspec'
3
+
4
+ ENV["GUARD_ENV"] = 'test'
5
+
6
+ Dir["#{File.expand_path('..', __FILE__)}/support/**/*.rb"].each { |f| require f }
7
+
8
+ RSpec.configure do |config|
9
+ config.color_enabled = true
10
+ config.filter_run :focus => true
11
+ config.run_all_when_everything_filtered = true
12
+
13
+ config.before(:each) do
14
+ @fixture_path = Pathname.new(File.expand_path('../fixtures/', __FILE__))
15
+ @lib_path = Pathname.new(File.expand_path('../../lib/', __FILE__))
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-motion
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - mordaroso
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: guard
16
+ requirement: &70212465443740 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.1.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70212465443740
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &70212465459540 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0.9'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70212465459540
36
+ - !ruby/object:Gem::Dependency
37
+ name: bundler
38
+ requirement: &70212465459040 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.1.0
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70212465459040
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: &70212465458440 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2.10'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70212465458440
58
+ - !ruby/object:Gem::Dependency
59
+ name: guard-rspec
60
+ requirement: &70212465457840 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '1.1'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70212465457840
69
+ description: Guard::Motion automatically run your specs (much like autotest).
70
+ email:
71
+ - mordaroso@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - .travis.yml
78
+ - Gemfile
79
+ - Guardfile
80
+ - LICENSE
81
+ - README.md
82
+ - Rakefile
83
+ - guard-motion.gemspec
84
+ - lib/guard/motion.rb
85
+ - lib/guard/motion/runner.rb
86
+ - lib/guard/motion/tasks.rb
87
+ - lib/guard/motion/templates/Guardfile
88
+ - lib/guard/motion/version.rb
89
+ - spec/fixtures/bundler/Gemfile
90
+ - spec/guard/motion/runner_spec.rb
91
+ - spec/guard/motion_spec.rb
92
+ - spec/spec_helper.rb
93
+ homepage: http://rubygems.org/gems/guard-motion
94
+ licenses: []
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 1.8.17
114
+ signing_key:
115
+ specification_version: 3
116
+ summary: Guard gem for RubyMotion
117
+ test_files:
118
+ - spec/fixtures/bundler/Gemfile
119
+ - spec/guard/motion/runner_spec.rb
120
+ - spec/guard/motion_spec.rb
121
+ - spec/spec_helper.rb