Module: RubberRing::Build

Included in:
CmsController
Defined in:
app/concerns/rubber_ring/build.rb

Class Method Summary collapse

Class Method Details

.run!(request) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/concerns/rubber_ring/build.rb', line 4

def Build.run!(request)
  # wget -m -p -E -k -np http://localhost:3000 -P build -nH
  # -nH: no host directories
  # -p: prefix with directory
  # -E: adjust extension, save as .html
  # -k: convert links suitable for local viewing

  root_url = request.protocol + request.host_with_port
  build_dir = "#{Rails.root.to_s}/public/build"

  # clear previous build
  FileUtils.rm_rf(build_dir)

  cmd = "wget -m -p -E -k -np #{root_url} -P #{build_dir} -nH"
  system(cmd)
end