ssejs 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Jim Patterson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,17 @@
1
+ = ssejs
2
+
3
+ Description goes here.
4
+
5
+ == Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
+ * Send me a pull request. Bonus points for topic branches.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 Jim Patterson. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,53 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "ssejs"
8
+ gem.summary = "Server Side Embeded Javascript in Ruby"
9
+ gem.description = "Server Side Embeded Javascript in Ruby"
10
+ gem.email = "jpatterson@yammer-inc.com"
11
+ gem.homepage = "http://github.com/jpatterson/ssejs"
12
+ gem.authors = ["Jim Patterson"]
13
+ gem.add_dependency "therubyracer", "0.7.1"
14
+ gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
+ end
20
+
21
+ require 'rake/testtask'
22
+ Rake::TestTask.new(:test) do |test|
23
+ test.libs << 'lib' << 'test'
24
+ test.pattern = 'test/**/test_*.rb'
25
+ test.verbose = true
26
+ end
27
+
28
+ begin
29
+ require 'rcov/rcovtask'
30
+ Rcov::RcovTask.new do |test|
31
+ test.libs << 'test'
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
35
+ rescue LoadError
36
+ task :rcov do
37
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
38
+ end
39
+ end
40
+
41
+ task :test => :check_dependencies
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "ssejs #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/lib/ejs.js ADDED
@@ -0,0 +1,505 @@
1
+ (function(){
2
+
3
+
4
+ var rsplit = function(string, regex) {
5
+ var result = regex.exec(string),retArr = new Array(), first_idx, last_idx, first_bit;
6
+ while (result != null)
7
+ {
8
+ first_idx = result.index; last_idx = regex.lastIndex;
9
+ if ((first_idx) != 0)
10
+ {
11
+ first_bit = string.substring(0,first_idx);
12
+ retArr.push(string.substring(0,first_idx));
13
+ string = string.slice(first_idx);
14
+ }
15
+ retArr.push(result[0]);
16
+ string = string.slice(result[0].length);
17
+ result = regex.exec(string);
18
+ }
19
+ if (! string == '')
20
+ {
21
+ retArr.push(string);
22
+ }
23
+ return retArr;
24
+ },
25
+ chop = function(string){
26
+ return string.substr(0, string.length - 1);
27
+ },
28
+ extend = function(d, s){
29
+ for(var n in s){
30
+ if(s.hasOwnProperty(n)) d[n] = s[n]
31
+ }
32
+ }
33
+
34
+
35
+ EJS = function( options ){
36
+ options = typeof options == "string" ? {view: options} : options
37
+ this.set_options(options);
38
+ if(options.precompiled){
39
+ this.template = {};
40
+ this.template.process = options.precompiled;
41
+ EJS.update(this.name, this);
42
+ return;
43
+ }
44
+ if(options.element)
45
+ {
46
+ if(typeof options.element == 'string'){
47
+ var name = options.element
48
+ options.element = document.getElementById( options.element )
49
+ if(options.element == null) throw name+'does not exist!'
50
+ }
51
+ if(options.element.value){
52
+ this.text = options.element.value
53
+ }else{
54
+ this.text = options.element.innerHTML
55
+ }
56
+ this.name = options.element.id
57
+ this.type = '['
58
+ }else if(options.url){
59
+ options.url = EJS.endExt(options.url, this.extMatch);
60
+ this.name = this.name ? this.name : options.url;
61
+ var url = options.url
62
+ //options.view = options.absolute_url || options.view || options.;
63
+ var template = EJS.get(this.name /*url*/, this.cache);
64
+ if (template) return template;
65
+ if (template == EJS.INVALID_PATH) return null;
66
+ try{
67
+ this.text = EJS.request( url+(this.cache ? '' : '?'+Math.random() ));
68
+ }catch(e){}
69
+
70
+ if(this.text == null){
71
+ throw( {type: 'EJS', message: 'There is no template at '+url} );
72
+ }
73
+ //this.name = url;
74
+ }
75
+ var template = new EJS.Compiler(this.text, this.type);
76
+
77
+ template.compile(options, this.name);
78
+
79
+
80
+ EJS.update(this.name, this);
81
+ this.template = template;
82
+ };
83
+ /* @Prototype*/
84
+ EJS.prototype = {
85
+ /**
86
+ * Renders an object with extra view helpers attached to the view.
87
+ * @param {Object} object data to be rendered
88
+ * @param {Object} extra_helpers an object with additonal view helpers
89
+ * @return {String} returns the result of the string
90
+ */
91
+ render : function(object, extra_helpers){
92
+ object = object || {};
93
+ this._extra_helpers = extra_helpers;
94
+ var v = new EJS.Helpers(object, extra_helpers || {});
95
+ return this.template.process.call(object, object,v);
96
+ },
97
+ update : function(element, options){
98
+ if(typeof element == 'string'){
99
+ element = document.getElementById(element)
100
+ }
101
+ if(options == null){
102
+ _template = this;
103
+ return function(object){
104
+ EJS.prototype.update.call(_template, element, object)
105
+ }
106
+ }
107
+ if(typeof options == 'string'){
108
+ params = {}
109
+ params.url = options
110
+ _template = this;
111
+ params.onComplete = function(request){
112
+ var object = eval( request.responseText )
113
+ EJS.prototype.update.call(_template, element, object)
114
+ }
115
+ EJS.ajax_request(params)
116
+ }else
117
+ {
118
+ element.innerHTML = this.render(options)
119
+ }
120
+ },
121
+ out : function(){
122
+ return this.template.out;
123
+ },
124
+ /**
125
+ * Sets options on this view to be rendered with.
126
+ * @param {Object} options
127
+ */
128
+ set_options : function(options){
129
+ this.type = options.type || EJS.type;
130
+ this.cache = options.cache != null ? options.cache : EJS.cache;
131
+ this.text = options.text || null;
132
+ this.name = options.name || null;
133
+ this.ext = options.ext || EJS.ext;
134
+ this.extMatch = new RegExp(this.ext.replace(/\./, '\.'));
135
+ }
136
+ };
137
+ EJS.endExt = function(path, match){
138
+ if(!path) return null;
139
+ match.lastIndex = 0
140
+ return path+ (match.test(path) ? '' : this.ext )
141
+ }
142
+
143
+
144
+
145
+
146
+ /* @Static*/
147
+ EJS.Scanner = function(source, left, right) {
148
+
149
+ extend(this,
150
+ {left_delimiter: left +'%',
151
+ right_delimiter: '%'+right,
152
+ double_left: left+'%%',
153
+ double_right: '%%'+right,
154
+ left_equal: left+'%=',
155
+ left_comment: left+'%#'})
156
+
157
+ this.SplitRegexp = left=='[' ? /(\[%%)|(%%\])|(\[%=)|(\[%#)|(\[%)|(%\]\n)|(%\])|(\n)/ : new RegExp('('+this.double_left+')|(%%'+this.double_right+')|('+this.left_equal+')|('+this.left_comment+')|('+this.left_delimiter+')|('+this.right_delimiter+'\n)|('+this.right_delimiter+')|(\n)') ;
158
+
159
+ this.source = source;
160
+ this.stag = null;
161
+ this.lines = 0;
162
+ };
163
+
164
+ EJS.Scanner.to_text = function(input){
165
+ if(input == null || input === undefined)
166
+ return '';
167
+ if(input instanceof Date)
168
+ return input.toDateString();
169
+ if(input.toString)
170
+ return input.toString();
171
+ return '';
172
+ };
173
+
174
+ EJS.Scanner.prototype = {
175
+ scan: function(block) {
176
+ scanline = this.scanline;
177
+ regex = this.SplitRegexp;
178
+ if (! this.source == '')
179
+ {
180
+ var source_split = rsplit(this.source, /\n/);
181
+ for(var i=0; i<source_split.length; i++) {
182
+ var item = source_split[i];
183
+ this.scanline(item, regex, block);
184
+ }
185
+ }
186
+ },
187
+ scanline: function(line, regex, block) {
188
+ this.lines++;
189
+ var line_split = rsplit(line, regex);
190
+ for(var i=0; i<line_split.length; i++) {
191
+ var token = line_split[i];
192
+ if (token != null) {
193
+ try{
194
+ block(token, this);
195
+ }catch(e){
196
+ throw {type: 'EJS.Scanner', line: this.lines};
197
+ }
198
+ }
199
+ }
200
+ }
201
+ };
202
+
203
+
204
+ EJS.Buffer = function(pre_cmd, post_cmd) {
205
+ this.line = new Array();
206
+ this.script = "";
207
+ this.pre_cmd = pre_cmd;
208
+ this.post_cmd = post_cmd;
209
+ for (var i=0; i<this.pre_cmd.length; i++)
210
+ {
211
+ this.push(pre_cmd[i]);
212
+ }
213
+ };
214
+ EJS.Buffer.prototype = {
215
+
216
+ push: function(cmd) {
217
+ this.line.push(cmd);
218
+ },
219
+
220
+ cr: function() {
221
+ this.script = this.script + this.line.join('; ');
222
+ this.line = new Array();
223
+ this.script = this.script + "\n";
224
+ },
225
+
226
+ close: function() {
227
+ if (this.line.length > 0)
228
+ {
229
+ for (var i=0; i<this.post_cmd.length; i++){
230
+ this.push(pre_cmd[i]);
231
+ }
232
+ this.script = this.script + this.line.join('; ');
233
+ line = null;
234
+ }
235
+ }
236
+
237
+ };
238
+
239
+
240
+ EJS.Compiler = function(source, left) {
241
+ this.pre_cmd = ['var ___ViewO = [];'];
242
+ this.post_cmd = new Array();
243
+ this.source = ' ';
244
+ if (source != null)
245
+ {
246
+ if (typeof source == 'string')
247
+ {
248
+ source = source.replace(/\r\n/g, "\n");
249
+ source = source.replace(/\r/g, "\n");
250
+ this.source = source;
251
+ }else if (source.innerHTML){
252
+ this.source = source.innerHTML;
253
+ }
254
+ if (typeof this.source != 'string'){
255
+ this.source = "";
256
+ }
257
+ }
258
+ left = left || '<';
259
+ var right = '>';
260
+ switch(left) {
261
+ case '[':
262
+ right = ']';
263
+ break;
264
+ case '<':
265
+ break;
266
+ default:
267
+ throw left+' is not a supported deliminator';
268
+ break;
269
+ }
270
+ this.scanner = new EJS.Scanner(this.source, left, right);
271
+ this.out = '';
272
+ };
273
+ EJS.Compiler.prototype = {
274
+ compile: function(options, name) {
275
+ options = options || {};
276
+ this.out = '';
277
+ var put_cmd = "___ViewO.push(";
278
+ var insert_cmd = put_cmd;
279
+ var buff = new EJS.Buffer(this.pre_cmd, this.post_cmd);
280
+ var content = '';
281
+ var clean = function(content)
282
+ {
283
+ content = content.replace(/\\/g, '\\\\');
284
+ content = content.replace(/\n/g, '\\n');
285
+ content = content.replace(/"/g, '\\"');
286
+ return content;
287
+ };
288
+ this.scanner.scan(function(token, scanner) {
289
+ if (scanner.stag == null)
290
+ {
291
+ switch(token) {
292
+ case '\n':
293
+ content = content + "\n";
294
+ buff.push(put_cmd + '"' + clean(content) + '");');
295
+ buff.cr();
296
+ content = '';
297
+ break;
298
+ case scanner.left_delimiter:
299
+ case scanner.left_equal:
300
+ case scanner.left_comment:
301
+ scanner.stag = token;
302
+ if (content.length > 0)
303
+ {
304
+ buff.push(put_cmd + '"' + clean(content) + '")');
305
+ }
306
+ content = '';
307
+ break;
308
+ case scanner.double_left:
309
+ content = content + scanner.left_delimiter;
310
+ break;
311
+ default:
312
+ content = content + token;
313
+ break;
314
+ }
315
+ }
316
+ else {
317
+ switch(token) {
318
+ case scanner.right_delimiter:
319
+ switch(scanner.stag) {
320
+ case scanner.left_delimiter:
321
+ if (content[content.length - 1] == '\n')
322
+ {
323
+ content = chop(content);
324
+ buff.push(content);
325
+ buff.cr();
326
+ }
327
+ else {
328
+ buff.push(content);
329
+ }
330
+ break;
331
+ case scanner.left_equal:
332
+ buff.push(insert_cmd + "(EJS.Scanner.to_text(" + content + ")))");
333
+ break;
334
+ }
335
+ scanner.stag = null;
336
+ content = '';
337
+ break;
338
+ case scanner.double_right:
339
+ content = content + scanner.right_delimiter;
340
+ break;
341
+ default:
342
+ content = content + token;
343
+ break;
344
+ }
345
+ }
346
+ });
347
+ if (content.length > 0)
348
+ {
349
+ // Chould be content.dump in Ruby
350
+ buff.push(put_cmd + '"' + clean(content) + '")');
351
+ }
352
+ buff.close();
353
+ this.out = buff.script + ";";
354
+ var to_be_evaled = '/*'+name+'*/this.process = function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {'+this.out+" return ___ViewO.join('');}}}catch(e){e.lineNumber=null;throw e;}};";
355
+
356
+ try{
357
+ eval(to_be_evaled);
358
+ }catch(e){
359
+ if(typeof JSLINT != 'undefined'){
360
+ JSLINT(this.out);
361
+ for(var i = 0; i < JSLINT.errors.length; i++){
362
+ var error = JSLINT.errors[i];
363
+ if(error.reason != "Unnecessary semicolon."){
364
+ error.line++;
365
+ var e = new Error();
366
+ e.lineNumber = error.line;
367
+ e.message = error.reason;
368
+ if(options.view)
369
+ e.fileName = options.view;
370
+ throw e;
371
+ }
372
+ }
373
+ }else{
374
+ throw e;
375
+ }
376
+ }
377
+ }
378
+ };
379
+
380
+
381
+ //type, cache, folder
382
+ /**
383
+ * Sets default options for all views
384
+ * @param {Object} options Set view with the following options
385
+ * <table class="options">
386
+ <tbody><tr><th>Option</th><th>Default</th><th>Description</th></tr>
387
+ <tr>
388
+ <td>type</td>
389
+ <td>'<'</td>
390
+ <td>type of magic tags. Options are '&lt;' or '['
391
+ </td>
392
+ </tr>
393
+ <tr>
394
+ <td>cache</td>
395
+ <td>true in production mode, false in other modes</td>
396
+ <td>true to cache template.
397
+ </td>
398
+ </tr>
399
+ </tbody></table>
400
+ *
401
+ */
402
+ EJS.config = function(options){
403
+ EJS.cache = options.cache != null ? options.cache : EJS.cache;
404
+ EJS.type = options.type != null ? options.type : EJS.type;
405
+ EJS.ext = options.ext != null ? options.ext : EJS.ext;
406
+
407
+ var templates_directory = EJS.templates_directory || {}; //nice and private container
408
+ EJS.templates_directory = templates_directory;
409
+ EJS.get = function(path, cache){
410
+ if(cache == false) return null;
411
+ if(templates_directory[path]) return templates_directory[path];
412
+ return null;
413
+ };
414
+
415
+ EJS.update = function(path, template) {
416
+ if(path == null) return;
417
+ templates_directory[path] = template ;
418
+ };
419
+
420
+ EJS.INVALID_PATH = -1;
421
+ };
422
+ EJS.config( {cache: true, type: '<', ext: '.ejs' } );
423
+
424
+
425
+
426
+ /**
427
+ * @constructor
428
+ * By adding functions to EJS.Helpers.prototype, those functions will be available in the
429
+ * views.
430
+ * @init Creates a view helper. This function is called internally. You should never call it.
431
+ * @param {Object} data The data passed to the view. Helpers have access to it through this._data
432
+ */
433
+ EJS.Helpers = function(data, extras){
434
+ this._data = data;
435
+ this._extras = extras;
436
+ extend(this, extras );
437
+ };
438
+ /* @prototype*/
439
+ EJS.Helpers.prototype = {
440
+ /**
441
+ * Renders a new view. If data is passed in, uses that to render the view.
442
+ * @param {Object} options standard options passed to a new view.
443
+ * @param {optional:Object} data
444
+ * @return {String}
445
+ */
446
+ view: function(options, data, helpers){
447
+ if(!helpers) helpers = this._extras
448
+ if(!data) data = this._data;
449
+ return new EJS(options).render(data, helpers);
450
+ },
451
+ /**
452
+ * For a given value, tries to create a human representation.
453
+ * @param {Object} input the value being converted.
454
+ * @param {Object} null_text what text should be present if input == null or undefined, defaults to ''
455
+ * @return {String}
456
+ */
457
+ to_text: function(input, null_text) {
458
+ if(input == null || input === undefined) return null_text || '';
459
+ if(input instanceof Date) return input.toDateString();
460
+ if(input.toString) return input.toString().replace(/\n/g, '<br />').replace(/''/g, "'");
461
+ return '';
462
+ }
463
+ };
464
+ EJS.newRequest = function(){
465
+ var factories = [function() { return new ActiveXObject("Msxml2.XMLHTTP"); },function() { return new XMLHttpRequest(); },function() { return new ActiveXObject("Microsoft.XMLHTTP"); }];
466
+ for(var i = 0; i < factories.length; i++) {
467
+ try {
468
+ var request = factories[i]();
469
+ if (request != null) return request;
470
+ }
471
+ catch(e) { continue;}
472
+ }
473
+ }
474
+
475
+ EJS.request = function(path){
476
+ var request = new EJS.newRequest()
477
+ request.open("GET", path, false);
478
+
479
+ try{request.send(null);}
480
+ catch(e){return null;}
481
+
482
+ if ( request.status == 404 || request.status == 2 ||(request.status == 0 && request.responseText == '') ) return null;
483
+
484
+ return request.responseText
485
+ }
486
+ EJS.ajax_request = function(params){
487
+ params.method = ( params.method ? params.method : 'GET')
488
+
489
+ var request = new EJS.newRequest();
490
+ request.onreadystatechange = function(){
491
+ if(request.readyState == 4){
492
+ if(request.status == 200){
493
+ params.onComplete(request)
494
+ }else
495
+ {
496
+ params.onComplete(request)
497
+ }
498
+ }
499
+ }
500
+ request.open(params.method, params.url)
501
+ request.send(null)
502
+ }
503
+
504
+
505
+ })();
data/lib/ssejs.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require 'v8'
3
+
4
+ module Ssejs
5
+ def self.render(template, vars = {})
6
+ V8::Context.new do |cxt|
7
+ cxt.load("#{File.dirname(__FILE__)}/ejs.js")
8
+ cxt['vars'] = vars
9
+ cxt['template'] = template
10
+ return cxt.eval("new EJS({text: template}).render(vars)")
11
+ end
12
+ end
13
+ end
data/ssejs.gemspec ADDED
@@ -0,0 +1,58 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{ssejs}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jim Patterson"]
12
+ s.date = %q{2010-06-09}
13
+ s.description = %q{Server Side Embeded Javascript in Ruby}
14
+ s.email = %q{jpatterson@yammer-inc.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "lib/ejs.js",
27
+ "lib/ssejs.rb",
28
+ "ssejs.gemspec",
29
+ "test/helper.rb",
30
+ "test/test_ssejs.rb"
31
+ ]
32
+ s.homepage = %q{http://github.com/jpatterson/ssejs}
33
+ s.rdoc_options = ["--charset=UTF-8"]
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = %q{1.3.7}
36
+ s.summary = %q{Server Side Embeded Javascript in Ruby}
37
+ s.test_files = [
38
+ "test/helper.rb",
39
+ "test/test_ssejs.rb"
40
+ ]
41
+
42
+ if s.respond_to? :specification_version then
43
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
+ s.specification_version = 3
45
+
46
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
+ s.add_runtime_dependency(%q<therubyracer>, ["= 0.7.1"])
48
+ s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
49
+ else
50
+ s.add_dependency(%q<therubyracer>, ["= 0.7.1"])
51
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
52
+ end
53
+ else
54
+ s.add_dependency(%q<therubyracer>, ["= 0.7.1"])
55
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
56
+ end
57
+ end
58
+
data/test/helper.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'ssejs'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestSsejs < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ssejs
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Jim Patterson
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-06-09 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: therubyracer
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - "="
28
+ - !ruby/object:Gem::Version
29
+ hash: 1
30
+ segments:
31
+ - 0
32
+ - 7
33
+ - 1
34
+ version: 0.7.1
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: thoughtbot-shoulda
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :development
50
+ version_requirements: *id002
51
+ description: Server Side Embeded Javascript in Ruby
52
+ email: jpatterson@yammer-inc.com
53
+ executables: []
54
+
55
+ extensions: []
56
+
57
+ extra_rdoc_files:
58
+ - LICENSE
59
+ - README.rdoc
60
+ files:
61
+ - .document
62
+ - .gitignore
63
+ - LICENSE
64
+ - README.rdoc
65
+ - Rakefile
66
+ - VERSION
67
+ - lib/ejs.js
68
+ - lib/ssejs.rb
69
+ - ssejs.gemspec
70
+ - test/helper.rb
71
+ - test/test_ssejs.rb
72
+ has_rdoc: true
73
+ homepage: http://github.com/jpatterson/ssejs
74
+ licenses: []
75
+
76
+ post_install_message:
77
+ rdoc_options:
78
+ - --charset=UTF-8
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ hash: 3
96
+ segments:
97
+ - 0
98
+ version: "0"
99
+ requirements: []
100
+
101
+ rubyforge_project:
102
+ rubygems_version: 1.3.7
103
+ signing_key:
104
+ specification_version: 3
105
+ summary: Server Side Embeded Javascript in Ruby
106
+ test_files:
107
+ - test/helper.rb
108
+ - test/test_ssejs.rb