Sha256: c2c28408e35279abcdc5fd156da242352d76173497db64b00990e520cacc4555

Contents?: true

Size: 981 Bytes

Versions: 1

Compression:

Stored size: 981 Bytes

Contents

require 'thor'
require 'thor/group'

module TinyRails
  class CLI < Thor::Group
    include Thor::Actions

    argument :app_path, :required => true

    def self.source_root
      "#{File.expand_path('../../../templates', __FILE__)}/"
    end

    def self.banner
      "tiny-rails #{self.arguments.map(&:usage).join(' ')} [options]"
    end

    def self.templates
      @templates ||= %w(
        application.coffee
        application.scss
        boot.rb
        config.ru
        Gemfile
        index.html.haml
        migrate
        models.rb
        server
        tiny_rails_controller.rb
        .gitignore
      )
    end

    def self.executables
      @executables ||= %w(
        migrate
        server
      )
    end

    def scaffold
      self.class.templates.each do |template|
        template(template, "#{app_path}/#{template}")
      end
      self.class.executables.each do |script|
        chmod "#{app_path}/#{script}", 0755
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tiny-rails-0.0.1 lib/tiny-rails/cli.rb