Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit 12f46b74d1e6f358e2e6fa74210e01b46dcac886 @maccman committed Mar 10, 2012
Showing with 22,963 additions and 0 deletions.
  1. +18 −0 Cakefile
  2. +21 −0 Gemfile
  3. +109 −0 Gemfile.lock
  4. +6 −0 Guardfile
  5. +41 −0 README.md
  6. +5 −0 Rakefile
  7. +54 −0 app.rb
  8. BIN assets/.DS_Store
  9. BIN assets/images/bg-grid.png
  10. BIN assets/javascripts/.DS_Store
  11. BIN assets/javascripts/app/.DS_Store
  12. +45 −0 assets/javascripts/app/controllers/canvas.module.coffee
  13. +9 −0 assets/javascripts/app/controllers/element.module.coffee
  14. +5 −0 assets/javascripts/app/controllers/elements/rectangle.module.coffee
  15. +6 −0 assets/javascripts/app/controllers/elements/triangle.module.coffee
  16. +4 −0 assets/javascripts/app/controllers/stage.module.coffee
  17. +10 −0 assets/javascripts/app/index.module.coffee
  18. +9 −0 assets/javascripts/application.js
  19. +3 −0 assets/stylesheets/app/stage.css.styl
  20. +3 −0 assets/stylesheets/application.css
  21. +9 −0 config.ru
  22. +6 −0 public/assets/application.css
  23. +11,286 −0 public/assets/application.js
  24. BIN public/assets/bg-grid.png
  25. +161 −0 public/assets/gfx/gfx.cube.js
  26. +291 −0 public/assets/gfx/gfx.effects.js
  27. +52 −0 public/assets/gfx/gfx.flip.js
  28. +81 −0 public/assets/gfx/gfx.overlay.js
  29. +9 −0 public/index.html
  30. +86 −0 vendor/assets/javascripts/gfx.coffee
  31. +156 −0 vendor/assets/javascripts/gfx/effects.coffee
  32. +9,266 −0 vendor/assets/javascripts/jquery.js
  33. +528 −0 vendor/assets/javascripts/spine.coffee
  34. +204 −0 vendor/assets/javascripts/spine/ajax.coffee
  35. +42 −0 vendor/assets/javascripts/spine/list.coffee
  36. +16 −0 vendor/assets/javascripts/spine/local.coffee
  37. +82 −0 vendor/assets/javascripts/spine/manager.coffee
  38. +144 −0 vendor/assets/javascripts/spine/relation.coffee
  39. +145 −0 vendor/assets/javascripts/spine/route.coffee
  40. +36 −0 vendor/assets/javascripts/spine/tabs.coffee
  41. +15 −0 vendor/assets/javascripts/spine/tmpl.coffee
