mobile_template 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +22 -0
  4. data/README.md +28 -0
  5. data/Rakefile +3 -0
  6. data/bin/mobile_template +71 -0
  7. data/lib/mobile_template/version.rb +4 -0
  8. data/lib/mobile_template.rb +5 -0
  9. data/mobile_template.gemspec +21 -0
  10. data/templates/assets/Gemfile +4 -0
  11. data/templates/assets/config.rb +96 -0
  12. data/templates/assets/config.ru +4 -0
  13. data/templates/assets/source/images/vendor/ajax-loader.gif +0 -0
  14. data/templates/assets/source/images/vendor/ajax-loader.png +0 -0
  15. data/templates/assets/source/images/vendor/icons-18-black.png +0 -0
  16. data/templates/assets/source/images/vendor/icons-18-white.png +0 -0
  17. data/templates/assets/source/images/vendor/icons-36-black.png +0 -0
  18. data/templates/assets/source/images/vendor/icons-36-white.png +0 -0
  19. data/templates/assets/source/index.html.erb +2 -0
  20. data/templates/assets/source/javascripts/app/index.js.coffee +2 -0
  21. data/templates/assets/source/javascripts/application.js.coffee +5 -0
  22. data/templates/assets/source/javascripts/vendor/cordova.js +4841 -0
  23. data/templates/assets/source/javascripts/vendor/jquery.js +9267 -0
  24. data/templates/assets/source/javascripts/vendor/jquery.mobile.js +7410 -0
  25. data/templates/assets/source/layout.erb +24 -0
  26. data/templates/assets/source/stylesheets/application.css.scss +2 -0
  27. data/templates/assets/source/stylesheets/vendor/jquery.mobile.css.scss +1872 -0
  28. data/templates/cordova_android/.gitignore +18 -0
  29. data/templates/cordova_android/LICENSE +202 -0
  30. data/templates/cordova_android/NOTICE +5 -0
  31. data/templates/cordova_android/README.md +95 -0
  32. data/templates/cordova_android/VERSION +1 -0
  33. data/templates/cordova_android/bin/BOOM +4 -0
  34. data/templates/cordova_android/bin/autotest +2 -0
  35. data/templates/cordova_android/bin/bench +29 -0
  36. data/templates/cordova_android/bin/create +46 -0
  37. data/templates/cordova_android/bin/create.bat +1 -0
  38. data/templates/cordova_android/bin/create.js +88 -0
  39. data/templates/cordova_android/bin/create.xml +79 -0
  40. data/templates/cordova_android/bin/node_modules/.bin/cake +7 -0
  41. data/templates/cordova_android/bin/node_modules/.bin/coffee +7 -0
  42. data/templates/cordova_android/bin/node_modules/.bin/nodeunit +120 -0
  43. data/templates/cordova_android/bin/node_modules/coffee-script/.npmignore +11 -0
  44. data/templates/cordova_android/bin/node_modules/coffee-script/LICENSE +22 -0
  45. data/templates/cordova_android/bin/node_modules/coffee-script/README +48 -0
  46. data/templates/cordova_android/bin/node_modules/coffee-script/Rakefile +78 -0
  47. data/templates/cordova_android/bin/node_modules/coffee-script/bin/cake +7 -0
  48. data/templates/cordova_android/bin/node_modules/coffee-script/bin/coffee +7 -0
  49. data/templates/cordova_android/bin/node_modules/coffee-script/extras/jsl.conf +44 -0
  50. data/templates/cordova_android/bin/node_modules/coffee-script/lib/browser.js +75 -0
  51. data/templates/cordova_android/bin/node_modules/coffee-script/lib/cake.js +76 -0
  52. data/templates/cordova_android/bin/node_modules/coffee-script/lib/coffee-script.js +135 -0
  53. data/templates/cordova_android/bin/node_modules/coffee-script/lib/command.js +301 -0
  54. data/templates/cordova_android/bin/node_modules/coffee-script/lib/grammar.js +591 -0
  55. data/templates/cordova_android/bin/node_modules/coffee-script/lib/helpers.js +66 -0
  56. data/templates/cordova_android/bin/node_modules/coffee-script/lib/index.js +8 -0
  57. data/templates/cordova_android/bin/node_modules/coffee-script/lib/lexer.js +656 -0
  58. data/templates/cordova_android/bin/node_modules/coffee-script/lib/nodes.js +2289 -0
  59. data/templates/cordova_android/bin/node_modules/coffee-script/lib/optparse.js +111 -0
  60. data/templates/cordova_android/bin/node_modules/coffee-script/lib/parser.js +676 -0
  61. data/templates/cordova_android/bin/node_modules/coffee-script/lib/repl.js +123 -0
  62. data/templates/cordova_android/bin/node_modules/coffee-script/lib/rewriter.js +363 -0
  63. data/templates/cordova_android/bin/node_modules/coffee-script/lib/scope.js +120 -0
  64. data/templates/cordova_android/bin/node_modules/coffee-script/package.json +27 -0
  65. data/templates/cordova_android/bin/node_modules/nodeunit/.gitignore +5 -0
  66. data/templates/cordova_android/bin/node_modules/nodeunit/.npmignore +3 -0
  67. data/templates/cordova_android/bin/node_modules/nodeunit/CONTRIBUTORS.md +60 -0
  68. data/templates/cordova_android/bin/node_modules/nodeunit/LICENSE +19 -0
  69. data/templates/cordova_android/bin/node_modules/nodeunit/Makefile +126 -0
  70. data/templates/cordova_android/bin/node_modules/nodeunit/README.md +432 -0
  71. data/templates/cordova_android/bin/node_modules/nodeunit/bin/nodeunit +120 -0
  72. data/templates/cordova_android/bin/node_modules/nodeunit/bin/nodeunit.json +10 -0
  73. data/templates/cordova_android/bin/node_modules/nodeunit/deps/async.js +623 -0
  74. data/templates/cordova_android/bin/node_modules/nodeunit/deps/console.log.js +55 -0
  75. data/templates/cordova_android/bin/node_modules/nodeunit/deps/ejs.js +125 -0
  76. data/templates/cordova_android/bin/node_modules/nodeunit/deps/json2.js +483 -0
  77. data/templates/cordova_android/bin/node_modules/nodeunit/examples/browser/nodeunit.js +1757 -0
  78. data/templates/cordova_android/bin/node_modules/nodeunit/examples/browser/suite1.js +12 -0
  79. data/templates/cordova_android/bin/node_modules/nodeunit/examples/browser/suite2.js +13 -0
  80. data/templates/cordova_android/bin/node_modules/nodeunit/examples/browser/test.html +16 -0
  81. data/templates/cordova_android/bin/node_modules/nodeunit/img/example_fail.png +0 -0
  82. data/templates/cordova_android/bin/node_modules/nodeunit/img/example_pass.png +0 -0
  83. data/templates/cordova_android/bin/node_modules/nodeunit/index.js +3 -0
  84. data/templates/cordova_android/bin/node_modules/nodeunit/lib/assert.js +316 -0
  85. data/templates/cordova_android/bin/node_modules/nodeunit/lib/core.js +260 -0
  86. data/templates/cordova_android/bin/node_modules/nodeunit/lib/nodeunit.js +82 -0
  87. data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/browser.js +119 -0
  88. data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/default.js +123 -0
  89. data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/html.js +107 -0
  90. data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/index.js +9 -0
  91. data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/junit.js +183 -0
  92. data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/minimal.js +112 -0
  93. data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/skip_passed.js +105 -0
  94. data/templates/cordova_android/bin/node_modules/nodeunit/lib/track.js +48 -0
  95. data/templates/cordova_android/bin/node_modules/nodeunit/lib/types.js +187 -0
  96. data/templates/cordova_android/bin/node_modules/nodeunit/lib/utils.js +209 -0
  97. data/templates/cordova_android/bin/node_modules/nodeunit/man1/nodeunit.1 +95 -0
  98. data/templates/cordova_android/bin/node_modules/nodeunit/nodelint.cfg +4 -0
  99. data/templates/cordova_android/bin/node_modules/nodeunit/package.json +56 -0
  100. data/templates/cordova_android/bin/node_modules/nodeunit/share/junit.xml.ejs +19 -0
  101. data/templates/cordova_android/bin/node_modules/nodeunit/share/license.js +11 -0
  102. data/templates/cordova_android/bin/node_modules/nodeunit/share/nodeunit.css +70 -0
  103. data/templates/cordova_android/bin/templates/project/.cordova/android/readme.md +1 -0
  104. data/templates/cordova_android/bin/templates/project/.cordova/readme.md +3 -0
  105. data/templates/cordova_android/bin/templates/project/cordova/create +36 -0
  106. data/templates/cordova_android/bin/templates/project/cordova/debug +9 -0
  107. data/templates/cordova_android/bin/templates/project/cordova/emulate +12 -0
  108. data/templates/cordova_android/bin/templates/project/cordova/log +3 -0
  109. data/templates/cordova_android/bin/templates/project/cordova/templates/Activity.java +16 -0
  110. data/templates/cordova_android/bin/templates/project/cordova/templates/project/AndroidManifest.xml +50 -0
  111. data/templates/cordova_android/bin/templates/project/cordova/templates/project/assets/www/index.html +42 -0
  112. data/templates/cordova_android/bin/templates/project/cordova/templates/project/assets/www/main.js +146 -0
  113. data/templates/cordova_android/bin/templates/project/cordova/templates/project/assets/www/master.css +96 -0
  114. data/templates/cordova_android/bin/templates/project/cordova/templates/project/res/drawable/icon.png +0 -0
  115. data/templates/cordova_android/bin/templates/project/cordova/templates/project/res/xml/cordova.xml +5 -0
  116. data/templates/cordova_android/bin/templates/project/cordova/templates/project/res/xml/plugins.xml +19 -0
  117. data/templates/cordova_android/bin/test +26 -0
  118. data/templates/cordova_android/bin/tests/autotest.coffee +4 -0
  119. data/templates/cordova_android/bin/tests/create.coffee +21 -0
  120. data/templates/cordova_android/bin/tests/debug.coffee +0 -0
  121. data/templates/cordova_android/bin/tests/test.coffee +0 -0
  122. data/templates/cordova_android/framework/.classpath +8 -0
  123. data/templates/cordova_android/framework/.project +33 -0
  124. data/templates/cordova_android/framework/AndroidManifest.xml +68 -0
  125. data/templates/cordova_android/framework/ant.properties +34 -0
  126. data/templates/cordova_android/framework/assets/js/accelerometer.js +137 -0
  127. data/templates/cordova_android/framework/assets/js/app.js +89 -0
  128. data/templates/cordova_android/framework/assets/js/battery.js +134 -0
  129. data/templates/cordova_android/framework/assets/js/camera.js +168 -0
  130. data/templates/cordova_android/framework/assets/js/capture.js +203 -0
  131. data/templates/cordova_android/framework/assets/js/compass.js +168 -0
  132. data/templates/cordova_android/framework/assets/js/contact.js +310 -0
  133. data/templates/cordova_android/framework/assets/js/cordova.android.js +4841 -0
  134. data/templates/cordova_android/framework/assets/js/cordova.js.base +924 -0
  135. data/templates/cordova_android/framework/assets/js/crypto.js +54 -0
  136. data/templates/cordova_android/framework/assets/js/device.js +83 -0
  137. data/templates/cordova_android/framework/assets/js/file.js +1082 -0
  138. data/templates/cordova_android/framework/assets/js/filetransfer.js +125 -0
  139. data/templates/cordova_android/framework/assets/js/geolocation.js +209 -0
  140. data/templates/cordova_android/framework/assets/js/header.txt +19 -0
  141. data/templates/cordova_android/framework/assets/js/media.js +233 -0
  142. data/templates/cordova_android/framework/assets/js/network.js +100 -0
  143. data/templates/cordova_android/framework/assets/js/notification.js +133 -0
  144. data/templates/cordova_android/framework/assets/js/position.js +100 -0
  145. data/templates/cordova_android/framework/assets/js/storage.js +439 -0
  146. data/templates/cordova_android/framework/assets/www/index.html +27 -0
  147. data/templates/cordova_android/framework/build.xml +216 -0
  148. data/templates/cordova_android/framework/libs/commons-codec-1.3.jar +0 -0
  149. data/templates/cordova_android/framework/proguard-project.txt +20 -0
  150. data/templates/cordova_android/framework/project.properties +14 -0
  151. data/templates/cordova_android/framework/res/drawable/icon.png +0 -0
  152. data/templates/cordova_android/framework/res/drawable/splash.png +0 -0
  153. data/templates/cordova_android/framework/res/layout/main.xml +29 -0
  154. data/templates/cordova_android/framework/res/values/strings.xml +23 -0
  155. data/templates/cordova_android/framework/res/xml/cordova.xml +37 -0
  156. data/templates/cordova_android/framework/res/xml/plugins.xml +37 -0
  157. data/templates/cordova_android/framework/src/com/phonegap/api/IPlugin.java +27 -0
  158. data/templates/cordova_android/framework/src/com/phonegap/api/LOG.java +28 -0
  159. data/templates/cordova_android/framework/src/com/phonegap/api/PhonegapActivity.java +28 -0
  160. data/templates/cordova_android/framework/src/com/phonegap/api/Plugin.java +27 -0
  161. data/templates/cordova_android/framework/src/com/phonegap/api/PluginManager.java +35 -0
  162. data/templates/cordova_android/framework/src/com/phonegap/api/PluginResult.java +53 -0
  163. data/templates/cordova_android/framework/src/org/apache/cordova/AccelListener.java +311 -0
  164. data/templates/cordova_android/framework/src/org/apache/cordova/App.java +198 -0
  165. data/templates/cordova_android/framework/src/org/apache/cordova/AudioHandler.java +364 -0
  166. data/templates/cordova_android/framework/src/org/apache/cordova/AudioPlayer.java +450 -0
  167. data/templates/cordova_android/framework/src/org/apache/cordova/AuthenticationToken.java +69 -0
  168. data/templates/cordova_android/framework/src/org/apache/cordova/BatteryListener.java +156 -0
  169. data/templates/cordova_android/framework/src/org/apache/cordova/CallbackServer.java +431 -0
  170. data/templates/cordova_android/framework/src/org/apache/cordova/CameraLauncher.java +500 -0
  171. data/templates/cordova_android/framework/src/org/apache/cordova/Capture.java +400 -0
  172. data/templates/cordova_android/framework/src/org/apache/cordova/CompassListener.java +308 -0
  173. data/templates/cordova_android/framework/src/org/apache/cordova/ContactAccessor.java +198 -0
  174. data/templates/cordova_android/framework/src/org/apache/cordova/ContactAccessorSdk5.java +1934 -0
  175. data/templates/cordova_android/framework/src/org/apache/cordova/ContactManager.java +113 -0
  176. data/templates/cordova_android/framework/src/org/apache/cordova/CordovaChromeClient.java +314 -0
  177. data/templates/cordova_android/framework/src/org/apache/cordova/CordovaWebViewClient.java +306 -0
  178. data/templates/cordova_android/framework/src/org/apache/cordova/Device.java +219 -0
  179. data/templates/cordova_android/framework/src/org/apache/cordova/DirectoryManager.java +161 -0
  180. data/templates/cordova_android/framework/src/org/apache/cordova/DroidGap.java +1417 -0
  181. data/templates/cordova_android/framework/src/org/apache/cordova/ExifHelper.java +165 -0
  182. data/templates/cordova_android/framework/src/org/apache/cordova/FileTransfer.java +458 -0
  183. data/templates/cordova_android/framework/src/org/apache/cordova/FileUploadResult.java +63 -0
  184. data/templates/cordova_android/framework/src/org/apache/cordova/FileUtils.java +1048 -0
  185. data/templates/cordova_android/framework/src/org/apache/cordova/GeoBroker.java +165 -0
  186. data/templates/cordova_android/framework/src/org/apache/cordova/GeoListener.java +133 -0
  187. data/templates/cordova_android/framework/src/org/apache/cordova/GpsListener.java +163 -0
  188. data/templates/cordova_android/framework/src/org/apache/cordova/HttpHandler.java +80 -0
  189. data/templates/cordova_android/framework/src/org/apache/cordova/LinearLayoutSoftKeyboardDetect.java +104 -0
  190. data/templates/cordova_android/framework/src/org/apache/cordova/NetworkListener.java +153 -0
  191. data/templates/cordova_android/framework/src/org/apache/cordova/NetworkManager.java +248 -0
  192. data/templates/cordova_android/framework/src/org/apache/cordova/Notification.java +366 -0
  193. data/templates/cordova_android/framework/src/org/apache/cordova/PreferenceNode.java +34 -0
  194. data/templates/cordova_android/framework/src/org/apache/cordova/PreferenceSet.java +62 -0
  195. data/templates/cordova_android/framework/src/org/apache/cordova/StandAlone.java +35 -0
  196. data/templates/cordova_android/framework/src/org/apache/cordova/Storage.java +239 -0
  197. data/templates/cordova_android/framework/src/org/apache/cordova/TempListener.java +112 -0
  198. data/templates/cordova_android/framework/src/org/apache/cordova/api/CordovaInterface.java +145 -0
  199. data/templates/cordova_android/framework/src/org/apache/cordova/api/IPlugin.java +116 -0
  200. data/templates/cordova_android/framework/src/org/apache/cordova/api/LOG.java +234 -0
  201. data/templates/cordova_android/framework/src/org/apache/cordova/api/Plugin.java +210 -0
  202. data/templates/cordova_android/framework/src/org/apache/cordova/api/PluginManager.java +359 -0
  203. data/templates/cordova_android/framework/src/org/apache/cordova/api/PluginResult.java +119 -0
  204. data/templates/cordova_android/framework/src/org/apache/cordova/file/EncodingException.java +28 -0
  205. data/templates/cordova_android/framework/src/org/apache/cordova/file/FileExistsException.java +28 -0
  206. data/templates/cordova_android/framework/src/org/apache/cordova/file/InvalidModificationException.java +29 -0
  207. data/templates/cordova_android/framework/src/org/apache/cordova/file/NoModificationAllowedException.java +28 -0
  208. data/templates/cordova_android/framework/src/org/apache/cordova/file/TypeMismatchException.java +29 -0
  209. data/templates/cordova_android/framework/test/org/apache/cordova/PreferenceNodeTest.java +53 -0
  210. data/templates/cordova_android/framework/test/org/apache/cordova/PreferenceSetTest.java +73 -0
  211. metadata +279 -0
