Class: Cs::Service::Cli
- Inherits:
-
Thor
- Object
- Thor
- Cs::Service::Cli
- Defined in:
- lib/cs/service/cli.rb
Overview
Cli
Constant Summary collapse
- ENVS =
rubocop:disable ClassLength
%w(REST_SERVER_ROOT TRADING_SERVER_ROOT RAILS_ROOT RACK_ENV).freeze
- PROJECTS =
%w( rest_server trading_server web).freeze
- CONFIG_FILES =
{ web: ENV['RAILS_ROOT'], trading_server: ENV['TRADING_SERVER_ROOT'], rest_server: ENV['REST_SERVER_ROOT'] }
Instance Method Summary collapse
- #env(env_name = nil) ⇒ Object
- #help(command = nil, subcommand = false) ⇒ Object
- #info(name = nil) ⇒ Object
- #load_conf ⇒ Object
- #log(project = nil) ⇒ Object
- #quit ⇒ Object
- #version ⇒ Object
Instance Method Details
#env(env_name = nil) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/cs/service/cli.rb', line 35 def env(env_name = nil) if env_name.nil? print_env elsif ENV[env_name] puts "#{env_name}=#{ENV[env_name]}" else say "#{env_name} is blank", :yellow end say "\nConfig Files:" fetch_config_files say "详见 cs-service help env" end |
#help(command = nil, subcommand = false) ⇒ Object
80 81 82 83 |
# File 'lib/cs/service/cli.rb', line 80 def help(command = nil, subcommand = false) say Motd.msg unless command super(command, subcommand) end |
#info(name = nil) ⇒ Object
49 50 51 52 |
# File 'lib/cs/service/cli.rb', line 49 def info(name = nil) # invoke(:env) run_eye(:info, name) end |
#load_conf ⇒ Object
21 22 23 24 25 |
# File 'lib/cs/service/cli.rb', line 21 def load_conf invoke(:env) quit if [:force] run_eye(:load, File.join(HOME_PATH, 'config/caishuo.eye')) end |
#log(project = nil) ⇒ Object
75 76 77 |
# File 'lib/cs/service/cli.rb', line 75 def log(project = nil) run_eye(:trace, project || PROJECTS) end |
#quit ⇒ Object
69 70 71 72 |
# File 'lib/cs/service/cli.rb', line 69 def quit stop run_eye(:quit) end |