Class: Powify::Client

Inherits:
Object
  • Object
show all
Extended by:
Powify
Defined in:
lib/powify/client.rb

Constant Summary

Constants included from Powify

POWPATH, VERSION

Class Method Summary collapse

Methods included from Powify

config, current_path, extension

Class Method Details

.helpObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/powify/client.rb', line 24

def help
  $stdout.puts ""
  $stdout.puts "  [SERVER COMMANDS]"
  $stdout.puts "    powify server install            install pow server"
  $stdout.puts "    powify server reinstall          reinstall pow server"
  $stdout.puts "    powify server update             update pow server"
  $stdout.puts "    powify server uninstall          uninstall pow server"
  $stdout.puts "    powify server list               list all pow apps"
  $stdout.puts "    powify server start              start the pow server"
  $stdout.puts "    powify server stop               stop the pow server"
  $stdout.puts "    powify server restart            restart the pow server"
  $stdout.puts "    powify server host               adds all pow apps to /etc/hosts file"
  $stdout.puts "    powify server unhost             removes all pow apps from /etc/hosts file"
  $stdout.puts "    powify server status             print the current server status"
  $stdout.puts "    powify server config             print the current server configuration"
  $stdout.puts "    powify server logs               tails the pow server logs"
  $stdout.puts ""
  $stdout.puts "  [UTILS COMMANDS]"
  $stdout.puts "    powify utils install             install powify.dev server management tool"
  $stdout.puts "    powify utils reinstall           reinstall powify.dev server management tool"
  $stdout.puts "    powify utils uninstall           uninstall powify.dev server management tool"
  $stdout.puts ""
  $stdout.puts "  [APP COMMANDS]"
  $stdout.puts "    powify create [NAME]             creates a pow app from the current directory"
  $stdout.puts "    powify destroy [NAME]            destroys the pow app linked to the current directory"
  $stdout.puts "    powify restart [NAME]            restarts the pow app linked to the current directory"
  $stdout.puts "    powify always_restart [NAME]     reload the pow app after each request"
  $stdout.puts "    powify always_restart_off [NAME] do not reload the pow app after each request"
  $stdout.puts "    powify rename [NAME]             rename the pow app to [NAME]"
  $stdout.puts "    powify rename [OLD] [NEW]        rename the pow app [OLD] to [NEW]"
  $stdout.puts "    powify environment [ENV]         run the this pow app in a different environment (aliased `env`)"
  $stdout.puts "    powify browse [NAME]             opens and navigates the default browser to this app"
  $stdout.puts "    powify logs [NAME]               tail the application logs"
  $stdout.puts ""
end

.run(args = []) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/powify/client.rb', line 5

def run(args = [])
  return help if args.empty?
  begin
    if (%w(version help) & args).empty?
      return Powify::Server.run(args[1..-1]) if args[0].strip == 'server'
      return Powify::Utils.run(args[1..-1]) if args[0].strip == 'utils'
      return Powify::App.run(args)
    end
  rescue Exception => e
    $stdout.puts e
  end

  self.send (%w(version help) & args).first.to_sym
end

.versionObject



20
21
22
# File 'lib/powify/client.rb', line 20

def version
  $stdout.puts Powify::VERSION
end