Sha256: dbfb9f140e4ae1424a50d091618a0cbded510e3fb5e61d79cdf8bb06bfb06bdd
Contents?: true
Size: 1.89 KB
Versions: 1
Compression:
Stored size: 1.89 KB
Contents
require 'docman/builders/builder' require 'docman/builders/common_builder' require 'docman/builders/git_builder' require 'docman/deployers/deployer' require 'docman/deployers/git_deployer' require 'docman/deployers/local_deployer' # TODO: refactor info into class. # TODO: make universal logging class. module Docman class DocrootController attr_reader :docroot_dir, :temp_dir def initialize(docroot_dir, deploy_target_name, options = {}) @deploy_target = Docman::Application.instance.config['deploy_targets'][deploy_target_name] Docman::Application.instance.deploy_target = @deploy_target docroot_config = DocrootConfig.new(docroot_dir, @deploy_target) @deployer = Object.const_get("Docman::Deployers::#{@deploy_target['handler']}").new(@deploy_target) @docroot_dir = docroot_dir @temp_dir = File.join(docroot_dir, 'tmp') @docroot_config = docroot_config end def deploy(name, type, version) puts "Deploy #{name}, type: #{type}" @docroot_config.states_dependin_on(name, version).each do |state_name, state| deploy_dir_chain(state_name, @docroot_config.info_by(name)) @deployer.push(@docroot_config.root_dir, state_name) end end def build(state) build_recursive(state) @deployer.push(@docroot_config.root_dir, state) end def build_recursive(state, dir = nil) dir = dir ? dir : @docroot_config.structure build_dir(state, dir[:info]) dir[:children].each do |child| build_recursive(state, child) end end def deploy_dir_chain(state, info) @docroot_config.chain(info).each do |name, item| if item.need_rebuild? build_recursive(state, item) return elsif build_dir(state, item) end end end def build_dir(state, info) @deployer.build(@docroot_config.root(info), state, info) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
docman-0.0.3 | lib/docman/docroot_controller.rb |