Class: PostyClient::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/posty_client/cli.rb', line 12

def self.exit_on_failure?
  true
end

Instance Method Details

#create_configObject



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/posty_client/cli.rb', line 26

def create_config
  require 'fileutils'

  user_config_file = File.expand_path('~/.posty_client.yml')
  if File.exists?(user_config_file)
    say("File #{user_config_file} already exists! Nothing created.", :red)
    exit 1
  end

  FileUtils.cp(PostyClient.root + '/config/posty_client.yml.dist', user_config_file)
  say("File #{user_config_file} created. Please customize.", :green)
end

#summaryObject



40
41
42
# File 'lib/posty_client/cli.rb', line 40

def summary
  print_table(PostyClient::Resources::Summary.get)
end

#versionObject



21
22
23
# File 'lib/posty_client/cli.rb', line 21

def version
  puts "version %s" % [PostyClient::VERSION]
end