Class: Heroku::Command::Sharing

Inherits:
BaseWithApp show all
Defined in:
lib/heroku/commands/sharing.rb

Instance Attribute Summary

Attributes inherited from BaseWithApp

#app

Attributes inherited from Base

#args, #autodetected_app

Instance Method Summary collapse

Methods inherited from BaseWithApp

#initialize

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::BaseWithApp

Instance Method Details

#addObject

Raises:



9
10
11
12
13
# File 'lib/heroku/commands/sharing.rb', line 9

def add
	email = args.shift.downcase rescue ''
	raise(CommandFailed, "Specify an email address to share the app with.") if email == ''
	display heroku.add_collaborator(app, email)
end

#listObject Also known as: index



3
4
5
6
# File 'lib/heroku/commands/sharing.rb', line 3

def list
	list = heroku.list_collaborators(app)
	display list.map { |c| c[:email] }.join("\n")
end

#removeObject

Raises:



15
16
17
18
19
20
# File 'lib/heroku/commands/sharing.rb', line 15

def remove
	email = args.shift.downcase rescue ''
	raise(CommandFailed, "Specify an email address to remove from the app.") if email == ''
	heroku.remove_collaborator(app, email)
	display "Collaborator removed."
end

#transferObject

Raises:



22
23
24
25
26
27
# File 'lib/heroku/commands/sharing.rb', line 22

def transfer
	email = args.shift.downcase rescue ''
	raise(CommandFailed, "Specify the email address of the new owner") if email == ''
	heroku.update(app, :transfer_owner => email)
	display "App ownership transfered. New owner is #{email}"
end