Permalink
Browse files

110/120 core tests passing on QUnit [ci skip]

  • Loading branch information...
1 parent 4d9d567 commit 5a96fcd71ab3dc019dae32463aeee394b59053ed @collin committed May 3, 2012
Showing with 2,697 additions and 412 deletions.
  1. +4 −0 .gitignore
  2. +1 −0 .rvmrc
  3. +4 −0 .stitchignore
  4. +14 −1 Assetfile
  5. +4 −1 Gemfile
  6. +28 −0 Gemfile.lock
  7. +113 −3 Rakefile
  8. +62 −0 alpha_simprini.erb
  9. +16 −0 convert_test_to_qunit.rb
  10. +1 −0 docs/AlphaSimprini-docs.js
  11. +52 −0 docs/ShareJS Structure.coffee
  12. +12 −0 script/package
  13. +6 −2 src/alpha_simprini.coffee
  14. +1 −1 src/alpha_simprini/core/callbacks.coffee
  15. +4 −2 src/alpha_simprini/core/model/share.coffee
  16. +44 −0 src/alpha_simprini/core/string.coffee
  17. +2 −2 src/alpha_simprini/string.coffee
  18. +2 −4 test/client/application.coffee
  19. +2 −6 test/client/binding.coffee
  20. +4 −8 test/client/binding/check_box.coffee
  21. +2 −6 test/client/binding/edit_line.coffee
  22. +6 −10 test/client/binding/field.coffee
  23. +3 −7 test/client/binding/input.coffee
  24. +6 −10 test/client/binding/many.coffee
  25. +1 −5 test/client/binding/model.coffee
  26. +4 −8 test/client/binding/one.coffee
  27. +5 −9 test/client/binding/select.coffee
  28. +4 −5 test/client/binding_group.coffee
  29. +2 −4 test/client/dom.coffee
  30. +18 −20 test/client/models/targets.coffee
  31. +16 −17 test/client/view.coffee
  32. +3 −6 test/client/view_events.coffee
  33. +2 −6 test/client/view_model.coffee
  34. +0 −1 test/client/views/panel.coffee
  35. +0 −1 test/client/views/region.coffee
  36. +1 −3 test/client_helper.coffee
  37. +0 −3 test/core.coffee
  38. +0 −3 test/core/callbacks.coffee
  39. +8 −11 test/core/collection.coffee
  40. +7 −10 test/core/filtered_collection.coffee
  41. +0 −3 test/core/instance_methods.coffee
  42. +1 −5 test/core/model.coffee
  43. +15 −14 test/core/model/rest.coffee
  44. +27 −28 test/core/model/share.coffee
  45. +3 −7 test/core/models/grouping.coffee
  46. +1 −4 test/core/models/radio_selection_model.coffee
  47. +19 −24 test/core/properties/belongs_to.coffee
  48. +0 −4 test/core/properties/field.coffee
  49. +63 −66 test/core/properties/has_many.coffee
  50. +27 −30 test/core/properties/has_one.coffee
  51. +11 −14 test/core/properties/virtual_property.coffee
  52. +0 −4 test/core/state_machine.coffee
  53. +22 −34 test/helper.coffee
  54. +59 −0 test/index.html
  55. +232 −0 test/qunit/qunit.css
  56. +1,660 −0 test/qunit/qunit.js
  57. +92 −0 test/qunit/run-qunit.js
  58. +1 −0 version.rb
