Class: Kikubari::Deploy::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/configuration/deploy_configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, *params) ⇒ Configuration

Returns a new instance of Configuration.

Raises:

  • (ArgumentError)


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/configuration/deploy_configuration.rb', line 25

def initialize( file , *params )

  unless File.exist?(file)
    raise "Deploy guide file doesn't exists: #{file}"
  end

  @deploy_file = parse_config_file(file)

  @config = @deploy_file.config || {}
  @do = @deploy_file.do || {}
  @after = @deploy_file.after
  @before = @deploy_file.before

  raise ArgumentError, "There is no params for deploy" if params.size == 0

  ## verify all arguments for params are present
  @verbose = false

  params.first.each do |key,value|
    instance_variable_set "@#{key}".strip, value
  end

  unless File.directory? @deploy_folder
    raise ArgumentError , "Deploy folder #{@deploy_folder} is not a valid deploy folder"
  end

  @environment_folder = @deploy_folder.join "releases"
  @date_folder = DateTime.now.strftime("%Y%m%d%H%M%S%L")
  @env_time_folder = @environment_folder.join @date_folder
  @current_deploy_folder = @environment_folder.join "current"
end

Instance Attribute Details

#afterObject

Returns the value of attribute after.



10
11
12
# File 'lib/configuration/deploy_configuration.rb', line 10

def after
  @after
end

#beforeObject

Returns the value of attribute before.



10
11
12
# File 'lib/configuration/deploy_configuration.rb', line 10

def before
  @before
end

#configObject

Returns the value of attribute config.



10
11
12
# File 'lib/configuration/deploy_configuration.rb', line 10

def config
  @config
end

#current_deploy_folderObject

Returns the value of attribute current_deploy_folder.



10
11
12
# File 'lib/configuration/deploy_configuration.rb', line 10

def current_deploy_folder
  @current_deploy_folder
end

#date_folderObject

Returns the value of attribute date_folder.



10
11
12
# File 'lib/configuration/deploy_configuration.rb', line 10

def date_folder
  @date_folder
end

#debugObject

Returns the value of attribute debug.



10
11
12
# File 'lib/configuration/deploy_configuration.rb', line 10

def debug
  @debug
end

#deploy_fileObject

Returns the value of attribute deploy_file.



10
11
12
# File 'lib/configuration/deploy_configuration.rb', line 10

def deploy_file
  @deploy_file
end

#deploy_folderObject

Returns the value of attribute deploy_folder.



10
11
12
# File 'lib/configuration/deploy_configuration.rb', line 10

def deploy_folder
  @deploy_folder
end

#doObject

Returns the value of attribute do.



10
11
12
# File 'lib/configuration/deploy_configuration.rb', line 10

def do
  @do
end

#dry_runObject

Returns the value of attribute dry_run.



10
11
12
# File 'lib/configuration/deploy_configuration.rb', line 10

def dry_run
  @dry_run
end

#env_time_folderObject

Returns the value of attribute env_time_folder.



10
11
12
# File 'lib/configuration/deploy_configuration.rb', line 10

def env_time_folder
  @env_time_folder
end

#environment_folderObject

Returns the value of attribute environment_folder.



10
11
12
# File 'lib/configuration/deploy_configuration.rb', line 10

def environment_folder
  @environment_folder
end

#rollbackObject

Returns the value of attribute rollback.



10
11
12
# File 'lib/configuration/deploy_configuration.rb', line 10

def rollback
  @rollback
end

#verboseObject

Returns the value of attribute verbose.



10
11
12
# File 'lib/configuration/deploy_configuration.rb', line 10

def verbose
  @verbose
end

Instance Method Details

#get_deployer_classObject

Return a class name for create a deployer instance for deployment process



58
59
60
61
62
# File 'lib/configuration/deploy_configuration.rb', line 58

def get_deployer_class
  fw_class = ( @config.framework ) ? @config.framework.downcase.capitalize : ""
  fw_system = ( @config.system ) ? @config.system.downcase.capitalize : ""
  "#{fw_class}#{fw_system}Deployer"
end