Class: Tinet::CLI

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

Instance Method Summary collapse

Instance Method Details

#buildObject



73
74
75
76
# File 'lib/tinet/cli.rb', line 73

def build
  return version if options[:version]
  Tinet::Command::Build.new(options).run
end

#confObject



82
83
84
85
# File 'lib/tinet/cli.rb', line 82

def conf
  return version if options[:version]
  Tinet::Command::Conf.new(options).run
end

#downObject



46
47
48
49
# File 'lib/tinet/cli.rb', line 46

def down
  return version if options[:version]
  Tinet::Command::Down.new(options).run
end

#exec(node, command) ⇒ Object



64
65
66
67
# File 'lib/tinet/cli.rb', line 64

def exec(node, command)
  return version if options[:version]
  Tinet::Command::Exec.new(options).run(node, command)
end

#help(command = nil, subcommand = false) ⇒ Object

Note:

Override Thor#help



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/tinet/cli.rb', line 103

def help(command = nil, subcommand = false)
  if command.nil?
    puts <<-USAGE
Usage:
  tinet [OPTIONS] COMMAND

Options:
  -f, [--specfile=SPECFILE]  # Specify specification YAML file (Default: ./spec.yml)
  -d, [--dry-run]            # Print the recipes that are needed to execute
  -v, [--version]            # Show the TINET version information

USAGE
  end
  super
end

#initObject



18
19
20
21
# File 'lib/tinet/cli.rb', line 18

def init
  return version if options[:version]
  Tinet::Command::Init.new.run
end

#psObject



27
28
29
30
# File 'lib/tinet/cli.rb', line 27

def ps
  return version if options[:version]
  Tinet::Command::Ps.new(options).run
end

#pullObject



55
56
57
58
# File 'lib/tinet/cli.rb', line 55

def pull
  return version if options[:version]
  Tinet::Command::Pull.new(options).run
end

#restartObject



91
92
93
94
95
# File 'lib/tinet/cli.rb', line 91

def restart
  return version if options[:version]
  Tinet::Command::Down.new(options).run
  Tinet::Command::Up.new(options).run
end

#upObject



36
37
38
39
40
# File 'lib/tinet/cli.rb', line 36

def up
  return version if options[:version]
  Tinet::Command::Up.new(options).run
  Tinet::Command::Conf.new(options).run
end

#versionObject



98
99
100
# File 'lib/tinet/cli.rb', line 98

def version
  puts "TINET version: #{Tinet::VERSION}"
end