Class: MobileWorkflowCli::AppBuilder
- Inherits:
-
Rails::AppBuilder
- Object
- Rails::AppBuilder
- MobileWorkflowCli::AppBuilder
- Defined in:
- lib/mobile_workflow_cli/app_builder.rb
Instance Method Summary collapse
- #ability_generator ⇒ Object
- #active_storage ⇒ Object
- #dokku(dokku_host) ⇒ Object
- #gemfile ⇒ Object
- #heroku ⇒ Object
- #mobile_workflow_generator(open_api_spec_path) ⇒ Object
- #procfiles ⇒ Object
- #readme ⇒ Object
- #rspec_generator ⇒ Object
- #s3_backend(region) ⇒ Object
Instance Method Details
#ability_generator ⇒ Object
20 21 22 |
# File 'lib/mobile_workflow_cli/app_builder.rb', line 20 def ability_generator copy_file 'ability.rb', 'app/models/ability.rb' end |
#active_storage ⇒ Object
24 25 26 27 28 |
# File 'lib/mobile_workflow_cli/app_builder.rb', line 24 def active_storage rails_command 'active_storage:install' copy_file 'storage.s3.yml', 'config/storage.yml' gsub_file 'config/environments/production.rb', 'config.active_storage.service = :local', 'config.active_storage.service = :amazon' end |
#dokku(dokku_host) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/mobile_workflow_cli/app_builder.rb', line 63 def dokku(dokku_host) @dokku_host = dokku_host dokku_backend.create dokku_backend.configure_activestorage if [:s3_storage] dokku_backend.deploy dokku_backend.sync_dotenv end |
#gemfile ⇒ Object
7 8 9 |
# File 'lib/mobile_workflow_cli/app_builder.rb', line 7 def gemfile template 'Gemfile.erb', 'Gemfile' end |
#heroku ⇒ Object
56 57 58 59 60 61 |
# File 'lib/mobile_workflow_cli/app_builder.rb', line 56 def heroku heroku_backend.create heroku_backend.configure_activestorage if [:s3_storage] heroku_backend.deploy heroku_backend.sync_dotenv end |
#mobile_workflow_generator(open_api_spec_path) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/mobile_workflow_cli/app_builder.rb', line 30 def mobile_workflow_generator(open_api_spec_path) copy_file open_api_spec_path, 'config/open_api_spec.json' gen_opts = "" gen_opts += "--doorkeeper_oauth" if [:doorkeeper_oauth] generate "mobile_workflow:install #{gen_opts}" # Copy user migrations if needed rails_command 'mobile_workflow:install:migrations' if [:doorkeeper_oauth] end |
#procfiles ⇒ Object
11 12 13 14 |
# File 'lib/mobile_workflow_cli/app_builder.rb', line 11 def procfiles copy_file 'Procfile', 'Procfile' copy_file 'Procfile.dev', 'Procfile.dev' end |
#readme ⇒ Object
3 4 5 |
# File 'lib/mobile_workflow_cli/app_builder.rb', line 3 def readme template 'README.md.erb', 'README.md' end |
#rspec_generator ⇒ Object
16 17 18 |
# File 'lib/mobile_workflow_cli/app_builder.rb', line 16 def rspec_generator generate 'rspec:install' end |
#s3_backend(region) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/mobile_workflow_cli/app_builder.rb', line 40 def s3_backend(region) @region = region aws_backend.create aws_backend.write_env if [:heroku] heroku_backend.sync_dotenv sleep 10 # Wait for the server to restart aws_backend.create_topic_subscription(heroku_backend.notifications_endpoint) elsif [:dokku] dokku_backend.sync_dotenv aws_backend.create_topic_subscription(dokku_backend.notifications_endpoint) end end |