forked from mislav/hub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
130 lines (105 loc) · 3.1 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
require 'rake/testtask'
task :default => :test
Rake::TestTask.new do |t|
t.libs << 'lib'
t.ruby_opts << '-rubygems'
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 lib"
end
desc "Build a gem"
task :gem => [ :gemspec, :build ]
desc "Build standalone script"
task :standalone => :load_hub do
require 'hub/standalone'
Hub::Standalone.save('hub')
end
desc "Build hub manual"
task "man:build" do
sh "ron -br5 --organization=DEFUNKT --manual='Git Manual' man/*.ron"
end
desc "Show hub manual"
task :man => "man:build" do
exec "man man/hub.1"
end
task :load_hub do
$LOAD_PATH.unshift 'lib'
require 'hub'
end
begin
require 'jeweler'
$LOAD_PATH.unshift 'lib'
require 'hub'
Jeweler::Tasks.new do |gemspec|
gemspec.name = "git-hub"
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"
gemspec.executables = ["hub"]
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 under the
"Standalone" section.
Cheers,
defunkt
------------------------------------------------------------
message
end
rescue LoadError
puts "Jeweler not available."
puts "Install it with: gem install jeweler"
end
Rake::TaskManager.class_eval do
def remove_task(task_name)
@tasks.delete(task_name.to_s)
end
end
# Remove jewelers install task
Rake.application.remove_task(:install)
desc "Install standalone script and man pages"
task :install => :standalone do
prefix = ENV['PREFIX'] || ENV['prefix'] || '/usr/local'
FileUtils.mkdir_p "#{prefix}/bin"
FileUtils.cp "hub", "#{prefix}/bin"
FileUtils.mkdir_p "#{prefix}/share/man/man1"
FileUtils.cp "man/hub.1", "#{prefix}/share/man/man1"
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/git-hub-#{Hub::Version}.gem"
system "git clean -fd"
exec "rake pages"
end
desc "Publish to GitHub Pages"
task :pages => [ "man:build", :check_dirty, :standalone ] do
cp "man/hub.1.html", "html"
sh "git checkout gh-pages"
sh "mv hub standalone"
sh "git add standalone*"
sh "mv html hub.1.html"
sh "git add hub.1.html"
sh "git commit -m 'update standalone'"
sh "git push origin gh-pages"
sh "git checkout master"
puts :done
end
task :check_dirty do
if !`git status`.include?('nothing to commit')
abort "dirty index - not publishing!"
end
end