Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: tools/cc-frame-viewer/third_party/gl-matrix/tasks/support/gl-matrix.rb

Issue 12250012: [cc] Add gl-matrix to cc-frame-viewer 3rd party (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 $:.unshift File.expand_path('.', File.dirname(__FILE__))
2 require 'sprockets'
3 require 'jasmine'
4
5 class Jasmine::Config
6 def simple_config_file
7 File.expand_path GLMatrix.base_path.join('spec/jasmine.yml')
8 end
9 end
10
11 class Rack::Jasmine::Runner
12 alias_method :jasmine_call, :call
13 def call(env)
14 GLMatrix.compile
15 jasmine_call env
16 end
17 end
18
19 module GLMatrix
20 autoload :ReleaseHelper, 'gl-matrix/release_helper'
21 autoload :Version, 'gl-matrix/version'
22 autoload :VERSION, 'gl-matrix/version'
23
24 module_function
25
26 def release(&block)
27 GLMatrix::ReleaseHelper.release &block
28 end
29
30 def sprockets
31 env = Sprockets::Environment.new base_path
32 env.append_path base_path.join('src')
33 env
34 end
35
36 def base_path
37 Pathname.new File.expand_path('../..', File.dirname(__FILE__))
38 end
39
40 # Compiles the source file to the dest file. If a block
41 # is given, the source file is yielded and replaced with
42 # the result. Returns the destination as a Pathname.
43 def compile(source = 'gl-matrix.js', dest = 'dist/gl-matrix.js')
44 dest = base_path.join dest
45 js = sprockets[source]
46 js = yield js if block_given?
47
48 File.open dest, "w" do |f|
49 f.puts js
50 end
51
52 puts "compiled #{source} to #{dest.relative_path_from base_path}"
53 dest
54 end
55
56 def minify(source = 'gl-matrix.js', dest = 'dist/gl-matrix-min.js')
57 dest = compile source, dest do |js|
58 Uglifier.compile js
59 end
60
61 puts "minified #{source} to #{dest.relative_path_from base_path}"
62 end
63
64 end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698