/
Rakefile
89 lines (69 loc) · 2.57 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
require 'rubygems'
require 'rake/gempackagetask'
require 'rake/clean'
require 'rake/rdoctask'
require 'spec/rake/spectask'
$: << File.join(File.dirname(__FILE__),"lib")
require 'heel'
# load all the extra tasks for the project
TASK_DIR = File.join(File.dirname(__FILE__),"tasks")
FileList[File.join(TASK_DIR,"*.rb")].each do |tasklib|
require "tasks/#{File.basename(tasklib)}"
end
task :default => 'test:default'
#-----------------------------------------------------------------------
# Documentation
#-----------------------------------------------------------------------
namespace :doc do
# generating documentation locally
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = Heel::SPEC.local_rdoc_dir
rdoc.options = Heel::SPEC.rdoc_options
rdoc.rdoc_files = Heel::SPEC.rdoc_files
end
desc "View the RDoc documentation locally"
task :view => :rdoc do
show_files Heel::SPEC.local_rdoc_dir
end
end
#-----------------------------------------------------------------------
# Packaging and Distribution
#-----------------------------------------------------------------------
namespace :dist do
GEM_SPEC = eval(Heel::SPEC.to_ruby)
Rake::GemPackageTask.new(GEM_SPEC) do |pkg|
pkg.need_tar = Heel::SPEC.need_tar
pkg.need_zip = Heel::SPEC.need_zip
end
desc "Install as a gem"
task :install => [:clobber, :package] do
sh "sudo gem install pkg/#{Heel::SPEC.full_name}.gem"
end
# uninstall the gem and all executables
desc "Uninstall gem"
task :uninstall do
sh "sudo gem uninstall #{Heel::SPEC.name} -x"
end
desc "dump gemspec"
task :gemspec do
puts Heel::SPEC.to_ruby
end
desc "reinstall gem"
task :reinstall => [:install, :uninstall]
desc "distribute copiously"
task :copious => [:package] do
Rake::SshFilePublisher.new('jeremy@copiousfreetime.org',
'/var/www/vhosts/www.copiousfreetime.org/htdocs/gems/gems',
'pkg',"#{Heel::SPEC.full_name}.gem").upload
sh "ssh jeremy@copiousfreetime.org rake -f /var/www/vhosts/www.copiousfreetime.org/htdocs/gems/Rakefile"
end
end
#-----------------------------------------------------------------------
# update the top level clobber task to depend on all possible sub-level
# tasks that have a name like ':clobber' in other namespaces
#-----------------------------------------------------------------------
Rake.application.tasks.each do |t|
if t.name =~ /:clobber/ then
task :clobber => [t.name]
end
end