Module: Capitate::Plugins::Build
- Defined in:
- lib/capitate/plugins/build.rb
Instance Method Summary collapse
-
#install(name, options, &block) ⇒ Object
Download, unpack and yield (unpacked source director).
-
#make_install(name, options) ⇒ Object
Configure, make, make install.
Instance Method Details
#install(name, options, &block) ⇒ Object
Download, unpack and yield (unpacked source director).
Options
name-
Name for app
options-
Options (see Install options)
Install options
build_dest-
Place to build from, ex. /usr/src, defaults to /tmp/name
url-
URL to download package from
Examples (in capistrano task)
script.make("rubygems", { :url => :url => "http://rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz" }) do |dir|
sudo "echo 'Running setup...' && cd #{dir} && ruby #{dir}/setup.rb"
end
59 60 61 62 63 64 65 66 67 |
# File 'lib/capitate/plugins/build.rb', line 59 def install(name, , &block) build_dest = [:build_dest] build_dest ||= "/tmp/#{name}" url = [:url] script.unpack(url, build_dest, ) do |dir| yield(dir) if block_given? end end |
#make_install(name, options) ⇒ Object
Configure, make, make install.
Options
name-
Name for app
options-
Options (See Make install options)
Make install options
build_dest-
Place to build from, ex. /usr/src, defaults to /tmp/name
url-
URL to download package from
configure_options-
Options for ./configure
symlink-
After install, list of source, dest pairs to symlink
[ { "/usr/local/sphinx-0.9.8-rc1" => "/usr/local/sphinx" }, ... ]
ln -s /usr/local/sphinx-0.9.8-rc1 /usr/local/sphinx
unpack_dir-
Directory that is unpacked from tgz (if not matching the file name)
to_log-
If specified, will redirect output to this path
Examples (in capistrano task)
build.make_install("nginx", { :url => "http://sysoev.ru/nginx/nginx-0.5.35.tar.gz", ... })
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/capitate/plugins/build.rb', line 22 def make_install(name, ) install(name, ) do |dir| = [:configure_options] || "" # Whether to capture build output unless .has_key?(:to_log) to_log = ">> debug.log 2>&1" else to_log = "" to_log = ">> #{options[:to_log]}" unless [:to_log].blank? end script.run_all " sh -c \"cd \#{dir} && ./configure \#{configure_options} \#{to_log}\"\n sh -c \"cd \#{dir} && make \#{to_log}\"\n sh -c \"cd \#{dir} && make install \#{to_log}\"\n CMDS\n \n utils.ln(options[:symlink]) unless options[:symlink].blank?\n end\nend\n" |