Class: MiniDeploy::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/mini_deploy/cli.rb

Instance Method Summary collapse

Instance Method Details

#installObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/mini_deploy/cli.rb', line 27

def install
  puts "Create sample config and receipt file. "

  sample_file = SampleFile.new

  [ './config/', './receipts/' ].each do |dir_path|
    if Dir.exist?(dir_path)
      puts "* #{dir_path} exists."
    else
      FileUtils.mkdir_p(dir_path)
      puts "* #{dir_path} created."
    end
  end

  sample_hosts_default_path = './config/sample_hosts.yml'

  IO.write(sample_hosts_default_path, sample_file.hosts)
  puts "* #{sample_hosts_default_path} create."

  sample_receipt_default_path = './receipts/sample.yml'

  IO.write(sample_receipt_default_path, sample_file.receipt)
  puts "* #{sample_receipt_default_path} create."
end

#start(path) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/mini_deploy/cli.rb', line 10

def start(path)
  Setting[:receipt_file_path] = File.expand_path(path)
  Setting[:host_file_path]    = File.expand_path(options[:host])

  if options[:host].nil?
    puts "Host File Not Found "
  else
    start_tasks_runner
  end
end

#versionObject



22
23
24
# File 'lib/mini_deploy/cli.rb', line 22

def version
  puts VERSION
end