paraduct 0.0.1.beta6 → 0.0.1.beta7

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.
data/README.md CHANGED
@@ -42,11 +42,13 @@ Commands:
42
42
  ```bash
43
43
  $ paraduct generate
44
44
  create .paraduct.yml
45
+ create .paraduct_rsync_exclude.txt
45
46
  ```
46
47
 
47
48
  ### 2. Customize .paraduct.yml
48
49
  ```bash
49
50
  $ vi .paraduct.yml
51
+ $ vi .paraduct_rsync_exclude.txt
50
52
  ```
51
53
 
52
54
  ### 3. Run test
@@ -67,6 +69,8 @@ variables:
67
69
  - value2a
68
70
  - value2b
69
71
  max_threads: 4
72
+ rsync_option:
73
+ exclude_from: .paraduct_rsync_exclude.txt
70
74
  ```
71
75
 
72
76
  ### script
@@ -93,6 +97,9 @@ value1b | value2b | NAME1_value1b_NAME2_value2b | tmp/paraduct_workspace/NAME1
93
97
  ### max_threads
94
98
  maximum concurrent execution number of jobs
95
99
 
100
+ ### rsync_option
101
+ support only `exclude-from`
102
+
96
103
  ## Contributing
97
104
 
98
105
  1. Fork it ( https://github.com/sue445/paraduct/fork )
@@ -16,7 +16,7 @@ module Paraduct
16
16
  START matrix test
17
17
  EOS
18
18
  product_variables.each do |params|
19
- Paraduct.logger.info "params: #{params}"
19
+ Paraduct.logger.info "params: #{params.map{ |key, value| "#{key}=#{value}" }.join(", ")}"
20
20
  end
21
21
 
22
22
  pool = Thread.pool(Paraduct.config.max_threads)
@@ -1,4 +1,5 @@
1
1
  module Paraduct
2
+ require "colorize"
2
3
  require "open3"
3
4
 
4
5
  class Runner
@@ -12,6 +13,7 @@ module Paraduct
12
13
  @script = args[:script]
13
14
  @params = args[:params]
14
15
  @base_job_dir = args[:base_job_dir]
16
+ @color = Paraduct::Runner.next_color
15
17
  end
16
18
 
17
19
  def setup_dir
@@ -55,11 +57,45 @@ module Paraduct
55
57
  end
56
58
  end
57
59
 
60
+ COLORS = [
61
+ :cyan,
62
+ :yellow,
63
+ :green,
64
+ :magenta,
65
+ :red,
66
+ :blue,
67
+ :light,
68
+ :cyan,
69
+ :light_yellow,
70
+ :light_green,
71
+ :light_magenta,
72
+ :light_red,
73
+ :light_blue,
74
+ ]
75
+ def self.next_color
76
+ @@color_index ||= -1
77
+ @@color_index = (@@color_index + 1) % COLORS.length
78
+ COLORS[@@color_index]
79
+ end
80
+
58
81
  private
59
82
  def run_command(command)
60
- stdout, stderr, status = Open3.capture3(command)
61
- raise Paraduct::Errors::ProcessError.new("#{stdout}\n#{stderr}", status) unless status.success?
62
- stdout
83
+ thread_id = Thread.current.object_id.to_s
84
+ console_label = "[#{thread_id.colorize(@color)}]"
85
+
86
+ lines = ""
87
+
88
+ IO.popen(command) do |io|
89
+ while line = io.gets
90
+ Paraduct.logger.info "#{console_label} #{line.strip}"
91
+ lines << line
92
+ end
93
+ end
94
+
95
+ status = $?
96
+ raise Paraduct::Errors::ProcessError.new(lines, status) unless status.success?
97
+
98
+ lines
63
99
  end
64
100
  end
65
101
  end
@@ -9,3 +9,5 @@ variables:
9
9
  - value2a
10
10
  - value2b
11
11
  max_threads: 4
12
+ rsync_option:
13
+ exclude_from: .paraduct_rsync_exclude.txt
@@ -1,3 +1,3 @@
1
1
  module Paraduct
2
- VERSION = "0.0.1.beta6"
2
+ VERSION = "0.0.1.beta7"
3
3
  end
data/paraduct.gemspec CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "activesupport"
22
+ spec.add_dependency "colorize"
22
23
  spec.add_dependency "rsync"
23
24
  spec.add_dependency "thor"
24
25
  spec.add_dependency "thread"
@@ -40,7 +40,6 @@ describe Paraduct::Runner do
40
40
  <<-EOS
41
41
  RUBY=1.9
42
42
  DATABASE=mysql
43
-
44
43
  EOS
45
44
  end
46
45
 
@@ -76,4 +75,12 @@ DATABASE=mysql
76
75
 
77
76
  it{ should eq "ruby=1.9, database=mysql" }
78
77
  end
78
+
79
+ describe "#next_color" do
80
+ it "can call many times" do
81
+ 20.times do
82
+ expect(Paraduct::Runner.next_color).to be_an_instance_of Symbol
83
+ end
84
+ end
85
+ end
79
86
  end
@@ -3,3 +3,4 @@
3
3
  echo "RUBY=${RUBY}"
4
4
  echo "DATABASE=${DATABASE}"
5
5
  exit 1
6
+ echo "after exit"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paraduct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.beta6
4
+ version: 0.0.1.beta7
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-21 00:00:00.000000000 Z
12
+ date: 2014-10-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: colorize
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: rsync
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -351,7 +367,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
351
367
  version: '0'
352
368
  segments:
353
369
  - 0
354
- hash: 3159191224660044510
370
+ hash: 3862644888547862433
355
371
  required_rubygems_version: !ruby/object:Gem::Requirement
356
372
  none: false
357
373
  requirements: