resin 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. data/README.markdown +52 -0
  2. data/amber/css/amber.css +519 -0
  3. data/amber/css/documentation.css +84 -0
  4. data/amber/css/profstef.css +75 -0
  5. data/amber/css/style.css +313 -0
  6. data/amber/images/amber.png +0 -0
  7. data/amber/images/amber_small.png +0 -0
  8. data/amber/images/off.png +0 -0
  9. data/amber/images/offHover.png +0 -0
  10. data/amber/images/presentation.png +0 -0
  11. data/amber/images/profstef.png +0 -0
  12. data/amber/images/sprite.png +0 -0
  13. data/amber/images/tinylogo.png +0 -0
  14. data/amber/images/twitterwall.png +0 -0
  15. data/amber/js/Additional-Examples.deploy.js +15 -0
  16. data/amber/js/Additional-Examples.js +21 -0
  17. data/amber/js/Benchfib.deploy.js +132 -0
  18. data/amber/js/Benchfib.js +167 -0
  19. data/amber/js/Canvas.deploy.js +1304 -0
  20. data/amber/js/Canvas.js +1885 -0
  21. data/amber/js/Compiler.deploy.js +1871 -0
  22. data/amber/js/Compiler.js +2616 -0
  23. data/amber/js/Documentation.deploy.js +961 -0
  24. data/amber/js/Documentation.js +1376 -0
  25. data/amber/js/Examples.deploy.js +53 -0
  26. data/amber/js/Examples.js +73 -0
  27. data/amber/js/IDE.deploy.js +3468 -0
  28. data/amber/js/IDE.js +4883 -0
  29. data/amber/js/Kernel-Announcements.deploy.js +107 -0
  30. data/amber/js/Kernel-Announcements.js +152 -0
  31. data/amber/js/Kernel-Classes.deploy.js +675 -0
  32. data/amber/js/Kernel-Classes.js +956 -0
  33. data/amber/js/Kernel-Collections.deploy.js +3273 -0
  34. data/amber/js/Kernel-Collections.js +4644 -0
  35. data/amber/js/Kernel-Exceptions.deploy.js +244 -0
  36. data/amber/js/Kernel-Exceptions.js +349 -0
  37. data/amber/js/Kernel-Methods.deploy.js +510 -0
  38. data/amber/js/Kernel-Methods.js +739 -0
  39. data/amber/js/Kernel-Objects.deploy.js +2698 -0
  40. data/amber/js/Kernel-Objects.js +3858 -0
  41. data/amber/js/Kernel-Tests.deploy.js +1419 -0
  42. data/amber/js/Kernel-Tests.js +1929 -0
  43. data/amber/js/Kernel-Transcript.deploy.js +142 -0
  44. data/amber/js/Kernel-Transcript.js +202 -0
  45. data/amber/js/SUnit.deploy.js +351 -0
  46. data/amber/js/SUnit.js +501 -0
  47. data/amber/js/amber.js +250 -0
  48. data/amber/js/boot.js +587 -0
  49. data/amber/js/compat.js +22 -0
  50. data/amber/js/init.js +8 -0
  51. data/amber/js/lib/CodeMirror/LICENSE +19 -0
  52. data/amber/js/lib/CodeMirror/amber.css +21 -0
  53. data/amber/js/lib/CodeMirror/codemirror.css +67 -0
  54. data/amber/js/lib/CodeMirror/codemirror.js +2144 -0
  55. data/amber/js/lib/CodeMirror/smalltalk.js +134 -0
  56. data/amber/js/lib/jQuery/jquery-1.4.4.min.js +167 -0
  57. data/amber/js/lib/jQuery/jquery-1.6.4.min.js +4 -0
  58. data/amber/js/lib/jQuery/jquery-ui-1.8.16.custom.min.js +791 -0
  59. data/amber/js/lib/jQuery/jquery.textarea.js +267 -0
  60. data/amber/js/lib/peg-0.6.2.min.js +2 -0
  61. data/amber/js/lib/showdown.js +419 -0
  62. data/amber/js/parser.js +4005 -0
  63. data/amber/js/parser.pegjs +220 -0
  64. data/amber/st/Benchfib.st +124 -0
  65. data/amber/st/Canvas.st +556 -0
  66. data/amber/st/Compiler.st +1425 -0
  67. data/amber/st/Documentation.st +758 -0
  68. data/amber/st/Examples.st +38 -0
  69. data/amber/st/IDE.st +2336 -0
  70. data/amber/st/Kernel-Announcements.st +61 -0
  71. data/amber/st/Kernel-Classes.st +403 -0
  72. data/amber/st/Kernel-Collections.st +1673 -0
  73. data/amber/st/Kernel-Exceptions.st +124 -0
  74. data/amber/st/Kernel-Methods.st +287 -0
  75. data/amber/st/Kernel-Objects.st +1489 -0
  76. data/amber/st/Kernel-Tests.st +892 -0
  77. data/amber/st/Kernel-Transcript.st +70 -0
  78. data/amber/st/SUnit.st +172 -0
  79. data/bin/runresin +12 -0
  80. data/lib/resin.rb +0 -0
  81. data/lib/resin/app/app.rb +121 -0
  82. data/lib/resin/app/views/index.haml +10 -0
  83. metadata +216 -0
