Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 8972b20a9cff5b6881b24b52beb619755058eaa3 @ebryn ebryn committed Nov 12, 2012
@@ -0,0 +1,12 @@
+bin/
+.bundle
+tmp/
+tests/source/
+dist/
+
+.DS_Store
+.project
+
+.github-upload-token
+
+tests/group-helper-tests.js
@@ -0,0 +1,54 @@
+{
+ "predef": [
+ "console",
+ "Ember",
+ "DS",
+ "Handlebars",
+ "Metamorph",
+ "RSVP",
+ "ember_assert",
+ "ember_warn",
+ "ember_deprecate",
+ "ember_deprecateFunc",
+ "require",
+ "equal",
+ "test",
+ "testBoth",
+ "testWithDefault",
+ "raises",
+ "deepEqual",
+ "start",
+ "stop",
+ "ok",
+ "strictEqual",
+ "module",
+ "expect",
+ "minispade"
+ ],
+
+ "node" : false,
+ "browser" : true,
+
+ "boss" : true,
+ "curly": false,
+ "debug": false,
+ "devel": false,
+ "eqeqeq": true,
+ "evil": true,
+ "forin": false,
+ "immed": false,
+ "laxbreak": false,
+ "newcap": true,
+ "noarg": true,
+ "noempty": false,
+ "nonew": false,
+ "nomen": false,
+ "onevar": false,
+ "plusplus": false,
+ "regexp": false,
+ "undef": true,
+ "sub": true,
+ "strict": false,
+ "white": false,
+ "eqnull": true
+}
@@ -0,0 +1,115 @@
+require "rake-pipeline-web-filters"
+require "json"
+require "uglifier"
+
+class EmberProductionFilter < Rake::Pipeline::Filter
+ def generate_output(inputs, output)
+ inputs.each do |input|
+ result = File.read(input.fullpath)
+ result.gsub!(%r{^(\s)*Ember\.(assert|deprecate|warn)\((.*)\).*$}, "")
+ output.write result
+ end
+ end
+end
+
+class EmberLicenseFilter < Rake::Pipeline::Filter
+ def generate_output(inputs, output)
+ inputs.each do |input|
+ file = File.read(input.fullpath)
+ license = File.read("generators/license.js")
+ output.write "#{license}\n\n#{file}"
+ end
+ end
+end
+
+class JSHintRC < Rake::Pipeline::Filter
+ def generate_output(inputs, output)
+ inputs.each do |input|
+ file = File.read(input.fullpath)
+ jshintrc = File.read(".jshintrc")
+ output.write "var JSHINTRC = #{jshintrc};\n\n#{file}"
+ end
+ end
+end
+
+distros = {
+ :full => %w(group-helper)
+}
+
+output "dist"
+
+input "packages" do
+ output "tests"
+
+ match "*/tests/**/*.js" do
+ minispade :rewrite_requires => true, :string => true, :module_id_generator => proc { |input|
+ id = input.path.dup
+ id.sub!(/\.js$/, '')
+ id.sub!(/\/main$/, '')
+ id.sub!('/tests', '/~tests')
+ id
+ }
+
+ concat "group-helper-tests.js"
+ end
+
+ match "group-helper-tests.js" do
+ filter JSHintRC
+ end
+end
+
+input "packages" do
+ match "*/lib/**/*.js" do
+ minispade :rewrite_requires => true, :string => true, :module_id_generator => proc { |input|
+ id = input.path.dup
+ id.sub!('/lib/', '/')
+ id.sub!(/\.js$/, '')
+ id.sub!(/\/main$/, '')
+ id
+ }
+
+ concat "group-helper-spade.js"
+ end
+end
+
+input "packages" do
+ match "*/lib/**/main.js" do
+ neuter(
+ :additional_dependencies => proc { |input|
+ Dir.glob(File.join(File.dirname(input.fullpath),'**','*.js'))
+ },
+ :path_transform => proc { |path, input|
+ package, path = path.split('/', 2)
+ current_package = input.path.split('/', 2)[0]
+ current_package == package && path ? File.join(package, "lib", "#{path}.js") : nil
+ },
+ :closure_wrap => true
+ ) do |filename|
+ File.join("modules/", filename.gsub('/lib/main.js', '.js'))
+ end
+ end
+end
+
+distros.each do |name, modules|
+ name = "group-helper"
+
+ input "dist/modules" do
+ module_paths = modules.map{|m| "#{m}.js" }
+ match "{#{module_paths.join(',')}}" do
+ concat(module_paths){ ["#{name}.js", "#{name}.prod.js"] }
+ end
+
+ # Strip dev code
+ match "#{name}.prod.js" do
+ filter(EmberProductionFilter) { ["#{name}.prod.js", "#{name}.min.js"] }
+ end
+
+ # Minify
+ match "#{name}.min.js" do
+ uglify{ "#{name}.min.js" }
+ filter EmberLicenseFilter
+ end
+ end
+end
+
+# vim: filetype=ruby
@@ -0,0 +1,13 @@
+source "http://rubygems.org"
+
+gem "rake-pipeline", :git => "https://github.com/livingsocial/rake-pipeline.git"
+gem "rake-pipeline-web-filters", :git => "https://github.com/wycats/rake-pipeline-web-filters.git"
+gem "colored"
+gem "uglifier", "~> 1.0.3"
+
+group :development do
+ gem "rack"
+ gem "github_downloads"
+ gem "ember-docs", :git => "https://github.com/emberjs/docs-generator.git"
+ gem "kicker"
+end
@@ -0,0 +1,80 @@
+GIT
+ remote: https://github.com/emberjs/docs-generator.git
+ revision: cfbc2a3aabc08de305224b290ad8f37f3ef5f847
+ specs:
+ ember-docs (0.1)
+ rack
+ thor
+
+GIT
+ remote: https://github.com/livingsocial/rake-pipeline.git
+ revision: 543f4322fe70facee9572d29ddabf7f090dad68a
+ specs:
+ rake-pipeline (0.6.0)
+ rake (~> 0.9.0)
+ thor
+
+GIT
+ remote: https://github.com/wycats/rake-pipeline-web-filters.git
+ revision: 81a22fb0808dfdeab8ed92d5d8c898ad198b9938
+ specs:
+ rake-pipeline-web-filters (0.6.0)
+ rack
+ rake-pipeline (~> 0.6)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ colored (1.2)
+ execjs (1.4.0)
+ multi_json (~> 1.0)
+ faraday (0.8.1)
+ multipart-post (~> 1.1)
+ github_api (0.6.1)
+ faraday (~> 0.8.1)
+ hashie (~> 1.2.0)
+ multi_json (~> 1.3)
+ nokogiri (~> 1.5.2)
+ oauth2
+ github_downloads (0.1.1)
+ github_api (~> 0.6.0)
+ rest-client (~> 1.6.7)
+ hashie (1.2.0)
+ httpauth (0.1)
+ json (1.7.3)
+ jwt (0.1.4)
+ json (>= 1.2.4)
+ kicker (2.5.0)
+ rb-fsevent
+ mime-types (1.19)
+ multi_json (1.3.6)
+ multipart-post (1.1.5)
+ nokogiri (1.5.5)
+ oauth2 (0.8.0)
+ faraday (~> 0.8)
+ httpauth (~> 0.1)
+ jwt (~> 0.1.4)
+ multi_json (~> 1.0)
+ rack (~> 1.2)
+ rack (1.4.1)
+ rake (0.9.2.2)
+ rb-fsevent (0.9.1)
+ rest-client (1.6.7)
+ mime-types (>= 1.16)
+ thor (0.15.2)
+ uglifier (1.0.4)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ colored
+ ember-docs!
+ github_downloads
+ kicker
+ rack
+ rake-pipeline!
+ rake-pipeline-web-filters!
+ uglifier (~> 1.0.3)
@@ -0,0 +1,108 @@
+abort "Please use Ruby 1.9 to build Ember.js!" if RUBY_VERSION !~ /^1\.9/
+
+require "bundler/setup"
+require "erb"
+require 'rake-pipeline'
+require "colored"
+
+def pipeline
+ Rake::Pipeline::Project.new("Assetfile")
+end
+
+def setup_uploader
+ require 'github_downloads'
+ uploader = GithubDownloads::Uploader.new
+ uploader.authorize
+ uploader
+end
+
+def upload_file(uploader, filename, description, file)
+ print "Uploading #{filename}..."
+ if uploader.upload_file(filename, description, file)
+ puts "Success"
+ else
+ puts "Failure"
+ end
+end
+
+desc "Strip trailing whitespace for JavaScript files in packages"
+task :strip_whitespace do
+ Dir["packages/**/*.js"].each do |name|
+ body = File.read(name)
+ File.open(name, "w") do |file|
+ file.write body.gsub(/ +\n/, "\n")
+ end
+ end
+end
+
+desc "Build ember-data.js"
+task :dist do
+ puts "Building Ember Data..."
+ pipeline.invoke
+ puts "Done"
+end
+
+desc "Clean build artifacts from previous builds"
+task :clean do
+ puts "Cleaning build..."
+ pipeline.clean
+ puts "Done"
+end
+
+desc "Upload latest Ember Data build to GitHub repository"
+task :upload_latest => :dist do
+ uploader = setup_uploader
+
+ # Upload minified first, so non-minified shows up on top
+ upload_file(uploader, 'ember-data-latest.min.js', "Ember Data Master (minified)", "dist/ember-data.min.js")
+ upload_file(uploader, 'ember-data-latest.js', "Ember Data Master", "dist/ember-data.js")
+end
+
+desc "Run tests with phantomjs"
+task :test, [:suite] => :dist do |t, args|
+ unless system("which phantomjs > /dev/null 2>&1")
+ abort "PhantomJS is not installed. Download from http://phantomjs.org"
+ end
+
+ suites = {
+ :default => ["package=all"],
+ :all => ["package=all",
+ "package=all&jquery=1.7.2&nojshint=true",
+ "package=all&extendprototypes=true&nojshint=true",
+ "package=all&extendprototypes=true&jquery=1.7.2&nojshint=true",
+ "package=all&dist=build&nojshint=true"]
+ }
+
+ if ENV['TEST']
+ opts = [ENV['TEST']]
+ else
+ suite = args[:suite] || :default
+ opts = suites[suite.to_sym]
+ end
+
+ unless opts
+ abort "No suite named: #{suite}"
+ end
+
+ cmd = opts.map do |opt|
+ "phantomjs tests/qunit/run-qunit.js \"file://localhost#{File.dirname(__FILE__)}/tests/index.html?#{opt}\""
+ end.join(' && ')
+
+ # Run the tests
+ puts "Running: #{opts.join(", ")}"
+ success = system(cmd)
+
+ if success
+ puts "Tests Passed".green
+ else
+ puts "Tests Failed".red
+ exit(1)
+ end
+end
+
+desc "Automatically run tests (Mac OS X only)"
+task :autotest do
+ system("kicker -e 'rake test' packages")
+end
+
+task :default => :dist
Oops, something went wrong.

0 comments on commit 8972b20

Please sign in to comment.