Permalink
Browse files

Update build script, .gitignore, Add Packager as submodule

  • Loading branch information...
1 parent fcdb384 commit 06ea9a3e68dcced882dd6635906056cc509084a8 @arian arian committed Jun 2, 2010
Showing with 37 additions and 120 deletions.
  1. +2 −0 .gitignore
  2. +4 −0 .gitmodules
  3. +31 −0 build
  4. +0 −120 build.rb
View
@@ -0,0 +1,2 @@
+mootools-more.js
+*.tmp*
View
@@ -7,3 +7,7 @@
[submodule "Tests/UnitTester"]
path = Tests/UnitTester
url = git://github.com/anutron/mootools-unittester.git
+[submodule "Packager"]
+ path = Packager
+ url = git://github.com/kamicane/packager.git
+
View
31 build
@@ -0,0 +1,31 @@
+#!/usr/bin/env php
+<?php
+
+$stderr = fopen('php://stderr', 'w');
+
+require dirname(__FILE__) . '/Packager/packager.php';
+
+$executable = array_shift($argv);
+$package = dirname(__FILE__);
+
+$pkg = new Packager($package);
+
+fwrite($stderr, "Packager is building MooTools More\n\n");
+fwrite($stderr, "Included Components:\n");
+
+
+$files = (empty($argv)) ? $pkg->get_all_files() : $pkg->components_to_files($argv);
+
+$files = $pkg->complete_files($files);
+
+foreach ($files as $file){
+ fwrite($stderr, "- $file: [" . implode(", ", $pkg->get_file_provides($file)) . "]\n");
+}
+
+$output = $pkg->build($files);
+
+echo $output;
+
+fclose($stderr);
+
+?>
View
120 build.rb
@@ -1,120 +0,0 @@
-#!/usr/bin/env ruby
-
-# USAGE:
-#
-# Full:
-# ./build.rb
-#
-# Fx.Tween, DomReady including all dependencies:
-# ./build.rb Fx.Tween DomReady
-
-require 'rubygems'
-require 'json'
-require 'yaml'
-
-module MooTools
- class Build
-
- attr_reader :included
- attr_accessor :build_path
- attr_accessor :dependency_paths
- attr_accessor :data
-
- def initialize(opts={})
- @path = opts[:path] || File.dirname(__FILE__)
- @build_path = opts[:build_path] || @path + '/mootools-more.js'
- @dependency_paths = opts[:dependency_paths] || [@path + '/Source']
- @dependency_file = opts[:dependency_file] || 'scripts.json'
-
- @scripts = []
- @included = []
- @data = {}
-
-
- @dependency_paths.each do |dependency_path|
- json = JSON.load(File.read( dependency_path + "/#{@dependency_file}" ))
- json.each_pair do |folder, group|
- group.each_pair do |script, properties|
- @scripts.push(script)
- @data[script] = {:folder => "#{dependency_path}/#{folder}", :deps => properties["deps"]}
- end
- end
- end
- end
-
- def full_build
- @scripts.each { |name| load_script name }
- @string
- end
-
- def load_script(name)
- return if @included.index(name) || name == 'None';
- unless @data.key? name
- puts "Script '#{name}' not found!"
- throw :script_not_found
- end
- puts "loading #{name}\n"
- @included.push name
- @data[name][:deps].each { |dep| load_script dep }
- @string ||= ""
- @string << File.read("#{@data[name][:folder]}/#{name}.js") << "\n"
- end
-
- def build
- @string ||= full_build
- @string.sub!('%build%', build_number)
- end
- alias :to_s :build
-
- def build_number
- begin
- ref = File.read(File.dirname(__FILE__) + '/.git/HEAD').chomp.match(/ref: (.*)/)[1]
- return File.read(File.dirname(__FILE__) + "/.git/#{ref}").chomp
- rescue
- return ""
- end
- end
-
- def save(filename)
- File.open(filename, 'w') { |fh| fh.write to_s }
- end
-
- def save!
- save build_path
- end
-
- def self.build!(argv, mootools = MooTools::Build.new)
- catch :script_not_found do
- if argv.length > 0
- argv.each { |script| mootools.load_script(script) }
- else
- mootools.full_build
- end
- end
-
- puts "MooTools Built '#{mootools.build_path}'"
- print " Included Scripts:","\n "
- puts mootools.included.join(" ")
- mootools.save!
- end
-
- end
-end
-
-if __FILE__ == $0
-
- conf = YAML.load_file('build.yml')
- if (File.exist?('build.local.yml'))
- local_conf = YAML.load_file('build.local.yml')
- conf.merge!(local_conf)
- end
-
-
- builder = MooTools::Build.new({
- :dependency_paths => conf[:dependency_paths],
- :build_path => conf[:build_path]
- })
-
- MooTools::Build.build! ARGV, builder
-
-end

0 comments on commit 06ea9a3

Please sign in to comment.