rake-tilde 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a7583f5894648460b25735c5983c4c4826734dc
4
- data.tar.gz: 371579309e3824d9f5a3a5220023ee62ca62d940
3
+ metadata.gz: f819477ad14b1b01204f0ec6ce88f3863ac35629
4
+ data.tar.gz: 46f034c96e23c72df0f23e558a7c5aeec231e417
5
5
  SHA512:
6
- metadata.gz: 0c982787530794164dc49f7d0b084b856e12940720915923d7a7a3a5402b19690508741449d890e6359723466a8bb544d9c65e918fe8390dab447ae75d8ac6a1
7
- data.tar.gz: 5d34530c1bc3db52950c00a580ca22346992f55ec2fcbbe8fd293c2088da2cc98e3134e96db5911c86f0a44a28d7623fccad42083422c3310535ec1d498c3f3b
6
+ metadata.gz: ae19740a1e631d544be51076941fe69da2aa7e30817fc038af4366634d0deb2d4f0b0dcb610485454feaf81e2eca9d69c734fabccd33efc8e617383ded7cd773
7
+ data.tar.gz: 8c197b1762f57e84b7a7454e203a79e68e9ad3458c846479bf7500a640958dab9216d20c43c95bf5a94f2d58a17c62bb36882489765f90f4a1319939cbfc2357
@@ -43,8 +43,8 @@ module Rake
43
43
  listener = Listen.to(paths, opts) do |modified, added, removed|
44
44
  $stdout.puts "** File system changed"
45
45
  begin
46
- Rake::Task.tasks.each { |t| t.reenable }
47
- task.invoke(*task_args)
46
+ pid = spawn("rake #{task.name}")
47
+ Process.wait pid
48
48
  blk.call(modified, added, removed) if blk
49
49
  rescue StandardError => exception
50
50
  $stderr.puts "** Task failed to run successfully with tilde"
@@ -55,10 +55,23 @@ module Rake
55
55
  listeners.push listener
56
56
  listener.start
57
57
  end
58
+
59
+ def sleep_forever
60
+ begin
61
+ sleep
62
+ rescue Interrupt
63
+ puts
64
+ end
65
+ end
58
66
  end
59
67
  end
60
68
 
61
69
  module OverrideInvoke
70
+ def top_level
71
+ super
72
+ Rake::Tilde.sleep_forever if tilde?
73
+ end
74
+
62
75
  def invoke_task(task_string)
63
76
  task_string = task_string.gsub(/^\~/, '')
64
77
  task_name, args = parse_task_string(task_string)
@@ -73,6 +86,10 @@ module OverrideInvoke
73
86
  def tilde_tasks
74
87
  @__tilde_tasks ||= []
75
88
  end
89
+
90
+ def tilde?
91
+ tilde_tasks.any?
92
+ end
76
93
  end
77
94
 
78
95
  Rake.application.extend OverrideInvoke
@@ -92,12 +109,8 @@ def listen(**args, &blk)
92
109
  Rake::Tilde.listen(**args, &blk)
93
110
  end
94
111
 
95
- at_exit do
96
- if Rake::Tilde.listening?
97
- begin
98
- sleep
99
- rescue Interrupt
100
- puts
101
- end
112
+ namespace :tilde do
113
+ task :sleep do
114
+ Rake::Tilde.sleep_forever unless Rake.application.tilde?
102
115
  end
103
116
  end
@@ -1,5 +1,5 @@
1
1
  module Rake
2
2
  module Tilde
3
- VERSION = "0.0.4"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-tilde
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - myobie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-04 00:00:00.000000000 Z
11
+ date: 2015-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler