Class: ForgeCLI::ModuleInstaller

Inherits:
Object
  • Object
show all
Defined in:
lib/forge-cli/module_installer.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(module_name, app, app_path) ⇒ ModuleInstaller

Returns a new instance of ModuleInstaller.



8
9
10
11
12
13
# File 'lib/forge-cli/module_installer.rb', line 8

def initialize(module_name, app, app_path)
  @module_name  = module_name.to_s
  @mod          = module_manifest
  @app          = app
  @app_path     = app_path
end

Class Method Details

.install_module!(module_name, app, app_path) ⇒ Object



3
4
5
6
# File 'lib/forge-cli/module_installer.rb', line 3

def self.install_module!(module_name, app, app_path)
  mi = new(module_name, app, app_path)
  mi.run!
end

Instance Method Details

#run!Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/forge-cli/module_installer.rb', line 15

def run!
  unless @module_name == "base"
    STDOUT.puts "\nInstalling #{@module_name.titleize}..."
  end
  install_dependencies! if @mod["dependencies"]
  copy_files!           if @mod["files"]
  delete_files!         if @mod["delete"]
  create_migrations!    if @mod["migrations"]

  post_hooks_class.run!(@app) if post_hooks_class
  unless @module_name == "base"
    STDOUT.puts "Done!"
  end
end