Sha256: 71459da8edba0734edc726824686e4477fb13ed6152276056396bd61f3e1b852

Contents?: true

Size: 895 Bytes

Versions: 3

Compression:

Stored size: 895 Bytes

Contents

module TinyRails
  module Commands
    class Add < Thor::Group
      include Thor::Actions
      include Actions

      argument :addons, :required => true, :type => :array

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

      # TODO: Move to a base command
      def self.source_root
        "#{File.expand_path('../../../../templates', __FILE__)}/"
      end

      def self.bundled_addons_path
        @bundled_addons_path ||= "#{File.expand_path('../../../../addons', __FILE__)}"
      end

      def guard_inside_tiny_rails_app
        unless File.exists?('boot.rb')
          puts "Can't add addons to a non-TinyRails application, please change to a TinyRails application directory first.\n"
          exit(1)
        end
      end

      def apply_addon_scripts
        addons.each{ |script| addon(script) }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tiny-rails-0.1.1 lib/tiny-rails/commands/add.rb
tiny-rails-0.1.0 lib/tiny-rails/commands/add.rb
tiny-rails-0.0.2 lib/tiny-rails/commands/add.rb