Sha256: fd5decb9101f1590b6e879b1898c19920e340eec626a544c2621c72482ebf68e

Contents?: true

Size: 968 Bytes

Versions: 10

Compression:

Stored size: 968 Bytes

Contents

module Lono
  class Task
    def self.init(options={})
      project_root = options[:project_root] || '.'
      puts "Setting up lono project" unless options[:quiet]
      %w[Guardfile config/lono.rb templates/app.json.erb].each do |name|
        source = File.expand_path("../../files/#{name}", __FILE__)
        dirname = File.dirname(name)
        FileUtils.mkdir(dirname) unless File.exist?(dirname)
        dest = "#{project_root}/#{name}"

        if File.exist?(dest)
          puts "already exists: #{dest}" unless options[:quiet]
        else
          puts "creating: #{dest}" unless options[:quiet]
          FileUtils.cp(source, dest)
        end
      end
    end
    def self.generate(options)
      new(options).generate
    end

    def initialize(options={})
      @options = options
      if options.empty?
        @dsl = DSL.new
      else
        @dsl = DSL.new(options)
      end
    end
    def generate
      @dsl.run(@options)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
lono-0.2.1 lib/lono/task.rb
lono-0.2.0 lib/lono/task.rb
lono-0.1.9 lib/lono/task.rb
lono-0.1.8 lib/lono/task.rb
lono-0.1.7 lib/lono/task.rb
lono-0.1.6 lib/lono/task.rb
lono-0.1.5 lib/lono/task.rb
lono-0.1.4 lib/lono/task.rb
lono-0.1.3 lib/lono/task.rb
lono-0.1.2 lib/lono/task.rb