Sha256: 5e0187d066e2ad9f24ea098387888cdfd6c321255b6f939ea92a8655ded6bf1b

Contents?: true

Size: 944 Bytes

Versions: 1

Compression:

Stored size: 944 Bytes

Contents

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