esp-commons 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ module EspCommons
4
4
  class Engine < ::Rails::Engine
5
5
  isolate_namespace EspCommons
6
6
 
7
- config.autoload_paths << File.expand_path('../lib/', __FILE__)
7
+ config.autoload_paths << File.expand_path('../libraries/', __FILE__)
8
8
 
9
9
  config.before_configuration do
10
10
  Settings.define 'appeals.url', :env_var => 'APPEALS_URL'
File without changes
File without changes
@@ -2,6 +2,7 @@ require 'amqp'
2
2
 
3
3
  class Subscriber
4
4
  def start
5
+ logger.debug "RAILS_ENV=#{Rails.env}"
5
6
  subscribers.each do |subscriber|
6
7
  AMQP.start(Settings['amqp.url']) do |connection|
7
8
  channel = AMQP::Channel.new(connection)
@@ -1,3 +1,3 @@
1
1
  module EspCommons
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -1,18 +1,40 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'optparse'
4
+ options = {}
5
+ OptionParser.new do |opts|
6
+ opts.on('-e', '--environment=ENVIRONMENT', 'Rails environment') do |env|
7
+ ENV['RAILS_ENV'] = env
8
+ end
9
+ opts.on('-p', '--pid-files-directory=DIRECTORY', "Pid files directory") do |dir|
10
+ options[:pid_files_dir] = dir
11
+ end
12
+ opts.on('-l', '--log-files-directory=DIRECTORY', "Log files directory") do |dir|
13
+ options[:log_files_dir] = dir
14
+ end
15
+ end.parse!
16
+
3
17
  require File.expand_path('../../config/environment', __FILE__)
4
18
 
5
19
  dir = Rails.root.to_s
6
20
 
7
- daemon_name = (dir.split('/')[-2..-1] << "daemon").join('-')
21
+ dir_chunks = dir.split('/')
22
+
23
+ project_name = dir_chunks[-1]
24
+ project_group = dir_chunks[-2]
25
+
26
+ daemon_name = [project_group, project_name, 'subscriber'].join('-')
8
27
 
9
28
  daemon_options = {
10
29
  :multiple => false,
11
30
  :dir_mode => :normal,
12
- :dir => Rails.root.join('tmp', 'pids'),
31
+ :dir => options[:pid_files_dir] || Rails.root.join('tmp', 'pids'),
32
+ :log_dir => options[:log_files_dir] || Rails.root.join('log'),
13
33
  :backtrace => true
14
34
  }
15
35
 
36
+ require 'daemons'
37
+
16
38
  Daemons.run_proc(daemon_name, daemon_options) do
17
39
  if ARGV.include?('--')
18
40
  ARGV.slice! 0..ARGV.index('--')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esp-commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: active_attr
16
- requirement: &9162020 !ruby/object:Gem::Requirement
16
+ requirement: &16840440 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,21 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *9162020
24
+ version_requirements: *16840440
25
+ - !ruby/object:Gem::Dependency
26
+ name: amqp
27
+ requirement: &16867680 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *16867680
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: bunny
27
- requirement: &9160100 !ruby/object:Gem::Requirement
38
+ requirement: &16867100 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ! '>='
@@ -32,10 +43,21 @@ dependencies:
32
43
  version: '0'
33
44
  type: :runtime
34
45
  prerelease: false
35
- version_requirements: *9160100
46
+ version_requirements: *16867100
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: curb
38
- requirement: &9456820 !ruby/object:Gem::Requirement
49
+ requirement: &16866360 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *16866360
58
+ - !ruby/object:Gem::Dependency
59
+ name: daemons
60
+ requirement: &16865340 !ruby/object:Gem::Requirement
39
61
  none: false
40
62
  requirements:
41
63
  - - ! '>='
@@ -43,10 +65,10 @@ dependencies:
43
65
  version: '0'
44
66
  type: :runtime
45
67
  prerelease: false
46
- version_requirements: *9456820
68
+ version_requirements: *16865340
47
69
  - !ruby/object:Gem::Dependency
48
70
  name: openteam-commons
49
- requirement: &9455460 !ruby/object:Gem::Requirement
71
+ requirement: &16864620 !ruby/object:Gem::Requirement
50
72
  none: false
51
73
  requirements:
52
74
  - - ! '>='
@@ -54,10 +76,10 @@ dependencies:
54
76
  version: '0'
55
77
  type: :runtime
56
78
  prerelease: false
57
- version_requirements: *9455460
79
+ version_requirements: *16864620
58
80
  - !ruby/object:Gem::Dependency
59
81
  name: rails
60
- requirement: &9454020 !ruby/object:Gem::Requirement
82
+ requirement: &16864140 !ruby/object:Gem::Requirement
61
83
  none: false
62
84
  requirements:
63
85
  - - ! '>='
@@ -65,10 +87,10 @@ dependencies:
65
87
  version: '0'
66
88
  type: :runtime
67
89
  prerelease: false
68
- version_requirements: *9454020
90
+ version_requirements: *16864140
69
91
  - !ruby/object:Gem::Dependency
70
92
  name: sqlite3
71
- requirement: &9453100 !ruby/object:Gem::Requirement
93
+ requirement: &16862880 !ruby/object:Gem::Requirement
72
94
  none: false
73
95
  requirements:
74
96
  - - ! '>='
@@ -76,7 +98,7 @@ dependencies:
76
98
  version: '0'
77
99
  type: :development
78
100
  prerelease: false
79
- version_requirements: *9453100
101
+ version_requirements: *16862880
80
102
  description: Description of EspCommons.
81
103
  email:
82
104
  - mail@openteam.ru
@@ -86,10 +108,10 @@ extra_rdoc_files: []
86
108
  files:
87
109
  - app/models/esp_commons/image.rb
88
110
  - config/locales/commons.ru.yml
111
+ - lib/esp-commons/libraries/message_maker.rb
112
+ - lib/esp-commons/libraries/subscriber.rb
113
+ - lib/esp-commons/libraries/requester.rb
89
114
  - lib/esp-commons/engine.rb
90
- - lib/esp-commons/lib/message_maker.rb
91
- - lib/esp-commons/lib/requester.rb
92
- - lib/esp-commons/lib/subscriber.rb
93
115
  - lib/esp-commons/version.rb
94
116
  - lib/esp-commons.rb
95
117
  - lib/generators/esp_commons/install/install_generator.rb
@@ -112,7 +134,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
134
  version: '0'
113
135
  segments:
114
136
  - 0
115
- hash: -2401056414345403331
137
+ hash: -3357116084122121062
116
138
  required_rubygems_version: !ruby/object:Gem::Requirement
117
139
  none: false
118
140
  requirements:
@@ -121,10 +143,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
143
  version: '0'
122
144
  segments:
123
145
  - 0
124
- hash: -2401056414345403331
146
+ hash: -3357116084122121062
125
147
  requirements: []
126
148
  rubyforge_project:
127
- rubygems_version: 1.8.16
149
+ rubygems_version: 1.8.15
128
150
  signing_key:
129
151
  specification_version: 3
130
152
  summary: Summary of EspCommons.