guard-spinach 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
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
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use --create 1.9.3@guard-spinach
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in guard-spinach.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem 'guard-minitest'
8
+ end
data/Guardfile ADDED
@@ -0,0 +1,5 @@
1
+ guard 'minitest' do
2
+ watch(%r|^test/(.*)_test\.rb|)
3
+ watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
4
+ watch(%r|^test/test_helper\.rb|) { "test" }
5
+ end
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+ require 'bundler'
3
+ Bundler::GemHelper.install_tasks
4
+
5
+ require 'rake/testtask'
6
+ Rake::TestTask.new do |t|
7
+ t.libs << "test"
8
+ t.test_files = FileList['./test/**/*_test.rb']
9
+ end
10
+
11
+ task :default => :test
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/guard/spinach/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Josep Jaume"]
6
+ gem.email = ["josepjaume@gmail.com"]
7
+ gem.description = %q{guard-spinach is a guard plugin for spinach}
8
+ gem.summary = %q{guard-spinach is a guard plugin for spinach}
9
+ gem.homepage = 'http://github.com/codegram/guard-spinach'
10
+
11
+ gem.add_runtime_dependency 'guard'
12
+ gem.add_runtime_dependency 'spinach'
13
+ gem.add_development_dependency 'mocha'
14
+ gem.add_development_dependency 'minitest'
15
+
16
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ gem.files = `git ls-files`.split("\n")
18
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ gem.name = "guard-spinach"
20
+ gem.require_paths = ['lib']
21
+ gem.version = Guard::SPINACH_VERSION
22
+ end
@@ -0,0 +1,19 @@
1
+ module Guard
2
+ class Spinach
3
+ class Runner
4
+ attr_reader :paths
5
+
6
+ def initialize(paths)
7
+ @paths = paths
8
+ end
9
+
10
+ def run
11
+ system(run_command)
12
+ end
13
+
14
+ def run_command
15
+ "spinach #{paths.join(" ")}"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,6 @@
1
+ guard 'spinach' do
2
+ watch(%r|^features/(.*)\.feature|)
3
+ watch(%r|^features/steps/(.*)([^/]+)\.rb|) do |m|
4
+ "features/#{m[1]}#{m[2]}.feature"
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module Guard
2
+ SPINACH_VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,14 @@
1
+ require 'guard'
2
+ require 'guard/guard'
3
+
4
+ module Guard
5
+ class Spinach < Guard
6
+ def run_on_change(paths)
7
+ Runner.new(paths).run
8
+ end
9
+ end
10
+ end
11
+
12
+ require_relative "spinach/runner"
13
+
14
+ require_relative "spinach/version"
@@ -0,0 +1,27 @@
1
+ require_relative '../../test_helper'
2
+
3
+ describe Guard::Spinach::Runner do
4
+ subject do
5
+ Guard::Spinach::Runner.new(paths)
6
+ end
7
+ let(:paths) do
8
+ ['fake/path.feature', 'foo/bar.feature']
9
+ end
10
+ describe "#initialize" do
11
+ it "sets up a bunch of file paths" do
12
+ subject.paths.must_include 'fake/path.feature'
13
+ subject.paths.must_include 'foo/bar.feature'
14
+ end
15
+ end
16
+ describe "#run_command" do
17
+ it "generates a valid run command" do
18
+ subject.run_command.must_equal "spinach fake/path.feature foo/bar.feature"
19
+ end
20
+ end
21
+ describe "#run" do
22
+ it "runs spinach on all the features in the list" do
23
+ subject.expects(:system).with("spinach fake/path.feature foo/bar.feature")
24
+ subject.run
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,16 @@
1
+ require_relative '../test_helper'
2
+
3
+ describe Guard::Spinach do
4
+ subject do
5
+ Guard::Spinach.new(data)
6
+ end
7
+ let(:paths) do
8
+ ['fake/path.feature', 'foo/bar.feature']
9
+ end
10
+ describe "#run_on_change" do
11
+ it "fires run on a runner" do
12
+ Guard::Spinach::Runner.any_instance.expects(:system).with(
13
+ "spinach fake/path.feature foo/bar.feature")
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ require 'bundler/setup'
2
+ Bundler.require :default, :test
3
+
4
+ require 'mocha'
5
+ require 'minitest/spec'
6
+ require 'minitest/autorun'
7
+
8
+ require_relative '../lib/guard/spinach'
9
+
10
+ def capture_stdout
11
+ output = StringIO.new
12
+ $stdout = output
13
+ $stderr = output
14
+ yield
15
+ ensure
16
+ $stdout = STDOUT
17
+ $stdout = STDERR
18
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-spinach
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Josep Jaume
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-10-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: guard
16
+ requirement: &70226750477840 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70226750477840
25
+ - !ruby/object:Gem::Dependency
26
+ name: spinach
27
+ requirement: &70226750477360 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70226750477360
36
+ - !ruby/object:Gem::Dependency
37
+ name: mocha
38
+ requirement: &70226750476880 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70226750476880
47
+ - !ruby/object:Gem::Dependency
48
+ name: minitest
49
+ requirement: &70226750475900 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70226750475900
58
+ description: guard-spinach is a guard plugin for spinach
59
+ email:
60
+ - josepjaume@gmail.com
61
+ executables: []
62
+ extensions: []
63
+ extra_rdoc_files: []
64
+ files:
65
+ - .gitignore
66
+ - .rvmrc
67
+ - Gemfile
68
+ - Guardfile
69
+ - Rakefile
70
+ - guard-spinach.gemspec
71
+ - lib/guard/spinach.rb
72
+ - lib/guard/spinach/runner.rb
73
+ - lib/guard/spinach/templates/Guardfile
74
+ - lib/guard/spinach/version.rb
75
+ - test/guard/spinach/runner_test.rb
76
+ - test/guard/spinach_test.rb
77
+ - test/test_helper.rb
78
+ homepage: http://github.com/codegram/guard-spinach
79
+ licenses: []
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 1.8.6
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: guard-spinach is a guard plugin for spinach
102
+ test_files:
103
+ - test/guard/spinach/runner_test.rb
104
+ - test/guard/spinach_test.rb
105
+ - test/test_helper.rb