Permalink
Browse files

add publish to release

  • Loading branch information...
1 parent 3f50453 commit 8a4494986e44dc18c2f75dcb32f48b868c1e764d @quix committed Mar 17, 2011
Showing with 9 additions and 10 deletions.
  1. +9 −10 levitate.rb
View
19 levitate.rb
@@ -292,12 +292,6 @@ class << self
"#{spec_output_dir}/#{spec_output_file}"
end
- [:gem, :tgz].each { |ext|
- attribute ext do
- "pkg/#{gem_name}-#{version}.#{ext}"
- end
- }
-
attribute :rcov_options do
# workaround for the default rspec task
Dir["*"].select { |f| File.directory? f }.inject(Array.new) { |acc, dir|
@@ -619,7 +613,7 @@ def define_test
def define_doc
desc "run rdoc"
task :doc => :clean_doc do
- Kernel.send :gem, 'rdoc' rescue nil
+ gem 'rdoc' rescue nil
require 'rdoc/rdoc'
args = (
gemspec.rdoc_options +
@@ -648,6 +642,7 @@ def define_publish
if source_control?
desc "publish docs"
task :publish => [:clean, :check_directory, :doc] do
+ current_branch = `git branch`[/^\* (\S+)$/, 1] or raise "??? branch"
if rubyforge_info
user, project = rubyforge_info
Dir.chdir(doc_dir) do
@@ -666,6 +661,7 @@ def define_publish
FileUtils.rmdir "doc"
git "add", "."
git "commit", "-m", "generated by rdoc"
+ git "checkout", current_branch
git "push", "-f", "origin", "gh-pages"
end
end
@@ -710,7 +706,10 @@ def define_check_directory
def define_ping
task :ping do
require 'rbconfig'
- %w[github.com].each { |server|
+ [
+ "github.com",
+ ("rubyforge.org" if rubyforge_info),
+ ].compact.each do |server|
cmd = "ping " + (
if RbConfig::CONFIG["host"] =~ %r!darwin!
"-c2 #{server}"
@@ -721,7 +720,7 @@ def define_ping
unless `#{cmd}` =~ %r!0% packet loss!
raise "No ping for #{server}"
end
- }
+ end
end
end
@@ -804,7 +803,7 @@ def define_release
sh "gem", "push", gem
end
- task :release => [:prerelease, :package, :finish_release]
+ task :release => [:prerelease, :package, :publish, :finish_release]
end
def define_debug_gem

0 comments on commit 8a44949

Please sign in to comment.