Permalink
Browse files

Switch to ember-dev for tooling

  • Loading branch information...
1 parent 14c3d14 commit 3e779046d1f542577273d3466c07f5416bd50ca4 @wagenet wagenet committed Feb 6, 2013
View
@@ -1,97 +1,11 @@
-Encoding.default_external = "UTF-8" if defined?(Encoding)
-
-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
+instance_eval File.read(EmberDev.support_path.join('Assetfile'))
distros = {
:full => %w(ember-data)
}
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 "ember-data-tests.js"
- end
-
- match "ember-data-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 "ember-data-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 = "ember-data"
@@ -101,14 +15,19 @@ distros.each do |name, modules|
concat(module_paths){ ["#{name}.js", "#{name}.prod.js"] }
end
+ match "#{name}.js" do
+ filter VersionInfo
+ end
+
# Strip dev code
match "#{name}.prod.js" do
- filter(EmberProductionFilter) { ["#{name}.prod.js", "#{name}.min.js"] }
+ filter(EmberStripDebugMessagesFilter) { ["#{name}.prod.js", "min/#{name}.js"] }
end
# Minify
- match "#{name}.min.js" do
+ match "min/#{name}.js" do
uglify{ "#{name}.min.js" }
+ filter VersionInfo
filter EmberLicenseFilter
end
end
View
12 Gemfile
@@ -1,14 +1,4 @@
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"
-gem "rake"
-
-group :development do
- gem "rack"
- gem "github_downloads"
- gem "ember-docs", :git => "https://github.com/emberjs/docs-generator.git"
- gem "kicker"
-end
+gem "ember-dev", :git => "https://github.com/emberjs/ember-dev.git", :branch => "master"
View
@@ -1,81 +1,58 @@
GIT
- remote: https://github.com/emberjs/docs-generator.git
- revision: cfbc2a3aabc08de305224b290ad8f37f3ef5f847
+ remote: https://github.com/emberjs/ember-dev.git
+ revision: a8d16307d65fc4ccb8395a53bb7654b7a084cefc
+ branch: master
specs:
- ember-docs (0.1)
+ ember-dev (0.1)
+ colored
+ execjs
+ grit
+ kicker
rack
- thor
+ rake-pipeline (~> 0.8.0)
+ rake-pipeline-web-filters (~> 0.7.0)
+ uglifier
GIT
remote: https://github.com/livingsocial/rake-pipeline.git
- revision: 543f4322fe70facee9572d29ddabf7f090dad68a
+ revision: ee992cbcda5172075062be035bcbef2cf1b0ff5d
specs:
- rake-pipeline (0.6.0)
- rake (~> 0.9.0)
+ rake-pipeline (0.8.0)
+ json
+ rake (~> 10.0.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)
+ diff-lcs (1.2.0)
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.5)
- rb-fsevent (0.9.1)
- rest-client (1.6.7)
- mime-types (>= 1.16)
- thor (0.15.2)
- uglifier (1.0.4)
+ grit (2.5.0)
+ diff-lcs (~> 1.1)
+ mime-types (~> 1.15)
+ posix-spawn (~> 0.3.6)
+ json (1.7.6)
+ kicker (2.6.1)
+ listen
+ listen (0.7.2)
+ mime-types (1.20.1)
+ multi_json (1.5.0)
+ posix-spawn (0.3.6)
+ rack (1.5.1)
+ rake (10.0.3)
+ rake-pipeline-web-filters (0.7.0)
+ rack
+ rake-pipeline (~> 0.6)
+ thor (0.17.0)
+ uglifier (1.3.0)
execjs (>= 0.3.0)
- multi_json (>= 1.0.2)
+ multi_json (~> 1.0, >= 1.0.2)
PLATFORMS
ruby
DEPENDENCIES
- colored
- ember-docs!
- github_downloads
- kicker
- rack
- rake
+ ember-dev!
rake-pipeline!
- rake-pipeline-web-filters!
- uglifier (~> 1.0.3)
View
116 Rakefile
@@ -1,32 +1,5 @@
-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
-
-def git_update
-end
+require "ember-dev/tasks"
directory "tmp"
@@ -52,89 +25,10 @@ file "packages/ember/lib/main.js" => [:update_ember_git, "tmp/ember.js/dist/embe
end
end
-namespace :ember do
- desc "Update Ember.js to master (packages/ember/lib/main.js)"
- task :update => "packages/ember/lib/main.js"
-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
+task :update_ember => "packages/ember/lib/main.js"
- 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 :clean => "ember:clean"
+task :dist => "ember:dist"
+task :test, [:suite] => "ember:test"
task :default => :dist
Oops, something went wrong.

3 comments on commit 3e77904

Contributor

bradfol replied Feb 6, 2013

Removed all the QUnit tests?
Maybe Readme needs to be updated for how to run tests now

Owner

wagenet replied Feb 7, 2013

Contributor

bradfol replied Feb 8, 2013

Got it.

Made a small correction to the URL, and added some more instructions. Pull Request

Please sign in to comment.