guard-parallel_all 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in guard-parallel_all.gemspec
4
+ gemspec
@@ -0,0 +1,32 @@
1
+ = Guard::ParallelAll
2
+
3
+ run_all ファイルを監視して rake parallel:[spec|features] する guard
4
+
5
+ * 普段は guard+spork でテストしている
6
+ * 全テストを parallel:spec, parallel:features で行なっている
7
+ * parallel でテストするときに guard を止めるのが面倒だ
8
+
9
+ == Install
10
+
11
+ # Gemfile
12
+ group :development do
13
+ gem 'guard-parallel_all'
14
+ end
15
+
16
+ == Usage
17
+
18
+ guard の readme[https://github.com/guard/guard#readme] を参照
19
+
20
+ == Guardfile
21
+
22
+ guard "parallel-all-spec" do
23
+ watch("tmp/parallel_all_spec")
24
+ end
25
+ guard "parallel-all-features" do
26
+ watch("tmp/parallel_all_features")
27
+ end
28
+
29
+ tmp/parallel_all_spec, tmp/parallel_all_features を touch すると parallel で全テストが走る
30
+
31
+ オプションは特にない
32
+
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "guard-parallel_all/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "guard-parallel_all"
7
+ s.version = Guard::ParallelAll::VERSION
8
+ s.authors = ["sakai shunsuke"]
9
+ s.email = ["sakai@ans-web.co.jp"]
10
+ s.homepage = "https://github.com/answer/guard-parallel_all"
11
+ s.summary = %q{parallel:[spec|features] する guard}
12
+ s.description = %q{run_all ファイルを監視して、 parallel タスクを起動する}
13
+
14
+ s.rubyforge_project = "guard-parallel_all"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency "guard"
22
+ end
@@ -0,0 +1,9 @@
1
+ # vi: set fileencoding=utf-8
2
+
3
+ require "guard-parallel_all/version"
4
+
5
+ module Guard
6
+ module ParallelAll
7
+ autoload :Runner, "guard-parallel_all/runner"
8
+ end
9
+ end
@@ -0,0 +1,27 @@
1
+ module Guard::ParallelAll
2
+ module Runner
3
+ class << self
4
+ def run(task_name,options)
5
+ exec_command task_name, options
6
+ end
7
+
8
+ private
9
+
10
+ def exec_command(task_name,options)
11
+ puts "execute parallel #{task_name}..."
12
+ system command(task_name,options)
13
+ end
14
+ def command(task_name,options)
15
+ cmd = []
16
+ cmd << "rvm #{options[:rvm].join(',')} exec" if options[:rvm].is_a?(Array)
17
+ cmd << "bundle exec" if bundler? && options[:bundler] != false
18
+
19
+ cmd << "rake parallel:#{task_name}"
20
+ cmd.join(' ')
21
+ end
22
+ def bundler?
23
+ @bundler ||= File.exist?("#{Dir.pwd}/Gemfile")
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ module Guard
2
+ module ParallelAll
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,14 @@
1
+ require "guard"
2
+ require "guard/guard"
3
+ require "guard-parallel_all/runner"
4
+
5
+ module Guard
6
+ class ParallelAllFeatures < Guard
7
+ def run_all
8
+ ParallelAll::Runner.run "features", options
9
+ end
10
+ def run_on_change(paths)
11
+ run_all
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require "guard"
2
+ require "guard/guard"
3
+ require "guard-parallel_all/runner"
4
+
5
+ module Guard
6
+ class ParallelAllSpec < Guard
7
+ def run_all
8
+ ParallelAll::Runner.run "spec", options
9
+ end
10
+ def run_on_change(paths)
11
+ run_all
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,68 @@
1
+ # vi: set fileencoding=utf-8
2
+
3
+ module Guard::ParallelAll
4
+ describe Runner, "#run_all" do
5
+ include Ans::Feature::Helpers::ActionHelper
6
+
7
+ before do
8
+ @task_name = "TASK"
9
+ @options = {}
10
+
11
+ the_action do
12
+ stub(Runner).system
13
+ stub(Runner).bundler?{@bundler}
14
+ Runner.run @task_name, @options
15
+ end
16
+ end
17
+
18
+ context "すべて無効な場合" do
19
+ it "は、素のコマンドをコールする" do
20
+ the_action
21
+ Runner.should have_received.system("rake parallel:TASK")
22
+ end
23
+ end
24
+
25
+ context "rvm オプションを指定した場合" do
26
+ before do
27
+ @options[:rvm] = ["--option1","--option2"]
28
+ end
29
+ it "は、 rvm 経由でコールする" do
30
+ the_action
31
+ Runner.should have_received.system("rvm --option1,--option2 exec rake parallel:TASK")
32
+ end
33
+ end
34
+
35
+ context "bundle 経由で実行する場合" do
36
+ before do
37
+ @bundler = true
38
+ end
39
+ it "は、 bundle 経由でコールする" do
40
+ the_action
41
+ Runner.should have_received.system("bundle exec rake parallel:TASK")
42
+ end
43
+ end
44
+
45
+ context "bundler が有効だが、無効にして実行する場合" do
46
+ before do
47
+ @bundler = true
48
+ @options[:bundler] = false
49
+ end
50
+ it "は、 bundle 経由でコールしない" do
51
+ the_action
52
+ Runner.should have_received.system("rake parallel:TASK")
53
+ end
54
+ end
55
+
56
+ context "全部有効な場合" do
57
+ before do
58
+ @options[:rvm] = ["--option1","--option2"]
59
+ @bundler = true
60
+ end
61
+ it "は、 bundle 経由でコールしない" do
62
+ the_action
63
+ Runner.should have_received.system("rvm --option1,--option2 exec bundle exec rake parallel:TASK")
64
+ end
65
+ end
66
+
67
+ end
68
+ end
@@ -0,0 +1,9 @@
1
+ # vi: set fileencoding=utf-8
2
+
3
+ module Guard::ParallelAll
4
+ describe :Runner do
5
+ it "は、 autoload される" do
6
+ Runner.should be_true
7
+ end
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-parallel_all
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - sakai shunsuke
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-14 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: guard
16
+ requirement: &11723400 !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: *11723400
25
+ description: run_all ファイルを監視して、 parallel タスクを起動する
26
+ email:
27
+ - sakai@ans-web.co.jp
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - README.rdoc
35
+ - Rakefile
36
+ - guard-parallel_all.gemspec
37
+ - lib/guard-parallel_all.rb
38
+ - lib/guard-parallel_all/runner.rb
39
+ - lib/guard-parallel_all/version.rb
40
+ - lib/guard/parallel-all-features.rb
41
+ - lib/guard/parallel-all-spec.rb
42
+ - spec/guard-parallel_all/runner_spec.rb
43
+ - spec/guard-parallel_all_spec.rb
44
+ homepage: https://github.com/answer/guard-parallel_all
45
+ licenses: []
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project: guard-parallel_all
64
+ rubygems_version: 1.8.10
65
+ signing_key:
66
+ specification_version: 3
67
+ summary: parallel:[spec|features] する guard
68
+ test_files: []