Class: GoDeploy::Deploy

Inherits:
Object
  • Object
show all
Defined in:
lib/go_deploy/deploy.rb

Overview

App go-deploy

Constant Summary collapse

TMP_DIR =
'/tmp'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDeploy

Returns a new instance of Deploy.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/go_deploy/deploy.rb', line 15

def initialize
  super
  begin
    error_message = 'Please specify an order e.g.go-deploy production deploy or go-deploy production logs'
    @file_name = ARGV[0]
    @action = ARGV[1]
    puts error_message.red and exit if @file_name.nil? && @action.nil?

    yaml_file = File.join(Dir.pwd, "#{@file_name}.yaml")

    self.config = YAML.load_file(yaml_file)
    @console = Console.new(config)
    @service = config['service']
  rescue StandardError => e
    puts e.message.red
    exit
  end
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



13
14
15
# File 'lib/go_deploy/deploy.rb', line 13

def config
  @config
end

Instance Method Details

#runObject



34
35
36
37
38
39
40
41
# File 'lib/go_deploy/deploy.rb', line 34

def run
  case @action.upcase
  when 'DEPLOY'
    deploy_go
  when 'LOGS'
    logs
  end
end