Sha256: b1c330ed9e7256e4b78cffbb9f9a16a7422ba915b3a14383d6ae0fb0b41bdb9f

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

module Cumuli
  module ProjectManager
    class Manager
      DEFAULT_PROJECT_PATH = Dir.pwd

      attr_accessor :config_path, :procfile_path

      def initialize(path=DEFAULT_PROJECT_PATH)
        @path = path
        @config_path = "#{path}/config/projects.yml"
        @procfile_path = "#{path}/Procfile"
      end

      def publish
        File.open(procfile_path, 'w') do |f|
          projects.each do |project|
            f.write project.to_procfile
          end
        end
      end

      def setup
        submodules_init
        system('git submodule init')
        system('git submodule update')
        system("git submodule foreach git pull")
        setup_projects
      end

      def submodules_init
        projects.each { |project| project.submodule_init }
      end

      def setup_projects
        projects.each { |project| project.setup }
      end

      def projects
        @projects ||= config.map{ |name, opts| Cumuli::ProjectManager::Project.new(name, opts) }
      end

      def config
        @config ||= YAML.load( File.read(config_path) )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cumuli-0.4.0 lib/cumuli/project_manager/manager.rb