This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
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
Showing
25 changed files
with
2,769 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,19 @@ | ||
|
||
.bpm | ||
.bundle | ||
bin/ | ||
*.bpkg | ||
Gemfile.lock | ||
spade-boot.js | ||
docs/jsdoc | ||
docs/output | ||
lib/*/tests/all.js | ||
lib/*/tests/qunit* | ||
test_*.html | ||
tests/source | ||
tmp | ||
dist/ | ||
examples/source/ | ||
.DS_Store | ||
NERD_tre* | ||
assets |
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,60 @@ | ||
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 "examples/source" | ||
|
||
|
||
match "*/{lib,tests}/**/*.js" do | ||
filter RegisterWrapper # used to select a specific test to be run | ||
# filter RequireRewrite | ||
filter ConcatFilter do |filename| | ||
filename =~ %r{/tests/} ? "ember-mk-tests.js" : "ember-mk.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,6 @@ | ||
|
||
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,15 @@ | ||
# A sample Gemfile | ||
source "http://rubygems.org" | ||
|
||
#gem "rake" | ||
|
||
|
||
gem "uglifier", "~> 1.0.3" | ||
gem "execjs", "~> 1.2.6" | ||
|
||
|
||
gem "rack" | ||
gem "rake-pipeline", :git => "https://github.com/livingsocial/rake-pipeline.git" | ||
|
||
|
||
gem "sproutcore", :git => "git://github.com/wycats/abbot-from-scratch.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,82 @@ | ||
require "bundler/setup" | ||
require "sproutcore" | ||
require "erb" | ||
require "uglifier" | ||
|
||
LICENSE = File.read("generators/license.js") | ||
|
||
## Some SproutCore modules expect an exports object to exist. Until bpm exists, | ||
## just mock this out for now. | ||
|
||
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_sc_assert(file) | ||
result = File.read(file) | ||
result.gsub!(%r{^(\s)+sc_assert\((.*)\).*$}, "") | ||
result | ||
end | ||
|
||
def uglify(file) | ||
uglified = Uglifier.compile(File.read(file)) | ||
"#{LICENSE}\n#{uglified}" | ||
end | ||
|
||
SproutCore::Compiler.intermediate = "tmp/intermediate" | ||
SproutCore::Compiler.output = "tmp/static" | ||
|
||
def compile_package_task(package) | ||
js_tasks = SproutCore::Compiler::Preprocessors::JavaScriptTask.with_input "packages/#{package}/lib/**/*.js", "." | ||
SproutCore::Compiler::CombineTask.with_tasks js_tasks, "#{SproutCore::Compiler.intermediate}/#{package}" | ||
end | ||
|
||
namespace :ember do | ||
task :mk => compile_package_task("ember-mk") | ||
end | ||
|
||
task :build => ["ember:mk"] | ||
|
||
file "dist/ember-mk.js" => :build do | ||
puts "Generating ember-mk.js" | ||
|
||
mkdir_p "dist" | ||
|
||
File.open("dist/ember-mk.js", "w") do |file| | ||
file.puts strip_require("tmp/static/ember-mk.js") | ||
end | ||
end | ||
|
||
# Minify dist/ember-mk.js to dist/ember-mk.min.js | ||
file "dist/ember-mk.min.js" => "dist/ember-mk.js" do | ||
puts "Generating ember-mk.min.js" | ||
|
||
File.open("dist/ember.prod.js", "w") do |file| | ||
file.puts strip_sc_assert("dist/ember-mk.js") | ||
end | ||
|
||
File.open("dist/ember-mk.min.js", "w") do |file| | ||
file.puts uglify("dist/ember-mk.js") | ||
end | ||
end | ||
|
||
desc "Clean build artifacts from previous builds" | ||
task :clean do | ||
sh "rm -rf tmp && rm -rf dist" | ||
end | ||
|
||
task :default => ["dist/ember-mk.min.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,46 @@ | ||
# Ember Mobile Kit | ||
|
||
The project publishs Mobile UI components to be used on multiple touch devices. | ||
|
||
The main idea behind: | ||
|
||
- Manage/Discuss the required features for a emberjs Mobile UIKit. | ||
- Reuse Mobile UIs components to be improved on its daily use. | ||
|
||
Initially, the project is not intented to be production ready, but a | ||
way to avoid developers rewrite from scratch what other developers have already done. | ||
|
||
# Features | ||
|
||
- Modal, Swipe and Tab Views. | ||
- Animation Manager. | ||
|
||
# How to Run/Build | ||
|
||
## Building Ember-mk | ||
|
||
Install gems with _bundle install_ and execute _rake_ task, ember-mk will be created on the _dist_ directory. | ||
Import the file to your project, on the correct order. | ||
|
||
|
||
##Examples | ||
|
||
run __bundle exec rackup__ | ||
|
||
http://localhost:9292/examples | ||
|
||
##Unit Tests | ||
|
||
run __bundle exec rackup__ | ||
|
||
Test the whole suite http://localhost:9292/examples/test.html | ||
|
||
Test only a specific test file (add test param: test location without extension) http://localhost:9292/examples/test.html?test=system/view_test | ||
|
||
If you want to test against other ember/jquery/ember-touchs version, deployed the js on the examples/assets directory. | ||
|
||
|
||
# TODO | ||
|
||
- Create own transform API to replace movejs. | ||
- Not implemented require pattern |
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,100 @@ | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title>QUnit Test Suite</title> | ||
<link rel="stylesheet" href="assets/qunit.css" type="text/css" media="screen"> | ||
|
||
<script type="text/javascript" src="assets/qunit.js"></script> | ||
<script type="text/javascript" src="assets/minispade.js"></script> | ||
|
||
<script type="text/javascript" src="assets/jquery-1.6.2.js"></script> | ||
<script type="text/javascript" src="assets/ember.js"></script> | ||
<script type="text/javascript" src="assets/ember-touch.js"></script> | ||
|
||
<script type="text/javascript" src="source/ember-mk.js"></script> | ||
<script type="text/javascript" src="source/ember-mk-tests.js"></script> | ||
</head> | ||
<body> | ||
<h1 id="qunit-header">QUnit Test Suite</h1> | ||
<h2 id="qunit-banner"></h2> | ||
<div id="qunit-testrunner-toolbar"></div> | ||
<h2 id="qunit-userAgent"></h2> | ||
<ol id="qunit-tests"></ol> | ||
<div id="qunit-fixture">test markup</div> | ||
|
||
<script type="text/javascript"> | ||
// Handle extending prototypes | ||
QUnit.config.urlConfig.push('extendprototypes'); | ||
|
||
window.ENV = window.ENV || {}; | ||
var extendPrototypes = location.search.match(/extendprototypes=([^&]+)/); | ||
ENV['EXTEND_PROTOTYPES'] = !!(extendPrototypes && decodeURIComponent(extendPrototypes[1])); | ||
|
||
|
||
// hack qunit to not suck for Ember objects | ||
var originalTypeof = QUnit.jsDump.typeOf; | ||
|
||
QUnit.jsDump.typeOf = function(obj) { | ||
if (Ember && Ember.Object && Ember.Object.detectInstance(obj)) { | ||
return "emberObject"; | ||
} | ||
|
||
return originalTypeof.call(this, obj); | ||
}; | ||
|
||
QUnit.jsDump.parsers.emberObject = function(obj) { | ||
return obj.toString(); | ||
} | ||
|
||
// Load Tests and Depenencies | ||
var packageName, re, match, moduleName, unique_test; | ||
|
||
|
||
var param_test = location.search.match(/test=([^&]+)/), unique_test; | ||
if ( param_test ) { | ||
unique_test = param_test[1]; | ||
} | ||
|
||
// There are no requires for these in the code | ||
//minispade.require('jquery-1.6.2/main'); | ||
//minispade.require('ember/main'); | ||
|
||
|
||
packageName = 'ember-mk'; | ||
re = new RegExp('^'+packageName+'/([^/]+)'); | ||
|
||
//minispade.require(packageName+'/main'); | ||
|
||
for (moduleName in minispade.modules) { | ||
if (!minispade.modules.hasOwnProperty(moduleName)) { continue; } | ||
|
||
match = moduleName.match(re); | ||
if (match && match[1] === 'tests') { | ||
|
||
if ( unique_test ) { | ||
|
||
var test_location = moduleName.replace('ember-mk/tests/', ''); | ||
//console.log(test_location); | ||
//console.log(unique_test); | ||
if ( unique_test === test_location ) { | ||
minispade.require(moduleName); | ||
} | ||
} else { | ||
|
||
//console.log(moduleName); | ||
minispade.require(moduleName); | ||
} | ||
|
||
|
||
} | ||
} | ||
|
||
|
||
|
||
|
||
</script> | ||
|
||
</body> | ||
</html> |
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 @@ | ||
|
||
minispade.register('ember-mk/tests/proof_test', function(exports) { | ||
|
||
module("MK Test", { | ||
setup: function() { | ||
}, | ||
|
||
teardown: function() { | ||
} | ||
}); | ||
|
||
test("still much to do", function() { | ||
|
||
ok(true); | ||
|
||
}); | ||
|
||
|
||
}); |
Oops, something went wrong.