jaigouk-merb_daemon 0.0.1.5 → 0.0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
+ h1. Still working on the codes.
2
+
1
3
  h1. merb_daemon_gen
2
4
 
3
5
  A plugin for creating psuedo-scheduled jobs in merb. This merb plugin is based on dougal / daemon_generator
@@ -12,17 +14,14 @@ h2. Usage
12
14
  To get yourself rolling:
13
15
 
14
16
  $ sudo gem install daemons
15
- $ merb-gen daemon <name>
17
+ $ merb-gen daemon name
16
18
 
17
- Then insert your code in the lib/daemons/<name>.rb stub. All pid's and logs will live in the normal log/ folder. This helps to make things Capistrano friendly.
19
+ Then insert your code in the lib/daemons/name.rb stub. All pid's and logs will live in the normal log/ folder. This helps to make things Capistrano friendly.
18
20
 
19
21
  Individual control script:
20
22
 
21
- $ ./lib/daemons/<name>_ctl [start|stop|restart]
22
-
23
- App-wide control script (I add this to my capistrano recipe's after_restart task):
23
+ $ ./lib/daemons/name_ctl [start|stop|restart]
24
24
 
25
- $ ./script/daemons [start|stop|restart]
26
25
 
27
26
  h2. Notes
28
27
 
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'merb-core'
5
5
  require 'merb-core/tasks/merb'
6
6
 
7
7
  GEM_NAME = "merb_daemon"
8
- GEM_VERSION = "0.0.1.5"
8
+ GEM_VERSION = "0.0.1.7"
9
9
  AUTHOR = "Jai-Gouk Kim"
10
10
  EMAIL = "jaigouk@gmail.com"
11
11
  HOMEPAGE = "http://jaigouk.blogspot.com/"
@@ -3,23 +3,23 @@ module Merb::Generators
3
3
  class DaemonGenerator < Generator
4
4
 
5
5
  def self.source_root
6
- File.join(File.dirname(__FILE__), 'daemons', 'templates')
6
+ File.join(File.dirname(__FILE__), 'templates', 'daemon_generator')
7
7
  end
8
8
 
9
9
  desc <<-DESC
10
10
  Generates custum daemons
11
11
  DESC
12
12
 
13
- first_argument :name, :required => true
13
+ first_argument :name, :required => true, :desc => "daemon name"
14
14
 
15
15
  template(:daemon_rb, :after => :chmod) do |t|
16
- t.source('script.rb')
17
- t.destination("lib/daemons/#{name}.rb")
16
+ t.source('%file_name%_script.rb') #script file
17
+ t.destination("lib/daemons/#{file_name}.rb")
18
18
  end
19
19
 
20
20
  template(:daemon_ctl, :after => :chmod) do |t|
21
- t.source('script_ctl')
22
- t.destination("lib/daemons/#{name}_ctl")
21
+ t.source('%file_name%_script_ctl')
22
+ t.destination("lib/daemons/#{file_name}_ctl")
23
23
  end
24
24
 
25
25
  template(:daemon, :after => :chmod) do |t|
@@ -28,7 +28,7 @@ module Merb::Generators
28
28
  end
29
29
 
30
30
  template :daemon_yml do |t|
31
- t.source(File.dirname(__FILE__) / 'templates' / 'daemons.yml')
31
+ t.source( 'daemons.yml')
32
32
  t.destination("config/daemons.yml")
33
33
  end
34
34
 
@@ -12,7 +12,7 @@ if defined?(Merb::Plugins)
12
12
  end
13
13
 
14
14
  Merb::BootLoader.after_app_loads do
15
- # code that can be required after the application loads
15
+
16
16
  end
17
17
 
18
18
  Merb::Plugins.add_rakefiles "merb_daemon/merbtasks"
@@ -4,3 +4,4 @@ namespace :merb_daemon do
4
4
  puts "merb_daemon_gen doesn't do anything"
5
5
  end
6
6
  end
7
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jaigouk-merb_daemon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.5
4
+ version: 0.0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jai-Gouk Kim
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-14 00:00:00 -08:00
12
+ date: 2009-01-15 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,7 +30,7 @@ dependencies:
30
30
  - !ruby/object:Gem::Version
31
31
  version: 1.0.10
32
32
  version:
33
- description: Merb plugin that provides daemons
33
+ description: Merb plugin that generates daemons
34
34
  email: jaigouk@gmail.com
35
35
  executables: []
36
36
 
@@ -46,14 +46,12 @@ files:
46
46
  - Rakefile
47
47
  - TODO
48
48
  - lib/generators
49
- - lib/generators/daemons
50
- - lib/generators/daemons/templates
51
- - lib/generators/daemons/templates/daemons
52
- - lib/generators/daemons/templates/daemons.yml
53
- - lib/generators/daemons/templates/script_ctl
54
- - lib/generators/daemons/templates/script.rb
55
- - lib/generators/daemons/daemon_generater.rb
56
- - lib/generators/daemon_generater.rb
49
+ - lib/generators/templates
50
+ - lib/generators/templates/daemons
51
+ - lib/generators/templates/daemons.yml
52
+ - lib/generators/templates/%file_name%_script.rb
53
+ - lib/generators/templates/%file_name%_script_ctl
54
+ - lib/generators/daemon_generator.rb
57
55
  - lib/merb_daemon
58
56
  - lib/merb_daemon/merbtasks.rb
59
57
  - lib/merb_daemon.rb
@@ -84,6 +82,6 @@ rubyforge_project: merb
84
82
  rubygems_version: 1.2.0
85
83
  signing_key:
86
84
  specification_version: 2
87
- summary: Merb plugin that provides daemons
85
+ summary: Merb plugin that generates daemons
88
86
  test_files: []
89
87
 
@@ -1,46 +0,0 @@
1
- # links that I referenced to write this plugin
2
- #http://wiki.merbivore.com/plugindev/generator
3
- #http://yehudakatz.com/2007/09/19/merb-plugins-oh-yeah-theyre-pretty-frickin-cool-too/
4
-
5
- module Merb::Generators
6
-
7
- class DaemonGenerator < NamespacedGenerator
8
-
9
- def self.source_root
10
- File.join(File.dirname(__FILE__), 'templates')
11
- end
12
-
13
- desc <<-DESC
14
- Generator that build custum daemon
15
- DESC
16
-
17
- first_argument :name, :required => true, :desc => "file name"
18
-
19
- template :daemon_rb do |t|
20
- t.source(File.dirname(__FILE__) / 'templates' / '%file_name%.rb')
21
- t.destination("lib/daemons/#{file_name}.rb")
22
- end
23
-
24
- template :daemon_control do |t|
25
- t.source(File.dirname(__FILE__) / 'templates' / 'script_ctl')
26
- t.destination("lib/daemons/#{file_name}_ctl")
27
- end
28
-
29
- template :daemon do |t|
30
- t.source(File.dirname(__FILE__) / 'templates' / 'daemons')
31
- t.destination("lib/daemons")
32
- end
33
-
34
- template :daemon_yml do |t|
35
- t.source(File.dirname(__FILE__) / 'templates' / 'daemons.yml')
36
- t.destination("config/daemons.yml")
37
- end
38
-
39
- def chmod(action)
40
- File.chmod(0755, action.destination)
41
- end
42
-
43
- end
44
-
45
- add :daemon, DaemonGenerator
46
- end
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env ruby
2
- Dir[File.dirname(__FILE__) + "/../lib/daemons/*_ctl"].each {|f| `#{f} #{ARGV.first}`}
@@ -1,5 +0,0 @@
1
- dir_mode: script
2
- dir: ../../log
3
- multiple: false
4
- backtrace: true
5
- monitor: true
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # You might want to change this
4
- ENV["MERB_ENV"] ||= "production"
5
-
6
- require File.dirname(__FILE__) + "/../../config/environments"
7
-
8
- $running = true
9
- Signal.trap("TERM") do
10
- $running = false
11
- end
12
-
13
- while($running) do
14
-
15
- # Replace this with your code
16
- Merb.logger.info("This daemon is still running at #{Time.now}.\n")
17
- sleep 10
18
- end
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'rubygems'
3
- require "daemons"
4
- require 'yaml'
5
- require 'erb'
6
-
7
- if(File.exists?(file_name))
8
- require file_name
9
- else
10
-
11
- #merb_version = Merb::VERSION
12
- #
13
- #gem 'activesupport',merb_version
14
- #require 'active_support'
15
- end
16
-
17
- options = YAML.load(
18
- ERB.new(
19
- IO.read(
20
- File.dirname(__FILE__) + "/../../config/daemons.yml"
21
- )).result).with_indifferent_access
22
- options[:dir_mode] = options[:dir_mode].to_sym
23
-
24
- Daemons.run File.dirname(__FILE__) + '/<%=file_name%>.rb', options