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
nameName for app
optionsOptions (see Install options)
Install options
build_destPlace to build from, ex. /usr/src, defaults to /tmp/name
urlURL 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
nameName for app
optionsOptions (See Make install options)
Make install options
build_destPlace to build from, ex. /usr/src, defaults to /tmp/name
urlURL to download package from
configure_optionsOptions for ./configure
symlinkAfter 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_dirDirectory that is unpacked from tgz (if not matching the file name)
to_logIf 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 = ">> #{[:to_log]}" unless [:to_log].blank? end script.run_all <<-CMDS sh -c "cd #{dir} && ./configure #{} #{to_log}" sh -c "cd #{dir} && make #{to_log}" sh -c "cd #{dir} && make install #{to_log}" CMDS utils.ln([:symlink]) unless [:symlink].blank? end end |