Sha256: 33b85eaa9b93f03324d966090185862ce62a13f6cd6d9bd8bfedec497da77dc9

Contents?: true

Size: 879 Bytes

Versions: 2

Compression:

Stored size: 879 Bytes

Contents

Dir[File.join(File.dirname(File.expand_path(__FILE__)),"..","itrigga-generator","*.rb")].each {|f| require f }

namespace :itrigga do

  desc "Generates files"
  task :generator do
    
    raise "Must enter an config file" unless ENV['CONFIG_FILE']
    
    # Example rake calls
    # rake itrigga:generator PATTERN=monit TEMPLATE_DIR=/tmp/test/templates OUTPUT_DIR=/tmp/test/output CONFIG_FILE=/tmp/test/test.yml BASE_DIR=/var/www/itrigga/shared
    #
    # rake itrigga:generator PATTERN=logrotate TEMPLATE_DIR=/tmp/test/templates OUTPUT_DIR=/tmp/test/output CONFIG_FILE=false BASE_DIR=/var/www/itrigga/shared

    # convert all ENV params into a hash with symbolised keys
    args = ENV.inject({}){|h,e| h[e[0].to_s.downcase.to_sym] = (e[1].to_s == "false" ? false : e[1]);h; }
    
    generator = ITrigga::Generator::Generator.new args
    generator.generate
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
itrigga-generator-0.1.3 lib/tasks/generator.rake
itrigga-generator-0.1.2 lib/tasks/generator.rake