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
base_root, class_option, default_source_root, desc, exit_on_failure?, hide!, hook_for, inherited, namespace, remove_hook_for, source_root
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
37 38 39 40 41 42 43 |
# File 'lib/rails/generators/rails/devcontainer/devcontainer_generator.rb', line 37 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
45 46 47 48 49 50 51 52 |
# File 'lib/rails/generators/rails/devcontainer/devcontainer_generator.rb', line 45 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
54 55 56 57 58 59 |
# File 'lib/rails/generators/rails/devcontainer/devcontainer_generator.rb', line 54 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/#{[:database]}.yml", "config/database.yml") end |