Sha256: dffe34e8274c9f464b260f583923b51ecc6d713db1d681374b02cbb6f6f0f340

Contents?: true

Size: 803 Bytes

Versions: 1

Compression:

Stored size: 803 Bytes

Contents

module Retreaver
  class Compile
    
    class << self
      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
      
      def run(command)
        puts(command)
        system(command)
      end
      
      def root
        File.expand_path(File.join(__FILE__, '../../../'))
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
retreaverjs-rails-0.0.12 lib/retreaverjs/compile.rb