This repository has been archived by the owner on Apr 9, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
83 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module Relish | ||
module Command | ||
class Collab < Base | ||
|
||
desc 'list the collaborators for a project' | ||
command :default do | ||
puts format(resource[resource_path].get(:accept => :json)) | ||
end | ||
|
||
usage 'collab:add <org_or_user_handle>/<project_handle>:' + | ||
'<collaborator_handle_or_email>' | ||
desc ['add a collaborator to a project', | ||
'example: relish collab:add rspec/rspec-core:justin'].join("\n") | ||
command :add do | ||
puts resource[resource_path].post(:handle_or_email => handle_or_email) | ||
end | ||
|
||
usage 'collab:remove <org_or_user_handle>/<project_handle>:' + | ||
'<collaborator_handle_or_email>' | ||
desc ['remove a collaborator from a project', | ||
'example: relish collab:remove rspec/rspec-core:justin'].join("\n") | ||
command :remove do | ||
puts resource["#{resource_path}/#{handle_or_email}"].delete | ||
end | ||
|
||
private | ||
|
||
def resource_path | ||
"projects/#{@param.remove_option}/memberships" | ||
end | ||
|
||
def handle_or_email | ||
@param.extract_option | ||
end | ||
|
||
def format(response) | ||
json_parse(response) do |hash| | ||
"#{hash['user']['handle']} (#{hash['user']['email']})" | ||
end | ||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
require 'yaml' | ||
|
||
module Relish | ||
module Command | ||
class Help < Base | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters