Sha256: c627804d1d30a5a9711fcbe96682adb7ad28c11b7a6bdcd05871b700981a6a86

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

# links that I referenced to write  this plugin
#http://wiki.merbivore.com/plugindev/generator
#http://yehudakatz.com/2007/09/19/merb-plugins-oh-yeah-theyre-pretty-frickin-cool-too/
    
module Merb::Generators
 
  class DaemonGenerator < NamespacedGenerator
    
    def self.source_root
      File.join(File.dirname(__FILE__),  'templates')
    end
    
    desc <<-DESC
    Generator that build custum daemon 
    DESC
    
    first_argument :name, :required => true, :desc => "file name"
 
    template :daemon_rb do |t|
      t.source(File.dirname(__FILE__) / 'templates' / '%file_name%.rb')
      t.destination("lib/daemons/#{file_name}.rb")
    end
    
    template :daemon_control do |t|
      t.source(File.dirname(__FILE__) / 'templates' / 'script_ctl')
      t.destination("lib/daemons/#{file_name}_ctl")
    end
    
    template :daemon do |t|
      t.source(File.dirname(__FILE__) / 'templates' / 'daemons')
      t.destination("lib/daemons")
    end

    template :daemon_yml do |t|
      t.source(File.dirname(__FILE__) / 'templates' / 'daemons.yml')
      t.destination("config/daemons.yml")
    end

    def chmod(action)
      File.chmod(0755, action.destination)
    end
    
  end
 
  add :daemon, DaemonGenerator 
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jaigouk-merb_daemon-0.0.1.5 lib/generators/daemons/daemon_generater.rb