class Retreaver::Compile

Public Class Methods

perform() click to toggle source
# File lib/retreaverjs/compile.rb, line 5
def perform
  Dir.chdir(root) do |f|
    run("npm install") unless Dir.exist?('./node_modules')
    # compile src
    run("grunt")
    output = 'vendor/assets/javascripts/'
    FileUtils.rm_rf(output)
    FileUtils.mkdir_p(output)
    Dir.glob('dist/*.js') { |f| FileUtils.cp(f, output) }
    # generate jsdocs
    output = 'vendor/documentation/javascripts/'
    FileUtils.rm_rf(output)
    run("./node_modules/.bin/jsdoc -c config/jsdocs.json")
  end
end
root() click to toggle source
# File lib/retreaverjs/compile.rb, line 26
def root
  File.expand_path(File.join(__FILE__, '../../../'))
end
run(command) click to toggle source
# File lib/retreaverjs/compile.rb, line 21
def run(command)
  puts(command)
  system(command)
end