@@ -0,0 +1,70 @@
1
+ Smalltalk current createPackage: 'Kernel-Transcript' properties: #{}!
2
+ Object subclass: #Transcript
3
+ instanceVariableNames: 'textarea'
4
+ category: 'Kernel-Transcript'!
5
+
6
+ Transcript class instanceVariableNames: 'current'!
7
+
8
+ !Transcript class methodsFor: 'instance creation'!
9
+
10
+ open
11
+ self current open
12
+ !
13
+
14
+ new
15
+ self shouldNotImplement
16
+ !
17
+
18
+ current
19
+ ^current
20
+ !
21
+
22
+ register: aTranscript
23
+ current := aTranscript
24
+ ! !
25
+
26
+ !Transcript class methodsFor: 'printing'!
27
+
28
+ show: anObject
29
+ self current show: anObject
30
+ !
31
+
32
+ cr
33
+ self current show: String cr
34
+ !
35
+
36
+ clear
37
+ self current clear
38
+ ! !
39
+
40
+ Object subclass: #ConsoleTranscript
41
+ instanceVariableNames: 'textarea'
42
+ category: 'Kernel-Transcript'!
43
+
44
+ !ConsoleTranscript methodsFor: 'actions'!
45
+
46
+ open
47
+ ! !
48
+
49
+ !ConsoleTranscript methodsFor: 'printing'!
50
+
51
+ clear
52
+ "no op"
53
+ !
54
+
55
+ cr
56
+ "no op"
57
+ !
58
+
59
+ show: anObject
60
+ | string |
61
+ string := anObject asString.
62
+ <console.log(String(string))>
63
+ ! !
64
+
65
+ !ConsoleTranscript class methodsFor: 'initialization'!
66
+
67
+ initialize
68
+ Transcript register: self new
69
+ ! !
70
+
@@ -0,0 +1,172 @@
1
+ Smalltalk current createPackage: 'SUnit' properties: #{}!
2
+ Object subclass: #TestCase
3
+ instanceVariableNames: 'testSelector'
4
+ category: 'SUnit'!
5
+
6
+ !TestCase methodsFor: 'accessing'!
7
+
8
+ setTestSelector: aSelector
9
+ testSelector := aSelector
10
+ !
11
+
12
+ selector
13
+ ^testSelector
14
+ ! !
15
+
16
+ !TestCase methodsFor: 'private'!
17
+
18
+ signalFailure: aString
19
+ TestFailure new
20
+ messageText: aString;
21
+ signal
22
+ ! !
23
+
24
+ !TestCase methodsFor: 'running'!
25
+
26
+ setUp
27
+ !
28
+
29
+ tearDown
30
+ !
31
+
32
+ runCaseFor: aTestResult
33
+ self setUp.
34
+ aTestResult increaseRuns.
35
+ self performTestFor: aTestResult.
36
+ self tearDown
37
+ !
38
+
39
+ performTestFor: aResult
40
+ [[self perform: self selector]
41
+ on: TestFailure do: [:ex | aResult addFailure: self]]
42
+ on: Error do: [:ex | aResult addError: self]
43
+ ! !
44
+
45
+ !TestCase methodsFor: 'testing'!
46
+
47
+ assert: aBoolean
48
+ self assert: aBoolean description: 'Assertion failed'
49
+ !
50
+
51
+ deny: aBoolean
52
+ self assert: aBoolean not
53
+ !
54
+
55
+ assert: expected equals: actual
56
+ ^ self assert: (expected = actual) description: 'Expected: ', expected asString, ' but was: ', actual asString
57
+ !
58
+
59
+ assert: aBoolean description: aString
60
+ aBoolean ifFalse: [self signalFailure: aString]
61
+ !
62
+
63
+ should: aBlock
64
+ self assert: aBlock value
65
+ !
66
+
67
+ should: aBlock raise: anExceptionClass
68
+ self assert: ([aBlock value. false]
69
+ on: anExceptionClass
70
+ do: [:ex | true])
71
+ ! !
72
+
73
+ !TestCase class methodsFor: 'accessing'!
74
+
75
+ testSelectors
76
+ ^self methodDictionary keys select: [:each | each match: '^test']
77
+ !
78
+
79
+ selector: aSelector
80
+ ^self new
81
+ setTestSelector: aSelector;
82
+ yourself
83
+ !
84
+
85
+ lookupHierarchyRoot
86
+ ^TestCase
87
+ !
88
+
89
+ allTestSelectors
90
+ | selectors |
91
+ selectors := self testSelectors.
92
+ self shouldInheritSelectors ifTrue: [
93
+ selectors addAll: self superclass allTestSelectors].
94
+ ^selectors
95
+ !
96
+
97
+ buildSuite
98
+ ^self allTestSelectors collect: [:each | self selector: each]
99
+ ! !
100
+
101
+ !TestCase class methodsFor: 'testing'!
102
+
103
+ shouldInheritSelectors
104
+ ^self ~= self lookupHierarchyRoot
105
+ ! !
106
+
107
+ Error subclass: #TestFailure
108
+ instanceVariableNames: ''
109
+ category: 'SUnit'!
110
+
111
+ Object subclass: #TestResult
112
+ instanceVariableNames: 'timestamp runs errors failures total'
113
+ category: 'SUnit'!
114
+
115
+ !TestResult methodsFor: 'accessing'!
116
+
117
+ timestamp
118
+ ^timestamp
119
+ !
120
+
121
+ errors
122
+ ^errors
123
+ !
124
+
125
+ failures
126
+ ^failures
127
+ !
128
+
129
+ total
130
+ ^total
131
+ !
132
+
133
+ total: aNumber
134
+ total := aNumber
135
+ !
136
+
137
+ addError: anError
138
+ self errors add: anError
139
+ !
140
+
141
+ addFailure: aFailure
142
+ self failures add: aFailure
143
+ !
144
+
145
+ runs
146
+ ^runs
147
+ !
148
+
149
+ increaseRuns
150
+ runs := runs + 1
151
+ !
152
+
153
+ status
154
+ ^self errors isEmpty
155
+ ifTrue: [
156
+ self failures isEmpty
157
+ ifTrue: ['success']
158
+ ifFalse: ['failure']]
159
+ ifFalse: ['error']
160
+ ! !
161
+
162
+ !TestResult methodsFor: 'initialization'!
163
+
164
+ initialize
165
+ super initialize.
166
+ timestamp := Date now.
167
+ runs := 0.
168
+ errors := Array new.
169
+ failures := Array new.
170
+ total := 0
171
+ ! !
172
+
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'resin/app/app.rb'
5
+ rescue LoadError => e
6
+ require 'rubygems'
7
+ path = File.expand_path '../../lib', __FILE__
8
+ $:.unshift(path) if File.directory?(path) && !$:.include?(path)
9
+ require 'resin/app/app.rb'
10
+ end
11
+
12
+ Resin::Server.run!
File without changes
@@ -0,0 +1,121 @@
1
+ require 'rubygems'
2
+ require 'sinatra/base'
3
+ require 'haml'
4
+
5
+ AMBER_PATH = File.expand_path('../../../../amber', __FILE__)
6
+
7
+ module Resin
8
+ def env
9
+ ENV['RACK_ENV']
10
+ end
11
+ module_function :env
12
+
13
+ def development?
14
+ !(env == 'production')
15
+ end
16
+ module_function :development?
17
+
18
+ class Server < Sinatra::Base
19
+ set :dump_errors, true
20
+ set :views, File.expand_path('../views', __FILE__)
21
+
22
+ set :views, [File.join(Dir.pwd, 'views'), File.expand_path('../views', __FILE__)]
23
+
24
+ helpers do
25
+ def find_template(views, name, engine, &block)
26
+ Array(views).each do |view|
27
+ super(view, name, engine, &block)
28
+ end
29
+ end
30
+
31
+ def embed_amber
32
+ return <<-END
33
+ <script type="text/javascript" src="/js/amber.js"></script>
34
+ <script type="text/javascript">
35
+ loadAmber({
36
+ files : [#{javascript_files}],
37
+ ready : function() { }
38
+ });
39
+ </script>
40
+ END
41
+ end
42
+ end
43
+
44
+ def javascript_files
45
+ files = []
46
+ Dir.glob("#{Dir.pwd}/js/*.js") do |filename|
47
+ unless filename.include? 'deploy'
48
+ files << "\"#{File.basename(filename)}\""
49
+ end
50
+ end
51
+ files.join(',')
52
+ end
53
+
54
+ get '/' do
55
+ haml :index
56
+ end
57
+
58
+ get '/:view' do |view|
59
+ begin
60
+ haml view.to_sym
61
+ rescue ::Errno::ENOENT
62
+ halt 404, 'Not found'
63
+ end
64
+ end
65
+
66
+ def load_resource(prefix, filename)
67
+ # A file in our working directory will take precedence over the
68
+ # Amber-bundled files. This should allow custom Kernel-Objects.js files
69
+ # for example.
70
+ local_file = File.join(Dir.pwd, "#{prefix}/", filename)
71
+ amber_file = File.join(AMBER_PATH, "/#{prefix}/", filename)
72
+
73
+ if File.exists? local_file
74
+ File.open(local_file, 'r').read
75
+ elsif File.exists? amber_file
76
+ File.open(amber_file, 'r').read
77
+ else
78
+ nil
79
+ end
80
+ end
81
+
82
+ def content_type_for_ext(filename)
83
+ if File.extname(filename) == '.js'
84
+ content_type 'application/javascript'
85
+ elsif File.extname(filename) == '.css'
86
+ content_type 'text/css'
87
+ else
88
+ content_type 'text/plain'
89
+ end
90
+ end
91
+
92
+ ['js', 'css', 'images'].each do |path|
93
+ get "/#{path}/*" do |filename|
94
+ content_type_for_ext filename
95
+ data = load_resource(path, filename)
96
+ if data.nil?
97
+ halt 404, 'Not found'
98
+ end
99
+ data
100
+ end
101
+ end
102
+
103
+ if Resin.development?
104
+ set :logging, true
105
+ disable :protection
106
+
107
+ # Only enable the saving mechanism in test/development
108
+ put '*' do
109
+ unless request.body.nil?
110
+ path = File.join(Dir.pwd, request.path)
111
+ puts ">> Commiting changes to #{path}"
112
+ File.open(path, 'w') do |fd|
113
+ request.body.each do |line|
114
+ fd.write(line)
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end
@@ -0,0 +1,10 @@
1
+ %html
2
+ %head
3
+ %title
4
+ Resin
5
+ = embed_amber
6
+ %body
7
+ - if Resin.development?
8
+ %div{:style => 'float: right; clear: all'}
9
+ %button{:onclick => "smalltalk.Browser._open();"}
10
+ Run IDE
metadata ADDED
@@ -0,0 +1,216 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: resin
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - R. Tyler Croy
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: &7546660 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.0.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *7546660
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &7546180 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *7546180
36
+ - !ruby/object:Gem::Dependency
37
+ name: shotgun
38
+ requirement: &7545440 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *7545440
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: &7544940 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *7544940
58
+ - !ruby/object:Gem::Dependency
59
+ name: rack-test
60
+ requirement: &7544520 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *7544520
69
+ - !ruby/object:Gem::Dependency
70
+ name: thin
71
+ requirement: &7544100 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: *7544100
80
+ - !ruby/object:Gem::Dependency
81
+ name: haml
82
+ requirement: &7543660 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: *7543660
91
+ - !ruby/object:Gem::Dependency
92
+ name: sinatra
93
+ requirement: &7543220 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :runtime
100
+ prerelease: false
101
+ version_requirements: *7543220
102
+ description:
103
+ email: tyler@linux.com
104
+ executables:
105
+ - runresin
106
+ extensions: []
107
+ extra_rdoc_files:
108
+ - README.markdown
109
+ files:
110
+ - bin/runresin
111
+ - lib/resin/app/app.rb
112
+ - lib/resin.rb
113
+ - lib/resin/app/views/index.haml
114
+ - amber/css/amber.css
115
+ - amber/css/style.css
116
+ - amber/css/documentation.css
117
+ - amber/css/profstef.css
118
+ - amber/js/Kernel-Tests.js
119
+ - amber/js/Additional-Examples.deploy.js
120
+ - amber/js/Kernel-Transcript.deploy.js
121
+ - amber/js/Canvas.deploy.js
122
+ - amber/js/Kernel-Announcements.js
123
+ - amber/js/Examples.js
124
+ - amber/js/lib/showdown.js
125
+ - amber/js/lib/peg-0.6.2.min.js
126
+ - amber/js/lib/CodeMirror/smalltalk.js
127
+ - amber/js/lib/CodeMirror/codemirror.css
128
+ - amber/js/lib/CodeMirror/amber.css
129
+ - amber/js/lib/CodeMirror/codemirror.js
130
+ - amber/js/lib/CodeMirror/LICENSE
131
+ - amber/js/lib/jQuery/jquery.textarea.js
132
+ - amber/js/lib/jQuery/jquery-1.4.4.min.js
133
+ - amber/js/lib/jQuery/jquery-ui-1.8.16.custom.min.js
134
+ - amber/js/lib/jQuery/jquery-1.6.4.min.js
135
+ - amber/js/Compiler.js
136
+ - amber/js/Kernel-Classes.deploy.js
137
+ - amber/js/init.js
138
+ - amber/js/amber.js
139
+ - amber/js/parser.pegjs
140
+ - amber/js/SUnit.js
141
+ - amber/js/Kernel-Objects.deploy.js
142
+ - amber/js/IDE.deploy.js
143
+ - amber/js/Kernel-Classes.js
144
+ - amber/js/Kernel-Objects.js
145
+ - amber/js/Kernel-Transcript.js
146
+ - amber/js/SUnit.deploy.js
147
+ - amber/js/Kernel-Tests.deploy.js
148
+ - amber/js/parser.js
149
+ - amber/js/Kernel-Methods.deploy.js
150
+ - amber/js/Canvas.js
151
+ - amber/js/Benchfib.js
152
+ - amber/js/Compiler.deploy.js
153
+ - amber/js/boot.js
154
+ - amber/js/Kernel-Methods.js
155
+ - amber/js/Documentation.js
156
+ - amber/js/Kernel-Collections.js
157
+ - amber/js/Additional-Examples.js
158
+ - amber/js/Kernel-Announcements.deploy.js
159
+ - amber/js/IDE.js
160
+ - amber/js/Examples.deploy.js
161
+ - amber/js/compat.js
162
+ - amber/js/Documentation.deploy.js
163
+ - amber/js/Kernel-Exceptions.js
164
+ - amber/js/Kernel-Exceptions.deploy.js
165
+ - amber/js/Benchfib.deploy.js
166
+ - amber/js/Kernel-Collections.deploy.js
167
+ - amber/st/Kernel-Classes.st
168
+ - amber/st/Examples.st
169
+ - amber/st/Documentation.st
170
+ - amber/st/SUnit.st
171
+ - amber/st/Canvas.st
172
+ - amber/st/Kernel-Tests.st
173
+ - amber/st/Compiler.st
174
+ - amber/st/Kernel-Objects.st
175
+ - amber/st/Kernel-Methods.st
176
+ - amber/st/IDE.st
177
+ - amber/st/Benchfib.st
178
+ - amber/st/Kernel-Collections.st
179
+ - amber/st/Kernel-Transcript.st
180
+ - amber/st/Kernel-Announcements.st
181
+ - amber/st/Kernel-Exceptions.st
182
+ - amber/images/tinylogo.png
183
+ - amber/images/sprite.png
184
+ - amber/images/profstef.png
185
+ - amber/images/twitterwall.png
186
+ - amber/images/presentation.png
187
+ - amber/images/off.png
188
+ - amber/images/amber.png
189
+ - amber/images/offHover.png
190
+ - amber/images/amber_small.png
191
+ - README.markdown
192
+ homepage: https://github.com/rtyler/resin
193
+ licenses: []
194
+ post_install_message:
195
+ rdoc_options: []
196
+ require_paths:
197
+ - lib
198
+ required_ruby_version: !ruby/object:Gem::Requirement
199
+ none: false
200
+ requirements:
201
+ - - ! '>='
202
+ - !ruby/object:Gem::Version
203
+ version: '0'
204
+ required_rubygems_version: !ruby/object:Gem::Requirement
205
+ none: false
206
+ requirements:
207
+ - - ! '>='
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ requirements: []
211
+ rubyforge_project:
212
+ rubygems_version: 1.8.10
213
+ signing_key:
214
+ specification_version: 3
215
+ summary: A tool for building Amber applications with Ruby
216
+ test_files: []