Class: KY::DeployGeneration
- Inherits:
-
Object
- Object
- KY::DeployGeneration
- Defined in:
- lib/ky/deploy_generation.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#deployment_yaml ⇒ Object
readonly
Returns the value of attribute deployment_yaml.
-
#full_output_dir ⇒ Object
readonly
Returns the value of attribute full_output_dir.
-
#proc_commands ⇒ Object
readonly
Returns the value of attribute proc_commands.
-
#project_name ⇒ Object
readonly
Returns the value of attribute project_name.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(full_output_dir, project_name, configuration = Configuration.new) ⇒ DeployGeneration
constructor
A new instance of DeployGeneration.
- #to_h ⇒ Object
Constructor Details
#initialize(full_output_dir, project_name, configuration = Configuration.new) ⇒ DeployGeneration
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/ky/deploy_generation.rb', line 3 def initialize(full_output_dir, project_name, configuration=Configuration.new) @configuration = configuration @proc_commands = File.read(configuration[:procfile_path]).split("\n") .map {|line| line.split(':', 2) } .map {|k, v| [k, ["/bin/bash","-c", v]] } .to_h @full_output_dir = full_output_dir @project_name = project_name || configuration[:project_name] @deployment_yaml = read_deployment_yaml end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
26 27 28 |
# File 'lib/ky/deploy_generation.rb', line 26 def configuration @configuration end |
#deployment_yaml ⇒ Object (readonly)
Returns the value of attribute deployment_yaml.
26 27 28 |
# File 'lib/ky/deploy_generation.rb', line 26 def deployment_yaml @deployment_yaml end |
#full_output_dir ⇒ Object (readonly)
Returns the value of attribute full_output_dir.
26 27 28 |
# File 'lib/ky/deploy_generation.rb', line 26 def full_output_dir @full_output_dir end |
#proc_commands ⇒ Object (readonly)
Returns the value of attribute proc_commands.
26 27 28 |
# File 'lib/ky/deploy_generation.rb', line 26 def proc_commands @proc_commands end |
#project_name ⇒ Object (readonly)
Returns the value of attribute project_name.
26 27 28 |
# File 'lib/ky/deploy_generation.rb', line 26 def project_name @project_name end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 |
# File 'lib/ky/deploy_generation.rb', line 14 def call to_h.each do |file_path, deploy_hash| File.write(file_path, deploy_hash.to_plain_yaml) end end |
#to_h ⇒ Object
20 21 22 23 24 |
# File 'lib/ky/deploy_generation.rb', line 20 def to_h proc_commands.map do |id, command_array| ["#{full_output_dir}/#{id}.deployment.yml", template_hash(id, command_array)] end.to_h end |