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
145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/sem/cli/projects.rb', line 145 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
127 128 129 130 131 132 133 134 135 136 |
# File 'lib/sem/cli/projects.rb', line 127 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
164 165 166 167 168 169 170 171 |
# File 'lib/sem/cli/projects.rb', line 164 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 |