View
@@ -2,3 +2,7 @@
examples/todo/node_modules/
.DS_Store
lib/
+dist/
+tmp/
+lib/
+vendor/
View
1 .rvmrc
@@ -0,0 +1 @@
+rvm use 1.9.2-p290
View
@@ -0,0 +1,4 @@
+/share/src/server
+coffee-script
+/bin/
+/socket.io-client/lib/vendor/
View
@@ -13,7 +13,20 @@ input "lib" do
id
}
- concat "AlphaSimprini-spade.js"
+ concat "alpha_simprini-spade.js"
end
end
+input "./", "alpha_simprini.erb" do
+ require "./version"
+ filter(Rake::Pipeline::Web::Filters::TiltFilter, {}, Object) do |input|
+ "alpha_simprini.html"
+ end
+end
+
+# output "dist/test"
+# input "tmp/test" do
+# match "**/*.js" do
+# neuter
+# end
+# end
View
@@ -5,4 +5,7 @@ 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 "coffee-script"
+gem "coffee-script"
+gem "github_uploader", "~> 0.1.0", require: false
+gem "html_package", "~> 0.0.3"
+gem "tilt"
View
@@ -17,17 +17,42 @@ GIT
GEM
remote: https://rubygems.org/
specs:
+ addressable (2.2.7)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.2.0)
colored (1.2)
execjs (1.3.0)
multi_json (~> 1.0)
+ faraday (0.7.6)
+ addressable (~> 2.2)
+ multipart-post (~> 1.1)
+ rack (~> 1.1)
+ github_api (0.4.11)
+ faraday (~> 0.7.6)
+ hashie (~> 1.2.0)
+ multi_json (~> 1.3)
+ nokogiri (~> 1.5.2)
+ oauth2 (~> 0.5.2)
+ github_uploader (0.1.0)
+ github_api (= 0.4.11)
+ rest-client
+ hashie (1.2.0)
+ html_package (0.0.3)
+ mime-types (1.18)
multi_json (1.3.2)
+ multipart-post (1.1.5)
+ nokogiri (1.5.2)
+ oauth2 (0.5.2)
+ faraday (~> 0.7)
+ multi_json (~> 1.0)
rack (1.4.1)
rake (0.9.2.2)
+ rest-client (1.6.7)
+ mime-types (>= 1.16)
thor (0.14.6)
+ tilt (1.3.3)
uglifier (1.0.4)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
@@ -38,6 +63,9 @@ PLATFORMS
DEPENDENCIES
coffee-script
colored
+ github_uploader (~> 0.1.0)
+ html_package (~> 0.0.3)
rake-pipeline!
rake-pipeline-web-filters!
+ tilt
uglifier (~> 1.0.3)
View
116 Rakefile
@@ -1,6 +1,11 @@
-abort "Use Ruby 1.9 to build Pathology" unless RUBY_VERSION["1.9"]
+abort "Use Ruby 1.9 to build Alpha Simprini" unless RUBY_VERSION["1.9"]
require 'rake-pipeline'
+require 'colored'
+
+def err(*args)
+ STDERR.puts(*args)
+end
def build
Rake::Pipeline::Project.new("Assetfile")
@@ -24,12 +29,13 @@ desc "Compile CoffeeScript"
task :coffeescript => :clean do
puts "Compiling CoffeeScript"
`coffee -co lib/ src/`
+ `coffee -co tmp/test test/`
puts "Done"
end
-desc "Build Pathology"
+desc "Build Alpha Simprini"
task :dist => [:coffeescript, :strip_whitespace] do
- puts "Building Pathology..."
+ puts "Building Alpha Simprini..."
build.invoke
puts "Done"
end
@@ -41,3 +47,107 @@ task :clean do
build.clean
puts "Done"
end
+
+desc "upload versions"
+task :upload => :test do
+ load "./version.rb"
+ uploader = GithubUploader.setup_uploader
+ GithubUploader.upload_file uploader, "Alpha Simprini-#{AS_VERSION}.js", "Alpha Simprini #{AS_VERSION}", "dist/Alpha Simprini.js"
+ GithubUploader.upload_file uploader, "Alpha Simprini-#{AS_VERSION}-spade.js", "Alpha Simprini #{AS_VERSION} (minispade)", "dist/Alpha Simprini-spade.js"
+ GithubUploader.upload_file uploader, "Alpha Simprini-#{AS_VERSION}.html", "Alpha Simprini #{AS_VERSION} (html_package)", "dist/Alpha Simprini.html"
+
+ GithubUploader.upload_file uploader, 'Alpha Simprini-latest.js', "Current Alpha Simprini", "dist/Alpha Simprini.js"
+ GithubUploader.upload_file uploader, 'Alpha Simprini-latest-spade.js', "Current Alpha Simprini (minispade)", "dist/Alpha Simprini-spade.js"
+end
+
+desc "Create json document object"
+task :jsondoc => [:phantomjs, :dist] do
+ cmd = %|phantomjs src/gather-docs.coffee "file://localhost#{File.dirname(__FILE__)}/src/gather-docs.html"|
+
+ err "Running tests"
+ err cmd
+ success = `#{cmd}`
+
+ if success
+ err "Built JSON".green
+ FileUtils.safe_unlink "dist/docs.json"
+ File.open("dist/docs.json", "w") {|f| f.write success }
+ else
+ err "Failed".red
+ exit(1)
+ end
+
+end
+
+task :phantomjs do
+ unless system("which phantomjs > /dev/null 2>&1")
+ abort "PhantomJS is not installed. Download from http://phantomjs.org"
+ end
+end
+
+desc "Install development dependencies with hip"
+task :vendor => :dist do
+ system "hip install --file=dist/alpha_simprini.html --out=./vendor --dev"
+end
+
+def test_url(tests)
+ url = "file://localhost#{File.dirname(__FILE__)}/test/index.html"
+ files = Dir["tmp/test/**/*.js"]
+ if tests == :all
+ files.reject!(/helper\.js/)
+ else
+ files = Dir["tmp/test/**/*.js"]
+ files = files.find_all do |test|
+ test[tests]
+ end
+ end
+ url += "?tests=#{files.join ','}"
+ url
+end
+
+def exec_test(tests=:all)
+ cmd = %|phantomjs ./test/qunit/run-qunit.js "#{test_url(tests)}"|
+
+ # Run the tests
+ err "Running tests"
+ err cmd
+
+ if success = system(cmd)
+ err "Tests Passed".green
+ else
+ err "Tests Failed".red
+ exit(1)
+ end
+end
+
+task :exec_test, [:tests] do |t, args|
+ exec_test(args[:tests])
+end
+
+task :open_test, [:tests] do |t, args|
+ tests = args[:tests] || :all
+ system %|echo "#{test_url(tests)}" \|pbcopy|
+ puts "url for tests is now in your clipboard".green
+end
+
+desc "Run tests with phantomjs"
+task :test, [:tests] => [:phantomjs, :dist, :vendor] do |t, args|
+ exec_test(args[:tests] || :all)
+end
+
+desc "tag/upload release"
+task :release, [:version] => :test do |t, args|
+ unless args[:version] and args[:version].match(/^[\d]+\.[\d]+\.[\d].*$/)
+ raise "SPECIFY A VERSION curent version: #{AS_VERSION}"
+ end
+ File.open("./version.rb", "w") do |f|
+ f.write %|AS_VERSION = "#{args[:version]}"|
+ end
+
+ system "git add version.rb"
+ system "git commit -m 'bumped version to #{args[:version]}'"
+ system "git tag #{args[:version]}"
+ system "git push origin master"
+ system "git push origin #{args[:version]}"
+ Rake::Task[:upload].invoke
+end
View
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/package+html; charset=UTF-8">
+ <title>Alpha Simprini</title>
+ <meta name="author" content="Collin Miller">
+ <meta name="version" content="<%= AS_VERSION %>">
+ <meta name="description" content="
+ Alpha Simprini is a browser application framework.
+ It is a terrible awful mish-mash of ideas from Backbone and SproutCore/Ember.js
+ ">
+
+ <link rel="self" type="text/spade+javascript"
+ href="http://cloud.github.com/downloads/collin/alpha_simprini/alpha_simprini-<%= AS_VERSION %>-spade.js">
+
+ <link rel="dependency" type="text/spade+javascript"
+ href="http://spader.herokuapp.com/spades/jwerty-0.3.0.js">
+
+ <link rel="dependency" type="text/package+html"
+ href="http://cloud.github.com/downloads/collin/pathology/pathology-0.3.0.html">
+
+ <link rel="dependency" type="text/package+html"
+ href="http://cloud.github.com/downloads/collin/knead/knead-0.3.1.html">
+
+ <link rel="dependency" type="text/package+html"
+ href="http://cloud.github.com/downloads/collin/taxi/taxi-0.3.1.html">
+
+ <link rel="dependency" type="text/spade+javascript"
+ href="http://spader.herokuapp.com/spades/fleck-0.5.1.js">
+
+ <link rel="dependency" type="text/spade+javascript"
+ href="http://spader.herokuapp.com/spades/sharejs-0.5.0-pre.js">
+
+ <link rel="dependency" type="text/spade+javascript"
+ href="http://spader.herokuapp.com/spades/sharejs.json-0.5.0-pre.js">
+
+ <link rel="dependency" type="text/spade+javascript"
+ href="http://spader.herokuapp.com/spades/bcsocket-0.4.0.js">
+
+ <link rel="dependency" type="text/spade+javascript"
+ href="http://spader.herokuapp.com/spades/rangy-core-1.2.3.js">
+
+<!-- <link rel="dependency" type="text/package+html"
+ href="http://cloud.github.com/downloads/collin/knead/knead-0.3.0.html">
+ -->
+</head>
+<body>
+
+ <h1> Alpha Simprini</h1>
+
+ <p>
+ Alpha Simprini is a browser application framework.
+ It is a terrible awful mish-mash of ideas from Backbone and SproutCore/Ember.js
+ </p>
+
+ <section id="authors">
+ <h1>Authors</h1>
+ <a href="mailto:collintmiller@gmail.com">Collin Miller</a>
+ </section>
+
+</body>
+</html>
View
@@ -0,0 +1,16 @@
+files = Dir["test/**/*.coffee"]
+for file in files
+ content = open(file).read
+
+ new_content = content.
+ gsub(': (test) ', ', '). # there is no test in qunit
+ gsub('test.', ''). # but the api is the same
+ gsub(/done\(\)\n?/, ''). # only you never call done
+ gsub(/^[ ]+\"/, 'test "') # and each test goes into the test method
+
+ File.open file, "w" do |file|
+ file.write new_content
+ end
+
+ puts file
+end

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,52 @@
+# LAYOUT DOCUMENT
+# {
+
+# # REFERENCED DOCUMENTS
+# "index" {
+# ID: "Pasteup.Models.Element.Root"
+# ID: "Pasteup.Models.Element.Composition"
+# ID: "Pasteup.Models.Element.Section"
+# ID: "Pasteup.Models.Element.Section"
+# }
+
+# # SELF
+# SELF: ID
+
+# # EMBEDDED DATA
+# "Pasteup.Models.Layout": {
+# ID: {
+# images: [ID, ID, ID, ID, ID]
+# compositions: [ID, ID, ID, ID]
+# root: [ID]
+# }
+# }
+
+# "Pasteup.Models.Image": {
+# ID: {}
+# ID: {}
+# ID: {}
+# ID: {}
+# }
+
+# "Pasteup.Models.Presenter": {
+# ID: {}
+# ID: {}
+# ID: {}
+# ID: {}
+# }
+
+# "Pasteup.Models.ComponentClasses": {
+# ID: {}
+# ID: {}
+# ID: {}
+# ID: {}
+# }
+
+# "Pasteup.Models.ValueClasses": {
+# ID: {}
+# ID: {}
+# ID: {}
+# ID: {}
+# }
+# }
+
View
@@ -0,0 +1,12 @@
+#! /usr/bin/env coffee
+pathname = require "path"
+ModuleLoader = require "module_loader"
+
+loader = new ModuleLoader
+ serve: false
+ env: "production"
+ module_root: pathname.resolve("./node_modules")
+ ignorefile: pathname.resolve("./.stitchignore")
+ packages: "jquery underscore underscore.string rangy-core knead jwerty pathology taxi alpha_simprini fleck".split(" ")
+
+console.log loader.build_universe()
Oops, something went wrong.

0 comments on commit 5a96fcd

Please sign in to comment.