angels 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/angels.gemspec +23 -0
- data/lib/angels/version.rb +3 -0
- data/lib/angels.rb +36 -0
- metadata +82 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/angels.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "angels/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "angels"
|
7
|
+
s.version = Angels::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Peder Linder"]
|
10
|
+
s.email = ["pederbl@jobstar.se"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Wrapper for daemons gem}
|
13
|
+
s.description = %q{Wrapper for daemons gem}
|
14
|
+
|
15
|
+
s.rubyforge_project = "angels"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency('daemons')
|
23
|
+
end
|
data/lib/angels.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
module Angels
|
2
|
+
|
3
|
+
def run_loop(name, opts = {}, &block)
|
4
|
+
opts = {
|
5
|
+
:loop_sleep => 60,
|
6
|
+
:retry => true,
|
7
|
+
:retry_sleep => 60,
|
8
|
+
:rails_root => File.expand_path(File.join(File.dirname(__FILE__), '..')),
|
9
|
+
:load_rails => false,
|
10
|
+
:pid_dir => File.join(File.dirname(__FILE__), '..', 'tmp'),
|
11
|
+
:default_env => 'production'
|
12
|
+
}.merge(opts)
|
13
|
+
|
14
|
+
environment_file = File.expand_path(File.dirname(__FILE__) + "/../config/environment.rb")
|
15
|
+
|
16
|
+
Daemons.run_proc(name, :dir_mode => :normal, :dir => opts[:pid_dir]) do
|
17
|
+
if opts[:load_rails]
|
18
|
+
ENV['RAILS_ENV'] ||= opts[:default_env]
|
19
|
+
require File.join(opts[:rails_root], 'config', 'environment')
|
20
|
+
end
|
21
|
+
|
22
|
+
loop {
|
23
|
+
begin
|
24
|
+
yield
|
25
|
+
sleep opts[:loop_sleep]
|
26
|
+
rescue SignalException, Interrupt; SystemExit; Process.exit
|
27
|
+
rescue => e
|
28
|
+
HoptoadNotifier.notify(e) if defined? HoptoadNotifier
|
29
|
+
raise e unless opts[:retry]
|
30
|
+
sleep opts[:retry_sleep]
|
31
|
+
end
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: angels
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Peder Linder
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-12-31 00:00:00 +00:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: daemons
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: *id001
|
33
|
+
description: Wrapper for daemons gem
|
34
|
+
email:
|
35
|
+
- pederbl@jobstar.se
|
36
|
+
executables: []
|
37
|
+
|
38
|
+
extensions: []
|
39
|
+
|
40
|
+
extra_rdoc_files: []
|
41
|
+
|
42
|
+
files:
|
43
|
+
- .gitignore
|
44
|
+
- Gemfile
|
45
|
+
- Rakefile
|
46
|
+
- angels.gemspec
|
47
|
+
- lib/angels.rb
|
48
|
+
- lib/angels/version.rb
|
49
|
+
has_rdoc: true
|
50
|
+
homepage: ""
|
51
|
+
licenses: []
|
52
|
+
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
segments:
|
64
|
+
- 0
|
65
|
+
version: "0"
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
requirements: []
|
75
|
+
|
76
|
+
rubyforge_project: angels
|
77
|
+
rubygems_version: 1.3.7
|
78
|
+
signing_key:
|
79
|
+
specification_version: 3
|
80
|
+
summary: Wrapper for daemons gem
|
81
|
+
test_files: []
|
82
|
+
|