Permalink
Browse files

update with latest build tools from ember

  • Loading branch information...
1 parent 601cbe2 commit 1a2c4b195e6facd6ca574bcc7c3d98006885fb4e @tchak tchak committed Mar 29, 2012
Showing with 5,273 additions and 400 deletions.
  1. +13 −12 .jshintrc
  2. +25 −2 Assetfile
  3. +8 −8 Gemfile.lock
  4. +16 −19 Rakefile
  5. +13 −0 config.ru
  6. +35 −8 packages/ember-data/tests/unit/model_test.js
  7. +566 −235 packages/ember/lib/main.js
  8. +80 −18 tests/index.html
  9. +4,433 −0 tests/jshint.js
  10. +84 −98 tests/qunit/run-qunit.js
View
@@ -1,30 +1,31 @@
{
"predef": [
- "jasmine",
- "spyOn",
- "it",
"console",
- "describe",
- "expect",
- "beforeEach",
- "waits",
- "waitsFor",
- "runs",
"Ember",
"DS",
+ "Handlebars",
+ "Metamorph",
"ember_assert",
+ "ember_warn",
+ "ember_deprecate",
+ "ember_deprecateFunc",
"require",
"equal",
"test",
+ "testBoth",
+ "testWithDefault",
"raises",
"deepEqual",
"start",
"stop",
"ok",
- "strictEqual"
+ "strictEqual",
+ "module",
+ "expect",
+ "minispade"
],
- "node" : true,
+ "node" : false,
"es5" : true,
"browser" : true,
@@ -35,7 +36,7 @@
"eqeqeq": true,
"evil": true,
"forin": false,
- "immed": true,
+ "immed": false,
"laxbreak": false,
"newcap": true,
"noarg": true,
View
@@ -1,7 +1,6 @@
require "rake-pipeline-web-filters"
require "json"
require "uglifier"
-require "./neuter"
class EmberProductionFilter < Rake::Pipeline::Filter
def generate_output(inputs, output)
@@ -23,6 +22,16 @@ class EmberLicenseFilter < Rake::Pipeline::Filter
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(ember-data)
}
@@ -43,6 +52,10 @@ input "packages" do
concat "ember-data-tests.js"
end
+
+ match "ember-data-tests.js" do
+ filter JSHintRC
+ end
end
input "packages" do
@@ -61,7 +74,17 @@ end
input "packages" do
match "*/lib/**/main.js" do
- neuter do |filename|
+ 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
View
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/livingsocial/rake-pipeline.git
- revision: f71caeb1406dafd6af5ab8453db8c5ac53947c92
+ revision: b70ca6cad7655e58d13031f3e24df7dfc74f9030
specs:
rake-pipeline (0.6.0)
rake (~> 0.9.0)
@@ -16,7 +16,7 @@ GIT
GIT
remote: https://github.com/wycats/rake-pipeline-web-filters.git
- revision: fe752a8cfdbb318b746fd76fd3c10dd8b8f29891
+ revision: ba0b8a00356b4c854930a8e849b5629d51ffd70f
specs:
rake-pipeline-web-filters (0.6.0)
rack
@@ -27,25 +27,25 @@ GEM
specs:
colored (1.2)
confparser (0.0.2.1)
- execjs (1.2.13)
+ execjs (1.3.0)
multi_json (~> 1.0)
faster_xml_simple (0.5.0)
libxml-ruby (>= 0.3.8.4)
github-upload (0.0.2)
confparser
net-github-upload (>= 0.0.6)
httpclient (2.2.4)
- json (1.6.4)
+ json (1.6.6)
kicker (2.5.0)
rb-fsevent
- libxml-ruby (2.2.2)
- multi_json (1.0.4)
- net-github-upload (0.0.7)
+ libxml-ruby (2.3.2)
+ multi_json (1.2.0)
+ net-github-upload (0.0.8)
faster_xml_simple
httpclient
json
nokogiri (>= 1.4.0)
- nokogiri (1.5.0)
+ nokogiri (1.5.2)
rack (1.4.1)
rake (0.9.2.2)
rb-fsevent (0.9.0)
View
@@ -1,11 +1,15 @@
-abort "Please use Ruby 1.9 to build Ember.js Data!" if RUBY_VERSION !~ /^1\.9/
+abort "Please use Ruby 1.9 to build Ember.js!" if RUBY_VERSION !~ /^1\.9/
require "bundler/setup"
require "erb"
require 'rake-pipeline'
require "ember_docs/cli"
require "colored"
+def pipeline
+ Rake::Pipeline::Project.new("Assetfile")
+end
+
desc "Strip trailing whitespace for JavaScript files in packages"
task :strip_whitespace do
Dir["packages/**/*.js"].each do |name|
@@ -18,29 +22,18 @@ end
desc "Build ember-data.js"
task :dist do
- Rake::Pipeline::Project.new("Assetfile").invoke
+ puts "Building Ember Data..."
+ pipeline.invoke
+ puts "Done"
end
desc "Clean build artifacts from previous builds"
task :clean do
- sh "rm -rf tmp dist tests/ember-data-tests.js"
-end
-
-desc "Run jshint"
-task :jshint do
- unless system("which jshint > /dev/null 2>&1")
- abort "Please install jshint. `npm install -g jshint`"
- end
-
- if system("jshint packages/ember*")
- puts "The JavaScript is clean".green
- else
- puts "The JavaScript is dirty".red
- exit(1)
- end
+ puts "Cleaning build..."
+ pipeline.clean
+ puts "Done"
end
-
desc "Run tests with phantomjs"
task :test, [:suite] => :dist do |t, args|
unless system("which phantomjs > /dev/null 2>&1")
@@ -49,7 +42,11 @@ task :test, [:suite] => :dist do |t, args|
suites = {
:default => ["package=all"],
- :all => ["package=all", "package=all&jquery=1.6.4", "package=all&extendprototypes=true", "package=all&extendprototypes=true&jquery=1.6.4"]
+ :all => ["package=all",
+ "package=all&jquery=1.6.4&nojshint=true",
+ "package=all&extendprototypes=true&nojshint=true",
+ "package=all&extendprototypes=true&jquery=1.6.4&nojshint=true",
+ "package=all&dist=build&nojshint=true"]
}
suite = args[:suite] || :default
View
@@ -2,5 +2,18 @@ require 'bundler/setup'
require 'rake-pipeline'
require 'rake-pipeline/middleware'
+class NoCache
+ def initialize(app)
+ @app = app
+ end
+
+ def call(env)
+ @app.call(env).tap do |status, headers, body|
+ headers["Cache-Control"] = "no-store"
+ end
+ end
+end
+
+use NoCache
use Rake::Pipeline::Middleware, "Assetfile"
run Rack::Directory.new('.')
@@ -1,6 +1,6 @@
var get = Ember.get, set = Ember.set, getPath = Ember.getPath;
-var store, Person;
+var Person, store, array;
module("DS.Model", {
setup: function() {
@@ -12,8 +12,8 @@ module("DS.Model", {
},
teardown: function() {
- store = null;
Person = null;
+ store = null;
}
});
@@ -144,13 +144,33 @@ test("retrieving properties should return the same value as they would if they w
})
});
+ // TODO :
+ // Investigate why this test fail with DS.attr `name` and jshint because of this :
+ // if (typeof String.prototype.name !== 'function') {
+ // String.prototype.name = function () {
+ // if (ix.test(this)) {
+ // return this;
+ // }
+ // if (nx.test(this)) {
+ // return '"' + this.replace(nxg, function (a) {
+ // var c = escapes[a];
+ // if (c) {
+ // return c;
+ // }
+ // return '\\u' + ('0000' + a.charCodeAt().toString(16)).slice(-4);
+ // }) + '"';
+ // }
+ // return '"' + this + '"';
+ // };
+ // }
+
var Person = DS.Model.extend({
- name: DS.attr('string')
+ firstName: DS.attr('string')
});
var record = store.find(Person, 1);
- strictEqual(get(record, 'name'), null, "returns null value");
+ strictEqual(get(record, 'firstName'), null, "returns null value");
});
test("it should cache attributes", function() {
@@ -183,16 +203,17 @@ test("it can specify which key to use when looking up properties on the hash", f
equal(get(record, 'name'), "Pete", "retrieves correct value");
});
-
-
-var Person, store, array;
-
module("DS.Model updating", {
setup: function() {
array = [{ id: 1, name: "Scumbag Dale" }, { id: 2, name: "Scumbag Katz" }, { id: 3, name: "Scumbag Bryn" }];
Person = DS.Model.extend({ name: DS.attr('string') });
store = DS.Store.create();
store.loadMany(Person, array);
+ },
+ teardown: function() {
+ Person = null;
+ store = null;
+ array = null;
}
});
@@ -258,6 +279,7 @@ test("when a DS.Model updates its attributes, its changes affect its filtered Ar
equal(get(people, 'length'), 0, "there are now no items");
});
+
module("with a simple Person model", {
setup: function() {
array = [{ id: 1, name: "Scumbag Dale" }, { id: 2, name: "Scumbag Katz" }, { id: 3, name: "Scumbag Bryn" }];
@@ -266,6 +288,11 @@ module("with a simple Person model", {
});
store = DS.Store.create();
store.loadMany(Person, array);
+ },
+ teardown: function() {
+ Person = null;
+ store = null;
+ array = null;
}
});
Oops, something went wrong.

0 comments on commit 1a2c4b1

Please sign in to comment.