@@ -0,0 +1,120 @@
1
+ #!/usr/bin/env node
2
+
3
+ var
4
+ fs = require('fs'),
5
+ path = require('path');
6
+
7
+ // TODO: remove this when https://github.com/joyent/node/pull/1312
8
+ // lands in core.
9
+ //
10
+ // Until then, use console.log from npm (https://gist.github.com/1077544)
11
+ require('../deps/console.log');
12
+
13
+ require.paths.push(process.cwd());
14
+ var args = process.ARGV.slice(2);
15
+
16
+ var files = [];
17
+
18
+ var testrunner,
19
+ config_file,
20
+ config_param_found = false,
21
+ output_param_found = false,
22
+ reporter_file = 'default',
23
+ reporter_param_found = false,
24
+ testspec_param_found = false;
25
+
26
+ var usage = "Usage: nodeunit [options] testmodule1.js testfolder [...] \n" +
27
+ "Options:\n\n" +
28
+ " --config FILE the path to a JSON file with options\n" +
29
+ " --reporter FILE optional path to a reporter file to customize the output\n" +
30
+ " --list-reporters list available build-in reporters\n" +
31
+ " -t name, specify a test to run\n" +
32
+ " -h, --help display this help and exit\n" +
33
+ " -v, --version output version information and exit";
34
+
35
+
36
+ // load default options
37
+ var content = fs.readFileSync(__dirname + '/nodeunit.json', 'utf8');
38
+ var options = JSON.parse(content);
39
+
40
+ // a very basic pseudo --options parser
41
+ args.forEach(function (arg) {
42
+ if (arg.slice(0, 9) === "--config=") {
43
+ config_file = arg.slice(9);
44
+ } else if (arg === '--config') {
45
+ config_param_found = true;
46
+ } else if (config_param_found) {
47
+ config_file = arg;
48
+ config_param_found = false;
49
+ } else if (arg.slice(0, 9) === "--output=") {
50
+ options.output = arg.slice(9);
51
+ } else if (arg === '--output') {
52
+ output_param_found = true;
53
+ } else if (output_param_found) {
54
+ options.output = arg;
55
+ output_param_found = false;
56
+ } else if (arg.slice(0, 11) === "--reporter=") {
57
+ reporter_file = arg.slice(11);
58
+ } else if (arg === '--reporter') {
59
+ reporter_param_found = true;
60
+ } else if (reporter_param_found) {
61
+ reporter_file = arg;
62
+ reporter_param_found = false;
63
+ } else if (arg === '-t') {
64
+ testspec_param_found = true;
65
+ } else if (testspec_param_found) {
66
+ options.testspec = arg;
67
+ testspec_param_found = false;
68
+ } else if (arg === '--list-reporters') {
69
+ var reporters = fs.readdirSync(__dirname + '/../lib/reporters');
70
+ reporters = reporters.filter(function (reporter_file) {
71
+ return (/\.js$/).test(reporter_file);
72
+ }).map(function (reporter_file) {
73
+ return reporter_file.replace(/\.js$/, '');
74
+ }).filter(function (reporter_file) {
75
+ return reporter_file !== 'index';
76
+ });
77
+ console.log('Build-in reporters: ');
78
+ reporters.forEach(function (reporter_file) {
79
+ var reporter = require('../lib/reporters/' + reporter_file);
80
+ console.log(' * ' + reporter_file + (reporter.info ? ': ' + reporter.info : ''));
81
+ });
82
+ process.exit(0);
83
+ } else if ((arg === '-v') || (arg === '--version')) {
84
+ var content = fs.readFileSync(__dirname + '/../package.json', 'utf8');
85
+ var pkg = JSON.parse(content);
86
+ console.log(pkg.version);
87
+ process.exit(0);
88
+ } else if ((arg === '-h') || (arg === '--help')) {
89
+ console.log(usage);
90
+ process.exit(0);
91
+ } else {
92
+ files.push(arg);
93
+ }
94
+ });
95
+
96
+ if (files.length === 0) {
97
+ console.log('Files required.');
98
+ console.log(usage);
99
+ process.exit(1);
100
+ }
101
+
102
+ if (config_file) {
103
+ content = fs.readFileSync(config_file, 'utf8');
104
+ var custom_options = JSON.parse(content);
105
+
106
+ for (var option in custom_options) {
107
+ if (typeof option === 'string') {
108
+ options[option] = custom_options[option];
109
+ }
110
+ }
111
+ }
112
+
113
+ var builtin_reporters = require(__dirname + '/../lib/reporters');
114
+ if (reporter_file in builtin_reporters) {
115
+ testrunner = builtin_reporters[reporter_file];
116
+ }
117
+ else {
118
+ testrunner = require(reporter_file);
119
+ }
120
+ testrunner.run(files, options);
@@ -0,0 +1,11 @@
1
+ *.coffee
2
+ *.html
3
+ .DS_Store
4
+ .git*
5
+ Cakefile
6
+ documentation/
7
+ examples/
8
+ extras/coffee-script.js
9
+ raw/
10
+ src/
11
+ test/
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2011 Jeremy Ashkenas
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,48 @@
1
+ =
2
+ {
3
+ } } {
4
+ { { } }
5
+ } }{ {
6
+ { }{ } } _____ __ __
7
+ ( }{ }{ { ) / ____| / _|/ _|
8
+ .- { { } { }} -. | | ___ | |_| |_ ___ ___
9
+ ( ( } { } { } } ) | | / _ \| _| _/ _ \/ _ \
10
+ |`-..________ ..-'| | |___| (_) | | | || __/ __/
11
+ | | \_____\___/|_| |_| \___|\___|
12
+ | ;--.
13
+ | (__ \ _____ _ _
14
+ | | ) ) / ____| (_) | |
15
+ | |/ / | (___ ___ _ __ _ _ __ | |_
16
+ | ( / \___ \ / __| '__| | '_ \| __|
17
+ | |/ ____) | (__| | | | |_) | |_
18
+ | | |_____/ \___|_| |_| .__/ \__|
19
+ `-.._________..-' | |
20
+ |_|
21
+
22
+
23
+ CoffeeScript is a little language that compiles into JavaScript.
24
+
25
+ Install Node.js, and then the CoffeeScript compiler:
26
+ sudo bin/cake install
27
+
28
+ Or, if you have the Node Package Manager installed:
29
+ npm install -g coffee-script
30
+ (Leave off the -g if you don't wish to install globally.)
31
+
32
+ Compile a script:
33
+ coffee /path/to/script.coffee
34
+
35
+ For documentation, usage, and examples, see:
36
+ http://coffeescript.org/
37
+
38
+ To suggest a feature, report a bug, or general discussion:
39
+ http://github.com/jashkenas/coffee-script/issues/
40
+
41
+ If you'd like to chat, drop by #coffeescript on Freenode IRC,
42
+ or on webchat.freenode.net.
43
+
44
+ The source repository:
45
+ git://github.com/jashkenas/coffee-script.git
46
+
47
+ All contributors are listed here:
48
+ http://github.com/jashkenas/coffee-script/contributors
@@ -0,0 +1,78 @@
1
+ require 'rubygems'
2
+ require 'erb'
3
+ require 'fileutils'
4
+ require 'rake/testtask'
5
+ require 'json'
6
+
7
+ desc "Build the documentation page"
8
+ task :doc do
9
+ source = 'documentation/index.html.erb'
10
+ child = fork { exec "bin/coffee -bcw -o documentation/js documentation/coffee/*.coffee" }
11
+ at_exit { Process.kill("INT", child) }
12
+ Signal.trap("INT") { exit }
13
+ loop do
14
+ mtime = File.stat(source).mtime
15
+ if !@mtime || mtime > @mtime
16
+ rendered = ERB.new(File.read(source)).result(binding)
17
+ File.open('index.html', 'w+') {|f| f.write(rendered) }
18
+ end
19
+ @mtime = mtime
20
+ sleep 1
21
+ end
22
+ end
23
+
24
+ desc "Build coffee-script-source gem"
25
+ task :gem do
26
+ require 'rubygems'
27
+ require 'rubygems/package'
28
+
29
+ gemspec = Gem::Specification.new do |s|
30
+ s.name = 'coffee-script-source'
31
+ s.version = JSON.parse(File.read('package.json'))["version"]
32
+ s.date = Time.now.strftime("%Y-%m-%d")
33
+
34
+ s.homepage = "http://jashkenas.github.com/coffee-script/"
35
+ s.summary = "The CoffeeScript Compiler"
36
+ s.description = <<-EOS
37
+ CoffeeScript is a little language that compiles into JavaScript.
38
+ Underneath all of those embarrassing braces and semicolons,
39
+ JavaScript has always had a gorgeous object model at its heart.
40
+ CoffeeScript is an attempt to expose the good parts of JavaScript
41
+ in a simple way.
42
+ EOS
43
+
44
+ s.files = [
45
+ 'lib/coffee_script/coffee-script.js',
46
+ 'lib/coffee_script/source.rb'
47
+ ]
48
+
49
+ s.authors = ['Jeremy Ashkenas']
50
+ s.email = 'jashkenas@gmail.com'
51
+ s.rubyforge_project = 'coffee-script-source'
52
+ end
53
+
54
+ file = File.open("coffee-script-source.gem", "w")
55
+ Gem::Package.open(file, 'w') do |pkg|
56
+ pkg.metadata = gemspec.to_yaml
57
+
58
+ path = "lib/coffee_script/source.rb"
59
+ contents = <<-ERUBY
60
+ module CoffeeScript
61
+ module Source
62
+ def self.bundled_path
63
+ File.expand_path("../coffee-script.js", __FILE__)
64
+ end
65
+ end
66
+ end
67
+ ERUBY
68
+ pkg.add_file_simple(path, 0644, contents.size) do |tar_io|
69
+ tar_io.write(contents)
70
+ end
71
+
72
+ contents = File.read("extras/coffee-script.js")
73
+ path = "lib/coffee_script/coffee-script.js"
74
+ pkg.add_file_simple(path, 0644, contents.size) do |tar_io|
75
+ tar_io.write(contents)
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+
3
+ var path = require('path');
4
+ var fs = require('fs');
5
+ var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
6
+
7
+ require(lib + '/cake').run();
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+
3
+ var path = require('path');
4
+ var fs = require('fs');
5
+ var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
6
+
7
+ require(lib + '/command').run();
@@ -0,0 +1,44 @@
1
+ # JavaScriptLint configuration file for CoffeeScript.
2
+
3
+ +no_return_value # function {0} does not always return a value
4
+ +duplicate_formal # duplicate formal argument {0}
5
+ -equal_as_assign # test for equality (==) mistyped as assignment (=)?{0}
6
+ +var_hides_arg # variable {0} hides argument
7
+ +redeclared_var # redeclaration of {0} {1}
8
+ -anon_no_return_value # anonymous function does not always return a value
9
+ +missing_semicolon # missing semicolon
10
+ +meaningless_block # meaningless block; curly braces have no impact
11
+ -comma_separated_stmts # multiple statements separated by commas (use semicolons?)
12
+ +unreachable_code # unreachable code
13
+ +missing_break # missing break statement
14
+ -missing_break_for_last_case # missing break statement for last case in switch
15
+ -comparison_type_conv # comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==)
16
+ -inc_dec_within_stmt # increment (++) and decrement (--) operators used as part of greater statement
17
+ -useless_void # use of the void type may be unnecessary (void is always undefined)
18
+ +multiple_plus_minus # unknown order of operations for successive plus (e.g. x+++y) or minus (e.g. x---y) signs
19
+ +use_of_label # use of label
20
+ -block_without_braces # block statement without curly braces
21
+ +leading_decimal_point # leading decimal point may indicate a number or an object member
22
+ +trailing_decimal_point # trailing decimal point may indicate a number or an object member
23
+ +octal_number # leading zeros make an octal number
24
+ +nested_comment # nested comment
25
+ +misplaced_regex # regular expressions should be preceded by a left parenthesis, assignment, colon, or comma
26
+ +ambiguous_newline # unexpected end of line; it is ambiguous whether these lines are part of the same statement
27
+ +empty_statement # empty statement or extra semicolon
28
+ -missing_option_explicit # the "option explicit" control comment is missing
29
+ +partial_option_explicit # the "option explicit" control comment, if used, must be in the first script tag
30
+ +dup_option_explicit # duplicate "option explicit" control comment
31
+ +useless_assign # useless assignment
32
+ +ambiguous_nested_stmt # block statements containing block statements should use curly braces to resolve ambiguity
33
+ +ambiguous_else_stmt # the else statement could be matched with one of multiple if statements (use curly braces to indicate intent)
34
+ -missing_default_case # missing default case in switch statement
35
+ +duplicate_case_in_switch # duplicate case in switch statements
36
+ +default_not_at_end # the default case is not at the end of the switch statement
37
+ +legacy_cc_not_understood # couldn't understand control comment using /*@keyword@*/ syntax
38
+ +jsl_cc_not_understood # couldn't understand control comment using /*jsl:keyword*/ syntax
39
+ +useless_comparison # useless comparison; comparing identical expressions
40
+ +with_statement # with statement hides undeclared variables; use temporary variable instead
41
+ +trailing_comma_in_array # extra comma is not recommended in array initializers
42
+ +assign_to_function_call # assignment to a function call
43
+ +parseint_missing_radix # parseInt missing radix parameter
44
+ +lambda_assign_requires_semicolon
@@ -0,0 +1,75 @@
1
+ (function() {
2
+ var CoffeeScript, runScripts;
3
+ CoffeeScript = require('./coffee-script');
4
+ CoffeeScript.require = require;
5
+ CoffeeScript.eval = function(code, options) {
6
+ return eval(CoffeeScript.compile(code, options));
7
+ };
8
+ CoffeeScript.run = function(code, options) {
9
+ if (options == null) {
10
+ options = {};
11
+ }
12
+ options.bare = true;
13
+ return Function(CoffeeScript.compile(code, options))();
14
+ };
15
+ if (typeof window === "undefined" || window === null) {
16
+ return;
17
+ }
18
+ CoffeeScript.load = function(url, callback) {
19
+ var xhr;
20
+ xhr = new (window.ActiveXObject || XMLHttpRequest)('Microsoft.XMLHTTP');
21
+ xhr.open('GET', url, true);
22
+ if ('overrideMimeType' in xhr) {
23
+ xhr.overrideMimeType('text/plain');
24
+ }
25
+ xhr.onreadystatechange = function() {
26
+ var _ref;
27
+ if (xhr.readyState === 4) {
28
+ if ((_ref = xhr.status) === 0 || _ref === 200) {
29
+ CoffeeScript.run(xhr.responseText);
30
+ } else {
31
+ throw new Error("Could not load " + url);
32
+ }
33
+ if (callback) {
34
+ return callback();
35
+ }
36
+ }
37
+ };
38
+ return xhr.send(null);
39
+ };
40
+ runScripts = function() {
41
+ var coffees, execute, index, length, s, scripts;
42
+ scripts = document.getElementsByTagName('script');
43
+ coffees = (function() {
44
+ var _i, _len, _results;
45
+ _results = [];
46
+ for (_i = 0, _len = scripts.length; _i < _len; _i++) {
47
+ s = scripts[_i];
48
+ if (s.type === 'text/coffeescript') {
49
+ _results.push(s);
50
+ }
51
+ }
52
+ return _results;
53
+ })();
54
+ index = 0;
55
+ length = coffees.length;
56
+ (execute = function() {
57
+ var script;
58
+ script = coffees[index++];
59
+ if ((script != null ? script.type : void 0) === 'text/coffeescript') {
60
+ if (script.src) {
61
+ return CoffeeScript.load(script.src, execute);
62
+ } else {
63
+ CoffeeScript.run(script.innerHTML);
64
+ return execute();
65
+ }
66
+ }
67
+ })();
68
+ return null;
69
+ };
70
+ if (window.addEventListener) {
71
+ addEventListener('DOMContentLoaded', runScripts, false);
72
+ } else {
73
+ attachEvent('onload', runScripts);
74
+ }
75
+ }).call(this);
@@ -0,0 +1,76 @@
1
+ (function() {
2
+ var CoffeeScript, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;
3
+ fs = require('fs');
4
+ path = require('path');
5
+ helpers = require('./helpers');
6
+ optparse = require('./optparse');
7
+ CoffeeScript = require('./coffee-script');
8
+ tasks = {};
9
+ options = {};
10
+ switches = [];
11
+ oparse = null;
12
+ helpers.extend(global, {
13
+ task: function(name, description, action) {
14
+ var _ref;
15
+ if (!action) {
16
+ _ref = [description, action], action = _ref[0], description = _ref[1];
17
+ }
18
+ return tasks[name] = {
19
+ name: name,
20
+ description: description,
21
+ action: action
22
+ };
23
+ },
24
+ option: function(letter, flag, description) {
25
+ return switches.push([letter, flag, description]);
26
+ },
27
+ invoke: function(name) {
28
+ if (!tasks[name]) {
29
+ missingTask(name);
30
+ }
31
+ return tasks[name].action(options);
32
+ }
33
+ });
34
+ exports.run = function() {
35
+ return path.exists('Cakefile', function(exists) {
36
+ var arg, args, _i, _len, _ref, _results;
37
+ if (!exists) {
38
+ throw new Error("Cakefile not found in " + (process.cwd()));
39
+ }
40
+ args = process.argv.slice(2);
41
+ CoffeeScript.run(fs.readFileSync('Cakefile').toString(), {
42
+ filename: 'Cakefile'
43
+ });
44
+ oparse = new optparse.OptionParser(switches);
45
+ if (!args.length) {
46
+ return printTasks();
47
+ }
48
+ options = oparse.parse(args);
49
+ _ref = options.arguments;
50
+ _results = [];
51
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
52
+ arg = _ref[_i];
53
+ _results.push(invoke(arg));
54
+ }
55
+ return _results;
56
+ });
57
+ };
58
+ printTasks = function() {
59
+ var desc, name, spaces, task;
60
+ console.log('');
61
+ for (name in tasks) {
62
+ task = tasks[name];
63
+ spaces = 20 - name.length;
64
+ spaces = spaces > 0 ? Array(spaces + 1).join(' ') : '';
65
+ desc = task.description ? "# " + task.description : '';
66
+ console.log("cake " + name + spaces + " " + desc);
67
+ }
68
+ if (switches.length) {
69
+ return console.log(oparse.help());
70
+ }
71
+ };
72
+ missingTask = function(task) {
73
+ console.log("No such task: \"" + task + "\"");
74
+ return process.exit(1);
75
+ };
76
+ }).call(this);
@@ -0,0 +1,135 @@
1
+ (function() {
2
+ var Lexer, RESERVED, compile, fs, lexer, parser, path, _ref;
3
+ var __hasProp = Object.prototype.hasOwnProperty;
4
+ fs = require('fs');
5
+ path = require('path');
6
+ _ref = require('./lexer'), Lexer = _ref.Lexer, RESERVED = _ref.RESERVED;
7
+ parser = require('./parser').parser;
8
+ if (require.extensions) {
9
+ require.extensions['.coffee'] = function(module, filename) {
10
+ var content;
11
+ content = compile(fs.readFileSync(filename, 'utf8'), {
12
+ filename: filename
13
+ });
14
+ return module._compile(content, filename);
15
+ };
16
+ } else if (require.registerExtension) {
17
+ require.registerExtension('.coffee', function(content) {
18
+ return compile(content);
19
+ });
20
+ }
21
+ exports.VERSION = '1.1.2';
22
+ exports.RESERVED = RESERVED;
23
+ exports.helpers = require('./helpers');
24
+ exports.compile = compile = function(code, options) {
25
+ if (options == null) {
26
+ options = {};
27
+ }
28
+ try {
29
+ return (parser.parse(lexer.tokenize(code))).compile(options);
30
+ } catch (err) {
31
+ if (options.filename) {
32
+ err.message = "In " + options.filename + ", " + err.message;
33
+ }
34
+ throw err;
35
+ }
36
+ };
37
+ exports.tokens = function(code, options) {
38
+ return lexer.tokenize(code, options);
39
+ };
40
+ exports.nodes = function(source, options) {
41
+ if (typeof source === 'string') {
42
+ return parser.parse(lexer.tokenize(source, options));
43
+ } else {
44
+ return parser.parse(source);
45
+ }
46
+ };
47
+ exports.run = function(code, options) {
48
+ var Module, mainModule;
49
+ mainModule = require.main;
50
+ mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '.';
51
+ mainModule.moduleCache && (mainModule.moduleCache = {});
52
+ if (process.binding('natives').module) {
53
+ Module = require('module').Module;
54
+ mainModule.paths = Module._nodeModulePaths(path.dirname(options.filename));
55
+ }
56
+ if (path.extname(mainModule.filename) !== '.coffee' || require.extensions) {
57
+ return mainModule._compile(compile(code, options), mainModule.filename);
58
+ } else {
59
+ return mainModule._compile(code, mainModule.filename);
60
+ }
61
+ };
62
+ exports.eval = function(code, options) {
63
+ var Module, Script, js, k, o, r, sandbox, v, _i, _len, _module, _ref2, _ref3, _ref4, _require;
64
+ if (options == null) {
65
+ options = {};
66
+ }
67
+ if (!(code = code.trim())) {
68
+ return;
69
+ }
70
+ if (_ref2 = require('vm'), Script = _ref2.Script, _ref2) {
71
+ sandbox = Script.createContext();
72
+ sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox;
73
+ if (options.sandbox != null) {
74
+ if (options.sandbox instanceof sandbox.constructor) {
75
+ sandbox = options.sandbox;
76
+ } else {
77
+ _ref3 = options.sandbox;
78
+ for (k in _ref3) {
79
+ if (!__hasProp.call(_ref3, k)) continue;
80
+ v = _ref3[k];
81
+ sandbox[k] = v;
82
+ }
83
+ }
84
+ }
85
+ sandbox.__filename = options.filename || 'eval';
86
+ sandbox.__dirname = path.dirname(sandbox.__filename);
87
+ if (!(sandbox.module || sandbox.require)) {
88
+ Module = require('module');
89
+ sandbox.module = _module = new Module(options.modulename || 'eval');
90
+ sandbox.require = _require = function(path) {
91
+ return Module._load(path, _module);
92
+ };
93
+ _module.filename = sandbox.__filename;
94
+ _ref4 = Object.getOwnPropertyNames(require);
95
+ for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
96
+ r = _ref4[_i];
97
+ _require[r] = require[r];
98
+ }
99
+ _require.paths = _module.paths = Module._nodeModulePaths(process.cwd());
100
+ _require.resolve = function(request) {
101
+ return Module._resolveFilename(request, _module);
102
+ };
103
+ }
104
+ }
105
+ o = {};
106
+ for (k in options) {
107
+ if (!__hasProp.call(options, k)) continue;
108
+ v = options[k];
109
+ o[k] = v;
110
+ }
111
+ o.bare = true;
112
+ js = compile(code, o);
113
+ if (Script) {
114
+ return Script.runInContext(js, sandbox);
115
+ } else {
116
+ return eval(js);
117
+ }
118
+ };
119
+ lexer = new Lexer;
120
+ parser.lexer = {
121
+ lex: function() {
122
+ var tag, _ref2;
123
+ _ref2 = this.tokens[this.pos++] || [''], tag = _ref2[0], this.yytext = _ref2[1], this.yylineno = _ref2[2];
124
+ return tag;
125
+ },
126
+ setInput: function(tokens) {
127
+ this.tokens = tokens;
128
+ return this.pos = 0;
129
+ },
130
+ upcomingInput: function() {
131
+ return "";
132
+ }
133
+ };
134
+ parser.yy = require('./nodes');
135
+ }).call(this);