Class: Kikubari::Deploy::Configuration
- Inherits:
-
Object
- Object
- Kikubari::Deploy::Configuration
- Defined in:
- lib/configuration/deploy_configuration.rb
Instance Attribute Summary collapse
-
#after ⇒ Object
Returns the value of attribute after.
-
#before ⇒ Object
Returns the value of attribute before.
-
#config ⇒ Object
Returns the value of attribute config.
-
#current_deploy_folder ⇒ Object
Returns the value of attribute current_deploy_folder.
-
#date_folder ⇒ Object
Returns the value of attribute date_folder.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#deploy_file ⇒ Object
Returns the value of attribute deploy_file.
-
#deploy_folder ⇒ Object
Returns the value of attribute deploy_folder.
-
#do ⇒ Object
Returns the value of attribute do.
-
#dry_run ⇒ Object
Returns the value of attribute dry_run.
-
#env_time_folder ⇒ Object
Returns the value of attribute env_time_folder.
-
#environment_folder ⇒ Object
Returns the value of attribute environment_folder.
-
#rollback ⇒ Object
Returns the value of attribute rollback.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
-
#get_deployer_class ⇒ Object
Return a class name for create a deployer instance for deployment process.
-
#initialize(file, *params) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(file, *params) ⇒ Configuration
Returns a new instance of Configuration.
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
#after ⇒ Object
Returns the value of attribute after.
10 11 12 |
# File 'lib/configuration/deploy_configuration.rb', line 10 def after @after end |
#before ⇒ Object
Returns the value of attribute before.
10 11 12 |
# File 'lib/configuration/deploy_configuration.rb', line 10 def before @before end |
#config ⇒ Object
Returns the value of attribute config.
10 11 12 |
# File 'lib/configuration/deploy_configuration.rb', line 10 def config @config end |
#current_deploy_folder ⇒ Object
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_folder ⇒ Object
Returns the value of attribute date_folder.
10 11 12 |
# File 'lib/configuration/deploy_configuration.rb', line 10 def date_folder @date_folder end |
#debug ⇒ Object
Returns the value of attribute debug.
10 11 12 |
# File 'lib/configuration/deploy_configuration.rb', line 10 def debug @debug end |
#deploy_file ⇒ Object
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_folder ⇒ Object
Returns the value of attribute deploy_folder.
10 11 12 |
# File 'lib/configuration/deploy_configuration.rb', line 10 def deploy_folder @deploy_folder end |
#do ⇒ Object
Returns the value of attribute do.
10 11 12 |
# File 'lib/configuration/deploy_configuration.rb', line 10 def do @do end |
#dry_run ⇒ Object
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_folder ⇒ Object
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_folder ⇒ Object
Returns the value of attribute environment_folder.
10 11 12 |
# File 'lib/configuration/deploy_configuration.rb', line 10 def environment_folder @environment_folder end |
#rollback ⇒ Object
Returns the value of attribute rollback.
10 11 12 |
# File 'lib/configuration/deploy_configuration.rb', line 10 def rollback @rollback end |
#verbose ⇒ Object
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_class ⇒ Object
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 |