Class: RestyTest::Installer

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/resty_test/installer.rb

Instance Method Summary collapse

Instance Method Details

#configure!Object



22
23
24
25
26
27
28
# 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!Object



4
5
6
7
8
9
10
11
12
# 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!Object



14
15
16
17
18
19
20
# 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!Object



30
31
32
33
34
35
36
# 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