Class: Retreaver::Compile

Inherits:
Object
  • Object
show all
Defined in:
lib/retreaverjs/compile.rb

Class Method Summary collapse

Class Method Details

.performObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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

.rootObject



26
27
28
# File 'lib/retreaverjs/compile.rb', line 26

def root
  File.expand_path(File.join(__FILE__, '../../../'))
end

.run(command) ⇒ Object



21
22
23
24
# File 'lib/retreaverjs/compile.rb', line 21

def run(command)
  puts(command)
  system(command)
end