Class: Sem::CLI::Projects::SharedConfigs
- Inherits:
-
Dracula
- Object
- Dracula
- Sem::CLI::Projects::SharedConfigs
- Defined in:
- lib/sem/cli/projects.rb
Instance Method Summary collapse
- #add(project_name, shared_config_name) ⇒ Object
- #list(project_name) ⇒ Object
- #remove(project_name, shared_config_name) ⇒ Object
Instance Method Details
#add(project_name, shared_config_name) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/sem/cli/projects.rb', line 76 def add(project_name, shared_config_name) project = Sem::API::Project.find!(project_name) shared_config = Sem::API::SharedConfig.find!(shared_config_name) project.add_shared_config(shared_config) shared_config.env_vars.each { |var| project.add_env_var(var) } shared_config.files.each { |file| project.add_config_file(file) } puts "Shared Configuration #{shared_config_name} added to the project." end |
#list(project_name) ⇒ Object
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/sem/cli/projects.rb', line 64 def list(project_name) project = Sem::API::Project.find!(project_name) shared_configs = project.shared_configs if !shared_configs.empty? Sem::Views::SharedConfigs.list(shared_configs) else Sem::Views::Projects.attach_first_shared_config(project) end end |
#remove(project_name, shared_config_name) ⇒ Object
89 90 91 92 93 94 95 96 |
# File 'lib/sem/cli/projects.rb', line 89 def remove(project_name, shared_config_name) project = Sem::API::Project.find!(project_name) shared_config = Sem::API::SharedConfig.find!(shared_config_name) project.remove_shared_config(shared_config) puts "Shared Configuration #{shared_config_name} removed from the project." end |