Sha256: 0116f38d45bbff6be50bef6775193e746b5e2641d4413252643488411ff81aba
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
module Relish module Command class Collab < Base desc 'list the collaborators for a project' command :default do puts format(resource[resource_path_for_no_option].get(:accept => :json)) end usage 'collab:add <project>:<collaborator handle or email>' desc ['add a collaborator to a project', 'example: relish collab:add rspec/rspec-core:justin'] command :add do puts resource[resource_path_for_option].post(:handle_or_email => handle_or_email) end usage 'collab:remove <project>:<collaborator handle or email>' desc ['remove a collaborator from a project', 'example: relish collab:remove rspec/rspec-core:justin'] command :remove do puts resource["#{resource_path_for_option}/#{handle_or_email}"].delete end private def resource_path_for_no_option resource_path(@param || project) end def resource_path_for_option resource_path(@param.extract_project_handle || project) end def resource_path(project) "projects/#{escape(project)}/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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
relish-0.1.3 | lib/relish/commands/collab.rb |