├── README.md
├── ReadMe.txt
├── assets
├── A-Z.jpg
├── Genre.jpg
├── Movies.jpg
├── Movies.xml
├── Movies
│ ├── Actors
│ │ ├── actor1.jpg
│ │ ├── actor2.jpg
│ │ ├── actor3.jpg
│ │ └── actor4.jpg
│ ├── MoviePlay.xml
│ ├── MoviePrePlay.xml
│ └── TronLegacy.jpg
├── MoviesA-Z.xml
├── MoviesGenre.xml
├── MoviesGenreGrid.xml
├── MoviesYear.xml
├── TVShows.jpg
├── TVShows.xml
├── TVShows
│ ├── BigBang.jpg
│ ├── SeasonSelect.xml
│ ├── episodePlay.xml
│ ├── s01e01.jpg
│ ├── s01e02.jpg
│ ├── s01e03.jpg
│ ├── season1.jpg
│ ├── season1episodes.xml
│ └── season2.jpg
├── Year.jpg
├── appletv
│ ├── application.js
│ └── us
│ │ └── js
│ │ └── application.js
├── index.xml
├── indexold.xml
└── media.js
├── atv.js
├── mime.js
├── node_modules
├── .bin
│ └── express
└── ejs
│ ├── .gitmodules
│ ├── .npmignore
│ ├── History.md
│ ├── Makefile
│ ├── Readme.md
│ ├── benchmark.js
│ ├── ejs.js
│ ├── ejs.min.js
│ ├── examples
│ ├── client.html
│ ├── list.ejs
│ └── list.js
│ ├── index.js
│ ├── lib
│ ├── ejs.js
│ ├── filters.js
│ └── utils.js
│ ├── package.json
│ ├── support
│ └── compile.js
│ └── test
│ ├── ejs.test.js
│ └── fixtures
│ └── user.ejs
├── package.json
├── utils.js
└── views
├── error.ejs
├── index.ejs
└── layout.ejs
/README.md:
--------------------------------------------------------------------------------
1 | ATVBrowser - An ATV2/3 trailer app hack.
2 |
3 | CREDITS:-
4 | I take no credit for writing the DNS Proxy and Web server code, that was written by a guy/gal on the Weiphone BBS by the username of lionphone. I just modified the code to work for me. This is the original forum post:- http://bbs.weiphone.com/read-htm-tid-5128270.html
5 |
6 | DISCLAIMER:-
7 | Standard disclaimer here, by using this code/source package you do so at your own risk. If you lose data, your computer melts, your house blows up or your current planet of residents is destroyed I take no responsibility. Basically don't blame me if anything goes wrong :)
8 |
9 |
10 | INSTRUCTIONS:-
11 |
12 | 1. Download the ATVBrowser zip file.
13 |
14 | 2. Windows:- Unzip the package to any location you like, just keep the directory structure intact.
15 | Mac:- Unzip the package to your Home folder, keep the directory structure intact.
16 |
17 | 3. You need two pieces of information, the IP address of the computer your running the DNS Proxy and Web server on and the DNS address of your ISP.
18 |
19 | 4. Open up the following file /ATVBrowser/atv.js and change the IP address on the second line to the IP address of your computer.
20 |
21 | 5. Open up the following file /ATVBrowser/utils.js and change the IP address on the second line to the IP address of your ISP's DNS.
22 |
23 | 6. You will need any m4v video file that will play on the ATV, it can be a iTunes store purchased file with DRM if you like.
24 |
25 | 7. Rename the video file to test.m4v and copy it into the /ATBrowser/assets directory.
26 |
27 | Now we need to install Node.js
28 |
29 | 1. Goto www.nodejs.org/download
30 |
31 | 2. Windows:- Download the Windows Binary(.exe) 32 or 64 bit version depending on your OS, save the node.exe file into the /ATVBrowser/ Directory. The same location as the atv.js file. VERY IMPORTANT!!! You only need the Windows Binary and not the full installer.
32 | Mac:- Download and install the Mac OSX Installer(.pkg) Universal package. VERY IMPORTANT!!! You need the full installer and not just the binaries.
33 |
34 | Running it all
35 |
36 | Windows:-
37 | 1. Open a command prompt and cd into the ATVBrowser directory.
38 | 2. Type:- node atv.js then press enter.
39 | 3. If all goes well you'll get a message saying the DNS Proxy and Web server are running.
40 |
41 | Mac:-
42 | 1. Open Terminal. The terminal should start up in your home directory.
43 | 2. Type:- cd ATVBrowser followed by enter.
44 | 3. Type:- sudo node atv.js followed by enter. You'll need to enter your user password. VERY IMPORTANT!!! You need to use sudo.
45 | 4. If all goes well you'll get a message saying the DNS Proxy and Web server are running.
46 |
47 | Now goto Setting/General/Network on your ATV and change the DNS address to the IP address of your computer, the one you entered into atv.js.
48 | Browse over to the Trailer app on the ATV and have fun.
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ATVBrowser - An ATV2/3 trailer app hack.
2 |
3 | CREDITS:-
4 | I take no credit for writing the DNS Proxy and Web server code, that was written by a guy/gal on the Weiphone BBS by the username of lionphone. I just modified the code to work for me. This is the original forum post:- http://bbs.weiphone.com/read-htm-tid-5128270.html
5 |
6 | DISCLAIMER:-
7 | Standard disclaimer here, by using this code/source package you do so at your own risk. If you lose data, your computer melts, your house blows up or your current planet of residents is destroyed I take no responsibility. Basically don't blame me if anything goes wrong :)
8 |
9 |
10 | INSTRUCTIONS:-
11 |
12 | 1. Download the ATVBrowser zip file.
13 |
14 | 2. Windows:- Unzip the package to any location you like, just keep the directory structure intact.
15 | Mac:- Unzip the package to your Home folder, keep the directory structure intact.
16 |
17 | 3. You need two pieces of information, the IP address of the computer your running the DNS Proxy and Web server on and the DNS address of your ISP.
18 |
19 | 4. Open up the following file /ATVBrowser/atv.js and change the IP address on the second line to the IP address of your computer.
20 |
21 | 5. Open up the following file /ATVBrowser/utils.js and change the IP address on the second line to the IP address of your ISP's DNS.
22 |
23 | 6. You will need any m4v video file that will play on the ATV, it can be a iTunes store purchased file with DRM if you like.
24 |
25 | 7. Rename the video file to test.m4v and copy it into the /ATBrowser/assets directory.
26 |
27 | Now we need to install Node.js
28 |
29 | 1. Goto www.nodejs.org/download
30 |
31 | 2. Windows:- Download the Windows Binary(.exe) 32 or 64 bit version depending on your OS, save the node.exe file into the /ATVBrowser/ Directory. The same location as the atv.js file. VERY IMPORTANT!!! You only need the Windows Binary and not the full installer.
32 | Mac:- Download and install the Mac OSX Installer(.pkg) Universal package. VERY IMPORTANT!!! You need the full installer and not just the binaries.
33 |
34 | Running it all
35 |
36 | Windows:-
37 | 1. Open a command prompt and cd into the ATVBrowser directory.
38 | 2. Type:- node atv.js then press enter.
39 | 3. If all goes well you'll get a message saying the DNS Proxy and Web server are running.
40 |
41 | Mac:-
42 | 1. Open Terminal. The terminal should start up in your home directory.
43 | 2. Type:- cd ATVBrowser followed by enter.
44 | 3. Type:- sudo node atv.js followed by enter. You'll need to enter your user password. VERY IMPORTANT!!! You need to use sudo.
45 | 4. If all goes well you'll get a message saying the DNS Proxy and Web server are running.
46 |
47 | Now goto Setting/General/Network on your ATV and change the DNS address to the IP address of your computer, the one you entered into atv.js.
48 | Browse over to the Trailer app on the ATV and have fun.
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/assets/A-Z.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/finkdiff/ATVBrowser-script/02779a532c8642a0dbf6d1c86ce1a2c1ea020a42/assets/A-Z.jpg
--------------------------------------------------------------------------------
/assets/Genre.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/finkdiff/ATVBrowser-script/02779a532c8642a0dbf6d1c86ce1a2c1ea020a42/assets/Genre.jpg
--------------------------------------------------------------------------------
/assets/Movies.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/finkdiff/ATVBrowser-script/02779a532c8642a0dbf6d1c86ce1a2c1ea020a42/assets/Movies.jpg
--------------------------------------------------------------------------------
/assets/Movies.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
16 | http://trailers.apple.com/A-Z.jpg
17 | resource://16X9.png
18 |
19 |
20 |
25 | http://trailers.apple.com/Genre.jpg
26 | resource://16X9.png
27 |
28 |
29 |
34 | http://trailers.apple.com/Year.jpg
35 | resource://16X9.png
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | Just Added
44 |
45 |
46 |
47 |
48 |
49 |
50 |
55 | Tron: Legacy
56 | 2010
57 | http://trailers.apple.com/Movies/TronLegacy.jpg
58 | resource://Poster.png
59 |
60 |
65 | Tron: Legacy
66 | 2010
67 | http://trailers.apple.com/Movies/TronLegacy.jpg
68 | resource://Poster.png
69 |
70 |
75 | Tron: Legacy
76 | 2010
77 | http://trailers.apple.com/Movies/TronLegacy.jpg
78 | resource://Poster.png
79 |
80 |
85 | Tron: Legacy
86 | 2010
87 | http://trailers.apple.com/Movies/TronLegacy.jpg
88 | resource://Poster.png
89 |
90 |
95 | Tron: Legacy
96 | 2010
97 | http://trailers.apple.com/Movies/TronLegacy.jpg
98 | resource://Poster.png
99 |
100 |
105 | Tron: Legacy
106 | 2010
107 | http://trailers.apple.com/Movies/TronLegacy.jpg
108 | resource://Poster.png
109 |
110 |
115 | Tron: Legacy
116 | 2010
117 | http://trailers.apple.com/Movies/TronLegacy.jpg
118 | resource://Poster.png
119 |
120 |
125 | Tron: Legacy
126 | 2010
127 | http://trailers.apple.com/Movies/TronLegacy.jpg
128 | resource://Poster.png
129 |
130 |
135 | Tron: Legacy
136 | 2010
137 | http://trailers.apple.com/Movies/TronLegacy.jpg
138 | resource://Poster.png
139 |
140 |
145 | Tron: Legacy
146 | 2010
147 | http://trailers.apple.com/Movies/TronLegacy.jpg
148 | resource://Poster.png
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
--------------------------------------------------------------------------------
/assets/Movies/Actors/actor1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/finkdiff/ATVBrowser-script/02779a532c8642a0dbf6d1c86ce1a2c1ea020a42/assets/Movies/Actors/actor1.jpg
--------------------------------------------------------------------------------
/assets/Movies/Actors/actor2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/finkdiff/ATVBrowser-script/02779a532c8642a0dbf6d1c86ce1a2c1ea020a42/assets/Movies/Actors/actor2.jpg
--------------------------------------------------------------------------------
/assets/Movies/Actors/actor3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/finkdiff/ATVBrowser-script/02779a532c8642a0dbf6d1c86ce1a2c1ea020a42/assets/Movies/Actors/actor3.jpg
--------------------------------------------------------------------------------
/assets/Movies/Actors/actor4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/finkdiff/ATVBrowser-script/02779a532c8642a0dbf6d1c86ce1a2c1ea020a42/assets/Movies/Actors/actor4.jpg
--------------------------------------------------------------------------------
/assets/Movies/MoviePlay.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | http://trailers.apple.com/test.m4v
7 | Tron: Legacy
8 | Sam Flynn, the tech-savvy son of Kevin Flynn, looks into his father's disappearance and finds himself pulled into the same world of fierce programs and gladiatorial games where Kevin has been living for 25 years. Along with Kevin's loyal confidant, father and son embark on a life-and-death journey across a visually-stunning cyber universe that has become far more advanced.
9 | http://trailers.apple.com/Movies/TronLegacy.jpg
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/assets/Movies/MoviePrePlay.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Tron: Legacy
6 | Walt Disney Pictures
7 | PG
8 | Sam Flynn, the tech-savvy son of Kevin Flynn, looks into his father's disappearance and finds himself pulled into the same world of fierce programs and gladiatorial games where Kevin has been living for 25 years. Along with Kevin's loyal confidant, father and son embark on a life-and-death journey across a visually-stunning cyber universe that has become far more advanced.
9 | http://trailers.apple.com/Movies/TronLegacy.jpg
10 | resource://Poster.png
11 |
12 |
26 | <% } %>
27 |
28 | ## Usage
29 |
30 | ejs.compile(str, options);
31 | // => Function
32 |
33 | ejs.render(str, options);
34 | // => str
35 |
36 | ## Options
37 |
38 | - `cache` Compiled functions are cached, requires `filename`
39 | - `filename` Used by `cache` to key caches
40 | - `scope` Function execution context
41 | - `debug` Output generated function body
42 | - `open` Open tag, defaulting to "<%"
43 | - `close` Closing tag, defaulting to "%>"
44 | - * All others are template-local variables
45 |
46 | ## Custom tags
47 |
48 | Custom tags can also be applied globally:
49 |
50 | var ejs = require('ejs');
51 | ejs.open = '{{';
52 | ejs.close = '}}';
53 |
54 | Which would make the following a valid template:
55 |
56 |
{{= title }}
57 |
58 | ## Filters
59 |
60 | EJS conditionally supports the concept of "filters". A "filter chain"
61 | is a designer friendly api for manipulating data, without writing JavaScript.
62 |
63 | Filters can be applied by supplying the _:_ modifier, so for example if we wish to take the array `[{ name: 'tj' }, { name: 'mape' }, { name: 'guillermo' }]` and output a list of names we can do this simply with filters:
64 |
65 | Template:
66 |
67 |
86 |
87 | ## Filter list
88 |
89 | Currently these filters are available:
90 |
91 | - first
92 | - last
93 | - capitalize
94 | - downcase
95 | - upcase
96 | - sort
97 | - sort_by:'prop'
98 | - size
99 | - length
100 | - plus:n
101 | - minus:n
102 | - times:n
103 | - divided_by:n
104 | - join:'val'
105 | - truncate:n
106 | - truncate_words:n
107 | - replace:pattern,substitution
108 | - prepend:val
109 | - append:val
110 | - map:'prop'
111 | - reverse
112 | - get:'prop'
113 |
114 | ## Adding filters
115 |
116 | To add a filter simply add a method to the `.filters` object:
117 |
118 | ```js
119 | ejs.filters.last = function(obj) {
120 | return obj[obj.length - 1];
121 | };
122 | ```
123 |
124 | ## client-side support
125 |
126 | include `./ejs.js` or `./ejs.min.js` and `require("ejs").compile(str)`.
127 |
128 | ## License
129 |
130 | (The MIT License)
131 |
132 | Copyright (c) 2009-2010 TJ Holowaychuk <tj@vision-media.ca>
133 |
134 | Permission is hereby granted, free of charge, to any person obtaining
135 | a copy of this software and associated documentation files (the
136 | 'Software'), to deal in the Software without restriction, including
137 | without limitation the rights to use, copy, modify, merge, publish,
138 | distribute, sublicense, and/or sell copies of the Software, and to
139 | permit persons to whom the Software is furnished to do so, subject to
140 | the following conditions:
141 |
142 | The above copyright notice and this permission notice shall be
143 | included in all copies or substantial portions of the Software.
144 |
145 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
146 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
147 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
148 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
149 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
150 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
151 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
152 |
--------------------------------------------------------------------------------
/node_modules/ejs/benchmark.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | var ejs = require('./lib/ejs'),
4 | str = '<% if (foo) { %>
\n <% } %>\n\n## Usage\n\n ejs.compile(str, options);\n // => Function\n\n ejs.render(str, options);\n // => str\n\n## Options\n\n - `cache` Compiled functions are cached, requires `filename`\n - `filename` Used by `cache` to key caches\n - `scope` Function execution context\n - `debug` Output generated function body\n - `open` Open tag, defaulting to \"<%\"\n - `close` Closing tag, defaulting to \"%>\"\n - * All others are template-local variables\n\n## Custom tags\n\nCustom tags can also be applied globally:\n\n var ejs = require('ejs');\n ejs.open = '{{';\n ejs.close = '}}';\n\nWhich would make the following a valid template:\n\n
{{= title }}
\n\n## Filters\n\nEJS conditionally supports the concept of \"filters\". A \"filter chain\"\nis a designer friendly api for manipulating data, without writing JavaScript.\n\nFilters can be applied by supplying the _:_ modifier, so for example if we wish to take the array `[{ name: 'tj' }, { name: 'mape' }, { name: 'guillermo' }]` and output a list of names we can do this simply with filters:\n\nTemplate:\n\n
<%=: users | map:'name' | join %>
\n\nOutput:\n\n
Tj, Mape, Guillermo
\n\nRender call:\n\n ejs.render(str, {\n users: [\n { name: 'tj' },\n { name: 'mape' },\n { name: 'guillermo' }\n ]\n });\n\nOr perhaps capitalize the first user's name for display:\n\n
<%=: users | first | capitalize %>
\n\n## Filter list\n\nCurrently these filters are available:\n\n - first\n - last\n - capitalize\n - downcase\n - upcase\n - sort\n - sort_by:'prop'\n - size\n - length\n - plus:n\n - minus:n\n - times:n\n - divided_by:n\n - join:'val'\n - truncate:n\n - truncate_words:n\n - replace:pattern,substitution\n - prepend:val\n - append:val\n - map:'prop'\n - reverse\n - get:'prop'\n\n## Adding filters\n\n To add a filter simply add a method to the `.filters` object:\n \n```js\nejs.filters.last = function(obj) {\n return obj[obj.length - 1];\n};\n```\n\n## client-side support\n\n include `./ejs.js` or `./ejs.min.js` and `require(\"ejs\").compile(str)`.\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2009-2010 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
23 | "readmeFilename": "Readme.md",
24 | "_id": "ejs@0.7.2",
25 | "dist": {
26 | "shasum": "8032ee9f1fccdae8376582fee1c6d80b31aa1bd3"
27 | },
28 | "_from": "ejs@0.7.2",
29 | "_resolved": "https://registry.npmjs.org/ejs/-/ejs-0.7.2.tgz"
30 | }
31 |
--------------------------------------------------------------------------------
/node_modules/ejs/support/compile.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Module dependencies.
4 | */
5 |
6 | var fs = require('fs');
7 |
8 | /**
9 | * Arguments.
10 | */
11 |
12 | var args = process.argv.slice(2)
13 | , pending = args.length
14 | , files = {};
15 |
16 | console.log('');
17 |
18 | // parse arguments
19 |
20 | args.forEach(function(file){
21 | var mod = file.replace('lib/', '');
22 | fs.readFile(file, 'utf8', function(err, js){
23 | if (err) throw err;
24 | console.log(' \033[90mcompile : \033[0m\033[36m%s\033[0m', file);
25 | files[file] = parse(js);
26 | --pending || compile();
27 | });
28 | });
29 |
30 | /**
31 | * Parse the given `js`.
32 | */
33 |
34 | function parse(js) {
35 | return parseInheritance(parseConditionals(js));
36 | }
37 |
38 | /**
39 | * Parse __proto__.
40 | */
41 |
42 | function parseInheritance(js) {
43 | return js
44 | .replace(/^ *(\w+)\.prototype\.__proto__ * = *(\w+)\.prototype *;?/gm, function(_, child, parent){
45 | return child + '.prototype = new ' + parent + ';\n'
46 | + child + '.prototype.constructor = '+ child + ';\n';
47 | });
48 | }
49 |
50 | /**
51 | * Parse the given `js`, currently supporting:
52 | *
53 | * 'if' ['node' | 'browser']
54 | * 'end'
55 | *
56 | */
57 |
58 | function parseConditionals(js) {
59 | var lines = js.split('\n')
60 | , len = lines.length
61 | , buffer = true
62 | , browser = false
63 | , buf = []
64 | , line
65 | , cond;
66 |
67 | for (var i = 0; i < len; ++i) {
68 | line = lines[i];
69 | if (/^ *\/\/ *if *(node|browser)/gm.exec(line)) {
70 | cond = RegExp.$1;
71 | buffer = browser = 'browser' == cond;
72 | } else if (/^ *\/\/ *end/.test(line)) {
73 | buffer = true;
74 | browser = false;
75 | } else if (browser) {
76 | buf.push(line.replace(/^( *)\/\//, '$1'));
77 | } else if (buffer) {
78 | buf.push(line);
79 | }
80 | }
81 |
82 | return buf.join('\n');
83 | }
84 |
85 | /**
86 | * Compile the files.
87 | */
88 |
89 | function compile() {
90 | var buf = '';
91 | buf += '\n// CommonJS require()\n\n';
92 | buf += browser.require + '\n\n';
93 | buf += 'require.modules = {};\n\n';
94 | buf += 'require.resolve = ' + browser.resolve + ';\n\n';
95 | buf += 'require.register = ' + browser.register + ';\n\n';
96 | buf += 'require.relative = ' + browser.relative + ';\n\n';
97 | args.forEach(function(file){
98 | var js = files[file];
99 | file = file.replace('lib/', '');
100 | buf += '\nrequire.register("' + file + '", function(module, exports, require){\n';
101 | buf += js;
102 | buf += '\n}); // module: ' + file + '\n';
103 | });
104 | fs.writeFile('ejs.js', buf, function(err){
105 | if (err) throw err;
106 | console.log(' \033[90m create : \033[0m\033[36m%s\033[0m', 'ejs.js');
107 | console.log();
108 | });
109 | }
110 |
111 | // refactored version of weepy's
112 | // https://github.com/weepy/brequire/blob/master/browser/brequire.js
113 |
114 | var browser = {
115 |
116 | /**
117 | * Require a module.
118 | */
119 |
120 | require: function require(p){
121 | if ('fs' == p) return {};
122 | var path = require.resolve(p)
123 | , mod = require.modules[path];
124 | if (!mod) throw new Error('failed to require "' + p + '"');
125 | if (!mod.exports) {
126 | mod.exports = {};
127 | mod.call(mod.exports, mod, mod.exports, require.relative(path));
128 | }
129 | return mod.exports;
130 | },
131 |
132 | /**
133 | * Resolve module path.
134 | */
135 |
136 | resolve: function(path){
137 | var orig = path
138 | , reg = path + '.js'
139 | , index = path + '/index.js';
140 | return require.modules[reg] && reg
141 | || require.modules[index] && index
142 | || orig;
143 | },
144 |
145 | /**
146 | * Return relative require().
147 | */
148 |
149 | relative: function(parent) {
150 | return function(p){
151 | if ('.' != p.substr(0, 1)) return require(p);
152 |
153 | var path = parent.split('/')
154 | , segs = p.split('/');
155 | path.pop();
156 |
157 | for (var i = 0; i < segs.length; i++) {
158 | var seg = segs[i];
159 | if ('..' == seg) path.pop();
160 | else if ('.' != seg) path.push(seg);
161 | }
162 |
163 | return require(path.join('/'));
164 | };
165 | },
166 |
167 | /**
168 | * Register a module.
169 | */
170 |
171 | register: function(path, fn){
172 | require.modules[path] = fn;
173 | }
174 | };
--------------------------------------------------------------------------------
/node_modules/ejs/test/ejs.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Module dependencies.
3 | */
4 |
5 | var ejs = require('../')
6 | , assert = require('assert');
7 |
8 | module.exports = {
9 | 'test .version': function(){
10 | assert.ok(/^\d+\.\d+\.\d+$/.test(ejs.version), 'Test .version format');
11 | },
12 |
13 | 'test html': function(){
14 | assert.equal('
yay
', ejs.render('
yay
'));
15 | },
16 |
17 | 'test renderFile': function(){
18 | var html = '