Class: Consist::CLI
- Inherits:
-
Thor
- Object
- Thor
- Consist::CLI
- Extended by:
- ThorExt::Start
- Includes:
- SSHKit::DSL, Thor::Actions
- Defined in:
- lib/consist/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
- #init(gh_path = nil) ⇒ Object
- #ping(user, server) ⇒ Object
- #up(server_ip) ⇒ Object
- #version ⇒ Object
Methods included from ThorExt::Start
Class Method Details
.source_root ⇒ Object
27 28 29 |
# File 'lib/consist/cli.rb', line 27 def self.source_root File.dirname(__FILE__) end |
Instance Method Details
#init(gh_path = nil) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/consist/cli.rb', line 58 def init(gh_path = nil) if gh_path full_url = "https://github.com/#{gh_path}" Consist::Utils.clone_repo_contents(full_url, Dir.pwd) else puts "Creating new Consistfile..." directory "templates/consist", File.join(Dir.pwd, ".consist") template "templates/Consistfile.tt", File.join(Dir.pwd, "Consistfile") puts "...done" end end |
#ping(user, server) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/consist/cli.rb', line 37 def ping(user, server) puts "---> Attempting to connect to #{server} as #{user}" on("#{user}@#{server}") do as user do execute "true" end end end |
#up(server_ip) ⇒ Object
50 51 52 53 54 55 |
# File 'lib/consist/cli.rb', line 50 def up(server_ip) specified_step = [:step] consistfile = [:consistfile] consist_dir = [:consistdir] Consist::Consistfile.new(server_ip, consist_dir:, consistfile:, specified_step:) end |
#version ⇒ Object
32 33 34 |
# File 'lib/consist/cli.rb', line 32 def version say "consist/#{VERSION} #{RUBY_DESCRIPTION}" end |