-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4eee4ff
Showing
24 changed files
with
27,332 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
bin/ | ||
.bundle | ||
tmp/ | ||
tests/source/ | ||
dist/ | ||
|
||
.DS_Store | ||
.project | ||
.rvmrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
LICENSE = File.read("generators/license.js") | ||
|
||
class RegisterWrapper < Filter | ||
def generate_output(inputs, output) | ||
inputs.each do |input| | ||
id = input.path.sub('/lib/','/').sub(/\.js$/, '') | ||
code = "\nminispade.register('#{id}', function(exports) {\n#{input.read}\n});\n" | ||
output.write code | ||
end | ||
end | ||
end | ||
|
||
class RequireRewrite < Filter | ||
def generate_output(inputs, output) | ||
inputs.each do |input| | ||
result = input.read | ||
result.gsub!(%r{^\s*require\(['"]([^'"]*)['"]\);?\s*}) do |s| | ||
module_id = $1 | ||
module_id.sub!(/^\./, File.dirname(input.path)) | ||
module_id << '/main' if module_id !~ /\// | ||
module_id.sub!('~tests','tests') | ||
"minispade.require('#{module_id}');" | ||
end | ||
output.write result | ||
end | ||
end | ||
end | ||
|
||
input "packages" | ||
output "tests/source" | ||
|
||
match "*/{lib,tests}/**/*.js" do | ||
filter RegisterWrapper | ||
filter RequireRewrite | ||
filter ConcatFilter do |filename| | ||
filename =~ %r{/tests/} ? "ember-tests.js" : "ember.js" | ||
end | ||
end | ||
|
||
# Hack to ignore certain files | ||
|
||
match "**/*.{json,md}" do | ||
filter ConcatFilter, "trash" | ||
end | ||
|
||
match "**/README" do | ||
filter ConcatFilter, "trash" | ||
end | ||
|
||
match "*/*.js" do | ||
filter ConcatFilter, "trash" | ||
end | ||
|
||
# vim: filetype=ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
source "http://rubygems.org" | ||
|
||
gem "sproutcore", :git => "https://github.com/wycats/abbot-from-scratch.git" | ||
gem "uglifier", "~> 1.0.3" | ||
gem "execjs", "~> 1.2.6" | ||
gem "rack" | ||
gem "rake-pipeline", :git => "https://github.com/livingsocial/rake-pipeline.git" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
GIT | ||
remote: https://github.com/livingsocial/rake-pipeline.git | ||
revision: 7f0b86214c97efec64907f8d83933b3d82667d5b | ||
specs: | ||
rake-pipeline (0.5.0) | ||
rake (~> 0.9.0) | ||
|
||
GIT | ||
remote: https://github.com/wycats/abbot-from-scratch.git | ||
revision: 29dfaa6c3c120847e61f742f74c414e4872cc142 | ||
specs: | ||
sproutcore (0.0.1) | ||
|
||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
execjs (1.2.12) | ||
multi_json (~> 1.0) | ||
multi_json (1.0.4) | ||
rack (1.3.5) | ||
rake (0.9.2.2) | ||
uglifier (1.0.4) | ||
execjs (>= 0.3.0) | ||
multi_json (>= 1.0.2) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
execjs (~> 1.2.6) | ||
rack | ||
rake-pipeline! | ||
sproutcore! | ||
uglifier (~> 1.0.3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (C) 2011 by Gordon L. Hempton | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## Ember Layout | ||
|
||
Provides an intuitive layout mechanism for Ember.js. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
abort "Please use Ruby 1.9 to build Ember.js!" if RUBY_VERSION !~ /^1\.9/ | ||
|
||
require "bundler/setup" | ||
require "erb" | ||
require "uglifier" | ||
|
||
# for now, the SproutCore compiler will be used to compile Ember.js | ||
require "sproutcore" | ||
|
||
LICENSE = File.read("generators/license.js") | ||
|
||
## Some Ember modules expect an exports object to exist. Mock it out. | ||
|
||
module SproutCore | ||
module Compiler | ||
class Entry | ||
def body | ||
"\n(function(exports) {\n#{@raw_body}\n})({});\n" | ||
end | ||
end | ||
end | ||
end | ||
|
||
## HELPERS ## | ||
|
||
def strip_require(file) | ||
result = File.read(file) | ||
result.gsub!(%r{^\s*require\(['"]([^'"])*['"]\);?\s*}, "") | ||
result | ||
end | ||
|
||
def strip_ember_assert(file) | ||
result = File.read(file) | ||
result.gsub!(%r{^(\s)+ember_assert\((.*)\).*$}, "") | ||
result | ||
end | ||
|
||
def uglify(file) | ||
uglified = Uglifier.compile(File.read(file)) | ||
"#{LICENSE}\n#{uglified}" | ||
end | ||
|
||
# Set up the intermediate and output directories for the interim build process | ||
|
||
SproutCore::Compiler.intermediate = "tmp/intermediate" | ||
SproutCore::Compiler.output = "tmp/static" | ||
|
||
# Create a compile task for an Ember package. This task will compute | ||
# dependencies and output a single JS file for a package. | ||
def compile_package_task(input, output=input) | ||
js_tasks = SproutCore::Compiler::Preprocessors::JavaScriptTask.with_input "packages/#{input}/lib/**/*.js", "." | ||
SproutCore::Compiler::CombineTask.with_tasks js_tasks, "#{SproutCore::Compiler.intermediate}/#{output}" | ||
end | ||
|
||
## TASKS ## | ||
|
||
# Create ember:package tasks for each of the Ember packages | ||
namespace :ember do | ||
%w(layout).each do |package| | ||
task package => compile_package_task("ember-#{package}", "ember-#{package}") | ||
end | ||
end | ||
|
||
# Create a build task that depends on all of the package dependencies | ||
task :build => ["ember:layout"] | ||
|
||
distributions = { | ||
"ember-layout" => ["ember-layout"] | ||
} | ||
|
||
distributions.each do |name, libraries| | ||
# Strip out require lines. For the interim, requires are | ||
# precomputed by the compiler so they are no longer necessary at runtime. | ||
file "dist/#{name}.js" => :build do | ||
puts "Generating #{name}.js" | ||
|
||
mkdir_p "dist" | ||
|
||
File.open("dist/#{name}.js", "w") do |file| | ||
libraries.each do |library| | ||
file.puts strip_require("tmp/static/#{library}.js") | ||
end | ||
end | ||
end | ||
|
||
# Minified distribution | ||
file "dist/#{name}.min.js" => "dist/#{name}.js" do | ||
require 'zlib' | ||
|
||
print "Generating #{name}.min.js... " | ||
STDOUT.flush | ||
|
||
File.open("dist/#{name}.prod.js", "w") do |file| | ||
file.puts strip_ember_assert("dist/#{name}.js") | ||
end | ||
|
||
minified_code = uglify("dist/#{name}.prod.js") | ||
File.open("dist/#{name}.min.js", "w") do |file| | ||
file.puts minified_code | ||
end | ||
|
||
gzipped_kb = Zlib::Deflate.deflate(minified_code).bytes.count / 1024 | ||
|
||
puts "#{gzipped_kb} KB gzipped" | ||
|
||
rm "dist/#{name}.prod.js" | ||
end | ||
end | ||
|
||
|
||
desc "Build Ember.js" | ||
task :dist => distributions.keys.map {|name| "dist/#{name}.min.js"} | ||
|
||
desc "Clean build artifacts from previous builds" | ||
task :clean do | ||
sh "rm -rf tmp && rm -rf dist" | ||
end | ||
|
||
|
||
|
||
### RELEASE TASKS ### | ||
|
||
EMBER_VERSION = File.read("VERSION").strip | ||
|
||
namespace :release do | ||
|
||
def pretend? | ||
ENV['PRETEND'] | ||
end | ||
|
||
namespace :framework do | ||
desc "Update repo" | ||
task :update do | ||
puts "Making sure repo is up to date..." | ||
system "git pull" unless pretend? | ||
end | ||
|
||
desc "Update Changelog" | ||
task :changelog do | ||
last_tag = `git describe --tags --abbrev=0`.strip | ||
puts "Getting Changes since #{last_tag}" | ||
|
||
cmd = "git log #{last_tag}..HEAD --format='* %s'" | ||
puts cmd | ||
|
||
changes = `#{cmd}` | ||
output = "*Ember #{EMBER_VERSION} (#{Time.now.strftime("%B %d, %Y")})*\n\n#{changes}\n" | ||
|
||
unless pretend? | ||
File.open('CHANGELOG', 'r+') do |file| | ||
current = file.read | ||
file.pos = 0; | ||
file.puts output | ||
file.puts current | ||
end | ||
else | ||
puts output.split("\n").map!{|s| " #{s}"}.join("\n") | ||
end | ||
end | ||
|
||
desc "bump the version to the one specified in the VERSION file" | ||
task :bump_version, :version do | ||
puts "Bumping to version: #{EMBER_VERSION}" | ||
|
||
unless pretend? | ||
# Bump the version of each component package | ||
Dir["packages/ember*/package.json", "ember.json"].each do |package| | ||
contents = File.read(package) | ||
contents.gsub! %r{"version": .*$}, %{"version": "#{EMBER_VERSION}",} | ||
contents.gsub! %r{"(ember-?\w*)": [^\n\{,]*(,?)$} do | ||
%{"#{$1}": "#{EMBER_VERSION}"#{$2}} | ||
end | ||
|
||
File.open(package, "w") { |file| file.write contents } | ||
end | ||
end | ||
end | ||
|
||
desc "Commit framework version bump" | ||
task :commit do | ||
puts "Commiting Version Bump" | ||
unless pretend? | ||
sh "git reset" | ||
sh %{git add VERSION CHANGELOG packages/**/package.json} | ||
sh "git commit -m 'Version bump - #{EMBER_VERSION}'" | ||
end | ||
end | ||
|
||
desc "Tag new version" | ||
task :tag do | ||
puts "Tagging v#{EMBER_VERSION}" | ||
system "git tag v#{EMBER_VERSION}" unless pretend? | ||
end | ||
|
||
desc "Push new commit to git" | ||
task :push do | ||
puts "Pushing Repo" | ||
unless pretend? | ||
print "Are you sure you want to push the ember.js repo to github? (y/N) " | ||
res = STDIN.gets.chomp | ||
if res == 'y' | ||
system "git push" | ||
system "git push --tags" | ||
else | ||
puts "Not Pushing" | ||
end | ||
end | ||
end | ||
|
||
desc "Prepare for a new release" | ||
task :prepare => [:update, :changelog, :bump_version] | ||
|
||
desc "Commit the new release" | ||
task :deploy => [:commit, :tag, :push] | ||
end | ||
end | ||
|
||
task :default => :dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1.0.pre |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'rake-pipeline' | ||
require 'rake-pipeline/middleware' | ||
|
||
use Rake::Pipeline::Middleware, "Assetfile" | ||
run Rack::Directory.new('.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// ========================================================================== | ||
// Project: Ember Data | ||
// Copyright: ©2012 Gordon L. Hempton (http://codebrief.com) and Contributors | ||
// Portions ©2006-2011 Strobe Inc. | ||
// License: Licensed under MIT license (see license.js) | ||
// ========================================================================== | ||
|
Oops, something went wrong.