Class: Greenhouse::Commands::Init
- Inherits:
-
Object
- Object
- Greenhouse::Commands::Init
- Includes:
- Command
- Defined in:
- lib/greenhouse/commands/init.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Command
Class Method Details
.usage ⇒ Object
55 56 57 |
# File 'lib/greenhouse/commands/init.rb', line 55 def usage puts "usage: #{::Greenhouse::CLI.command_name} #{command_name} #{valid_arguments.to_s}" end |
Instance Method Details
#add_another? ⇒ Boolean
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/greenhouse/commands/init.rb', line 60 def add_another? another = nil while !['', 'n','no'].include?(another) do puts "The following projects will be initialized in your ecosystem:" Projects.projects.each do |project| puts " #{project.title.cyan}" end puts print "Would you like to add another project before initializing? ([y]es/[N]o): " another = STDIN.gets.chomp.downcase Tasks::AddProject.perform if ['y','yes'].include?(another) end end |
#run ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/greenhouse/commands/init.rb', line 74 def run while Projects.projects.empty? do puts "You must define at least one project for your ecosystem.\n" Tasks::AddProject.perform end # Prompt to add another project add_another? # Sync all projects Projects.projects.each do |project| Tasks::SyncProject.perform(project) end # Create a Procfile that uses `greenhouse launch` to launch the app's processes Tasks::GenerateProcfile.perform end |