comb 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +19 -0
- data/Rakefile +1 -0
- data/bin/comb +3 -0
- data/comb.gemspec +24 -0
- data/lib/comb.rb +36 -0
- data/lib/comb/version.rb +3 -0
- data/test/README +2 -0
- data/test/container.html +5 -0
- data/test/js/app.js +8 -0
- data/test/js/controllers/articles.js +1 -0
- data/test/js/controllers/edit.js +1 -0
- data/test/js/utils/date.js +7 -0
- data/test/js/utils/uri.js +1 -0
- data/test/js/widgets/combos/megatable.js +1 -0
- data/test/js/widgets/emailbox.js +1 -0
- data/test/js/widgets/textbox.js +4 -0
- data/test/output.js +78 -0
- metadata +76 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2011 Ryan Allen, Envato Pty Ltd
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/comb
ADDED
data/comb.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "comb/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "comb"
|
7
|
+
s.version = Comb::VERSION
|
8
|
+
s.authors = ["Ryan Allen"]
|
9
|
+
s.email = ["ryan@yeahnah.org"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Assembler for modular client-side apps.}
|
12
|
+
s.description = %q{Brings file-based module support to client-side JavaScript applications.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "comb"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
24
|
+
end
|
data/lib/comb.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require_relative "comb/version"
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
module Comb
|
5
|
+
def self.assemble(path)
|
6
|
+
out = []
|
7
|
+
library_path = path
|
8
|
+
out << "// generated by comb on #{Time.now.utc.iso8601}"
|
9
|
+
out << <<-eos
|
10
|
+
var modules = function() {
|
11
|
+
var registry = {}
|
12
|
+
return {
|
13
|
+
register: function(name, module) {
|
14
|
+
registry[name] = module
|
15
|
+
},
|
16
|
+
require: function(name) {
|
17
|
+
return registry[name]()
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}()
|
21
|
+
var require = modules.require
|
22
|
+
eos
|
23
|
+
Dir.glob(library_path + '/**/*.js').each do |path|
|
24
|
+
file = path.gsub(library_path, '').gsub(/^\//, '')
|
25
|
+
mod = file.gsub(/\.js$/, '')
|
26
|
+
out << <<-eos
|
27
|
+
// #{file} => #{mod}
|
28
|
+
modules.register('#{mod}', function() {
|
29
|
+
#{File.open(path) { |f| f.read }.split("\n").collect { |line| " #{line}" }.join("\n")}
|
30
|
+
})
|
31
|
+
eos
|
32
|
+
end
|
33
|
+
out << "// end of comb output"
|
34
|
+
out.join("\n")
|
35
|
+
end
|
36
|
+
end
|
data/lib/comb/version.rb
ADDED
data/test/README
ADDED
data/test/container.html
ADDED
data/test/js/app.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
// articles...
|
@@ -0,0 +1 @@
|
|
1
|
+
// edit controller
|
@@ -0,0 +1 @@
|
|
1
|
+
exports.bestUri = 'yeahnah.org'
|
@@ -0,0 +1 @@
|
|
1
|
+
// lol mega table
|
@@ -0,0 +1 @@
|
|
1
|
+
// lol an email box, does nothing
|
data/test/output.js
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
// generated by comb on 2011-12-28T03:11:08Z
|
2
|
+
var modules = function() {
|
3
|
+
var registry = {}
|
4
|
+
return {
|
5
|
+
register: function(name, module) {
|
6
|
+
registry[name] = module
|
7
|
+
},
|
8
|
+
require: function(name) {
|
9
|
+
return registry[name]()
|
10
|
+
}
|
11
|
+
}
|
12
|
+
}()
|
13
|
+
var require = modules.require
|
14
|
+
// app.js => app
|
15
|
+
modules.register('app', function() {
|
16
|
+
var exports = {}
|
17
|
+
exports.run = function() {
|
18
|
+
var textbox = require('widgets/textbox')
|
19
|
+
var emailbox = require('widgets/emailbox')
|
20
|
+
var uri = require('utils/uri')
|
21
|
+
alert(uri.bestUri)
|
22
|
+
var bdays = require('utils/date')
|
23
|
+
bdays.whatsMyBday()
|
24
|
+
}
|
25
|
+
return exports
|
26
|
+
})
|
27
|
+
// controllers/articles.js => controllers/articles
|
28
|
+
modules.register('controllers/articles', function() {
|
29
|
+
var exports = {}
|
30
|
+
// articles...
|
31
|
+
return exports
|
32
|
+
})
|
33
|
+
// controllers/edit.js => controllers/edit
|
34
|
+
modules.register('controllers/edit', function() {
|
35
|
+
var exports = {}
|
36
|
+
// edit controller
|
37
|
+
return exports
|
38
|
+
})
|
39
|
+
// utils/date.js => utils/date
|
40
|
+
modules.register('utils/date', function() {
|
41
|
+
var exports = {}
|
42
|
+
var myBday = '24/11/1982'
|
43
|
+
|
44
|
+
var whatsMyBday = function() {
|
45
|
+
alert(myBday)
|
46
|
+
}
|
47
|
+
|
48
|
+
exports.whatsMyBday = whatsMyBday
|
49
|
+
return exports
|
50
|
+
})
|
51
|
+
// utils/uri.js => utils/uri
|
52
|
+
modules.register('utils/uri', function() {
|
53
|
+
var exports = {}
|
54
|
+
exports.bestUri = 'yeahnah.org'
|
55
|
+
return exports
|
56
|
+
})
|
57
|
+
// widgets/combos/megatable.js => widgets/combos/megatable
|
58
|
+
modules.register('widgets/combos/megatable', function() {
|
59
|
+
var exports = {}
|
60
|
+
// lol mega table
|
61
|
+
return exports
|
62
|
+
})
|
63
|
+
// widgets/emailbox.js => widgets/emailbox
|
64
|
+
modules.register('widgets/emailbox', function() {
|
65
|
+
var exports = {}
|
66
|
+
// lol an email box, does nothing
|
67
|
+
return exports
|
68
|
+
})
|
69
|
+
// widgets/textbox.js => widgets/textbox
|
70
|
+
modules.register('widgets/textbox', function() {
|
71
|
+
var exports = {}
|
72
|
+
exports.name = 'textbox'
|
73
|
+
exports.make = function() {
|
74
|
+
// macking an textbox
|
75
|
+
}
|
76
|
+
return exports
|
77
|
+
})
|
78
|
+
// end of comb output
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: comb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ryan Allen
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-28 00:00:00.000000000Z
|
13
|
+
dependencies: []
|
14
|
+
description: Brings file-based module support to client-side JavaScript applications.
|
15
|
+
email:
|
16
|
+
- ryan@yeahnah.org
|
17
|
+
executables:
|
18
|
+
- comb
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- Gemfile
|
24
|
+
- MIT-LICENSE
|
25
|
+
- Rakefile
|
26
|
+
- bin/comb
|
27
|
+
- comb.gemspec
|
28
|
+
- lib/comb.rb
|
29
|
+
- lib/comb/version.rb
|
30
|
+
- test/README
|
31
|
+
- test/container.html
|
32
|
+
- test/js/app.js
|
33
|
+
- test/js/controllers/articles.js
|
34
|
+
- test/js/controllers/edit.js
|
35
|
+
- test/js/utils/date.js
|
36
|
+
- test/js/utils/uri.js
|
37
|
+
- test/js/widgets/combos/megatable.js
|
38
|
+
- test/js/widgets/emailbox.js
|
39
|
+
- test/js/widgets/textbox.js
|
40
|
+
- test/output.js
|
41
|
+
homepage: ''
|
42
|
+
licenses: []
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
requirements: []
|
60
|
+
rubyforge_project: comb
|
61
|
+
rubygems_version: 1.8.10
|
62
|
+
signing_key:
|
63
|
+
specification_version: 3
|
64
|
+
summary: Assembler for modular client-side apps.
|
65
|
+
test_files:
|
66
|
+
- test/README
|
67
|
+
- test/container.html
|
68
|
+
- test/js/app.js
|
69
|
+
- test/js/controllers/articles.js
|
70
|
+
- test/js/controllers/edit.js
|
71
|
+
- test/js/utils/date.js
|
72
|
+
- test/js/utils/uri.js
|
73
|
+
- test/js/widgets/combos/megatable.js
|
74
|
+
- test/js/widgets/emailbox.js
|
75
|
+
- test/js/widgets/textbox.js
|
76
|
+
- test/output.js
|