Class: MKBrut::App
- Inherits:
-
Object
- Object
- MKBrut::App
- Defined in:
- lib/mkbrut/app.rb
Instance Method Summary collapse
- #create! ⇒ Object
-
#initialize(current_dir:, app_options:, out:, err:) ⇒ App
constructor
A new instance of App.
Constructor Details
#initialize(current_dir:, app_options:, out:, err:) ⇒ App
Returns a new instance of App.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/mkbrut/app.rb', line 7 def initialize(current_dir:, app_options:, out:, err:) @out = out @app_options = @out.puts "Creating app with these options:\n" @out.puts "App name: #{.app_name}" @out.puts "App ID: #{.app_id}" @out.puts "Prefix: #{.prefix}" @out.puts "Organization: #{.organization}" @out.puts "Include demo? #{.demo}\n" if .dry_run? @out.puts "Dry Run" MKBrut::Ops::BaseOp.dry_run = true end templates_dir = Pathname( Gem::Specification.find_by_name("mkbrut").gem_dir ) / "templates" @base = MKBrut::Base.new( app_options:, current_dir:, templates_dir: ) @segments = [ MKBrut::Segments::BareBones.new( app_options:, current_dir:, templates_dir:, ), ] if .demo? @segments << MKBrut::Segments::Demo.new( app_options:, current_dir:, templates_dir: ) end .segments.each do |segment| case segment when "heroku" @segments << MKBrut::Segments::Heroku.new( project_root: @base.project_root, templates_dir: ) when "sidekiq" @segments << MKBrut::Segments::Sidekiq.new( project_root: @base.project_root, templates_dir: ) else raise "Segment #{segment} is not supported" end end @segments.sort! end |
Instance Method Details
#create! ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/mkbrut/app.rb', line 65 def create! @out.puts "Creating Base app" @base.create! @segments.each do |segment| @out.puts "Creating segment: #{segment.class.friendly_name}" segment.add! end @out.puts "#{@app_options.app_name} was created\n\n" @out.puts "Time to get building:" @out.puts "1. cd #{@app_options.app_name}" @out.puts "2. dx/build" @out.puts "3. dx/start" @out.puts "4. [ in another terminal ] dx/exec bash" @out.puts "5. [ inside the Docker container ] bin/setup" @out.puts "6. [ inside the Docker container ] bin/dev" @out.puts "7. Visit http://localhost:6502 in your browser" @out.puts "8. [ inside the Docker container ] bin/setup help # to see more commands" end |