Class: MiniDeploy::TasksRunner
- Inherits:
-
Object
- Object
- MiniDeploy::TasksRunner
- Defined in:
- lib/mini_deploy.rb
Instance Method Summary collapse
-
#initialize ⇒ TasksRunner
constructor
A new instance of TasksRunner.
- #start ⇒ Object
Constructor Details
#initialize ⇒ TasksRunner
Returns a new instance of TasksRunner.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/mini_deploy.rb', line 14 def initialize console_tag "Load Important File" console.info "Load host and receipt file." @receipt_data = ReceiptReader.new(Setting[:receipt_file_path]).fetch @chose_hosts = @receipt_data[:deploy_nodes] @hosts_data = HostsDataReader.new(Setting[:host_file_path]).fetch @hosts_data.select! do |item| @chose_hosts.include?(item[:node_id]) end raise HostsDataNoMatchFound if @hosts_data.length < 1 console.done 'Loaded.' rescue HostsDataNoMatchFound show_important_error "Hosts Data No Match Found" rescue HostsDataReaderLoadError show_important_error "Can't load hosts file." rescue ReceiptReaderLoadError show_important_error "Can't load receipt hosts file." rescue ReceiptReaderParseError show_important_error "Can't parse receipt hosts file." end |
Instance Method Details
#start ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/mini_deploy.rb', line 47 def start console_tag 'Start Receipt Script' console.done "Load Receipt: #{@receipt_data[:receipt_title]} ( by #{@receipt_data[:receipt_author]}, #{@receipt_data[:receipt_create_at]} )" show_chose_hosts console_tag "Confirm execute." show_important_error "User stop task." unless confirmed_start @hosts_data.each do |host_data| process_host_task host_data end console_tag "All Done" console.done "Receipt processed: " + Time.now.to_s rescue StandardError => e show_important_error e. end |