Class: Entityjs::Eunit

Inherits:
Object
  • Object
show all
Defined in:
lib/entityjs/commands/eunit.rb

Overview

outputs eunit compiled code

Class Method Summary collapse

Class Method Details

.eunit_nameObject



38
39
40
# File 'lib/entityjs/commands/eunit.rb', line 38

def self.eunit_name
  return "eunit-#{Entityjs::VERSION}.min.js"
end

.generate(name = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/entityjs/commands/eunit.rb', line 6

def self.generate(name=nil)
  
  if name.is_a? Array
    name = name.first
  end
  
  name ||= self.eunit_name
  
  puts "Collecting test src files"
  
  min = Entityjs::Build.compile_eunit
  
  puts "Minifying"
  
  license = "/* QUnit V1.5.0pre with EntityJS Entensions | http://docs.jquery.com/QUnit */\n"
  
  min = Entityjs::Build.minify(min, :license=>license)
  
  File.open(name, 'w') do |f|
    
    f.write(min)
    
  end
  
  puts "Done!"
  puts "File is at"
  puts "  ./#{name}"
  
  
  return 0
end