daemonz 0.3.3 → 0.3.4
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.
- data/.document +5 -0
- data/.project +23 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +111 -0
- data/{MIT-LICENSE → LICENSE} +0 -0
- data/README.rdoc +82 -0
- data/Rakefile +39 -17
- data/VERSION +1 -1
- data/daemonz.gemspec +52 -21
- data/lib/daemonz/generators/config/templates/prepackaged/starling.yml +2 -1
- data/lib/daemonz/killer.rb +5 -5
- data/lib/daemonz/manage.rb +4 -3
- metadata +149 -68
- data/README.textile +0 -73
- data/init.rb +0 -6
data/.document
ADDED
data/.project
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<projectDescription>
|
3
|
+
<name>daemonz</name>
|
4
|
+
<comment></comment>
|
5
|
+
<projects>
|
6
|
+
</projects>
|
7
|
+
<buildSpec>
|
8
|
+
<buildCommand>
|
9
|
+
<name>com.aptana.ide.core.unifiedBuilder</name>
|
10
|
+
<arguments>
|
11
|
+
</arguments>
|
12
|
+
</buildCommand>
|
13
|
+
<buildCommand>
|
14
|
+
<name>org.rubypeople.rdt.core.rubybuilder</name>
|
15
|
+
<arguments>
|
16
|
+
</arguments>
|
17
|
+
</buildCommand>
|
18
|
+
</buildSpec>
|
19
|
+
<natures>
|
20
|
+
<nature>com.aptana.ruby.core.rubynature</nature>
|
21
|
+
<nature>org.rubypeople.rdt.core.rubynature</nature>
|
22
|
+
</natures>
|
23
|
+
</projectDescription>
|
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source :rubygems
|
2
|
+
|
3
|
+
gem 'posix-spawn', '>= 0.3.6'
|
4
|
+
gem 'simple-daemon', '>= 0.1.2'
|
5
|
+
gem 'rails', '>= 3.2.0'
|
6
|
+
gem 'zerg_support', '>= 0.1.5'
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem 'bundler', '>= 1.0.21'
|
10
|
+
gem 'flexmock', '>= 0.9.0'
|
11
|
+
gem 'jeweler', '>= 1.8.3'
|
12
|
+
gem 'rake', '>= 0.9.2.2'
|
13
|
+
gem 'rcov', '>= 0', :platform => :mri_18
|
14
|
+
gem 'simplecov', '>= 0', :platform => :mri_19
|
15
|
+
gem 'sqlite3', '>= 1.3.5'
|
16
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actionmailer (3.2.1)
|
5
|
+
actionpack (= 3.2.1)
|
6
|
+
mail (~> 2.4.0)
|
7
|
+
actionpack (3.2.1)
|
8
|
+
activemodel (= 3.2.1)
|
9
|
+
activesupport (= 3.2.1)
|
10
|
+
builder (~> 3.0.0)
|
11
|
+
erubis (~> 2.7.0)
|
12
|
+
journey (~> 1.0.1)
|
13
|
+
rack (~> 1.4.0)
|
14
|
+
rack-cache (~> 1.1)
|
15
|
+
rack-test (~> 0.6.1)
|
16
|
+
sprockets (~> 2.1.2)
|
17
|
+
activemodel (3.2.1)
|
18
|
+
activesupport (= 3.2.1)
|
19
|
+
builder (~> 3.0.0)
|
20
|
+
activerecord (3.2.1)
|
21
|
+
activemodel (= 3.2.1)
|
22
|
+
activesupport (= 3.2.1)
|
23
|
+
arel (~> 3.0.0)
|
24
|
+
tzinfo (~> 0.3.29)
|
25
|
+
activeresource (3.2.1)
|
26
|
+
activemodel (= 3.2.1)
|
27
|
+
activesupport (= 3.2.1)
|
28
|
+
activesupport (3.2.1)
|
29
|
+
i18n (~> 0.6)
|
30
|
+
multi_json (~> 1.0)
|
31
|
+
arel (3.0.0)
|
32
|
+
builder (3.0.0)
|
33
|
+
erubis (2.7.0)
|
34
|
+
flexmock (0.9.0)
|
35
|
+
git (1.2.5)
|
36
|
+
hike (1.2.1)
|
37
|
+
i18n (0.6.0)
|
38
|
+
jeweler (1.8.3)
|
39
|
+
bundler (~> 1.0)
|
40
|
+
git (>= 1.2.5)
|
41
|
+
rake
|
42
|
+
rdoc
|
43
|
+
journey (1.0.1)
|
44
|
+
json (1.6.5)
|
45
|
+
mail (2.4.1)
|
46
|
+
i18n (>= 0.4.0)
|
47
|
+
mime-types (~> 1.16)
|
48
|
+
treetop (~> 1.4.8)
|
49
|
+
mime-types (1.17.2)
|
50
|
+
multi_json (1.0.4)
|
51
|
+
polyglot (0.3.3)
|
52
|
+
posix-spawn (0.3.6)
|
53
|
+
rack (1.4.1)
|
54
|
+
rack-cache (1.1)
|
55
|
+
rack (>= 0.4)
|
56
|
+
rack-ssl (1.3.2)
|
57
|
+
rack
|
58
|
+
rack-test (0.6.1)
|
59
|
+
rack (>= 1.0)
|
60
|
+
rails (3.2.1)
|
61
|
+
actionmailer (= 3.2.1)
|
62
|
+
actionpack (= 3.2.1)
|
63
|
+
activerecord (= 3.2.1)
|
64
|
+
activeresource (= 3.2.1)
|
65
|
+
activesupport (= 3.2.1)
|
66
|
+
bundler (~> 1.0)
|
67
|
+
railties (= 3.2.1)
|
68
|
+
railties (3.2.1)
|
69
|
+
actionpack (= 3.2.1)
|
70
|
+
activesupport (= 3.2.1)
|
71
|
+
rack-ssl (~> 1.3.2)
|
72
|
+
rake (>= 0.8.7)
|
73
|
+
rdoc (~> 3.4)
|
74
|
+
thor (~> 0.14.6)
|
75
|
+
rake (0.9.2.2)
|
76
|
+
rcov (1.0.0)
|
77
|
+
rdoc (3.12)
|
78
|
+
json (~> 1.4)
|
79
|
+
simple-daemon (0.1.2)
|
80
|
+
simplecov (0.5.4)
|
81
|
+
multi_json (~> 1.0.3)
|
82
|
+
simplecov-html (~> 0.5.3)
|
83
|
+
simplecov-html (0.5.3)
|
84
|
+
sprockets (2.1.2)
|
85
|
+
hike (~> 1.2)
|
86
|
+
rack (~> 1.0)
|
87
|
+
tilt (~> 1.1, != 1.3.0)
|
88
|
+
sqlite3 (1.3.5)
|
89
|
+
thor (0.14.6)
|
90
|
+
tilt (1.3.3)
|
91
|
+
treetop (1.4.10)
|
92
|
+
polyglot
|
93
|
+
polyglot (>= 0.3.1)
|
94
|
+
tzinfo (0.3.31)
|
95
|
+
zerg_support (0.1.5)
|
96
|
+
|
97
|
+
PLATFORMS
|
98
|
+
ruby
|
99
|
+
|
100
|
+
DEPENDENCIES
|
101
|
+
bundler (>= 1.0.21)
|
102
|
+
flexmock (>= 0.9.0)
|
103
|
+
jeweler (>= 1.8.3)
|
104
|
+
posix-spawn (>= 0.3.6)
|
105
|
+
rails (>= 3.2.0)
|
106
|
+
rake (>= 0.9.2.2)
|
107
|
+
rcov
|
108
|
+
simple-daemon (>= 0.1.2)
|
109
|
+
simplecov
|
110
|
+
sqlite3 (>= 1.3.5)
|
111
|
+
zerg_support (>= 0.1.5)
|
data/{MIT-LICENSE → LICENSE}
RENAMED
File without changes
|
data/README.rdoc
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
= Daemonz
|
2
|
+
|
3
|
+
Automatically starts and stops the daemons in a Rails application.
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
Add the following entry to your Gemfile:
|
8
|
+
|
9
|
+
gem 'daemonz'
|
10
|
+
|
11
|
+
Get the gem wired and generate the default configuration:
|
12
|
+
|
13
|
+
bundle install
|
14
|
+
rails g daemonz:config
|
15
|
+
|
16
|
+
You don't need to do anything in your code for daemonz to work. It will start
|
17
|
+
the daemons when your server starts, and stop them when your server exits. It
|
18
|
+
does work with multiple servers.
|
19
|
+
|
20
|
+
== Configuration
|
21
|
+
|
22
|
+
The main configuration file is config/daemonz.yml. Daemons are configured by
|
23
|
+
individual files in the config/daemonz directory. Configuration files are ran
|
24
|
+
through Erb, so you can go crazy.
|
25
|
+
|
26
|
+
Daemonz comes with a few configuration examples that can also be used as they
|
27
|
+
are, by removing the line containing ":disabled: true". Please contribute your
|
28
|
+
configuration if you think others could use it.
|
29
|
+
|
30
|
+
== Daemon Generator
|
31
|
+
|
32
|
+
Daemonz includes a generator for a daemon intended to do background processing
|
33
|
+
inside a Rails environment. If you're writing your first daemon, give it a try.
|
34
|
+
The scaffolded code includes the configuration file, a daemon skeleton using the
|
35
|
+
simple-daemon gem, and an integration test skeleton.
|
36
|
+
|
37
|
+
rails g daemon YourDaemonName
|
38
|
+
|
39
|
+
== Testing
|
40
|
+
|
41
|
+
You can test your daemonz configuration with rake, as shown below. Keep in mind
|
42
|
+
that the Rake tasks are only provided for testing, and you should not use them
|
43
|
+
while your Rails application is running. Nothing bad should happen if you run
|
44
|
+
the tasks by mistake, but things may go astray if you mix the Rake tasks with
|
45
|
+
application starts and stops.
|
46
|
+
|
47
|
+
rake daemons:start # Starts your daemons (for testing only)
|
48
|
+
rake daemons:stop # Stops your daemons (for testing only)
|
49
|
+
|
50
|
+
Using the default configuration, daemons are not running during tests. The
|
51
|
+
snippet below shows how you can have daemons running during a specific test.
|
52
|
+
|
53
|
+
class DaemonsTest < ActionController::IntegrationTest
|
54
|
+
# If this isn't here, Rails runs the entire test in a transaction, so
|
55
|
+
# the database changes performed by daemons won't be visible to the test
|
56
|
+
# code.
|
57
|
+
#
|
58
|
+
# Keep in mind that SQLite can't do multi-process access, so you'll need
|
59
|
+
# to upgrade to a database server, such as MySQL or PostgreSQL if you're
|
60
|
+
# accessing the database from your daemons.
|
61
|
+
self.use_transactional_fixtures = false
|
62
|
+
|
63
|
+
test "something needing daemons" do
|
64
|
+
Daemonz.with_daemons do
|
65
|
+
# daemons will be alive while this code is executed
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
== Note on Patches/Pull Requests
|
71
|
+
|
72
|
+
* Fork the project.
|
73
|
+
* Make your feature addition or bug fix.
|
74
|
+
* Add tests for it. This is important so I don't break it in a future version
|
75
|
+
unintentionally.
|
76
|
+
* Commit, do not mess with rakefile, version, or history.
|
77
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
78
|
+
* Send me a pull request. Bonus points for topic branches.
|
79
|
+
|
80
|
+
== Copyright
|
81
|
+
|
82
|
+
Copyright (c) 2008-2012 Victor Costan, released under the MIT license
|
data/Rakefile
CHANGED
@@ -1,19 +1,41 @@
|
|
1
|
-
require
|
2
|
-
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
3
|
begin
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'jeweler'
|
12
|
+
Jeweler::Tasks.new do |gem|
|
13
|
+
gem.name = "daemonz"
|
14
|
+
gem.homepage = "http://github.com/costan/daemonz"
|
15
|
+
gem.license = "MIT"
|
16
|
+
gem.summary = %Q{User authentication for Rails 3 applications.}
|
17
|
+
gem.description = %Q{Works with Facebook.}
|
18
|
+
gem.email = "victor@costan.us"
|
19
|
+
gem.authors = ["Victor Costan"]
|
20
|
+
# Dependencies in Gemfile.
|
21
|
+
end
|
22
|
+
Jeweler::RubygemsDotOrgTasks.new
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
Rake::TestTask.new(:test) do |test|
|
26
|
+
test.libs << 'lib' << 'test'
|
27
|
+
test.pattern = 'test/**/*_test.rb'
|
28
|
+
test.verbose = true
|
29
|
+
end
|
30
|
+
|
31
|
+
task :default => :test
|
32
|
+
|
33
|
+
require 'rdoc/task'
|
34
|
+
Rake::RDocTask.new do |rdoc|
|
35
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
36
|
+
|
37
|
+
rdoc.rdoc_dir = 'rdoc'
|
38
|
+
rdoc.title = "authpwn_rails #{version}"
|
39
|
+
rdoc.rdoc_files.include('README*')
|
40
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
19
41
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.4
|
data/daemonz.gemspec
CHANGED
@@ -4,24 +4,29 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.3.
|
7
|
+
s.name = "daemonz"
|
8
|
+
s.version = "0.3.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Victor Costan"]
|
12
|
-
s.date =
|
13
|
-
s.
|
12
|
+
s.date = "2012-02-04"
|
13
|
+
s.description = "Works with Facebook."
|
14
|
+
s.email = "victor@costan.us"
|
14
15
|
s.extra_rdoc_files = [
|
15
|
-
"
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
16
18
|
]
|
17
19
|
s.files = [
|
18
|
-
"
|
19
|
-
"
|
20
|
+
".document",
|
21
|
+
".project",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE",
|
25
|
+
"README.rdoc",
|
20
26
|
"Rakefile",
|
21
27
|
"VERSION",
|
22
28
|
"config_template.yml",
|
23
29
|
"daemonz.gemspec",
|
24
|
-
"init.rb",
|
25
30
|
"lib/daemonz.rb",
|
26
31
|
"lib/daemonz/config.rb",
|
27
32
|
"lib/daemonz/generators/config/config_generator.rb",
|
@@ -38,29 +43,55 @@ Gem::Specification.new do |s|
|
|
38
43
|
"lib/daemonz/master.rb",
|
39
44
|
"lib/daemonz/process.rb",
|
40
45
|
"lib/daemonz/railtie.rb",
|
41
|
-
"lib/daemonz/tasks/daemonz_tasks.rake"
|
42
|
-
]
|
43
|
-
s.homepage = %q{http://github.com/costan/daemonz}
|
44
|
-
s.require_paths = ["lib"]
|
45
|
-
s.rubygems_version = %q{1.6.0}
|
46
|
-
s.summary = %q{Automatically starts and stops the daemons in a Rails application}
|
47
|
-
s.test_files = [
|
46
|
+
"lib/daemonz/tasks/daemonz_tasks.rake",
|
48
47
|
"test/daemonz_test.rb"
|
49
48
|
]
|
49
|
+
s.homepage = "http://github.com/costan/daemonz"
|
50
|
+
s.licenses = ["MIT"]
|
51
|
+
s.require_paths = ["lib"]
|
52
|
+
s.rubygems_version = "1.8.15"
|
53
|
+
s.summary = "User authentication for Rails 3 applications."
|
50
54
|
|
51
55
|
if s.respond_to? :specification_version then
|
52
56
|
s.specification_version = 3
|
53
57
|
|
54
58
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
55
|
-
s.add_runtime_dependency(%q<
|
56
|
-
s.add_runtime_dependency(%q<
|
59
|
+
s.add_runtime_dependency(%q<posix-spawn>, [">= 0.3.6"])
|
60
|
+
s.add_runtime_dependency(%q<simple-daemon>, [">= 0.1.2"])
|
61
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.2.0"])
|
62
|
+
s.add_runtime_dependency(%q<zerg_support>, [">= 0.1.5"])
|
63
|
+
s.add_development_dependency(%q<bundler>, [">= 1.0.21"])
|
64
|
+
s.add_development_dependency(%q<flexmock>, [">= 0.9.0"])
|
65
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.8.3"])
|
66
|
+
s.add_development_dependency(%q<rake>, [">= 0.9.2.2"])
|
67
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
68
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
69
|
+
s.add_development_dependency(%q<sqlite3>, [">= 1.3.5"])
|
57
70
|
else
|
58
|
-
s.add_dependency(%q<
|
59
|
-
s.add_dependency(%q<
|
71
|
+
s.add_dependency(%q<posix-spawn>, [">= 0.3.6"])
|
72
|
+
s.add_dependency(%q<simple-daemon>, [">= 0.1.2"])
|
73
|
+
s.add_dependency(%q<rails>, [">= 3.2.0"])
|
74
|
+
s.add_dependency(%q<zerg_support>, [">= 0.1.5"])
|
75
|
+
s.add_dependency(%q<bundler>, [">= 1.0.21"])
|
76
|
+
s.add_dependency(%q<flexmock>, [">= 0.9.0"])
|
77
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.3"])
|
78
|
+
s.add_dependency(%q<rake>, [">= 0.9.2.2"])
|
79
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
80
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
81
|
+
s.add_dependency(%q<sqlite3>, [">= 1.3.5"])
|
60
82
|
end
|
61
83
|
else
|
62
|
-
s.add_dependency(%q<
|
63
|
-
s.add_dependency(%q<
|
84
|
+
s.add_dependency(%q<posix-spawn>, [">= 0.3.6"])
|
85
|
+
s.add_dependency(%q<simple-daemon>, [">= 0.1.2"])
|
86
|
+
s.add_dependency(%q<rails>, [">= 3.2.0"])
|
87
|
+
s.add_dependency(%q<zerg_support>, [">= 0.1.5"])
|
88
|
+
s.add_dependency(%q<bundler>, [">= 1.0.21"])
|
89
|
+
s.add_dependency(%q<flexmock>, [">= 0.9.0"])
|
90
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.3"])
|
91
|
+
s.add_dependency(%q<rake>, [">= 0.9.2.2"])
|
92
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
93
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
94
|
+
s.add_dependency(%q<sqlite3>, [">= 1.3.5"])
|
64
95
|
end
|
65
96
|
end
|
66
97
|
|
@@ -33,7 +33,8 @@ starling:
|
|
33
33
|
# Pattern for the PID file(s) used by the daemon.
|
34
34
|
:pids: tmp/pids/starling*.pid
|
35
35
|
# Override for the patterns used to identify the daemon's processes.
|
36
|
-
:kill_patterns:
|
36
|
+
:kill_patterns:
|
37
|
+
- <%= Rails.root.join 'log', 'starling.log' %>
|
37
38
|
# Time to wait after sending the stop command, before killing the daemon.
|
38
39
|
:delay_before_kill: 0.2
|
39
40
|
# Override the daemon startup order. Starling consumer daemons should have
|
data/lib/daemonz/killer.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'English'
|
2
|
-
|
3
1
|
module Daemonz
|
4
2
|
# Complex procedure for killing a process or a bunch of process replicas
|
5
3
|
# kill_command is the script that's supposed to kill the process / processes (tried first)
|
@@ -17,9 +15,11 @@ module Daemonz
|
|
17
15
|
end
|
18
16
|
if options[:force_script] or !(pid_files.empty? or kill_script.nil?)
|
19
17
|
logger.info "Issuing kill order: #{kill_script}\n" if options[:verbose]
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
unless kill_script.nil?
|
19
|
+
status = POSIX::Spawn::Child.new kill_script
|
20
|
+
if !status.success? and options[:verbose]
|
21
|
+
logger.warn "Kill order failed with exit code #{status.exitstatus}"
|
22
|
+
end
|
23
23
|
end
|
24
24
|
|
25
25
|
deadline_time = Time.now + (options[:script_delay] || 0.5)
|
data/lib/daemonz/manage.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'posix/spawn'
|
2
2
|
|
3
3
|
module Daemonz
|
4
4
|
# Starts daemons, yields, stops daemons. Intended for tests.
|
@@ -53,8 +53,9 @@ module Daemonz
|
|
53
53
|
:verbose => true, :force_script => false
|
54
54
|
|
55
55
|
logger.info "Daemonz starting #{daemon[:name]}: #{daemon[:start][:cmdline]}"
|
56
|
-
|
57
|
-
|
56
|
+
status = POSIX::Spawn::Child.new daemon[:start][:cmdline]
|
57
|
+
|
58
|
+
unless status.success?
|
58
59
|
logger.warn "Daemonz start script for #{daemon[:name]} failed " +
|
59
60
|
"with code #{$CHILD_STATUS.exitstatus}"
|
60
61
|
end
|
metadata
CHANGED
@@ -1,67 +1,155 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: daemonz
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.4
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
- 3
|
10
|
-
version: 0.3.3
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Victor Costan
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
date: 2012-02-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: posix-spawn
|
16
|
+
requirement: &8563100 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.3.6
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *8563100
|
25
|
+
- !ruby/object:Gem::Dependency
|
22
26
|
name: simple-daemon
|
27
|
+
requirement: &8562340 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.1.2
|
33
|
+
type: :runtime
|
23
34
|
prerelease: false
|
24
|
-
|
35
|
+
version_requirements: *8562340
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rails
|
38
|
+
requirement: &8561540 !ruby/object:Gem::Requirement
|
25
39
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 3.2.0
|
33
44
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: zerg_support
|
37
45
|
prerelease: false
|
38
|
-
|
46
|
+
version_requirements: *8561540
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: zerg_support
|
49
|
+
requirement: &8560780 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.1.5
|
47
55
|
type: :runtime
|
48
|
-
|
49
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *8560780
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: bundler
|
60
|
+
requirement: &8559940 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 1.0.21
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *8559940
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: flexmock
|
71
|
+
requirement: &8559120 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.9.0
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *8559120
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: jeweler
|
82
|
+
requirement: &8558140 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 1.8.3
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *8558140
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rake
|
93
|
+
requirement: &10742260 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 0.9.2.2
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *10742260
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: rcov
|
104
|
+
requirement: &10741180 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *10741180
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: simplecov
|
115
|
+
requirement: &10740640 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *10740640
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: sqlite3
|
126
|
+
requirement: &10739880 !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.3.5
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: *10739880
|
135
|
+
description: Works with Facebook.
|
50
136
|
email: victor@costan.us
|
51
137
|
executables: []
|
52
|
-
|
53
138
|
extensions: []
|
54
|
-
|
55
|
-
|
56
|
-
- README.
|
57
|
-
files:
|
58
|
-
-
|
59
|
-
-
|
139
|
+
extra_rdoc_files:
|
140
|
+
- LICENSE
|
141
|
+
- README.rdoc
|
142
|
+
files:
|
143
|
+
- .document
|
144
|
+
- .project
|
145
|
+
- Gemfile
|
146
|
+
- Gemfile.lock
|
147
|
+
- LICENSE
|
148
|
+
- README.rdoc
|
60
149
|
- Rakefile
|
61
150
|
- VERSION
|
62
151
|
- config_template.yml
|
63
152
|
- daemonz.gemspec
|
64
|
-
- init.rb
|
65
153
|
- lib/daemonz.rb
|
66
154
|
- lib/daemonz/config.rb
|
67
155
|
- lib/daemonz/generators/config/config_generator.rb
|
@@ -80,39 +168,32 @@ files:
|
|
80
168
|
- lib/daemonz/railtie.rb
|
81
169
|
- lib/daemonz/tasks/daemonz_tasks.rake
|
82
170
|
- test/daemonz_test.rb
|
83
|
-
has_rdoc: true
|
84
171
|
homepage: http://github.com/costan/daemonz
|
85
|
-
licenses:
|
86
|
-
|
172
|
+
licenses:
|
173
|
+
- MIT
|
87
174
|
post_install_message:
|
88
175
|
rdoc_options: []
|
89
|
-
|
90
|
-
require_paths:
|
176
|
+
require_paths:
|
91
177
|
- lib
|
92
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
178
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
179
|
none: false
|
94
|
-
requirements:
|
95
|
-
- -
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
|
98
|
-
segments:
|
180
|
+
requirements:
|
181
|
+
- - ! '>='
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
segments:
|
99
185
|
- 0
|
100
|
-
|
101
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
|
+
hash: -1522999873803002788
|
187
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
188
|
none: false
|
103
|
-
requirements:
|
104
|
-
- -
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
|
107
|
-
segments:
|
108
|
-
- 0
|
109
|
-
version: "0"
|
189
|
+
requirements:
|
190
|
+
- - ! '>='
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
110
193
|
requirements: []
|
111
|
-
|
112
194
|
rubyforge_project:
|
113
|
-
rubygems_version: 1.
|
195
|
+
rubygems_version: 1.8.15
|
114
196
|
signing_key:
|
115
197
|
specification_version: 3
|
116
|
-
summary:
|
117
|
-
test_files:
|
118
|
-
- test/daemonz_test.rb
|
198
|
+
summary: User authentication for Rails 3 applications.
|
199
|
+
test_files: []
|
data/README.textile
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
h1. Daemonz
|
2
|
-
|
3
|
-
bq. Automatically starts and stops the daemons in a Rails application.
|
4
|
-
|
5
|
-
h2. Installation
|
6
|
-
|
7
|
-
Add the following entry to your Gemfile:
|
8
|
-
<pre>
|
9
|
-
gem 'daemonz'
|
10
|
-
</pre>
|
11
|
-
|
12
|
-
After running <code>bundle install</code> generate the default configuration:
|
13
|
-
<pre>
|
14
|
-
rails g daemonz:config
|
15
|
-
</pre>
|
16
|
-
|
17
|
-
You don't need to do anything in your code for daemonz to work. It will start
|
18
|
-
the daemons when your server starts, and stop them when your server exits. It
|
19
|
-
does work with multiple servers.
|
20
|
-
|
21
|
-
h2. Configuration
|
22
|
-
|
23
|
-
The main configuration file is config/daemonz.yml. Daemons are configured by
|
24
|
-
individual files in the config/daemonz directory. Configuration files are ran
|
25
|
-
through Erb, so you can go crazy.
|
26
|
-
|
27
|
-
Daemonz comes with a few configuration examples that can also be used as they
|
28
|
-
are, by removing the <code>:disabled: true</code> line. Please contribute your
|
29
|
-
configuration if you think others could use it.
|
30
|
-
|
31
|
-
h2. Daemon Generator
|
32
|
-
|
33
|
-
Daemonz includes a generator for a daemon intended to do background processing
|
34
|
-
inside a Rails environment. If you're writing your first daemon, give it a try.
|
35
|
-
The scaffolded code includes the configuration file, a daemon skeleton using the
|
36
|
-
<code>simple-daemon</code> gem, and an integration test skeleton.
|
37
|
-
|
38
|
-
<pre>
|
39
|
-
rails g daemon YourDaemonName
|
40
|
-
</pre>
|
41
|
-
|
42
|
-
h2. Testing
|
43
|
-
|
44
|
-
You can test your daemonz configuration with rake, as shown below. Keep in mind
|
45
|
-
that the Rake tasks are only provided for testing, and you should not use them
|
46
|
-
while your Rails application is running. Nothing bad should happen if you run
|
47
|
-
the tasks by mistake, but things may go astray if you mix the Rake tasks with
|
48
|
-
application starts and stops.
|
49
|
-
<pre>
|
50
|
-
rake daemons:start # Starts your daemons (for testing only)
|
51
|
-
rake daemons:stop # Stops your daemons (for testing only)
|
52
|
-
</pre>
|
53
|
-
|
54
|
-
Using the default configuration, daemons are not running during tests. The
|
55
|
-
snippet below shows how you can have daemons running during a specific test.
|
56
|
-
<notextile>
|
57
|
-
<pre>
|
58
|
-
class DaemonsTest < ActionController::IntegrationTest
|
59
|
-
# If this isn't here, Rails runs the entire test in a transaction, so daemons'
|
60
|
-
# database changes aren't visible. Also, if you share the database with
|
61
|
-
# daemons, sqlite won't cut it.
|
62
|
-
self.use_transactional_fixtures = false
|
63
|
-
|
64
|
-
test "something needing daemons" do
|
65
|
-
Daemonz.with_daemons do
|
66
|
-
# daemons will be alive while this code is executed
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
</pre>
|
71
|
-
</notextile>
|
72
|
-
|
73
|
-
p. Copyright (c) 2008 Victor Costan, released under the MIT license
|