Class: Azuki::Command::Sharing
- Defined in:
- lib/azuki/command/sharing.rb
Overview
manage collaborators on an app
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#add ⇒ Object
sharing:add EMAIL.
-
#index ⇒ Object
sharing.
-
#remove ⇒ Object
sharing:remove EMAIL.
-
#transfer ⇒ Object
sharing:transfer EMAIL.
Methods inherited from Base
#api, #app, #azuki, #initialize, namespace
Methods included from Helpers
#action, #ask, #confirm, #confirm_billing, #confirm_command, #create_git_remote, #deprecate, #display, #display_header, #display_object, #display_row, #display_table, #error, error_with_failure, error_with_failure=, extended, extended_into, #fail, #format_bytes, #format_date, #format_error, #format_with_bang, #get_terminal_environment, #git, #has_git?, #home_directory, #hprint, #hputs, included, included_into, #json_decode, #json_encode, #launchy, #line_formatter, #longest, #output_with_bang, #quantify, #redisplay, #retry_on_exception, #run_command, #running_on_a_mac?, #running_on_windows?, #set_buffer, #shell, #spinner, #status, #string_distance, #styled_array, #styled_error, #styled_hash, #styled_header, #suggestion, #time_ago, #truncate, #with_tty
Constructor Details
This class inherits a constructor from Azuki::Command::Base
Instance Method Details
#add ⇒ Object
sharing:add EMAIL
add a collaborator to an app
Example:
$ azuki sharing:add [email protected] Adding [email protected] to example collaborators… done
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/azuki/command/sharing.rb', line 38 def add unless email = shift_argument error("Usage: azuki sharing:add EMAIL\nMust specify EMAIL to add sharing.") end validate_arguments! action("Adding #{email} to #{app} collaborators") do api.post_collaborator(app, email) end end |
#index ⇒ Object
sharing
list collaborators on an app
Example:
$ azuki sharing
example Collaborators
20 21 22 23 24 25 26 27 |
# File 'lib/azuki/command/sharing.rb', line 20 def index validate_arguments! # this is never empty, as it always includes the owner collaborators = api.get_collaborators(app).body styled_header("#{app} Collaborators") styled_array(collaborators.map {|collaborator| collaborator["email"]}) end |
#remove ⇒ Object
sharing:remove EMAIL
remove a collaborator from an app
Example:
$ azuki sharing:remove [email protected] Removing [email protected] to example collaborators… done
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/azuki/command/sharing.rb', line 58 def remove unless email = shift_argument error("Usage: azuki sharing:remove EMAIL\nMust specify EMAIL to remove sharing.") end validate_arguments! action("Removing #{email} from #{app} collaborators") do api.delete_collaborator(app, email) end end |
#transfer ⇒ Object
sharing:transfer EMAIL
transfer an app to a new owner
Example:
$ azuki sharing:transfer [email protected] Transferring example to [email protected]… done
78 79 80 81 82 83 84 85 86 87 |
# File 'lib/azuki/command/sharing.rb', line 78 def transfer unless email = shift_argument error("Usage: azuki sharing:transfer EMAIL\nMust specify EMAIL to transfer an app.") end validate_arguments! action("Transferring #{app} to #{email}") do api.put_app(app, "transfer_owner" => email) end end |