class RestyTest::Installer
Public Instance Methods
configure!()
click to toggle source
# File lib/resty_test/installer.rb, line 22 def configure! extract! return if File.file?(File.join(paths.src, "Makefile")) log "Configuring", :info sh "cd #{paths.src} && ./configure --prefix='#{paths.root}' #{opts}" end
download!()
click to toggle source
# File lib/resty_test/installer.rb, line 4 def download! return if File.file?(paths.tar) log "Downloading #{File.basename(paths.tar)}", :info FileUtils.mkdir_p(paths.root) File.open(paths.tar, "wb") do |file| Excon.get RestyTest.config.source, response_block: lambda {|c, _, _| file.write(c) } end end
extract!()
click to toggle source
# File lib/resty_test/installer.rb, line 14 def extract! download! return if File.file?(File.join(paths.src, "configure")) log "Extracting source", :info sh "cd #{paths.root} && mkdir -p src && /usr/bin/env tar xzf #{paths.tar} -C src --strip-components 1" end
install!()
click to toggle source
# File lib/resty_test/installer.rb, line 30 def install! configure! return if File.file?(paths.nginx_bin) log "Building & installing", :info sh "cd #{paths.src} && make && make install" end
Protected Instance Methods
log(message, level = :debug)
click to toggle source
# File lib/resty_test/installer.rb, line 54 def log(message, level = :debug) RestyTest.logger.send(level, message) end
opts()
click to toggle source
# File lib/resty_test/installer.rb, line 50 def opts RestyTest.config.build_opts.join(" ") end
paths()
click to toggle source
# File lib/resty_test/installer.rb, line 46 def paths RestyTest.paths end
sh(cmd)
click to toggle source
# File lib/resty_test/installer.rb, line 40 def sh(cmd) log cmd log `#{cmd}` raise "Abort!" unless $? == 0 end