Class: SwitchTower::Generators::RailsLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/switchtower/generators/rails/loader.rb

Class Method Summary collapse

Class Method Details

.load!(options) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/switchtower/generators/rails/loader.rb', line 4

def self.load!(options)
  require "#{options[:apply_to]}/config/environment"
  require "rails_generator"
  require "rails_generator/scripts/generate"

  Rails::Generator::Base.sources << Rails::Generator::PathSource.new(
    :switchtower, File.dirname(__FILE__))

  args = ["deployment"]
  args << (options[:application] || "Application")
  args << (options[:recipe_file] || "deploy")

  Rails::Generator::Scripts::Generate.new.run(args)
end