2009-12-08 09:28:03 +03:00
|
|
|
require 'rake/testtask'
|
|
|
|
|
2009-12-06 01:15:59 +03:00
|
|
|
task :default => :test
|
2009-12-08 09:28:03 +03:00
|
|
|
|
|
|
|
Rake::TestTask.new do |t|
|
|
|
|
t.libs << 'lib'
|
|
|
|
t.pattern = 'test/**/*_test.rb'
|
|
|
|
t.verbose = false
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Launch Kicker (like autotest)"
|
|
|
|
task :kicker do
|
|
|
|
puts "Kicking... (ctrl+c to cancel)"
|
|
|
|
exec "kicker -e rake test bin"
|
|
|
|
end
|
2009-12-08 11:26:59 +03:00
|
|
|
|
|
|
|
desc "Build a gem"
|
|
|
|
task :gem => [ :gemspec, :build ]
|
|
|
|
|
2009-12-08 13:12:29 +03:00
|
|
|
desc "Install `hub`"
|
|
|
|
task :setup => :standalone do
|
|
|
|
path = ENV['BINPATH'] || %w( ~/bin /usr/local/bin /usr/bin ).detect do |dir|
|
|
|
|
File.directory? File.expand_path(dir)
|
|
|
|
end
|
|
|
|
|
|
|
|
if path
|
|
|
|
puts "Installing into #{path}"
|
|
|
|
cp "standalone", hub = File.expand_path(File.join(path, 'hub'))
|
|
|
|
chmod 0755, hub
|
|
|
|
puts "Done. Type `hub version` to see if it worked!"
|
|
|
|
else
|
|
|
|
puts "** Can't find a suitable installation location."
|
|
|
|
abort "** Please set the BINPATH env variable and try again."
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-12-08 11:26:59 +03:00
|
|
|
begin
|
|
|
|
require 'jeweler'
|
|
|
|
$LOAD_PATH.unshift 'lib'
|
2009-12-08 11:49:09 +03:00
|
|
|
require 'hub'
|
2009-12-08 11:26:59 +03:00
|
|
|
Jeweler::Tasks.new do |gemspec|
|
2009-12-09 06:52:09 +03:00
|
|
|
gemspec.name = "hub"
|
2009-12-08 11:26:59 +03:00
|
|
|
gemspec.summary = gemspec.description = "hub introduces git to GitHub"
|
|
|
|
gemspec.homepage = "http://github.com/defunkt/hub"
|
|
|
|
gemspec.version = Hub::Version
|
|
|
|
gemspec.authors = ["Chris Wanstrath"]
|
|
|
|
gemspec.email = "chris@ozmm.org"
|
2009-12-08 13:03:17 +03:00
|
|
|
gemspec.post_install_message = <<-message
|
|
|
|
|
|
|
|
------------------------------------------------------------
|
|
|
|
|
|
|
|
You there! Wait, I say!
|
|
|
|
=======================
|
|
|
|
|
|
|
|
If you are a heavy user of `git` on the command
|
|
|
|
line you may want to install `hub` the old
|
|
|
|
fashioned way! Faster startup time, you see.
|
|
|
|
|
|
|
|
Check out the installation instructions at
|
|
|
|
http://github.com/defunkt/hub#readme or simply
|
|
|
|
use the `install` command:
|
|
|
|
|
|
|
|
$ hub install
|
|
|
|
|
|
|
|
------------------------------------------------------------
|
|
|
|
|
|
|
|
message
|
2009-12-08 11:26:59 +03:00
|
|
|
end
|
|
|
|
rescue LoadError
|
|
|
|
puts "Jeweler not available."
|
|
|
|
puts "Install it with: gem install jeweler"
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Push a new version to Gemcutter"
|
|
|
|
task :publish => [ :test, :gemspec, :build ] do
|
|
|
|
system "git tag v#{Hub::Version}"
|
|
|
|
system "git push origin v#{Hub::Version}"
|
|
|
|
system "git push origin master"
|
|
|
|
system "gem push pkg/hub-#{Hub::Version}.gem"
|
|
|
|
system "git clean -fd"
|
2009-12-08 12:14:16 +03:00
|
|
|
exec "rake pages"
|
2009-12-08 11:26:59 +03:00
|
|
|
end
|
|
|
|
|
2009-12-08 12:14:16 +03:00
|
|
|
desc "Publish to GitHub Pages"
|
|
|
|
task :pages => [ :check_dirty, :standalone ] do
|
|
|
|
`git checkout gh-pages`
|
2009-12-08 12:25:52 +03:00
|
|
|
`md5 -q standalone > standalone.md5`
|
|
|
|
`git add standalone*`
|
2009-12-08 12:16:17 +03:00
|
|
|
`git commit -m "update standalone"`
|
|
|
|
`git push origin gh-pages`
|
2009-12-08 12:14:16 +03:00
|
|
|
`git checkout master`
|
2009-12-08 12:16:17 +03:00
|
|
|
puts :done
|
2009-12-08 12:14:16 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
task :check_dirty do
|
|
|
|
if !`git status`.include?('nothing to commit')
|
|
|
|
abort "dirty index - not publishing!"
|
|
|
|
end
|
|
|
|
end
|
2009-12-08 12:16:17 +03:00
|
|
|
|
|
|
|
desc "Build standalone script"
|
|
|
|
task :standalone => :test do
|
2009-12-09 06:08:19 +03:00
|
|
|
$LOAD_PATH.unshift 'lib'
|
|
|
|
require 'hub'
|
|
|
|
Hub::Standalone.save('standalone')
|
2009-12-08 12:16:17 +03:00
|
|
|
end
|