@@ -0,0 +1,18 @@
+{print} = require 'util'
+{spawn} = require 'child_process'
+
+task 'build', 'Build lib/ from src/', ->
+ coffee = spawn 'coffee', ['-c', '-o', 'lib', 'src']
+ coffee.stderr.on 'data', (data) ->
+ process.stderr.write data.toString()
+ coffee.stdout.on 'data', (data) ->
+ print data.toString()
+ coffee.on 'exit', (code) ->
+ callback?() if code is 0
+
+task 'watch', 'Watch src/ for changes', ->
+ coffee = spawn 'coffee', ['-w', '-c', '-o', 'lib', 'src']
+ coffee.stderr.on 'data', (data) ->
+ process.stderr.write data.toString()
+ coffee.stdout.on 'data', (data) ->
+ print data.toString()
21 Gemfile
@@ -0,0 +1,21 @@
+source :rubygems
+
+gem 'sinatra', :require => 'sinatra/base'
+gem 'rack'
+gem 'sinatra-contrib'
+gem 'json'
+gem 'thin'
+
+gem 'coffee-script'
+gem 'eco'
+gem 'uglifier'
+gem 'sprockets'
+gem 'sprockets-commonjs', :git => 'git://github.com/maccman/sprockets-commonjs.git'
+gem 'stylus'
+
+group :test, :development do
+ gem 'growl'
+ gem 'guard-sprockets2', :git => 'git://github.com/maccman/guard-sprockets2.git'
+ gem 'rb-fsevent'
+ gem 'ruby-debug19', :require => 'ruby-debug'
+end
@@ -0,0 +1,109 @@
+GIT
+ remote: git://github.com/maccman/guard-sprockets2.git
+ revision: c5ba5979959b480f90e59e015ebc855a70e6e50a
+ specs:
+ guard-sprockets2 (0.0.2)
+ guard
+ sprockets (~> 2.0)
+
+GIT
+ remote: git://github.com/maccman/sprockets-commonjs.git
+ revision: 627dc367068299e514b2186b986c3ebb4c5cde6e
+ specs:
+ sprockets-commonjs (0.0.1)
+ sprockets (~> 2.3.1)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ archive-tar-minitar (0.5.2)
+ backports (2.3.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.2.0)
+ columnize (0.3.6)
+ daemons (1.1.8)
+ eco (1.0.0)
+ coffee-script
+ eco-source
+ execjs
+ eco-source (1.1.0.rc.1)
+ eventmachine (0.12.10)
+ execjs (1.3.0)
+ multi_json (~> 1.0)
+ ffi (1.0.11)
+ growl (1.0.3)
+ guard (1.0.1)
+ ffi (>= 0.5.0)
+ thor (~> 0.14.6)
+ hike (1.2.1)
+ json (1.6.5)
+ linecache19 (0.5.12)
+ ruby_core_source (>= 0.1.4)
+ multi_json (1.1.0)
+ rack (1.4.1)
+ rack-protection (1.2.0)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rb-fsevent (0.9.0)
+ ruby-debug-base19 (0.11.25)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby_core_source (>= 0.1.4)
+ ruby-debug19 (0.11.6)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby-debug-base19 (>= 0.11.19)
+ ruby_core_source (0.1.5)
+ archive-tar-minitar (>= 0.5.2)
+ sinatra (1.3.2)
+ rack (~> 1.3, >= 1.3.6)
+ rack-protection (~> 1.2)
+ tilt (~> 1.3, >= 1.3.3)
+ sinatra-contrib (1.3.1)
+ backports (>= 2.0)
+ eventmachine
+ rack-protection
+ rack-test
+ sinatra (~> 1.3.0)
+ tilt (~> 1.3)
+ sprockets (2.3.1)
+ hike (~> 1.2)
+ multi_json (~> 1.0)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ stylus (0.4.1)
+ execjs
+ stylus-source
+ stylus-source (0.24.0)
+ thin (1.3.1)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
+ thor (0.14.6)
+ tilt (1.3.3)
+ uglifier (1.2.3)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ coffee-script
+ eco
+ growl
+ guard-sprockets2!
+ json
+ rack
+ rb-fsevent
+ ruby-debug19
+ sinatra
+ sinatra-contrib
+ sprockets
+ sprockets-commonjs!
+ stylus
+ thin
+ uglifier
@@ -0,0 +1,6 @@
+require './app'
+
+guard 'sprockets2', :sprockets => App.sprockets, :precompile => App.precompile do
+ watch(%r{^assets/.+$})
+ watch('app.rb')
+end
@@ -0,0 +1,41 @@
+
+* Resize
+* Move
+* Text
+
+
+##Canvas CSS properties
+
+background-clip: border-box;
+background-color: transparent;
+background-image: none;
+background-position: 0% 0%;
+background-repeat: repeat;
+background-size: auto;
+
+border-bottom-color: #555;
+border-bottom-left-radius: 0px;
+border-bottom-right-radius: 0px;
+border-bottom-style: none;
+border-bottom-width: 0px;
+
+border-left-color: #555;
+border-left-style: none;
+border-left-width: 0px;
+border-right-color: #555;
+border-right-style: none;
+border-right-width: 0px;
+border-top-color: #555;
+border-top-left-radius: 0px;
+border-top-right-radius: 0px;
+border-top-style: none;
+border-top-width: 0px;
+
+box-shadow: none;
+color: #555;
+
+filter: none;
+height: 20px;
+
+width: 848px;
+z-index: auto;
@@ -0,0 +1,5 @@
+namespace :macgap do
+ task :build do
+ `macgap --name Stylo ./public`
+ end
+end
54 app.rb
@@ -0,0 +1,54 @@
+require 'rubygems'
+require 'bundler'
+require 'pathname'
+require 'sinatra/json'
+require 'sinatra/reloader'
+
+Bundler.require
+
+require 'sprockets/commonjs'
+require 'stylus/tilt'
+require 'stylus/import_processor'
+
+module AssetHelpers
+ def asset_path(source)
+ '/assets/' + settings.sprockets.find_asset(source).digest_path
+ end
+end
+
+class App < Sinatra::Base
+ set :root, Pathname(File.expand_path('../', __FILE__))
+ set :raise_errors, true
+ set :show_exceptions, true
+ set :sprockets, Sprockets::Environment.new(root)
+ set :precompile, [ /\w+\.(?!js|css).+/, /application.(css|js)$/ ]
+
+ configure do
+ sprockets.append_path(root.join('assets', 'javascripts'))
+ sprockets.append_path(root.join('assets', 'stylesheets'))
+ sprockets.append_path(root.join('assets', 'images'))
+
+ sprockets.append_path(root.join('vendor', 'assets', 'javascripts'))
+ sprockets.append_path(root.join('vendor', 'assets', 'stylesheets'))
+
+ sprockets.register_engine '.styl', Tilt::StylusTemplate
+ sprockets.register_preprocessor 'text/css', Stylus::ImportProcessor
+
+ sprockets.append_path(Sprockets::CommonJS::ASSETS_PATH)
+
+ sprockets.context_class.instance_eval do
+ include AssetHelpers
+ end
+ end
+
+ helpers Sinatra::JSON
+
+ helpers do
+ include AssetHelpers
+
+ def url(path)
+ base = "#{request.scheme}://#{request.env['HTTP_HOST']}"
+ base + path
+ end
+ end
+end
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,45 @@
+Element = require('app/controllers/element')
+
+class Canvas extends Element
+ tag: 'canvas'
+
+ points: []
+
+ constructor: ->
+ super
+ @ctx = @el[0].getContext('2d')
+
+ css: ->
+ super
+ @paint()
+
+ paint: ->
+ first = @points[0]
+ points = @points[1...@points.length]
+ return unless first
+
+ @ctx.beginPath()
+ @ctx.moveTo(first...)
+
+ for point in @points
+ @ctx.lineTo(point...)
+
+ @ctx.fill()
+
+ width: (val) ->
+
+ height: (val) ->
+
+ backgroundImage: (val) ->
+
+ backgroundColor: (val) ->
+
+ borderBottom: (val) ->
+
+ boxShadow: (val) ->
+
+ borderRadius: (val) ->
+
+
+
+module.exports = Canvas
@@ -0,0 +1,9 @@
+class Element extends Spine.Controller
+ css: (types) ->
+ for key, value of types
+ @[key]?(value) or @el.css(key, value)
+
+ rotate: (val) ->
+ @el.transform(rotate: val)
+
+module.exports = Element
@@ -0,0 +1,5 @@
+Element = require('app/controllers/element')
+
+class Rectangle extends Element
+
+module.exports = Rectangle
@@ -0,0 +1,6 @@
+Element = require('app/controllers/canvas')
+
+class Triangle extends Canvas
+ points: [1, 2, 3]
+
+module.exports = Rectangle
@@ -0,0 +1,4 @@
+class Stage extends Spine.Controller
+ className: 'stage'
+
+module.exports = Stage
@@ -0,0 +1,10 @@
+Stage = require('app/controllers/stage')
+
+class App extends Spine.Controller
+ className: 'app'
+
+ constructor: ->
+ super
+ @append(@stage = new Stage)
+
+module.exports = App
@@ -0,0 +1,9 @@
+//= require commonjs
+//= require jquery
+//= require spine
+//= require spine/manager
+//= require spine/route
+//= require spine/relation
+//= require gfx
+//= require gfx/effects
+//= require_tree ./app
@@ -0,0 +1,3 @@
+#app .stage {
+ background: url('bg-grid.png')
+}
@@ -0,0 +1,3 @@
+/*
+= require_tree ./app
+*/
@@ -0,0 +1,9 @@
+require './app'
+
+map "/assets" do
+ run App.sprockets
+end
+
+map "/" do
+ run App
+end
@@ -0,0 +1,6 @@
+#app .stage {
+ background: url("bg-grid.png");
+}
+/*
+
+*/
Oops, something went wrong.

0 comments on commit 12f46b7

Please sign in to comment.