ungodly 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/ungodly.rb +104 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4a8952af5c2f335076eb3caee69dabc3c621f132
|
4
|
+
data.tar.gz: b01c17566de44fae523f407f769a3d456f993150
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e213f2f4f67077f432167ff46d893c98815bb21bff42ee8f806baeb5a29f02e0ea1fb57563714a74490fefb502efcfabd076714ff0875e67c84bea72991be3dd
|
7
|
+
data.tar.gz: 5e54848fd98e1874cbc22fa4cba309c06fc71085271e85bbbcae351da8d46994a5dd18130689165b174ff4ac06254299222ff9a72d48947b043ed94025c3d6e6
|
data/lib/ungodly.rb
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
module Ungodly
|
5
|
+
extend Rake::DSL
|
6
|
+
|
7
|
+
|
8
|
+
class GodCommandFailure < StandardError
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
# Helper method for invoking god commands
|
13
|
+
def self.invoke(args)
|
14
|
+
pid = Process.spawn(*args)
|
15
|
+
_, result = Process.wait2(pid)
|
16
|
+
|
17
|
+
s = result.exitstatus
|
18
|
+
if s != 0
|
19
|
+
raise GodCommandFailure, "god command exited with status #{s}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
class GodManager
|
25
|
+
|
26
|
+
attr_accessor :env, :god_path
|
27
|
+
attr_accessor :config_path, :managed_pid_dir, :port
|
28
|
+
|
29
|
+
def initialize(options = {})
|
30
|
+
@env = options[:env]
|
31
|
+
|
32
|
+
@god_path = options[:god_path]
|
33
|
+
|
34
|
+
@port = options[:port]
|
35
|
+
@managed_pid_dir = options[:managed_pid_dir]
|
36
|
+
@config_path = options[:config_path]
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
# Helper methods for generating fragments of god commands
|
41
|
+
def env_param
|
42
|
+
(env) ? [env] : []
|
43
|
+
end
|
44
|
+
|
45
|
+
def god_exec_param
|
46
|
+
[god_path || "god"]
|
47
|
+
end
|
48
|
+
|
49
|
+
def port_param
|
50
|
+
(port) ? ["-p", port] : []
|
51
|
+
end
|
52
|
+
|
53
|
+
def managed_pid_dir_param
|
54
|
+
(managed_pid_dir) ? ["-managed-pid-dir", managed_pid_dir] : []
|
55
|
+
end
|
56
|
+
|
57
|
+
def config_path_param
|
58
|
+
(config_path) ? ["-c", config_path] : []
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
# Helper methods for generating god commands
|
63
|
+
|
64
|
+
def launch_cmd
|
65
|
+
env_param + god_exec_param + port_param + managed_pid_dir_param + config_path_param
|
66
|
+
end
|
67
|
+
|
68
|
+
def terminate_cmd
|
69
|
+
env_param + god_exec_param + port_param + ["terminate"]
|
70
|
+
end
|
71
|
+
|
72
|
+
def status_cmd
|
73
|
+
env_param + god_exec_param + port_param + ["status"]
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
def self.create_tasks(options = {})
|
82
|
+
|
83
|
+
god_manager = GodManager.new(options)
|
84
|
+
|
85
|
+
desc "Launch god and the workers"
|
86
|
+
task :launch do
|
87
|
+
invoke god_manager.launch_cmd
|
88
|
+
end
|
89
|
+
|
90
|
+
desc "Terminate god and the workers"
|
91
|
+
task :terminate do
|
92
|
+
invoke god_manager.terminate_cmd
|
93
|
+
end
|
94
|
+
|
95
|
+
desc "Show the status of the god workers"
|
96
|
+
task :status do
|
97
|
+
invoke god_manager.status_cmd
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ungodly
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brian Lauber
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: god
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.13.4
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.13.4
|
41
|
+
description: Rake task generator for the God gem
|
42
|
+
email: constructible.truth@gmail.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- lib/ungodly.rb
|
48
|
+
homepage: https://github.com/briandamaged/ungodly
|
49
|
+
licenses:
|
50
|
+
- MIT
|
51
|
+
metadata: {}
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 2.0.3
|
69
|
+
signing_key:
|
70
|
+
specification_version: 4
|
71
|
+
summary: Rake task generator for the God gem
|
72
|
+
test_files: []
|