Class: LaunchBase::CLI::Base

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/launch_base/cli/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.install_modules(project_path, options) ⇒ Object



57
58
59
60
61
62
63
# File 'lib/launch_base/cli/base.rb', line 57

def self.install_modules(project_path, options)
  Plugin.each_plugin do |_plugin_name, plugin|
    if options[plugin.command_line_flag]
      plugin.install(destination_root: project_path)
    end
  end
end

Instance Method Details

#helpObject



52
53
54
55
# File 'lib/launch_base/cli/base.rb', line 52

def help
  show_banner
  super
end

#new(project_path) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/launch_base/cli/base.rb', line 36

def new(project_path)
  installed_rails_version = Utilities.get_rails_version

  if installed_rails_version
    if Utilities.rails_up_to_date?(installed_rails_version)
      run "rails new #{project_path} -m #{Utilities.gem_home}/templates/launch_base_default_template.rb"
      Base.install_modules(project_path, options)
    else
      say "Your current installation of Rails is outdated (#{installed_rails_version}). "\
          "Please upgrade to Rails #{RAILS_VERSION}"
    end
  else
    say "No installation of Rails found. Please install Rails #{RAILS_VERSION}"
  end
end

#updateObject



22
23
24
# File 'lib/launch_base/cli/base.rb', line 22

def update
  run 'bundle update launch_base --conservative'
end