lib/docman/docroot_controller.rb in docman-0.0.4 vs lib/docman/docroot_controller.rb in docman-0.0.5
- old
+ new
@@ -1,27 +1,25 @@
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'
+require 'docman/deployers/common_deployer'
-# TODO: refactor info into class.
# TODO: make universal logging class.
module Docman
class DocrootController
- attr_reader :docroot_dir, :temp_dir
+ attr_reader :docroot_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)
+ @deployer = Docman::Deployers::Deployer.create(@deploy_target['handler'], @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}"
@@ -34,14 +32,14 @@
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])
+ def build_recursive(state, info = nil)
+ info = info ? info : @docroot_config.structure
+ build_dir(state, info)
- dir[:children].each do |child|
+ info['children'].each do |child|
build_recursive(state, child)
end
end
def deploy_dir_chain(state, info)
\ No newline at end of file