forked from defunkt/gist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
51 lines (40 loc) · 1.03 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
begin
require "mg"
MG.new("gist.gemspec")
rescue LoadError
nil
end
desc "Build standalone script and manpages"
task :build => [ :standalone, :build_man ]
desc "Build standalone script"
task :standalone => :load_gist do
require 'gist/standalone'
Gist::Standalone.save('gist')
end
desc "Build gist manual"
task :build_man do
sh "ronn -br5 --organization=GITHUB --manual='Gist Manual' man/*.ron"
end
desc "Show gist manual"
task :man => :build_man do
exec "man man/gist.1"
end
task :load_gist do
$LOAD_PATH.unshift 'lib'
require 'gist'
end
Rake::TaskManager.class_eval do
def remove_task(task_name)
@tasks.delete(task_name.to_s)
end
end
# Remove mg's 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 "gist", "#{prefix}/bin"
FileUtils.mkdir_p "#{prefix}/share/man/man1"
FileUtils.cp "man/gist.1", "#{prefix}/share/man/man1"
end