Skip to content
This repository has been archived by the owner on Apr 4, 2018. It is now read-only.

Commit

Permalink
make github repo creation optional
Browse files Browse the repository at this point in the history
  • Loading branch information
ddollar committed Feb 14, 2011
1 parent 2e44168 commit 880e944
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions lib/parka/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def install(gemspec_filename=nil)

desc "push [GEMSPEC]", "Build the gem and push it to GitHub and RubyGems.org"

method_option :create, :type => :boolean, :aliases => "-c",
:desc => "Create a Github repository for this project"

def push(gemspec_filename=nil)
gemspec = Gem::Specification.load(gemspec_filename || default_gemspec)
gemfile = build(gemspec_filename)
Expand All @@ -45,15 +48,17 @@ def push(gemspec_filename=nil)
end

# create github repo
repos = github_repositories
names = repos.map { |repo| repo["name"] }
unless names.include?(gemspec.name)
github["repos/create"].post(
:name => gemspec.name,
:description => gemspec.summary,
:homepage => gemspec.homepage,
:public => "1"
)
if options[:create]
begin
github["repos/create"].post(
:name => gemspec.name,
:description => gemspec.summary,
:homepage => gemspec.homepage,
:public => "1"
)
rescue
error "Unable to create GitHub repository: #{gemspec.name}"
end
end

# create release tag
Expand Down

0 comments on commit 880e944

Please sign in to comment.