Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 49 lines (40 sloc) 1.564 kB
68ef5c0 @jnunemaker added install and uninstall rake tasks to make things less manual
jnunemaker authored
1 desc 'installs the generator and templates in your current ruby directory'
2 task :install do
3 rdoc_path = get_rdoc_path()
4 generator_path, template_path = get_local_paths()
5 generator_install_path, template_install_path = get_install_paths(rdoc_path)
6
7 say "Installing ajax generator"
8 sudo "cp #{generator_path}/ajax_generator.rb #{generator_install_path}"
9
10 say "Installing ajax templates"
11 sudo "cp -R #{template_path}/ajax #{template_install_path}"
12
13 say "Installed to #{rdoc_path}"
14 end
15
16 task :uninstall do
17 rdoc_path = get_rdoc_path()
18 generator_install_path, template_install_path = get_install_paths(rdoc_path)
19 sudo "rm -rf #{generator_install_path}/ajax_generator.rb #{template_install_path}/ajax"
20 end
21
22 def sudo(cmd)
23 # puts %Q{sudo -p "Password: " #{cmd}}
24 %x[sudo -p "Password: " #{cmd}]
25 end
26
27 def say(msg)
28 puts msg
29 end
30
31 def get_rdoc_path
32 rdoc_path = ENV['RDOC']
33 # if using macports ruby i know where stuff is
34 rdoc_path ||= %x[which ruby] =~ /^\/opt/ ? '/opt/local/lib/ruby/1.8/rdoc' : nil
216182f ReadME and rake install script tweaks
Brian Chamberlain authored
35 raise ArgumentError, "Don't forget: RDOC=/path/to/lib/ruby/1.8/rdoc rake install" unless rdoc_path
68ef5c0 @jnunemaker added install and uninstall rake tasks to make things less manual
jnunemaker authored
36 rdoc_path
37 end
38
39 def get_local_paths
40 generator_path = File.join(File.dirname(__FILE__), '..', 'rdoc', 'generators')
41 template_path = File.join(generator_path, 'template')
42 [generator_path, template_path]
43 end
44
45 def get_install_paths(rdoc_path)
46 generator_install_path = File.join(rdoc_path, 'generators')
47 template_install_path = File.join(rdoc_path, 'generators', 'template')
48 [generator_install_path, template_install_path]
49 end
Something went wrong with that request. Please try again.