Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
packaged gem
Browse files Browse the repository at this point in the history
  • Loading branch information
Sparkboxx committed Jan 15, 2013
1 parent 2aa0d86 commit 8a23ddb
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 0 deletions.
Binary file added pkg/github-helpers-0.0.1.gem
Binary file not shown.
6 changes: 6 additions & 0 deletions pkg/github-helpers-0.0.1/README.rdoc
@@ -0,0 +1,6 @@
= github-helpers

Describe your project here

:include:github-helpers.rdoc

86 changes: 86 additions & 0 deletions pkg/github-helpers-0.0.1/bin/github-helpers
@@ -0,0 +1,86 @@
#!/usr/bin/env ruby
require 'gli'
begin # XXX: Remove this begin/rescue before distributing your app
require 'github-helpers'
rescue LoadError
STDERR.puts "In development, you need to use `bundle exec bin/github-helpers` to run your app"
STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
STDERR.puts "Feel free to remove this message from bin/github-helpers now"
exit 64
end

include GLI::App

program_desc 'Add and Remove github collaborators to collections of repositories.'

version GithubHelpers::VERSION

#desc 'Describe some switch here'
#switch [:s,:switch]

desc 'Github Username'
flag [:u,:username]

desc 'Github Password'
flag [:p,:password]


pre do |global,command,options,args|
# Pre logic here
# Return true to proceed; false to abort and not call the
# chosen command
# Use skips_pre before a command to skip this block
# on that command only

username = global[:username] || ask("Github Username:")
password = global[:password] || ask("Github Password: (it's safe, characters won't end up on your screen)"){|q| q.echo = false}
$github_helper = GithubHelpers::Collaborators.new(username, password)
true
end

desc 'Add collaborators to repositories'
command :add do |c|
c.desc 'List of repository names, when no list is given, it defaults to all repositories of the authenticated Github user.'
c.arg_name 'repositories', [:multiple, :optional]
c.flag [:r,:repositories]

c.desc 'List of github usernames (handles).'
c.arg_name 'repositories', :multiple
c.flag [:h,:handles]

c.action do |global, options, args|
repos = $github_helper.repos(options[:repositories])
$github_helper.add_collaborators(args,repos)
end
end

desc 'Remove collaborators to repositories'
command :remove do |c|
c.desc 'List of repository names, when no list is given, it defaults to all repositories of the authenticated Github user.'
c.arg_name 'repositories', [:multiple, :optional]
c.flag [:r,:repositories]

c.desc 'List of github usernames (handles).'
c.arg_name 'repositories', :multiple
c.flag [:h,:handles]

c.action do |global, options, args|
repos = $github_helper.repos(options[:repositories])
handles = options[:handles]
$github_helper.remove_collaborators(handles,repos)
end
end

post do |global,command,options,args|
# Post logic here
# Use skips_post before a command to skip this
# block on that command only
end

on_error do |exception|
# Error logic here
# return false to skip default error handling
true
end

exit run(ARGV)
5 changes: 5 additions & 0 deletions pkg/github-helpers-0.0.1/github-helpers.rdoc
@@ -0,0 +1,5 @@
= github-helpers

Generate this with
github-helpers rdoc
After you have described your command line interface
2 changes: 2 additions & 0 deletions pkg/github-helpers-0.0.1/lib/github-helpers.rb
@@ -0,0 +1,2 @@
require 'github-helpers/version.rb'
require 'github-helpers/collaborators.rb'
3 changes: 3 additions & 0 deletions pkg/github-helpers-0.0.1/lib/github-helpers/version.rb
@@ -0,0 +1,3 @@
module GithubHelpers
VERSION = '0.0.1'
end

0 comments on commit 8a23ddb

Please sign in to comment.