Class: TinyRails::Commands::Add

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions, Actions
Defined in:
lib/tiny-rails/commands/add.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Actions

#addon, #application, #enable_asset_pipeline!, #gem, #initializer, #migration, #route

Class Method Details



9
10
11
# File 'lib/tiny-rails/commands/add.rb', line 9

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

.bundled_addons_pathObject



18
19
20
# File 'lib/tiny-rails/commands/add.rb', line 18

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

.source_rootObject

TODO: Move to a base command



14
15
16
# File 'lib/tiny-rails/commands/add.rb', line 14

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

Instance Method Details

#apply_addon_scriptsObject



29
30
31
# File 'lib/tiny-rails/commands/add.rb', line 29

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

#guard_inside_tiny_rails_appObject



22
23
24
25
26
27
# File 'lib/tiny-rails/commands/add.rb', line 22

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