Class: Adminix::Entrypoint
- Inherits:
-
Object
- Object
- Adminix::Entrypoint
- Defined in:
- lib/adminix/entrypoint.rb
Class Method Summary collapse
- .action_env ⇒ Object
- .action_help ⇒ Object
- .action_setup ⇒ Object
- .action_version ⇒ Object
- .action_watcher ⇒ Object
- .execute_action(args) ⇒ Object
Class Method Details
.action_env ⇒ Object
52 53 54 |
# File 'lib/adminix/entrypoint.rb', line 52 def self.action_env Service.instance. end |
.action_help ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/adminix/entrypoint.rb', line 14 def self.action_help puts "Usage: adminix COMMAND\n\n" + "Create and manage Adminix services\n\n" + "Version: #{VERSION}\n\n" + "Author:\n" + " Christian Dyl\n\n" + "Commands:\n" + " env Display the commands to define ENV variables\n" + " watcher Launch Adminix watcher\n" + " setup Generage adminix.json\n" + " version Show the Adminix version" end |
.action_setup ⇒ Object
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/adminix/entrypoint.rb', line 27 def self.action_setup if Config.instance.file_exists? puts "File \"#{ENV['HOME']}/.adminix.json\" already exists, overwrite config (yes/no):" return unless ['yes', 'y'].include?($stdin.gets.chomp) end puts "Enter secret key:" secret_key = $stdin.gets.chomp puts "Enter service id (empty to create a new service)" service_id = $stdin.gets.chomp service_name = '' if service_id == '' puts "Enter service name" service_name = $stdin.gets.chomp end Config.setup( secret_key: secret_key, service_id: service_id, service_name: service_name ) end |
.action_version ⇒ Object
64 65 66 |
# File 'lib/adminix/entrypoint.rb', line 64 def self.action_version puts "The current version is #{VERSION}" end |
.action_watcher ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/adminix/entrypoint.rb', line 56 def self.action_watcher Service.instance.sync #watcher = Watcher.new #watcher.start #watcher end |
.execute_action(args) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/adminix/entrypoint.rb', line 3 def self.execute_action(args) action = args[0] case action when 'help' then action_help when 'setup' then action_setup when 'env' then action_env when 'watcher' then action_watcher when 'version' then action_version end end |