spud 0.1.8 → 0.1.9
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.
- checksums.yaml +4 -4
- data/lib/args.rb +1 -1
- data/lib/build_tools/spud/rule.rb +1 -4
- data/lib/build_tools/spud/rule_context.rb +12 -5
- data/lib/spud.rb +5 -1
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9b52bb3b0a406042b1c0feaf8c6952974992b1c79586eb372417c03253367db
|
4
|
+
data.tar.gz: 366ce2813f418f1b0a5795a28c73f37128ef3a82c0dff95809877ab5dca5783e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fe21ca0d2b91d02c995deb4515382e5a59ee54160bcee71af23608cb634962b3beb16c764193ee9ff46314d8f7251d5fdc40ae1a535a5646362ba208784c7a7
|
7
|
+
data.tar.gz: e7f16245115ca30d84585c5fee030e1be064dff6e38fd67196f5423501699242a132f7dab0e58885d7f6d24c54f16828960a23b7cba9e65dfc648bfe835e8f02
|
data/lib/args.rb
CHANGED
@@ -22,7 +22,7 @@ module Spud
|
|
22
22
|
case arg
|
23
23
|
when '-h', '--help' then [options.merge(help: true), index + 1]
|
24
24
|
when '-v', '--version' then [options.merge(version: true), index + 1]
|
25
|
-
when '-w', '--watch' then [options.merge(watches: options[:watches] + [args[index + 1]]), index + 2]
|
25
|
+
#when '-w', '--watch' then [options.merge(watches: options[:watches] + [args[index + 1]]), index + 2]
|
26
26
|
when '--debug' then [options.merge(debug: true), index + 1]
|
27
27
|
else raise Error, "invalid option '#{arg}'"
|
28
28
|
end
|
@@ -28,10 +28,7 @@ module Spud::BuildTools
|
|
28
28
|
raise Spud::Error, "invocation of '#{@name}' missing required #{arguments} #{names}"
|
29
29
|
end
|
30
30
|
|
31
|
-
unless key_params?
|
32
|
-
RuleContext.new(@spud, @file_context).instance_exec(*args, &@block)
|
33
|
-
return
|
34
|
-
end
|
31
|
+
return RuleContext.new(@spud, @file_context).instance_exec(*args, &@block) unless key_params?
|
35
32
|
|
36
33
|
begin
|
37
34
|
RuleContext.new(@spud, @file_context).instance_exec(*args, **kwargs, &@block)
|
@@ -5,14 +5,21 @@ require_relative '../../error'
|
|
5
5
|
module Spud::BuildTools
|
6
6
|
module SpudBuild
|
7
7
|
class RuleContext
|
8
|
+
attr_reader :__process
|
9
|
+
|
8
10
|
def initialize(spud, file_context)
|
9
|
-
@
|
11
|
+
@__spud = spud
|
12
|
+
@__process = nil
|
10
13
|
|
11
14
|
file_context.singleton_methods.each do |method_name|
|
12
15
|
define_singleton_method(method_name, &file_context.method(method_name))
|
13
16
|
end
|
14
17
|
end
|
15
18
|
|
19
|
+
def __shell(cmd, params = {})
|
20
|
+
@__process = Spud::Shell.new(cmd, params)
|
21
|
+
end
|
22
|
+
|
16
23
|
def sh(cmd)
|
17
24
|
out = sh?(cmd)
|
18
25
|
raise ShellError unless out.status.exitstatus.zero?
|
@@ -22,7 +29,7 @@ module Spud::BuildTools
|
|
22
29
|
|
23
30
|
def sh?(cmd)
|
24
31
|
puts cmd
|
25
|
-
|
32
|
+
__shell(cmd)
|
26
33
|
end
|
27
34
|
|
28
35
|
def shh(cmd)
|
@@ -33,7 +40,7 @@ module Spud::BuildTools
|
|
33
40
|
end
|
34
41
|
|
35
42
|
def shh?(cmd)
|
36
|
-
|
43
|
+
__shell(cmd)
|
37
44
|
end
|
38
45
|
|
39
46
|
def shhh(cmd)
|
@@ -44,11 +51,11 @@ module Spud::BuildTools
|
|
44
51
|
end
|
45
52
|
|
46
53
|
def shhh?(cmd)
|
47
|
-
|
54
|
+
__shell(cmd, silent: true)
|
48
55
|
end
|
49
56
|
|
50
57
|
def invoke(name, *args, **kwargs)
|
51
|
-
@
|
58
|
+
@__spud.invoke(name, *args, **kwargs)
|
52
59
|
end
|
53
60
|
end
|
54
61
|
end
|
data/lib/spud.rb
CHANGED
@@ -50,6 +50,7 @@ module Spud
|
|
50
50
|
rule = rules[name.to_s]
|
51
51
|
raise Error, "no rule found for '#{name}'" unless rule
|
52
52
|
|
53
|
+
thread = nil
|
53
54
|
timestamps = {}
|
54
55
|
loop do
|
55
56
|
begin
|
@@ -60,13 +61,16 @@ module Spud
|
|
60
61
|
|
61
62
|
if !old_timestamp || new_timestamp > old_timestamp
|
62
63
|
timestamps[filename] = new_timestamp
|
63
|
-
|
64
|
+
|
65
|
+
thread.kill if thread
|
66
|
+
thread = Thread.new { invoke(name, *args, **kwargs) }
|
64
67
|
break
|
65
68
|
end
|
66
69
|
end
|
67
70
|
|
68
71
|
sleep 0.1
|
69
72
|
rescue Interrupt
|
73
|
+
thread.kill if thread
|
70
74
|
break
|
71
75
|
end
|
72
76
|
end
|
data/lib/version.rb
CHANGED