8 # Fx.Tween, DomReady including all dependencies:
9 # ./build.rb Fx.Tween DomReady
18 attr_accessor :build_path
19 attr_accessor :dependency_path
21 def initialize(path = File.dirname(__FILE__))
27 @build_path ||= @path + '/mootools.js'
28 @dependency_path ||= @path + '/Source/scripts.json'
30 json = JSON.load(File.read( dependency_path ))
31 json.each_pair do |folder, group|
32 group.each_pair do |script, properties|
33 @data[script] = {:folder => folder, :deps => properties["deps"]}
39 @data.each_key { |name| load_script name }
44 return if @included.index(name) || name == 'None';
45 unless @data.key? name
46 puts "Script '#{name}' not found!"
47 throw :script_not_found
50 @data[name][:deps].each { |dep| load_script dep }
52 @string << File.read(@path + "/Source/#{@data[name][:folder]}/#{name}.js") << "\n"
56 @string ||= full_build
57 @string.sub!('%build%', build_number)
62 ref = File.read(File.dirname(__FILE__) + '/.git/HEAD').chomp.match(/ref: (.*)/)[1]
63 return File.read(File.dirname(__FILE__) + "/.git/#{ref}").chomp
67 File.open(filename, 'w') { |fh| fh.write to_s }
75 mootools = MooTools::Build.new
77 catch :script_not_found do
79 argv.each { |script| mootools.load_script(script) }
85 puts "MooTools Built '#{mootools.build_path}'"
86 print " Included Scripts:","\n "
87 puts mootools.included.join(" ")
96 MooTools::Build.build! ARGV