Rakefile 2.3 KB
Newer Older
C
Chris Wanstrath 已提交
1 2
require 'rake/testtask'

C
Chris Wanstrath 已提交
3
task :default => :test
C
Chris Wanstrath 已提交
4 5 6 7 8 9 10 11 12 13 14 15

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
C
the gem  
Chris Wanstrath 已提交
16 17 18 19

desc "Build a gem"
task :gem => [ :gemspec, :build ]

C
Chris Wanstrath 已提交
20 21 22 23
desc "Build standalone script"
task :standalone => [ :test, :load_hub ] do
  Hub::Standalone.save('hub')
end
C
Chris Wanstrath 已提交
24

C
Chris Wanstrath 已提交
25 26 27
task :load_hub do
  $LOAD_PATH.unshift 'lib'
  require 'hub'
C
Chris Wanstrath 已提交
28 29
end

C
the gem  
Chris Wanstrath 已提交
30 31 32
begin
  require 'jeweler'
  $LOAD_PATH.unshift 'lib'
C
Chris Wanstrath 已提交
33
  require 'hub'
C
the gem  
Chris Wanstrath 已提交
34
  Jeweler::Tasks.new do |gemspec|
C
Chris Wanstrath 已提交
35
    gemspec.name = "git-hub"
C
the gem  
Chris Wanstrath 已提交
36 37 38 39 40
    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"
N
Nick Quaranto 已提交
41
    gemspec.executables = ["hub"]
C
Chris Wanstrath 已提交
42 43 44 45 46 47 48 49 50
    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
C
Chris Wanstrath 已提交
51
       fashioned way.  Faster  startup  time,  you see.
C
Chris Wanstrath 已提交
52 53

       Check  out  the  installation  instructions  at
C
Chris Wanstrath 已提交
54 55
       http://github.com/defunkt/hub#readme  under the
       "Standalone" section.
C
Chris Wanstrath 已提交
56

C
Chris Wanstrath 已提交
57 58
       Cheers,
       defunkt
C
Chris Wanstrath 已提交
59 60 61 62

------------------------------------------------------------

message
C
the gem  
Chris Wanstrath 已提交
63 64 65 66 67 68 69 70 71 72 73
  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"
C
Chris Wanstrath 已提交
74
  system "gem push pkg/git-hub-#{Hub::Version}.gem"
C
the gem  
Chris Wanstrath 已提交
75
  system "git clean -fd"
C
Chris Wanstrath 已提交
76
  exec "rake pages"
C
the gem  
Chris Wanstrath 已提交
77 78
end

C
Chris Wanstrath 已提交
79 80 81
desc "Publish to GitHub Pages"
task :pages => [ :check_dirty, :standalone ] do
  `git checkout gh-pages`
C
Chris Wanstrath 已提交
82
  `mv hub standalone`
C
Chris Wanstrath 已提交
83
  `git add standalone*`
C
Chris Wanstrath 已提交
84 85
  `git commit -m "update standalone"`
  `git push origin gh-pages`
C
Chris Wanstrath 已提交
86
  `git checkout master`
C
Chris Wanstrath 已提交
87
  puts :done
C
Chris Wanstrath 已提交
88 89 90 91 92 93 94
end

task :check_dirty do
  if !`git status`.include?('nothing to commit')
    abort "dirty index - not publishing!"
  end
end