Class: Rails::Generators::DevcontainerGenerator
- Defined in:
- lib/rails/generators/rails/devcontainer/devcontainer_generator.rb
Overview
:nodoc:
Instance Method Summary collapse
- #create_devcontainer ⇒ Object
- #update_application_system_test_case ⇒ Object
- #update_database_yml ⇒ Object
Methods inherited from Base
add_shebang_option!, banner, base_name, base_root, class_option, default_aliases_for_option, default_for_option, default_generator_root, default_source_root, default_value_for_option, desc, exit_on_failure?, generator_name, hide!, hook_for, hooks, inherited, namespace, prepare_for_invocation, remove_hook_for, source_root, usage_path
Methods included from Actions
#add_source, #environment, #gem, #gem_group, #generate, #git, #github, #initialize, #initializer, #lib, #rails_command, #rake, #rakefile, #readme, #route, #vendor
Instance Method Details
#create_devcontainer ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/rails/generators/rails/devcontainer/devcontainer_generator.rb', line 40 def create_devcontainer empty_directory ".devcontainer" template "devcontainer/devcontainer.json", ".devcontainer/devcontainer.json" template "devcontainer/Dockerfile", ".devcontainer/Dockerfile" template "devcontainer/compose.yaml", ".devcontainer/compose.yaml" end |
#update_application_system_test_case ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/rails/generators/rails/devcontainer/devcontainer_generator.rb', line 48 def update_application_system_test_case return unless [:system_test] system_test_case_path = File. "test/application_system_test_case.rb", destination_root return unless File.exist? system_test_case_path gsub_file(system_test_case_path, /^\s*driven_by\b.*/, system_test_configuration) end |
#update_database_yml ⇒ Object
57 58 59 60 61 62 |
# File 'lib/rails/generators/rails/devcontainer/devcontainer_generator.rb', line 57 def update_database_yml # Only postgresql has devcontainer specific configuration, so only update database.yml if we are using postgres return unless [:database] == "postgresql" template("config/databases/#{options[:database]}.yml", "config/database.yml") end |