daemons-rails 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +3 -1
- data/Rakefile +3 -0
- data/daemons-rails.gemspec +2 -1
- data/lib/daemons-rails.rb +11 -9
- data/lib/daemons/rails.rb +6 -1
- data/lib/daemons/rails/configuration.rb +4 -2
- data/lib/daemons/rails/controller.rb +3 -3
- data/lib/daemons/rails/version.rb +1 -1
- data/lib/generators/templates/script_ctl +2 -3
- data/spec/lib/daemons/rails/config_spec.rb +4 -4
- metadata +41 -35
data/README.markdown
CHANGED
@@ -5,7 +5,8 @@ To get it work just add dependency to this gem in your Gemfile.
|
|
5
5
|
|
6
6
|
## NOTES ##
|
7
7
|
|
8
|
-
**If you
|
8
|
+
- **If you switched from earlier version to 1.2 its recommended to change `Daemons.run` to `Daemons::Rails.run` in your `*_ctl` files**
|
9
|
+
- **If you switched from earlier version to 1.1 you may need to move `script/daemons` file to `lib/daemons` directory.**
|
9
10
|
|
10
11
|
## GENERATOR ##
|
11
12
|
|
@@ -78,6 +79,7 @@ and same set of methods. Effectively, *Daemons::Rails::Monitoring* just delegate
|
|
78
79
|
|
79
80
|
## CHANGES ##
|
80
81
|
|
82
|
+
* 1.2.0 - development dependency on Rails bumped to support Rails 4 (dmilisic). Removed direct dependency on Daemons gem from generated files (in preparation for more daemonization providers)
|
81
83
|
* 1.1.2 - fix script template to load environment within Rails.root directory. It takes no effect on already generated scripts.
|
82
84
|
* 1.1.1 - fix dependencies, clean-up specs
|
83
85
|
* 1.1.0 - supported custom directory for daemons, support multiple daemons directories
|
data/Rakefile
CHANGED
data/daemons-rails.gemspec
CHANGED
@@ -15,9 +15,10 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Daemons::Rails::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency 'rails', '~>3.0'
|
19
18
|
gem.add_dependency 'daemons'
|
20
19
|
gem.add_dependency 'multi_json', '~>1.0'
|
20
|
+
|
21
|
+
gem.add_development_dependency 'rails', '>=3.0.0'
|
21
22
|
gem.add_development_dependency "rake"
|
22
23
|
gem.add_development_dependency 'rspec', '>=2.12'
|
23
24
|
end
|
data/lib/daemons-rails.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'rails'
|
2
|
+
require 'daemons/rails/config'
|
3
|
+
require 'daemons/rails/monitoring'
|
4
4
|
|
5
5
|
module Daemons
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
module Rails
|
7
|
+
class Railtie < ::Rails::Railtie
|
8
|
+
generators do
|
9
|
+
require 'generators/daemon_generator.rb'
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
rake_tasks do
|
13
|
+
load 'tasks/daemons.rake'
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
data/lib/daemons/rails.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require
|
1
|
+
require 'daemons'
|
2
|
+
require 'daemons/rails/configuration'
|
2
3
|
|
3
4
|
module Daemons
|
4
5
|
module Rails
|
@@ -10,5 +11,9 @@ module Daemons
|
|
10
11
|
def self.configure
|
11
12
|
yield configuration
|
12
13
|
end
|
14
|
+
|
15
|
+
def self.run(*args)
|
16
|
+
Daemons.run(*args)
|
17
|
+
end
|
13
18
|
end
|
14
19
|
end
|
@@ -5,7 +5,9 @@ module Daemons
|
|
5
5
|
module Rails
|
6
6
|
class Configuration
|
7
7
|
def detect_root
|
8
|
-
if
|
8
|
+
if ENV["DAEMONS_ROOT"]
|
9
|
+
Pathname.new(ENV["DAEMONS_ROOT"])
|
10
|
+
elsif defined?(::Rails)
|
9
11
|
::Rails.root
|
10
12
|
else
|
11
13
|
root = Pathname.new(FileUtils.pwd)
|
@@ -37,4 +39,4 @@ module Daemons
|
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|
40
|
-
end
|
42
|
+
end
|
@@ -5,11 +5,11 @@ module Daemons
|
|
5
5
|
|
6
6
|
def initialize(controller_path)
|
7
7
|
@path = controller_path
|
8
|
-
@app_name = "#{controller_path.basename.to_s[0
|
8
|
+
@app_name = "#{controller_path.basename.to_s[0...-'_ctl'.length]}.rb"
|
9
9
|
end
|
10
10
|
|
11
11
|
def run(command)
|
12
|
-
|
12
|
+
`cd #{Daemons::Rails.configuration.root} && #{path} #{command}`
|
13
13
|
end
|
14
14
|
|
15
15
|
def start
|
@@ -25,4 +25,4 @@ module Daemons
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
28
|
-
end
|
28
|
+
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rubygems'
|
3
|
-
require
|
4
|
-
require "daemons/rails/config"
|
3
|
+
require 'daemons/rails/config'
|
5
4
|
|
6
5
|
config = Daemons::Rails::Config.for_controller(File.expand_path(__FILE__))
|
7
|
-
Daemons.run config[:script], config.to_hash
|
6
|
+
Daemons::Rails.run config[:script], config.to_hash
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'daemons/rails/config'
|
3
3
|
|
4
4
|
describe Daemons::Rails::Config do
|
5
|
-
describe
|
5
|
+
describe 'daemon controller config' do
|
6
6
|
subject { Daemons::Rails::Config.for_controller(Rails.root.join('app', 'daemons', 'test_ctl').to_s) }
|
7
7
|
|
8
|
-
it
|
8
|
+
it 'should init options' do
|
9
9
|
subject[:script].should == Rails.root.join('app', 'daemons', 'test.rb').to_s
|
10
10
|
end
|
11
11
|
end
|
metadata
CHANGED
@@ -1,96 +1,96 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daemons-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.0
|
4
5
|
prerelease:
|
5
|
-
version: 1.1.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- mirasrael
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
type: :runtime
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '3.0'
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
version: '3.0'
|
29
|
-
name: rails
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
type: :runtime
|
32
15
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
16
|
requirements:
|
35
17
|
- - ! '>='
|
36
18
|
- !ruby/object:Gem::Version
|
37
19
|
version: '0'
|
38
|
-
prerelease: false
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
20
|
none: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
22
|
requirements:
|
42
23
|
- - ! '>='
|
43
24
|
- !ruby/object:Gem::Version
|
44
25
|
version: '0'
|
26
|
+
none: false
|
27
|
+
prerelease: false
|
45
28
|
name: daemons
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
29
|
type: :runtime
|
30
|
+
- !ruby/object:Gem::Dependency
|
48
31
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
32
|
requirements:
|
51
33
|
- - ~>
|
52
34
|
- !ruby/object:Gem::Version
|
53
35
|
version: '1.0'
|
54
|
-
prerelease: false
|
55
|
-
version_requirements: !ruby/object:Gem::Requirement
|
56
36
|
none: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
38
|
requirements:
|
58
39
|
- - ~>
|
59
40
|
- !ruby/object:Gem::Version
|
60
41
|
version: '1.0'
|
42
|
+
none: false
|
43
|
+
prerelease: false
|
61
44
|
name: multi_json
|
45
|
+
type: :runtime
|
62
46
|
- !ruby/object:Gem::Dependency
|
63
|
-
type: :development
|
64
47
|
requirement: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: 3.0.0
|
65
52
|
none: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
54
|
requirements:
|
67
55
|
- - ! '>='
|
68
56
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
57
|
+
version: 3.0.0
|
58
|
+
none: false
|
70
59
|
prerelease: false
|
71
|
-
|
60
|
+
name: rails
|
61
|
+
type: :development
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
72
68
|
none: false
|
69
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
70
|
requirements:
|
74
71
|
- - ! '>='
|
75
72
|
- !ruby/object:Gem::Version
|
76
73
|
version: '0'
|
74
|
+
none: false
|
75
|
+
prerelease: false
|
77
76
|
name: rake
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
77
|
type: :development
|
78
|
+
- !ruby/object:Gem::Dependency
|
80
79
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
80
|
requirements:
|
83
81
|
- - ! '>='
|
84
82
|
- !ruby/object:Gem::Version
|
85
83
|
version: '2.12'
|
86
|
-
prerelease: false
|
87
|
-
version_requirements: !ruby/object:Gem::Requirement
|
88
84
|
none: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
86
|
requirements:
|
90
87
|
- - ! '>='
|
91
88
|
- !ruby/object:Gem::Version
|
92
89
|
version: '2.12'
|
90
|
+
none: false
|
91
|
+
prerelease: false
|
93
92
|
name: rspec
|
93
|
+
type: :development
|
94
94
|
description: daemons gem support for Rails 3
|
95
95
|
email: []
|
96
96
|
executables: []
|
@@ -135,17 +135,23 @@ rdoc_options: []
|
|
135
135
|
require_paths:
|
136
136
|
- lib
|
137
137
|
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
-
none: false
|
139
138
|
requirements:
|
140
139
|
- - ! '>='
|
141
140
|
- !ruby/object:Gem::Version
|
141
|
+
hash: 3041252732915999327
|
142
142
|
version: '0'
|
143
|
-
|
143
|
+
segments:
|
144
|
+
- 0
|
144
145
|
none: false
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
147
|
requirements:
|
146
148
|
- - ! '>='
|
147
149
|
- !ruby/object:Gem::Version
|
150
|
+
hash: 3041252732915999327
|
148
151
|
version: '0'
|
152
|
+
segments:
|
153
|
+
- 0
|
154
|
+
none: false
|
149
155
|
requirements: []
|
150
156
|
rubyforge_project:
|
151
157
|
rubygems_version: 1.8.24
|