mirror of
https://github.com/lloeki/umodule-source.git
synced 2025-12-06 10:44:39 +01:00
v0.5, matching JS version
This commit is contained in:
commit
68a37bd4a1
6 changed files with 123 additions and 0 deletions
20
LICENSE
Normal file
20
LICENSE
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
Copyright (c) 2012 Loic Nageleisen
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
3
README.mdown
Normal file
3
README.mdown
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
# umodule-source
|
||||||
|
|
||||||
|
Ruby gem containing [umodule-js](https://github.com/lloeki/umodule-js) source.
|
||||||
1
lib/umodule-source.rb
Normal file
1
lib/umodule-source.rb
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
require 'umodule/source'
|
||||||
13
lib/umodule/source.rb
Normal file
13
lib/umodule/source.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
module Umodule
|
||||||
|
module Source
|
||||||
|
VERSION = 0.5
|
||||||
|
|
||||||
|
def self.bundled_path
|
||||||
|
File.expand_path('../source/umodule.js', __FILE__)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.contents
|
||||||
|
@contents ||= File.read(bundled_path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
70
lib/umodule/source/umodule.js
Normal file
70
lib/umodule/source/umodule.js
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
// Generated by CoffeeScript 1.6.2
|
||||||
|
/*
|
||||||
|
# umodule.js v0.5
|
||||||
|
# (c) 2013 Loic Nageleisen
|
||||||
|
# Licensed under 3-clause BSD
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var Module, require, root,
|
||||||
|
__slice = [].slice;
|
||||||
|
|
||||||
|
root = typeof global !== "undefined" && global !== null ? global : window;
|
||||||
|
|
||||||
|
require = function(id) {
|
||||||
|
var item, target, _i, _len, _ref;
|
||||||
|
|
||||||
|
target = Module.root;
|
||||||
|
_ref = id.split('/');
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
item = _ref[_i];
|
||||||
|
target = target[item];
|
||||||
|
}
|
||||||
|
if (typeof target === 'undefined') {
|
||||||
|
throw new Error("module not found: " + id);
|
||||||
|
}
|
||||||
|
return target.exports;
|
||||||
|
};
|
||||||
|
|
||||||
|
Module = (function() {
|
||||||
|
function Module(id) {
|
||||||
|
this.id = id;
|
||||||
|
this.exports = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
Module.define = function(target, name, block) {
|
||||||
|
var item, top, _i, _len, _ref, _ref1;
|
||||||
|
|
||||||
|
if (arguments.length < 3) {
|
||||||
|
_ref = [Module.root].concat(__slice.call(arguments)), target = _ref[0], name = _ref[1], block = _ref[2];
|
||||||
|
}
|
||||||
|
top = target;
|
||||||
|
_ref1 = name.split('/');
|
||||||
|
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||||
|
item = _ref1[_i];
|
||||||
|
target = target[item] || (target[item] = new Module(item));
|
||||||
|
}
|
||||||
|
block.call(target, target.exports, target.require, target);
|
||||||
|
return target;
|
||||||
|
};
|
||||||
|
|
||||||
|
Module.prototype.require = function() {
|
||||||
|
return require();
|
||||||
|
};
|
||||||
|
|
||||||
|
return Module;
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
Module.root = new Module('root');
|
||||||
|
|
||||||
|
Module.root.exports = root;
|
||||||
|
|
||||||
|
Module.root.module = new Module('module');
|
||||||
|
|
||||||
|
Module.root.module.exports = Module;
|
||||||
|
|
||||||
|
root.require = require;
|
||||||
|
|
||||||
|
}).call(this);
|
||||||
16
umodule-source.gemspec
Normal file
16
umodule-source.gemspec
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
$:.push File.expand_path('../lib', __FILE__)
|
||||||
|
require 'umodule/source'
|
||||||
|
|
||||||
|
Gem::Specification.new do |s|
|
||||||
|
s.name = 'umodule-source'
|
||||||
|
s.version = Umodule::Source::VERSION
|
||||||
|
s.authors = ['Loic Nageleisen']
|
||||||
|
s.email = ['loic.nageleisen@gmail.com']
|
||||||
|
s.homepage = 'http://github.com/lloeki/umodule-source'
|
||||||
|
s.summary = %q{uModule source as a Ruby gem.}
|
||||||
|
s.description = %q{uModule source as a Ruby gem.}
|
||||||
|
s.files = %W[ lib/umodule-source.rb
|
||||||
|
lib/umodule/source.rb
|
||||||
|
lib/umodule/source/umodule.js ]
|
||||||
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue