pwrake 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,16 +29,21 @@ module Pwrake
29
29
  @master.pwrake_options
30
30
  end
31
31
 
32
+ def start_worker
33
+ @master.start
34
+ end
32
35
 
33
36
  # Run the Pwrake application.
34
37
  def run
35
38
  standard_exception_handling do
36
- @master = Master.new
37
39
  init("pwrake")
38
- @master.init
40
+ @master = Master.new
39
41
  load_rakefile
40
- @master.setup
41
- top_level
42
+ begin
43
+ top_level
44
+ ensure
45
+ @master.finish
46
+ end
42
47
  end
43
48
  end
44
49
 
@@ -50,12 +55,7 @@ module Pwrake
50
55
  elsif options.show_prereqs
51
56
  display_prerequisites
52
57
  else
53
- begin
54
- @master.start
55
- top_level_tasks.each { |task_name| invoke_task(task_name) }
56
- ensure
57
- @master.finish
58
- end
58
+ top_level_tasks.each { |task_name| invoke_task(task_name) }
59
59
  end
60
60
  end
61
61
  end
@@ -18,18 +18,13 @@ module Pwrake
18
18
  attr_reader :shell_set
19
19
 
20
20
  def initialize
21
- end
22
-
23
- def init
24
- init_option # Pwrake::Option
25
- end
26
-
27
- def setup
21
+ init_option # Pwrake::Option
28
22
  setup_option # Pwrake::Option
23
+ @started = false
29
24
  end
30
25
 
31
26
  def start
32
- @counter = Counter.new
27
+ return if @task_queue
33
28
  @task_queue = @queue_class.new(@core_list)
34
29
  @task_queue.enable_steal = !Rake.application.options.disable_steal
35
30
  @shell_set = []
@@ -42,8 +37,8 @@ module Pwrake
42
37
  def finish
43
38
  Log.debug "-- Master#finish called"
44
39
  @task_queue.finish if @task_queue
45
- @threads.each{|t| t.join }
46
- @counter.print
40
+ @threads.each{|t| t.join } if @threads
41
+ @counter.print if @counter
47
42
  finish_option # Pwrake::Option
48
43
  end
49
44
 
@@ -15,6 +15,7 @@ module Pwrake
15
15
 
16
16
 
17
17
  def invoke_modify(*args)
18
+ application.start_worker
18
19
  task_args = TaskArguments.new(arg_names, args)
19
20
  flag = application.pwrake_options['HALT_QUEUE_WHILE_SEARCH']
20
21
  start_time = Time.now
@@ -26,6 +27,7 @@ module Pwrake
26
27
  search_with_call_chain(self, task_args, InvocationChain::EMPTY)
27
28
  end
28
29
  Log.info "-- search_tasks %.6fs" % (Time.now-start_time)
30
+ return if @already_invoked
29
31
 
30
32
  if conn = Pwrake.current_shell
31
33
  @waiting_thread = nil
@@ -36,10 +36,10 @@ module Pwrake
36
36
 
37
37
  def enq_synchronize
38
38
  if @halt
39
- yield
39
+ ret = yield
40
40
  else
41
41
  @mutex.synchronize do
42
- yield
42
+ ret = yield
43
43
  enq_finish
44
44
  end
45
45
  @cv.broadcast
@@ -48,6 +48,7 @@ module Pwrake
48
48
  Log.debug "--- run #{th}";
49
49
  th.run
50
50
  end
51
+ ret
51
52
  end
52
53
 
53
54
  def enq_finish
@@ -1,3 +1,3 @@
1
1
  module Pwrake
2
- VERSION = "0.9.3"
2
+ VERSION = "0.9.4"
3
3
  end
@@ -0,0 +1,3 @@
1
+ task :default do
2
+ sh "echo OK"
3
+ end.invoke
@@ -80,4 +80,9 @@ describe Helper do
80
80
  its(:n_files) { should eq 3 }
81
81
  end
82
82
 
83
+ context "dir=010 invoke in Rakefile" do
84
+ subject { Helper.new("010").run }
85
+ it { should be_success }
86
+ end
87
+
83
88
  end
metadata CHANGED
@@ -1,33 +1,24 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: pwrake
3
- version: !ruby/object:Gem::Version
4
- hash: 61
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.4
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 9
9
- - 3
10
- version: 0.9.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Masahiro TANAKA
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-12-26 00:00:00 Z
12
+ date: 2013-01-04 00:00:00.000000000 Z
19
13
  dependencies: []
20
-
21
14
  description: Parallel workflow extension for Rake
22
- email:
15
+ email:
23
16
  - masa16.tanaka@gmail.com
24
- executables:
17
+ executables:
25
18
  - pwrake
26
19
  extensions: []
27
-
28
20
  extra_rdoc_files: []
29
-
30
- files:
21
+ files:
31
22
  - .gitignore
32
23
  - Gemfile
33
24
  - LICENSE.txt
@@ -65,43 +56,35 @@ files:
65
56
  - spec/008/pwrake_conf.yaml
66
57
  - spec/009/Rakefile
67
58
  - spec/009/pwrake_conf.yaml
59
+ - spec/010/Rakefile
68
60
  - spec/helper.rb
69
61
  - spec/hosts
70
62
  - spec/pwrake_spec.rb
71
63
  homepage: http://masa16.github.com/pwrake
72
64
  licenses: []
73
-
74
65
  post_install_message:
75
66
  rdoc_options: []
76
-
77
- require_paths:
67
+ require_paths:
78
68
  - lib
79
- required_ruby_version: !ruby/object:Gem::Requirement
69
+ required_ruby_version: !ruby/object:Gem::Requirement
80
70
  none: false
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- hash: 3
85
- segments:
86
- - 0
87
- version: "0"
88
- required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
76
  none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- hash: 3
94
- segments:
95
- - 0
96
- version: "0"
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
97
81
  requirements: []
98
-
99
82
  rubyforge_project:
100
- rubygems_version: 1.8.24
83
+ rubygems_version: 1.8.23
101
84
  signing_key:
102
85
  specification_version: 3
103
86
  summary: Adding Parallel and Distributed feature to Rake
104
- test_files:
87
+ test_files:
105
88
  - spec/001/Rakefile
106
89
  - spec/002/Rakefile
107
90
  - spec/003/Rakefile
@@ -114,6 +97,7 @@ test_files:
114
97
  - spec/008/pwrake_conf.yaml
115
98
  - spec/009/Rakefile
116
99
  - spec/009/pwrake_conf.yaml
100
+ - spec/010/Rakefile
117
101
  - spec/helper.rb
118
102
  - spec/hosts
119
103
  - spec/pwrake_spec.rb