Class: Awestruct::CLI::Deploy

Inherits:
Object
  • Object
show all
Defined in:
lib/awestruct/cli/deploy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site_config, deploy_config) ⇒ Deploy

Returns a new instance of Deploy



13
14
15
16
17
18
# File 'lib/awestruct/cli/deploy.rb', line 13

def initialize(site_config, deploy_config)
  @site_config   = site_config
  @deploy_config = deploy_config
  @deploy_config['type'] ||= (is_github? ? :github_pages : :rsync)
  $LOG.info "Deploying to #{deploy_type}" if $LOG.info?
end

Instance Attribute Details

#deploy_configObject

Returns the value of attribute deploy_config



11
12
13
# File 'lib/awestruct/cli/deploy.rb', line 11

def deploy_config
  @deploy_config
end

#site_configObject

Returns the value of attribute site_config



10
11
12
# File 'lib/awestruct/cli/deploy.rb', line 10

def site_config
  @site_config
end

Instance Method Details

#deploy_typeObject



20
21
22
# File 'lib/awestruct/cli/deploy.rb', line 20

def deploy_type
  deploy_config['type']
end

#runObject



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/awestruct/cli/deploy.rb', line 24

def run()
  deployer_class = Awestruct::Deployers.instance[ deploy_type.to_sym ]
  
  if ( deployer_class.nil? )
    $LOG.error "Unable to locate correct deployer for #{deploy_type}" if $LOG.error?
    $LOG.error "Deployers available for #{::Awestruct::Deployers.instance.collect {|k,v| "#{v} (#{k})"}.join(', ')}" if $LOG.error?
    return
  end
  
  deployer = deployer_class.new( site_config, deploy_config )
  deployer.run
end