Sha256: 6e980245873b866299f5d5261879c33fac6d9a23f9809f5e8430e81895bc89e4

Contents?: true

Size: 1.17 KB

Versions: 7

Compression:

Stored size: 1.17 KB

Contents

module Lono
  class Task
    def self.init(options={})
      project_root = options[:project_root] || '.'
      puts "Setting up lono project" unless options[:quiet]
      source_root = File.expand_path("../../starter_project", __FILE__)
      paths = Dir.glob("#{source_root}/**/*").
                select {|p| File.file?(p) }
      paths.each do |src|
        dest = src.gsub(%r{.*starter_project/},'')
        dest = "#{project_root}/#{dest}"

        if File.exist?(dest) and !options[:force]
          puts "already exists: #{dest}" unless options[:quiet]
        else
          puts "creating: #{dest}" unless options[:quiet]
          dirname = File.dirname(dest)
          FileUtils.mkdir_p(dirname) unless File.exist?(dirname)
          FileUtils.cp(src, dest)
        end
      end
      puts "Starter lono project created"
    end
    def self.generate(options)
      new(options).generate
    end

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

    def self.bashify(path)
      @bashify = Lono::Bashify.new(:path => path)
      @bashify.run
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lono-0.4.1 lib/lono/task.rb
lono-0.4.0 lib/lono/task.rb
lono-0.3.4 lib/lono/task.rb
lono-0.3.3 lib/lono/task.rb
lono-0.3.2 lib/lono/task.rb
lono-0.3.1 lib/lono/task.rb
lono-0.3.0 lib/lono/task.rb