arsenicum 0.1.3 → 0.2
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/bin/arsenicum +0 -2
- data/bin/arsenicum_rails +1 -1
- data/lib/arsenicum/cli/rails_cli.rb +20 -0
- data/lib/arsenicum/cli.rb +50 -0
- data/lib/arsenicum/configuration/rails_configuration.rb +12 -0
- data/lib/arsenicum/configuration.rb +8 -1
- data/lib/arsenicum/main/rails_main.rb +8 -0
- data/lib/arsenicum/main.rb +9 -9
- data/lib/arsenicum/version.rb +1 -1
- data/lib/arsenicum.rb +1 -12
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0db275857e4df7d382e9118bf5939c1d0f414eac
|
4
|
+
data.tar.gz: e96f9f008045765ec16630f2f0820d2219144de1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8139cf79ce9249b4096db334bd7363c54218339bff1f0a31b6cbc8ce22476462257b45b820a7bb98ff045070d52696a2b1b7f5c5bfa85d9361985c9b51f0a344
|
7
|
+
data.tar.gz: babcd0a21ffd39a7cb3543d63fdb1c4a8bb44f3eb98b323f0ab7be563853e5a59606266ec427946e4294521929078b5ffa0ee0dc88ec09bcdd344b42f31bdd47
|
data/bin/arsenicum
CHANGED
data/bin/arsenicum_rails
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
class Arsenicum::CLI::RailsCLI < Arsenicum::CLI
|
4
|
+
private
|
5
|
+
def create_configuration
|
6
|
+
::Arsenicum::Configuration::RailsConfiguration.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def create_main
|
10
|
+
::Arsenicum::Main::RailsMain.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def handle_options(opt)
|
14
|
+
super
|
15
|
+
|
16
|
+
opt.on('-e', '--environment=ENVIRONMENT') do |env|
|
17
|
+
configuration.environment env
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
class Arsenicum::CLI
|
2
|
+
autoload :RailsCLI, 'arsenicum/cli/rails_cli'
|
3
|
+
|
4
|
+
attr_reader :arguments, :configuration
|
5
|
+
private :arguments, :configuration
|
6
|
+
|
7
|
+
def initialize(arguments)
|
8
|
+
@arguments = arguments
|
9
|
+
@configuration = create_configuration
|
10
|
+
parse_options arguments
|
11
|
+
end
|
12
|
+
|
13
|
+
def boot
|
14
|
+
create_main.run configuration
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def create_configuration
|
19
|
+
Arsenicum::Configuration.new
|
20
|
+
end
|
21
|
+
|
22
|
+
def create_main
|
23
|
+
Arsenicum::Main.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def parse_options(arguments)
|
27
|
+
OptionParser.new(&method(:handle_options)).parse!(arguments)
|
28
|
+
end
|
29
|
+
|
30
|
+
def handle_options(opt)
|
31
|
+
opt.on '-c', '--config-file=CONFIG_FILE', 'Specifies configuration file. all other options will be ignored.' do |config_path|
|
32
|
+
config_file = File.expand_path config_path
|
33
|
+
script = File.read config_file
|
34
|
+
configuration.instance_eval script, config_file, 1
|
35
|
+
end
|
36
|
+
|
37
|
+
opt.on '-d', '--daemonize' do
|
38
|
+
configuration.daemonize
|
39
|
+
end
|
40
|
+
|
41
|
+
opt.on '--stdout=PATH' do |v|
|
42
|
+
configuration.stdout v
|
43
|
+
end
|
44
|
+
|
45
|
+
opt.on '--stderr=PATH' do |v|
|
46
|
+
configuration.stderr v
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -4,11 +4,12 @@ module Arsenicum
|
|
4
4
|
class MisconfigurationError < StandardError;end
|
5
5
|
|
6
6
|
class Configuration
|
7
|
-
attr_reader :pidfile_path, :daemon, :stdout_path, :stderr_path, :logger_config
|
7
|
+
attr_reader :pidfile_path, :daemon, :stdout_path, :stderr_path, :logger_config, :working_directory
|
8
8
|
|
9
9
|
def initialize
|
10
10
|
@pidfile_path = 'arsenicum.pid'
|
11
11
|
@logger_config = LoggerConfiguration.new
|
12
|
+
@working_directory = '.'
|
12
13
|
end
|
13
14
|
|
14
15
|
def queue_configurations
|
@@ -41,6 +42,10 @@ module Arsenicum
|
|
41
42
|
@pidfile_path = path
|
42
43
|
end
|
43
44
|
|
45
|
+
def directory(path)
|
46
|
+
@working_directory = path
|
47
|
+
end
|
48
|
+
|
44
49
|
class InstanceConfiguration
|
45
50
|
include Arsenicum::Util
|
46
51
|
|
@@ -197,5 +202,7 @@ module Arsenicum
|
|
197
202
|
end
|
198
203
|
end
|
199
204
|
end
|
205
|
+
|
206
|
+
autoload :RailsConfiguration, 'arsenicum/configuration/rails_configuration'
|
200
207
|
end
|
201
208
|
end
|
data/lib/arsenicum/main.rb
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
module Arsenicum
|
2
|
-
|
3
|
-
def run(
|
2
|
+
class Main
|
3
|
+
def run(config)
|
4
4
|
$0 = 'arsenicum[main]'
|
5
5
|
|
6
|
-
config = Arsenicum::Configuration.new
|
7
|
-
config_file = File.expand_path config_file
|
8
|
-
|
9
|
-
script = File.read config_file
|
10
|
-
config.instance_eval script, config_file, 1
|
11
|
-
|
12
6
|
if config.daemon
|
13
7
|
Process.daemon true, true
|
14
8
|
|
@@ -17,9 +11,13 @@ module Arsenicum
|
|
17
11
|
end
|
18
12
|
end
|
19
13
|
|
14
|
+
Dir.chdir config.working_directory
|
15
|
+
|
20
16
|
configure_io config
|
21
17
|
configure_log config
|
22
18
|
|
19
|
+
before_boot(config)
|
20
|
+
|
23
21
|
threads = config.queue_configurations.map{|qc|qc.build.start_async}
|
24
22
|
begin
|
25
23
|
threads.each(&:join)
|
@@ -40,10 +38,12 @@ module Arsenicum
|
|
40
38
|
end
|
41
39
|
end
|
42
40
|
|
41
|
+
def before_boot(config);end
|
42
|
+
|
43
43
|
def configure_log(config)
|
44
44
|
Arsenicum::Logger.configure config.logger_config
|
45
45
|
end
|
46
46
|
|
47
|
-
|
47
|
+
autoload :RailsMain, 'arsenicum/main/rails_main'
|
48
48
|
end
|
49
49
|
end
|
data/lib/arsenicum/version.rb
CHANGED
data/lib/arsenicum.rb
CHANGED
@@ -12,16 +12,5 @@ module Arsenicum
|
|
12
12
|
autoload :Task, 'arsenicum/task'
|
13
13
|
autoload :Routing, 'arsenicum/routing'
|
14
14
|
autoload :Logger, 'arsenicum/logger'
|
15
|
-
|
16
|
-
class << self
|
17
|
-
def configure(arg = nil, &block)
|
18
|
-
Arsenicum::Configuration.configure arg, &block
|
19
|
-
end
|
20
|
-
|
21
|
-
def configuration
|
22
|
-
Configuration.instance
|
23
|
-
end
|
24
|
-
|
25
|
-
alias_method :config, :configuration
|
26
|
-
end
|
15
|
+
autoload :CLI, 'arsenicum/cli'
|
27
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arsenicum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- condor
|
@@ -141,7 +141,10 @@ files:
|
|
141
141
|
- bin/arsenicum_rails
|
142
142
|
- lib/arsenicum-rails.rb
|
143
143
|
- lib/arsenicum.rb
|
144
|
+
- lib/arsenicum/cli.rb
|
145
|
+
- lib/arsenicum/cli/rails_cli.rb
|
144
146
|
- lib/arsenicum/configuration.rb
|
147
|
+
- lib/arsenicum/configuration/rails_configuration.rb
|
145
148
|
- lib/arsenicum/core.rb
|
146
149
|
- lib/arsenicum/core/broker.rb
|
147
150
|
- lib/arsenicum/core/commands.rb
|
@@ -151,6 +154,7 @@ files:
|
|
151
154
|
- lib/arsenicum/io.rb
|
152
155
|
- lib/arsenicum/logger.rb
|
153
156
|
- lib/arsenicum/main.rb
|
157
|
+
- lib/arsenicum/main/rails_main.rb
|
154
158
|
- lib/arsenicum/queue.rb
|
155
159
|
- lib/arsenicum/queue/sqs.rb
|
156
160
|
- lib/arsenicum/routing.rb
|