action_subscriber 2.1.2-java → 2.2.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/action_subscriber +17 -2
- data/lib/action_subscriber.rb +6 -5
- data/lib/action_subscriber/configuration.rb +21 -10
- data/lib/action_subscriber/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: c9958787beb51135b66b1c55da8e5c361e0dc52d
|
4
|
+
data.tar.gz: 60ae57496371855cf7107ffe85c0835bd6444f64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd3530b49d2c228baa00efc4d5b468b6288dedba99b47777047743148616647fd5a126d7fba793a648a322b88e2739c750240cf07ad0dfc9064e5e4cdc17e449
|
7
|
+
data.tar.gz: dbf7288f4e2a7fe760ad1d9a1559b2d3c9d73eb4cd4a40b26d60e3f6789294f7282833268386ffc01a477e78a75c92f9a43635b1c741fbea3aa28aa97503b866
|
data/bin/action_subscriber
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
$ACTION_SUBSCRIBER_SERVER_MODE = true
|
4
|
+
|
3
5
|
require 'active_support'
|
4
6
|
require 'active_support/core_ext'
|
5
7
|
require 'thor'
|
8
|
+
require 'action_subscriber'
|
6
9
|
|
7
10
|
module ActionSubscriber
|
8
11
|
class CLI < ::Thor
|
@@ -23,12 +26,24 @@ module ActionSubscriber
|
|
23
26
|
BABOUDESC
|
24
27
|
|
25
28
|
def start
|
26
|
-
require options[:app]
|
27
|
-
|
28
29
|
$0 = "Action Subscriber server #{object_id}"
|
29
30
|
::ActionSubscriber.logger.info "Loading configuration..."
|
30
31
|
|
31
32
|
::ActionSubscriber::Configuration.configure_from_yaml_and_cli(options)
|
33
|
+
|
34
|
+
::ActionSubscriber.logger.info "Requiring app..."
|
35
|
+
|
36
|
+
require options[:app]
|
37
|
+
|
38
|
+
# We run these outside of lib/action_subscriber.rb because we need to load
|
39
|
+
# our railtie (Rails must be defined) before we can run our load hooks.
|
40
|
+
# When requiring action_subscriber as a client, these will be run
|
41
|
+
# automatically.
|
42
|
+
::ActionSubscriber.logger.info "Running load hooks..."
|
43
|
+
|
44
|
+
require "action_subscriber/railtie" if defined?(Rails)
|
45
|
+
::ActiveSupport.run_load_hooks(:action_subscriber, Base)
|
46
|
+
|
32
47
|
::ActionSubscriber.logger.info "Starting server..."
|
33
48
|
|
34
49
|
case ::ActionSubscriber.configuration.mode
|
data/lib/action_subscriber.rb
CHANGED
@@ -114,14 +114,18 @@ module ActionSubscriber
|
|
114
114
|
alias_method :config, :configuration
|
115
115
|
end
|
116
116
|
|
117
|
+
# Execution is delayed until after app loads when used with bin/action_subscriber
|
118
|
+
unless $ACTION_SUBSCRIBER_SERVER_MODE
|
119
|
+
::ActiveSupport.run_load_hooks(:action_subscriber, Base)
|
120
|
+
require "action_subscriber/railtie" if defined?(Rails)
|
121
|
+
end
|
122
|
+
|
117
123
|
# Initialize config object
|
118
124
|
config
|
119
125
|
|
120
126
|
# Intialize async publisher adapter
|
121
127
|
::ActionSubscriber::Publisher::Async.publisher_adapter
|
122
128
|
|
123
|
-
::ActiveSupport.run_load_hooks(:action_subscriber, Base)
|
124
|
-
|
125
129
|
##
|
126
130
|
# Private Implementation
|
127
131
|
#
|
@@ -144,11 +148,8 @@ module ActionSubscriber
|
|
144
148
|
end
|
145
149
|
end
|
146
150
|
private_class_method :default_routes
|
147
|
-
|
148
151
|
end
|
149
152
|
|
150
|
-
require "action_subscriber/railtie" if defined?(Rails)
|
151
|
-
|
152
153
|
at_exit do
|
153
154
|
::ActionSubscriber::Publisher::Async.publisher_adapter.shutdown!
|
154
155
|
::ActionSubscriber::RabbitConnection.publisher_disconnect!
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "yaml"
|
2
|
+
|
1
3
|
module ActionSubscriber
|
2
4
|
class Configuration
|
3
5
|
attr_accessor :allow_low_priority_methods,
|
@@ -24,6 +26,8 @@ module ActionSubscriber
|
|
24
26
|
:times_to_pop,
|
25
27
|
:virtual_host
|
26
28
|
|
29
|
+
CONFIGURATION_MUTEX = ::Mutex.new
|
30
|
+
|
27
31
|
DEFAULTS = {
|
28
32
|
:allow_low_priority_methods => false,
|
29
33
|
:async_publisher => 'memory',
|
@@ -51,18 +55,25 @@ module ActionSubscriber
|
|
51
55
|
##
|
52
56
|
# Class Methods
|
53
57
|
#
|
54
|
-
def self.configure_from_yaml_and_cli(cli_options = {})
|
55
|
-
|
58
|
+
def self.configure_from_yaml_and_cli(cli_options = {}, reload = false)
|
59
|
+
CONFIGURATION_MUTEX.synchronize do
|
60
|
+
@configure_from_yaml_and_cli = nil if reload
|
61
|
+
@configure_from_yaml_and_cli ||= begin
|
62
|
+
env = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || ENV["APP_ENV"] || "development"
|
56
63
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
64
|
+
yaml_config = {}
|
65
|
+
absolute_config_path = ::File.expand_path(::File.join("config", "action_subscriber.yml"))
|
66
|
+
if ::File.exists?(absolute_config_path)
|
67
|
+
yaml_config = ::YAML.load_file(absolute_config_path)[env]
|
68
|
+
end
|
62
69
|
|
63
|
-
|
64
|
-
|
65
|
-
|
70
|
+
::ActionSubscriber::Configuration::DEFAULTS.each_pair do |key, value|
|
71
|
+
setting = cli_options[key] || yaml_config[key.to_s]
|
72
|
+
::ActionSubscriber.config.__send__("#{key}=", setting) if setting
|
73
|
+
end
|
74
|
+
|
75
|
+
nil
|
76
|
+
end
|
66
77
|
end
|
67
78
|
end
|
68
79
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_subscriber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Brian Stien
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2016-02-
|
15
|
+
date: 2016-02-23 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|