eye-patch 0.0.8 → 0.0.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/eye/patch.rb +11 -0
- data/lib/eye/patch/overrides.rb +43 -13
- data/lib/eye/patch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c944d91e42e1d00b32dc0fe2bdd9d326d97a4a39
|
|
4
|
+
data.tar.gz: 5987d11eab09075aec1b7369dcf7b1fcbbf92dca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b2735759864af0e4b8ba6df917d5fa95ed477f6e7b0bb54ea533c3c86dbf9a36718dd5b2df019d95e4e1a6afed98285f547966f7968f6b7fb8b5c98a9e335953
|
|
7
|
+
data.tar.gz: ad085aa238b0223b8626308f61dccbb29f3782bf6aa0af13d042503e1ca71b3992c4bc89c95665236078e6889e0bc14de79ef6fb23e7a39c099e8ff48c1fd688
|
data/lib/eye/patch.rb
CHANGED
|
@@ -22,6 +22,17 @@ module Eye::Patch
|
|
|
22
22
|
Application.new(settings))
|
|
23
23
|
config.validate!
|
|
24
24
|
|
|
25
|
+
config.applications.values.each do |application|
|
|
26
|
+
if application[:setup_file]
|
|
27
|
+
@setup_file = File.join(application[:working_dir], application[:setup_file])
|
|
28
|
+
break
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
25
32
|
config
|
|
26
33
|
end
|
|
34
|
+
|
|
35
|
+
def self.setup_file
|
|
36
|
+
@setup_file
|
|
37
|
+
end
|
|
27
38
|
end
|
data/lib/eye/patch/overrides.rb
CHANGED
|
@@ -8,31 +8,61 @@ Eye::Cli.class_eval do
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
Eye::System.class_eval do
|
|
11
|
-
|
|
11
|
+
class << self
|
|
12
|
+
alias_method :daemonize_without_hook, :daemonize
|
|
13
|
+
alias_method :exec_without_hook, :exec
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
o.update(in: config[:stdin]) if config[:stdin]
|
|
18
|
-
o.update(close_others: !config[:preserve_fds])
|
|
15
|
+
def daemonize(*args)
|
|
16
|
+
Eye::Control.invoke_spawn_callback
|
|
17
|
+
daemonize_without_hook(*args)
|
|
18
|
+
end
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
def exec(*args)
|
|
21
|
+
Eye::Control.invoke_spawn_callback
|
|
22
|
+
exec_without_hook(*args)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def spawn_options(config = {})
|
|
28
|
+
o = {pgroup: true, chdir: config[:working_dir] || '/'}
|
|
29
|
+
o.update(out: [config[:stdout], 'a']) if config[:stdout]
|
|
30
|
+
o.update(err: [config[:stderr], 'a']) if config[:stderr]
|
|
31
|
+
o.update(in: config[:stdin]) if config[:stdin]
|
|
32
|
+
o.update(close_others: !config[:preserve_fds])
|
|
33
|
+
|
|
34
|
+
if Eye::Local.root?
|
|
35
|
+
o.update(uid: Etc.getpwnam(config[:uid]).uid) if config[:uid]
|
|
36
|
+
o.update(gid: Etc.getpwnam(config[:gid]).gid) if config[:gid]
|
|
37
|
+
end
|
|
26
38
|
|
|
27
|
-
|
|
39
|
+
o.update(umask: config[:umask]) if config[:umask]
|
|
40
|
+
|
|
41
|
+
o
|
|
42
|
+
end
|
|
28
43
|
end
|
|
29
44
|
end
|
|
30
45
|
|
|
31
46
|
Eye::Controller.class_eval do
|
|
47
|
+
|
|
48
|
+
def invoke_spawn_callback
|
|
49
|
+
if respond_to?(:before_spawn)
|
|
50
|
+
debug "Invoking before_spawn hook"
|
|
51
|
+
before_spawn
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
32
55
|
private
|
|
33
56
|
|
|
34
57
|
def parse_config(filename)
|
|
35
|
-
Eye::Patch.parse(filename)
|
|
58
|
+
config = Eye::Patch.parse(filename)
|
|
59
|
+
|
|
60
|
+
if Eye::Patch.setup_file
|
|
61
|
+
info "Loading setup from: #{Eye::Patch.setup_file}"
|
|
62
|
+
require Eye::Patch.setup_file
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
config
|
|
36
66
|
end
|
|
37
67
|
end
|
|
38
68
|
|
data/lib/eye/patch/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: eye-patch
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Horner
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-02-
|
|
11
|
+
date: 2014-02-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: eye
|