Class: Cumuli::ProjectManager::Manager
- Inherits:
-
Object
- Object
- Cumuli::ProjectManager::Manager
- Defined in:
- lib/cumuli/project_manager/manager.rb
Constant Summary collapse
- DEFAULT_PROJECT_PATH =
Dir.pwd
Instance Attribute Summary collapse
-
#config_path ⇒ Object
Returns the value of attribute config_path.
-
#procfile_path ⇒ Object
Returns the value of attribute procfile_path.
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(path = DEFAULT_PROJECT_PATH) ⇒ Manager
constructor
A new instance of Manager.
- #projects ⇒ Object
- #publish ⇒ Object
- #setup ⇒ Object
- #setup_projects ⇒ Object
- #submodules_init ⇒ Object
Constructor Details
#initialize(path = DEFAULT_PROJECT_PATH) ⇒ Manager
Returns a new instance of Manager.
8 9 10 11 12 |
# File 'lib/cumuli/project_manager/manager.rb', line 8 def initialize(path=DEFAULT_PROJECT_PATH) @path = path @config_path = "#{path}/config/projects.yml" @procfile_path = "#{path}/Procfile" end |
Instance Attribute Details
#config_path ⇒ Object
Returns the value of attribute config_path.
6 7 8 |
# File 'lib/cumuli/project_manager/manager.rb', line 6 def config_path @config_path end |
#procfile_path ⇒ Object
Returns the value of attribute procfile_path.
6 7 8 |
# File 'lib/cumuli/project_manager/manager.rb', line 6 def procfile_path @procfile_path end |
Instance Method Details
#config ⇒ Object
43 44 45 |
# File 'lib/cumuli/project_manager/manager.rb', line 43 def config @config ||= YAML.load( File.read(config_path) ) end |
#projects ⇒ Object
39 40 41 |
# File 'lib/cumuli/project_manager/manager.rb', line 39 def projects @projects ||= config.map{ |name, opts| Cumuli::ProjectManager::Project.new(name, opts) } end |
#publish ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/cumuli/project_manager/manager.rb', line 14 def publish File.open(procfile_path, 'w') do |f| projects.each do |project| f.write project.to_procfile end end end |
#setup ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/cumuli/project_manager/manager.rb', line 22 def setup publish submodules_init system('git submodule init') system('git submodule update') system("git submodule foreach git pull") setup_projects end |
#setup_projects ⇒ Object
35 36 37 |
# File 'lib/cumuli/project_manager/manager.rb', line 35 def setup_projects projects.each { |project| project.setup } end |
#submodules_init ⇒ Object
31 32 33 |
# File 'lib/cumuli/project_manager/manager.rb', line 31 def submodules_init projects.each { |project| project.submodule_init } end |