module RubyYacht::Plugins::Rails
This module provides the plugin for managing Ruby on Rails
apps.
Public Class Methods
load()
click to toggle source
This method loads the configuration for the Rails
plugin.
# File lib/ruby_yacht/plugins/rails.rb, line 5 def self.load load_server_type load_hooks load_environment_variables end
load_environment_variables()
click to toggle source
This method loads the hooks for setting environment variables for the Rails
apps.
# File lib/ruby_yacht/plugins/rails.rb, line 54 def self.load_environment_variables RubyYacht.configure do add_hooks app_server_type: :rails, container_type: :app do during :initialize_app_environment do set_environment_variable 'RAILS_ENV' do @project.rails_environment == 'development' ? nil : @project.rails_environment end set_environment_variable 'SECRET_KEY_BASE' do @project.rails_secret_key_base end set_environment_variable 'EXCLUDED_GEM_GROUPS' do groups = @project.rails_excluded_gem_groups.join(' ') groups = '""' if groups == '' groups end end end end end
load_hooks()
click to toggle source
This method loads the configuration for the Rails
hooks.
# File lib/ruby_yacht/plugins/rails.rb, line 25 def self.load_hooks RubyYacht.configure do add_hooks(app_server_type: :rails, container_type: :app, script_folder: File.join(File.dirname(__FILE__), 'rails', 'scripts')) do during(:install_libraries) { run_script :ruby, 'install_gems.rb' } after(:build_checkout) { command 'bundle install --clean' } if RubyYacht.configuration.find_server_type(:mysql) during :load_database_seeds do container_type :database database_server_type :mysql run_script :ruby, 'load_seeds.rb' end end during :build_new_app do run_script :ruby, 'build_new_app.rb' end before(:startup) { run_script :ruby, 'update_rails_config.rb' } before(:startup) { run_script :ruby, 'prepare_rails_for_launch.rb' } during(:startup) { command 'rails s -b 0.0.0.0 -p $APP_PORT' } end end end
load_server_type()
click to toggle source
This method loads the configuration for the Rails
server type.
# File lib/ruby_yacht/plugins/rails.rb, line 12 def self.load_server_type RubyYacht.configure do server_type :rails do container_type :app baseline_image 'ruby:2.3' project_attribute name: :environment, default: 'development' project_attribute name: :excluded_gem_groups, default: [] project_attribute name: :secret_key_base end end end