bjork 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bjork.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Daniel Moore
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Bjork
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'bjork'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install bjork
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ task :default => :start
4
+
5
+ task :start do
6
+ require "bjork"
7
+
8
+ Bjork::Server.run!
9
+ end
data/bjork.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bjork/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bjork"
8
+ spec.version = Bjork::VERSION
9
+ spec.authors = ["Daniel Moore"]
10
+ spec.email = ["yahivin@gmail.com"]
11
+ spec.description = %q{A magical singing HTML5 game server}
12
+ spec.summary = %q{A magical singing HTML5 game server}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_dependency "sinatra"
25
+ spec.add_dependency "coffee-script"
26
+ spec.add_dependency "haml"
27
+ spec.add_dependency "sprockets"
28
+ spec.add_dependency "shank"
29
+ spec.add_dependency "jquery-source", "1.9.1.1"
30
+ end
@@ -0,0 +1,65 @@
1
+ # TODO: Not currently working with concatenated Sprockets files :(
2
+
3
+ # Monkey patch some source maps
4
+ module CoffeeScript
5
+ class << self
6
+ def compile(script, options = {})
7
+ script = script.read if script.respond_to?(:read)
8
+
9
+ if options.key?(:no_wrap) && !options.key?(:bare)
10
+ options[:bare] = options[:no_wrap]
11
+ else
12
+ options[:bare] = false
13
+ end
14
+
15
+ # TODO: Better root_dir
16
+ root_dir = Pathname("radical")
17
+
18
+ pathname = options[:pathname]
19
+ if pathname.nil?
20
+ return Source.context.call("CoffeeScript.compile", script, options)
21
+ else
22
+ clean_name = pathname.basename.to_s.split(".").first
23
+
24
+ rel_path = if pathname.to_s.start_with?(Bundler.bundle_path.to_s)
25
+ Pathname('bundler').join(pathname.relative_path_from(Bundler.bundle_path)).dirname
26
+ else
27
+ pathname.relative_path_from(root_dir).dirname
28
+ end
29
+
30
+ chill_dir = root_dir.join("source_maps")
31
+ map_dir = chill_dir.join(rel_path)
32
+ map_dir.mkpath
33
+
34
+ map_file = map_dir.join("#{clean_name}.map")
35
+ coffee_file = map_dir.join("#{clean_name}.coffee")
36
+
37
+ options[:sourceMap] = true
38
+ # coffee requires filename option to work with source maps (see http://coffeescript.org/documentation/docs/coffee-script.html#section-4)
39
+ options[:filename] = "#{clean_name}.coffee"
40
+ # specify coffee source file explicitly (see http://coffeescript.org/documentation/docs/sourcemap.html#section-8)
41
+ options[:sourceFiles] = ["/#{coffee_file.relative_path_from(chill_dir)}"]
42
+ ret = Source.context.call("CoffeeScript.compile", script, options)
43
+
44
+ coffee_file.open('w') {|f| f.puts script }
45
+ map_file.open('w') {|f| f.puts ret["v3SourceMap"]}
46
+
47
+ comment = "//@ sourceMappingURL=/#{map_file.relative_path_from(chill_dir)}\n"
48
+ return ret['js'] + comment
49
+ end
50
+
51
+ end
52
+ end
53
+ end
54
+
55
+ # Monkeypatch this method to include the scripts' pathname
56
+ require 'tilt/coffee'
57
+
58
+ module Tilt
59
+ class CoffeeScriptTemplate < Template
60
+ def evaluate(scope, locals, &block)
61
+ pathname = scope.respond_to?(:pathname) ? scope.pathname : nil
62
+ @output ||= CoffeeScript.compile(data, options.merge(:pathname => pathname))
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,3 @@
1
+ module Bjork
2
+ VERSION = "0.0.2"
3
+ end
data/lib/bjork.rb ADDED
@@ -0,0 +1,75 @@
1
+ require "bjork/version"
2
+
3
+ require "sinatra"
4
+
5
+ require 'coffee-script'
6
+ require "haml"
7
+
8
+ require "sprockets"
9
+
10
+ require "shank"
11
+ require "jquery-source"
12
+
13
+ # Defaulting to bare compilation
14
+ Tilt::CoffeeScriptTemplate.default_bare = true
15
+
16
+ module Bjork
17
+ class Server < Sinatra::Base
18
+ local_folder = File.expand_path(File.dirname(__FILE__))
19
+
20
+ # TODO: Add a file cache to speed up sproco
21
+ set :assets, Sprockets::Environment.new
22
+
23
+ # Configure sprockets
24
+ settings.assets.append_path "#{local_folder}/javascripts"
25
+ settings.assets.append_path "#{local_folder}/stylesheets"
26
+
27
+ # External Sources
28
+ settings.assets.append_path "source"
29
+
30
+ set :public_folder, local_folder
31
+
32
+ set :haml, { :format => :html5 }
33
+
34
+ get "/" do
35
+ haml :index
36
+ end
37
+
38
+ get "/javascripts/*.*" do
39
+ content_type "application/javascript"
40
+
41
+ path, extension = params[:splat]
42
+
43
+ settings.assets["#{path}.#{extension}"]
44
+ end
45
+
46
+ get "/stylesheets/:file.css" do
47
+ content_type "text/css"
48
+ settings.assets["#{params[:file]}.css"]
49
+ end
50
+
51
+ get '/debug_console' do
52
+ haml :debug
53
+ end
54
+
55
+ post '/debug_console' do
56
+ begin
57
+ eval(params[:text]).inspect
58
+ rescue Exception => e
59
+ ([e.message] + e.backtrace).join("\n")
60
+ end
61
+ end
62
+
63
+ # TODO: handle saving directory
64
+ # post '/levels' do
65
+ # data = params["data"]
66
+ # name = params["name"]
67
+
68
+ # File.open("levels/#{name}.json", 'w') do |file|
69
+ # file.write(data)
70
+ # end
71
+
72
+ # 200
73
+ # end
74
+ end
75
+ end
@@ -0,0 +1,105 @@
1
+ /* line 17, ../../../../.rvm/gems/ruby-1.9.2-p180/bundler/gems/compass-91a748a91636/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
2
+ html, body, div, span, applet, object, iframe,
3
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
4
+ a, abbr, acronym, address, big, cite, code,
5
+ del, dfn, em, img, ins, kbd, q, s, samp,
6
+ small, strike, strong, sub, sup, tt, var,
7
+ b, u, i, center,
8
+ dl, dt, dd, ol, ul, li,
9
+ fieldset, form, label, legend,
10
+ table, caption, tbody, tfoot, thead, tr, th, td,
11
+ article, aside, canvas, details, embed,
12
+ figure, figcaption, footer, header, hgroup,
13
+ menu, nav, output, ruby, section, summary,
14
+ time, mark, audio, video {
15
+ margin: 0;
16
+ padding: 0;
17
+ border: 0;
18
+ font-size: 100%;
19
+ font: inherit;
20
+ vertical-align: baseline;
21
+ }
22
+
23
+ /* line 20, ../../../../.rvm/gems/ruby-1.9.2-p180/bundler/gems/compass-91a748a91636/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
24
+ body {
25
+ line-height: 1;
26
+ }
27
+
28
+ /* line 22, ../../../../.rvm/gems/ruby-1.9.2-p180/bundler/gems/compass-91a748a91636/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
29
+ ol, ul {
30
+ list-style: none;
31
+ }
32
+
33
+ /* line 24, ../../../../.rvm/gems/ruby-1.9.2-p180/bundler/gems/compass-91a748a91636/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
34
+ table {
35
+ border-collapse: collapse;
36
+ border-spacing: 0;
37
+ }
38
+
39
+ /* line 26, ../../../../.rvm/gems/ruby-1.9.2-p180/bundler/gems/compass-91a748a91636/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
40
+ caption, th, td {
41
+ text-align: left;
42
+ font-weight: normal;
43
+ vertical-align: middle;
44
+ }
45
+
46
+ /* line 28, ../../../../.rvm/gems/ruby-1.9.2-p180/bundler/gems/compass-91a748a91636/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
47
+ q, blockquote {
48
+ quotes: none;
49
+ }
50
+ /* line 101, ../../../../.rvm/gems/ruby-1.9.2-p180/bundler/gems/compass-91a748a91636/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
51
+ q:before, q:after, blockquote:before, blockquote:after {
52
+ content: "";
53
+ content: none;
54
+ }
55
+
56
+ /* line 30, ../../../../.rvm/gems/ruby-1.9.2-p180/bundler/gems/compass-91a748a91636/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
57
+ a img {
58
+ border: none;
59
+ }
60
+
61
+ /* line 114, ../../../../.rvm/gems/ruby-1.9.2-p180/bundler/gems/compass-91a748a91636/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
62
+ article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary {
63
+ display: block;
64
+ }
65
+
66
+ /* line 12, ../../app/assets/stylesheets/partials/_contents_centered.sass */
67
+ .contents_centered {
68
+ position: relative;
69
+ }
70
+ /* line 4, ../../app/assets/stylesheets/partials/_contents_centered.sass */
71
+ .contents_centered > canvas {
72
+ margin: auto;
73
+ position: absolute;
74
+ top: 0;
75
+ bottom: 0;
76
+ left: 0;
77
+ right: 0;
78
+ }
79
+
80
+ /* line 8, ../../app/assets/stylesheets/partials/_ellipsis.sass */
81
+ .ellipsis {
82
+ white-space: nowrap;
83
+ overflow: hidden;
84
+ -o-text-overflow: ellipsis;
85
+ -ms-text-overflow: ellipsis;
86
+ text-overflow: ellipsis;
87
+ -moz-binding: url('/assets/xml/ellipsis.xml#ellipsis');
88
+ }
89
+
90
+ /* line 5, ../../app/assets/stylesheets/project.sass */
91
+ html {
92
+ background-color: #00010d;
93
+ color: #b0d6ee;
94
+ height: 100%;
95
+ overflow: auto;
96
+ }
97
+
98
+ /* line 11, ../../app/assets/stylesheets/project.sass */
99
+ body {
100
+ font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
101
+ font-size: 12px;
102
+ line-height: 1.5;
103
+ min-height: 100%;
104
+ position: relative;
105
+ }
@@ -0,0 +1,25 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{:"http-equiv"=>"Content-Type", :content=>"text/html;charset=UTF-8"}
5
+ %title Debug Console
6
+ %script{:type=>"text/javascript", :src=>"javascripts/jquery.js"}
7
+ %body
8
+ #eval_text
9
+ %textarea#text{:rows => 10, :style => 'width: 100%;'}
10
+
11
+ #button
12
+ %button{:onclick => 'eval_text()'} eval
13
+
14
+ %pre#result{:style => 'color: green; background-color: black; padding: 8px; display: none;'}
15
+
16
+ :javascript
17
+ $(document).ready(function() {
18
+ $("#text").focus();
19
+ });
20
+
21
+ function eval_text() {
22
+ $("#result").show();
23
+ $("#result").html('...');
24
+ $("#result").load('/debug_console', {text: $('#text').val()});
25
+ }
@@ -0,0 +1,12 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %link{:href => "stylesheets/all.css", :media => "screen", :rel => "stylesheet", :type => "text/css"}
5
+ %script{:src => "javascripts/jquery.js", :type => "text/javascript"}
6
+ %body.contents_centered
7
+ %canvas{:height => "720", :width => "1280"}
8
+ :javascript
9
+ BASE_URL = "./"; MTIME = "1331090712";
10
+
11
+ %script{:src => "javascripts/shank.js"}
12
+ %script{:src => "javascripts/main.js"}
data//360/237/230/216 ADDED
@@ -0,0 +1,9 @@
1
+ # coding: utf-8
2
+
3
+ 😎,😺,👮 = %w.🌟 💩 ⛵.;def 😃💬(*👝);puts 👝;end;
4
+
5
+ 😃💬 😎
6
+
7
+ 😃💬 😺
8
+
9
+ 😃💬 👮
metadata ADDED
@@ -0,0 +1,187 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bjork
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Daniel Moore
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: sinatra
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: coffee-script
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: haml
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: sprockets
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: shank
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: jquery-source
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - '='
132
+ - !ruby/object:Gem::Version
133
+ version: 1.9.1.1
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - '='
140
+ - !ruby/object:Gem::Version
141
+ version: 1.9.1.1
142
+ description: A magical singing HTML5 game server
143
+ email:
144
+ - yahivin@gmail.com
145
+ executables: []
146
+ extensions: []
147
+ extra_rdoc_files: []
148
+ files:
149
+ - .gitignore
150
+ - Gemfile
151
+ - LICENSE.txt
152
+ - README.md
153
+ - Rakefile
154
+ - bjork.gemspec
155
+ - lib/bjork.rb
156
+ - lib/bjork/source_maps.rb
157
+ - lib/bjork/version.rb
158
+ - lib/stylesheets/all.css
159
+ - lib/views/debug.haml
160
+ - lib/views/index.haml
161
+ - ! "\U0001F60E"
162
+ homepage: ''
163
+ licenses:
164
+ - MIT
165
+ post_install_message:
166
+ rdoc_options: []
167
+ require_paths:
168
+ - lib
169
+ required_ruby_version: !ruby/object:Gem::Requirement
170
+ none: false
171
+ requirements:
172
+ - - ! '>='
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ none: false
177
+ requirements:
178
+ - - ! '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ requirements: []
182
+ rubyforge_project:
183
+ rubygems_version: 1.8.24
184
+ signing_key:
185
+ specification_version: 3
186
+ summary: A magical singing HTML5 game server
187
+ test_files: []