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
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/sem/cli/projects.rb', line 58 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
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/sem/cli/projects.rb', line 46 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
71 72 73 74 75 76 77 78 |
# File 'lib/sem/cli/projects.rb', line 71 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 |