Sha256: f263ffd107101062ff4681e484976b5363f2cd28d89e83c5769b130a0a23a653

Contents?: true

Size: 987 Bytes

Versions: 1

Compression:

Stored size: 987 Bytes

Contents

module Merb::Generators
 
  class DaemonGenerator < Generator
    
    def self.source_root
      File.join(File.dirname(__FILE__),  'templates', 'daemon_generator')
    end
    
    desc <<-DESC
    Generates custum daemons 
    DESC
    
    first_argument :name, :required => true, :desc => "daemon name"
 
    template(:daemon_rb, :after => :chmod) do |t|
      t.source('%file_name%_script.rb') #script file
      t.destination("lib/daemons/#{file_name}.rb")
    end
    
    template(:daemon_ctl, :after => :chmod) do |t|
      t.source('%file_name%_script_ctl')
      t.destination("lib/daemons/#{file_name}_ctl")
    end
    
    template(:daemon, :after => :chmod) do |t|
      t.source('daemons')
      t.destination("lib/daemons")
    end

    template :daemon_yml do |t|
      t.source( '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.7 lib/generators/daemon_generator.rb