Class: Heroku::Command::Help

Inherits:
Base
  • Object
show all
Defined in:
lib/heroku/commands/help.rb

Defined Under Namespace

Classes: HelpGroup

Instance Attribute Summary

Attributes inherited from Base

#args, #autodetected_app

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#app_urls, #ask, #display, #error, #escape, #extract_app, #extract_app_in_dir, #extract_option, #format_date, #git_remotes, #git_url, #heroku, #initialize, #shell, #web_url

Methods included from Helpers

#home_directory, #running_on_a_mac?, #running_on_windows?

Constructor Details

This class inherits a constructor from Heroku::Command::Base

Class Method Details

.create_default_groups!Object



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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/heroku/commands/help.rb', line 31

def self.create_default_groups!
	group('General Commands') do
		command 'help',                         'show this usage'
		command 'version',                      'show the gem version'
		space
		command 'list',                         'list your apps'
		command 'create [<name>]',              'create a new app'
		space
		command 'keys',                         'show your user\'s public keys'
		command 'keys:add [<path to keyfile>]', 'add a public key'
		command 'keys:remove <keyname> ',       'remove a key by name (user@host)'
		command 'keys:clear',                   'remove all keys'
		space
		command 'info',                         'show app info, like web url and git repo'
		command 'open',                         'open the app in a web browser'
		command 'rename <newname>',             'rename the app'
		space
		command 'dynos <qty>',                  'scale to qty web processes'
		command 'workers <qty>',                'scale to qty background processes'
		space
		command 'sharing:add <email>',          'add a collaborator'
		command 'sharing:remove <email>',       'remove a collaborator'
		command 'sharing:transfer <email>',     'transfers the app ownership'
		space
		command 'domains:add <domain>',         'add a custom domain name'
		command 'domains:remove <domain>',      'remove a custom domain name'
		command 'domains:clear',                'remove all custom domains'
		space
		command 'ssl:add <pem> <key>',          'add SSL cert to the app'
		command 'ssl:remove <domain>',          'removes SSL cert from the app domain'
		space
		command 'rake <command>',               'remotely execute a rake command'
		command 'console <command>',            'remotely execute a single console command'
		command 'console',                      'start an interactive console to the remote app'
		space
		command 'restart',                      'restart app servers'
		command 'logs',                         'fetch recent log output for debugging'
		command 'logs:cron',                    'fetch cron log output'
		space
		command 'maintenance:on',               'put the app into maintenance mode'
		command 'maintenance:off',              'take the app out of maintenance mode'
		space
		command 'config',                       'display the app\'s config vars (environment)'
		command 'config:add key=val [...]',     'add one or more config vars'
		command 'config:remove key [...]',      'remove one or more config vars'
		command 'config:clear',                 'clear user-set vars and reset to default'
		space
		command 'db:pull [<database_url>]',     'pull the app\'s database into a local database'
		command 'db:push [<database_url>]',     'push a local database into the app\'s remote database'
		command 'db:reset',                     'reset the database for the app'
		space
		command 'bundles',                      'list bundles for the app'
		command 'bundles:capture [<bundle>]',   'capture a bundle of the app\'s code and data'
		command 'bundles:download',             'download most recent app bundle as a tarball'
		command 'bundles:download <bundle>',    'download the named bundle'
		command 'bundles:animate <bundle>',     'animate a bundle into a new app'
		command 'bundles:destroy <bundle>',     'destroy the named bundle'
		space
		command 'addons',                       'list installed addons'
		command 'addons:info',                  'list all available addons'
		command 'addons:add name [key=value]',  'install addon (with zero or more config vars)'
		command 'addons:remove name',           'uninstall an addons'
		command 'addons:clear',                 'uninstall all addons'
		space
		command 'destroy',                      'destroy the app permanently'
	end

	group('Plugins') do
		command 'plugins',                      'list installed plugins'
		command 'plugins:install <url>',        'install the plugin from the specified git url'
		command 'plugins:uninstall <url/name>', 'remove the specified plugin'
	end
end

.group(title, &block) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/heroku/commands/help.rb', line 23

def self.group(title, &block)
	groups << begin
		group = HelpGroup.new(title)
		group.instance_eval(&block)
		group
	end
end

.groupsObject



19
20
21
# File 'lib/heroku/commands/help.rb', line 19

def self.groups
	@groups ||= []
end

Instance Method Details

#indexObject



105
106
107
# File 'lib/heroku/commands/help.rb', line 105

def index
	display usage
end

#usageObject



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/heroku/commands/help.rb', line 113

def usage
	longest_command_length = self.class.groups.map do |group|
		group.map { |g| g.first.length }
	end.flatten.max

	self.class.groups.inject(StringIO.new) do |output, group|
		output.puts "=== %s" % group.title
		output.puts

		group.each do |command, description|
			if command.empty?
				output.puts
			else
				output.puts "%-*s # %s" % [longest_command_length, command, description]
			end
		end

		output.puts
		output
	end.string + <<-EOTXT
=== Example:

 rails myapp
 cd myapp
 git init
 git add .
 git commit -m "my new app"
 heroku create
 git push heroku master

EOTXT
end

#versionObject



109
110
111
# File 'lib/heroku/commands/help.rb', line 109

def version
	display Heroku::Client.version
end