Class: Deliver::Deliverer
- Inherits:
-
Object
- Object
- Deliver::Deliverer
- Defined in:
- lib/deliver/deliverer.rb
Overview
This class will collect the deploy data from different places This will trigger:
-
Parsing the Deliverfile
-
Temporary storing all the information got from the file, until the file finished executing
-
Triggering the upload process itself using the DeliverProcess class
Defined Under Namespace
Instance Attribute Summary collapse
-
#deliver_file ⇒ Deliver::Deliverfile::Deliverfile
A reference to the Deliverfile which is currently being used.
-
#deliver_process ⇒ Deliver::DeliverProcess
The class which handels the deployment process itself.
Class Method Summary collapse
-
.all_available_blocks_to_set ⇒ Hash
An array of all available blocks to be set for a deployment.
-
.all_available_keys_to_set ⇒ Hash
An array of all available options to be set a deployment_information.
Instance Method Summary collapse
-
#finished_executing_deliver_file ⇒ Object
This method will take care of the actual deployment process, after we received all information from the Deliverfile.
-
#initialize(path = nil, hash: nil, force: false, is_beta_ipa: false, skip_deploy: false) ⇒ Deliverer
constructor
Start a new deployment process based on the given Deliverfile used for build servers.
-
#set_new_block(key, block) ⇒ Object
Sets a new block for a specific key.
-
#set_new_value(key, value) ⇒ Object
This method is internally called from the Deliverfile DSL to set a value for a given key.
Constructor Details
#initialize(path = nil, hash: nil, force: false, is_beta_ipa: false, skip_deploy: false) ⇒ Deliverer
Start a new deployment process based on the given Deliverfile used for build servers. If this is set to false a PDF summary will be generated and opened
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/deliver/deliverer.rb', line 70 def initialize(path = nil, hash: nil, force: false, is_beta_ipa: false, skip_deploy: false) @deliver_process = DeliverProcess.new @deliver_process.deploy_information[ValKey::SKIP_PDF] = true if force @deliver_process.deploy_information[ValKey::IS_BETA_IPA] = is_beta_ipa @deliver_process.deploy_information[ValKey::SKIP_DEPLOY] = skip_deploy if hash hash.each do |key, value| # we still call this interface to verify the inputs correctly set_new_value(key, value) end finished_executing_deliver_file else @deliver_file = Deliver::Deliverfile::Deliverfile.new(self, path) end # Do not put code here... end |
Instance Attribute Details
#deliver_file ⇒ Deliver::Deliverfile::Deliverfile
Returns A reference to the Deliverfile which is currently being used.
11 12 13 |
# File 'lib/deliver/deliverer.rb', line 11 def deliver_file @deliver_file end |
#deliver_process ⇒ Deliver::DeliverProcess
Returns The class which handels the deployment process itself.
14 15 16 |
# File 'lib/deliver/deliverer.rb', line 14 def deliver_process @deliver_process end |
Class Method Details
.all_available_blocks_to_set ⇒ Hash
An array of all available blocks to be set for a deployment
Is used to verify user inputs
122 123 124 |
# File 'lib/deliver/deliverer.rb', line 122 def self.all_available_blocks_to_set Deliverer::AllBlocks.constants.collect { |a| Deliverer::AllBlocks.const_get(a) } end |
.all_available_keys_to_set ⇒ Hash
An array of all available options to be set a deployment_information.
Is used to verify user inputs
114 115 116 |
# File 'lib/deliver/deliverer.rb', line 114 def self.all_available_keys_to_set Deliverer::ValKey.constants.collect { |a| Deliverer::ValKey.const_get(a) } end |
Instance Method Details
#finished_executing_deliver_file ⇒ Object
This method will take care of the actual deployment process, after we received all information from the Deliverfile.
This method will be called from the Deliver::Deliverfile after it is finished executing the Ruby script.
131 132 133 |
# File 'lib/deliver/deliverer.rb', line 131 def finished_executing_deliver_file deliver_process.run end |
#set_new_block(key, block) ⇒ Object
Sets a new block for a specific key
106 107 108 |
# File 'lib/deliver/deliverer.rb', line 106 def set_new_block(key, block) @deliver_process.deploy_information[:blocks][key] = block end |
#set_new_value(key, value) ⇒ Object
This method is internally called from the Deliverfile DSL to set a value for a given key. This method will also verify if the key is valid.
93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/deliver/deliverer.rb', line 93 def set_new_value(key, value) unless self.class.all_available_keys_to_set.include?key raise "Invalid key '#{key}', must be contained in Deliverer::ValKey.".red end if @deliver_process.deploy_information[key] Helper.log.warn("You already set a value for key '#{key}'. Overwriting value '#{value}' with new value.") end @deliver_process.deploy_information[key] = value end |