nutshell-crm 0.0.5 → 0.0.6.alpha

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 (260) hide show
  1. data/.rbenv-version +1 -0
  2. data/.travis.yml +8 -0
  3. data/CHANGELOG.md +5 -0
  4. data/README.md +37 -0
  5. data/Rakefile +14 -3
  6. data/lib/nutshell-crm.rb +92 -5
  7. data/lib/nutshell-crm/version.rb +1 -1
  8. data/nutshell-crm.gemspec +1 -0
  9. data/spec/nutshell-crm_spec.rb +17 -8
  10. data/vendor/bundle/bin/rake +19 -0
  11. data/vendor/bundle/gems/json-1.6.4/.gitignore +8 -0
  12. data/vendor/bundle/gems/json-1.6.4/.travis.yml +15 -0
  13. data/vendor/bundle/gems/json-1.6.4/CHANGES +227 -0
  14. data/vendor/bundle/gems/json-1.6.4/COPYING +58 -0
  15. data/vendor/bundle/gems/json-1.6.4/COPYING-json-jruby +57 -0
  16. data/vendor/bundle/gems/json-1.6.4/GPL +340 -0
  17. data/vendor/bundle/gems/json-1.6.4/Gemfile +11 -0
  18. data/vendor/bundle/gems/json-1.6.4/README-json-jruby.markdown +33 -0
  19. data/vendor/bundle/gems/json-1.6.4/README.rdoc +358 -0
  20. data/vendor/bundle/gems/json-1.6.4/Rakefile +408 -0
  21. data/vendor/bundle/gems/json-1.6.4/TODO +1 -0
  22. data/vendor/bundle/gems/json-1.6.4/VERSION +1 -0
  23. data/{README → vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/.keep} +0 -0
  24. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log +52 -0
  25. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat +1000 -0
  26. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat +1001 -0
  27. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat +900 -0
  28. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat +901 -0
  29. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat +1000 -0
  30. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat +1001 -0
  31. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log +261 -0
  32. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat +1000 -0
  33. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat +1001 -0
  34. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat +1000 -0
  35. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat +1001 -0
  36. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat +1000 -0
  37. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat +1001 -0
  38. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log +262 -0
  39. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat +1000 -0
  40. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat +1001 -0
  41. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log +82 -0
  42. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log +34 -0
  43. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat +900 -0
  44. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat +901 -0
  45. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log +81 -0
  46. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat +1000 -0
  47. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat +1001 -0
  48. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log +82 -0
  49. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat +1000 -0
  50. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat +1001 -0
  51. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log +82 -0
  52. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat +1000 -0
  53. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat +1001 -0
  54. data/vendor/bundle/gems/json-1.6.4/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log +82 -0
  55. data/vendor/bundle/gems/json-1.6.4/benchmarks/data/.keep +0 -0
  56. data/vendor/bundle/gems/json-1.6.4/benchmarks/generator2_benchmark.rb +222 -0
  57. data/vendor/bundle/gems/json-1.6.4/benchmarks/generator_benchmark.rb +224 -0
  58. data/vendor/bundle/gems/json-1.6.4/benchmarks/ohai.json +1216 -0
  59. data/vendor/bundle/gems/json-1.6.4/benchmarks/ohai.ruby +1 -0
  60. data/vendor/bundle/gems/json-1.6.4/benchmarks/parser2_benchmark.rb +251 -0
  61. data/vendor/bundle/gems/json-1.6.4/benchmarks/parser_benchmark.rb +259 -0
  62. data/vendor/bundle/gems/json-1.6.4/data/example.json +1 -0
  63. data/vendor/bundle/gems/json-1.6.4/data/index.html +38 -0
  64. data/vendor/bundle/gems/json-1.6.4/data/prototype.js +4184 -0
  65. data/vendor/bundle/gems/json-1.6.4/diagrams/.keep +0 -0
  66. data/vendor/bundle/gems/json-1.6.4/ext/json/ext/fbuffer/fbuffer.h +156 -0
  67. data/vendor/bundle/gems/json-1.6.4/ext/json/ext/generator/Makefile +187 -0
  68. data/vendor/bundle/gems/json-1.6.4/ext/json/ext/generator/extconf.rb +13 -0
  69. data/vendor/bundle/gems/json-1.6.4/ext/json/ext/generator/generator.bundle +0 -0
  70. data/vendor/bundle/gems/json-1.6.4/ext/json/ext/generator/generator.c +1384 -0
  71. data/vendor/bundle/gems/json-1.6.4/ext/json/ext/generator/generator.h +161 -0
  72. data/vendor/bundle/gems/json-1.6.4/ext/json/ext/generator/generator.o +0 -0
  73. data/vendor/bundle/gems/json-1.6.4/ext/json/ext/json/ext/generator.bundle +0 -0
  74. data/vendor/bundle/gems/json-1.6.4/ext/json/ext/json/ext/parser.bundle +0 -0
  75. data/vendor/bundle/gems/json-1.6.4/ext/json/ext/parser/Makefile +187 -0
  76. data/vendor/bundle/gems/json-1.6.4/ext/json/ext/parser/extconf.rb +13 -0
  77. data/vendor/bundle/gems/json-1.6.4/ext/json/ext/parser/parser.bundle +0 -0
  78. data/vendor/bundle/gems/json-1.6.4/ext/json/ext/parser/parser.c +2203 -0
  79. data/vendor/bundle/gems/json-1.6.4/ext/json/ext/parser/parser.h +77 -0
  80. data/vendor/bundle/gems/json-1.6.4/ext/json/ext/parser/parser.o +0 -0
  81. data/vendor/bundle/gems/json-1.6.4/ext/json/ext/parser/parser.rl +926 -0
  82. data/vendor/bundle/gems/json-1.6.4/install.rb +19 -0
  83. data/vendor/bundle/gems/json-1.6.4/java/src/json/ext/ByteListTranscoder.java +167 -0
  84. data/vendor/bundle/gems/json-1.6.4/java/src/json/ext/Generator.java +437 -0
  85. data/vendor/bundle/gems/json-1.6.4/java/src/json/ext/GeneratorMethods.java +232 -0
  86. data/vendor/bundle/gems/json-1.6.4/java/src/json/ext/GeneratorService.java +43 -0
  87. data/vendor/bundle/gems/json-1.6.4/java/src/json/ext/GeneratorState.java +522 -0
  88. data/vendor/bundle/gems/json-1.6.4/java/src/json/ext/OptionsReader.java +113 -0
  89. data/vendor/bundle/gems/json-1.6.4/java/src/json/ext/Parser.java +2640 -0
  90. data/vendor/bundle/gems/json-1.6.4/java/src/json/ext/Parser.rl +964 -0
  91. data/vendor/bundle/gems/json-1.6.4/java/src/json/ext/ParserService.java +35 -0
  92. data/vendor/bundle/gems/json-1.6.4/java/src/json/ext/RuntimeInfo.java +121 -0
  93. data/vendor/bundle/gems/json-1.6.4/java/src/json/ext/StringDecoder.java +166 -0
  94. data/vendor/bundle/gems/json-1.6.4/java/src/json/ext/StringEncoder.java +106 -0
  95. data/vendor/bundle/gems/json-1.6.4/java/src/json/ext/Utils.java +89 -0
  96. data/vendor/bundle/gems/json-1.6.4/json-java.gemspec +22 -0
  97. data/vendor/bundle/gems/json-1.6.4/json.gemspec +40 -0
  98. data/vendor/bundle/gems/json-1.6.4/json_pure.gemspec +42 -0
  99. data/vendor/bundle/gems/json-1.6.4/lib/json.rb +62 -0
  100. data/vendor/bundle/gems/json-1.6.4/lib/json/add/bigdecimal.rb +21 -0
  101. data/vendor/bundle/gems/json-1.6.4/lib/json/add/complex.rb +22 -0
  102. data/vendor/bundle/gems/json-1.6.4/lib/json/add/core.rb +11 -0
  103. data/vendor/bundle/gems/json-1.6.4/lib/json/add/date.rb +34 -0
  104. data/vendor/bundle/gems/json-1.6.4/lib/json/add/date_time.rb +50 -0
  105. data/vendor/bundle/gems/json-1.6.4/lib/json/add/exception.rb +31 -0
  106. data/vendor/bundle/gems/json-1.6.4/lib/json/add/ostruct.rb +31 -0
  107. data/vendor/bundle/gems/json-1.6.4/lib/json/add/range.rb +29 -0
  108. data/vendor/bundle/gems/json-1.6.4/lib/json/add/rational.rb +22 -0
  109. data/vendor/bundle/gems/json-1.6.4/lib/json/add/regexp.rb +30 -0
  110. data/vendor/bundle/gems/json-1.6.4/lib/json/add/struct.rb +30 -0
  111. data/vendor/bundle/gems/json-1.6.4/lib/json/add/symbol.rb +25 -0
  112. data/vendor/bundle/gems/json-1.6.4/lib/json/add/time.rb +35 -0
  113. data/vendor/bundle/gems/json-1.6.4/lib/json/common.rb +470 -0
  114. data/vendor/bundle/gems/json-1.6.4/lib/json/ext.rb +21 -0
  115. data/vendor/bundle/gems/json-1.6.4/lib/json/ext/.keep +0 -0
  116. data/vendor/bundle/gems/json-1.6.4/lib/json/pure.rb +21 -0
  117. data/vendor/bundle/gems/json-1.6.4/lib/json/pure/generator.rb +468 -0
  118. data/vendor/bundle/gems/json-1.6.4/lib/json/pure/parser.rb +359 -0
  119. data/vendor/bundle/gems/json-1.6.4/lib/json/version.rb +8 -0
  120. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail1.json +1 -0
  121. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail10.json +1 -0
  122. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail11.json +1 -0
  123. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail12.json +1 -0
  124. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail13.json +1 -0
  125. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail14.json +1 -0
  126. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail18.json +1 -0
  127. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail19.json +1 -0
  128. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail2.json +1 -0
  129. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail20.json +1 -0
  130. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail21.json +1 -0
  131. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail22.json +1 -0
  132. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail23.json +1 -0
  133. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail24.json +1 -0
  134. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail25.json +1 -0
  135. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail27.json +2 -0
  136. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail28.json +2 -0
  137. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail3.json +1 -0
  138. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail4.json +1 -0
  139. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail5.json +1 -0
  140. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail6.json +1 -0
  141. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail7.json +1 -0
  142. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail8.json +1 -0
  143. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/fail9.json +1 -0
  144. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/pass1.json +56 -0
  145. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/pass15.json +1 -0
  146. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/pass16.json +1 -0
  147. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/pass17.json +1 -0
  148. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/pass2.json +1 -0
  149. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/pass26.json +1 -0
  150. data/vendor/bundle/gems/json-1.6.4/tests/fixtures/pass3.json +6 -0
  151. data/vendor/bundle/gems/json-1.6.4/tests/setup_variant.rb +11 -0
  152. data/vendor/bundle/gems/json-1.6.4/tests/test_json.rb +527 -0
  153. data/vendor/bundle/gems/json-1.6.4/tests/test_json_addition.rb +188 -0
  154. data/vendor/bundle/gems/json-1.6.4/tests/test_json_encoding.rb +65 -0
  155. data/vendor/bundle/gems/json-1.6.4/tests/test_json_fixtures.rb +35 -0
  156. data/vendor/bundle/gems/json-1.6.4/tests/test_json_generate.rb +249 -0
  157. data/vendor/bundle/gems/json-1.6.4/tests/test_json_string_matching.rb +40 -0
  158. data/vendor/bundle/gems/json-1.6.4/tests/test_json_unicode.rb +72 -0
  159. data/vendor/bundle/gems/json-1.6.4/tools/fuzz.rb +139 -0
  160. data/vendor/bundle/gems/json-1.6.4/tools/server.rb +62 -0
  161. data/vendor/bundle/gems/rake-0.9.2.2/.gemtest +0 -0
  162. data/vendor/bundle/gems/rake-0.9.2.2/CHANGES +522 -0
  163. data/vendor/bundle/gems/rake-0.9.2.2/MIT-LICENSE +21 -0
  164. data/vendor/bundle/gems/rake-0.9.2.2/README.rdoc +197 -0
  165. data/vendor/bundle/gems/rake-0.9.2.2/Rakefile +369 -0
  166. data/vendor/bundle/gems/rake-0.9.2.2/TODO +20 -0
  167. data/vendor/bundle/gems/rake-0.9.2.2/bin/rake +33 -0
  168. data/vendor/bundle/gems/rake-0.9.2.2/install.rb +90 -0
  169. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake.rb +69 -0
  170. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/alt_system.rb +109 -0
  171. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/application.rb +595 -0
  172. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/classic_namespace.rb +11 -0
  173. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/clean.rb +32 -0
  174. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/cloneable.rb +25 -0
  175. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/contrib/compositepublisher.rb +21 -0
  176. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/contrib/ftptools.rb +150 -0
  177. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/contrib/publisher.rb +73 -0
  178. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/contrib/rubyforgepublisher.rb +16 -0
  179. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/contrib/sshpublisher.rb +50 -0
  180. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/contrib/sys.rb +191 -0
  181. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/default_loader.rb +10 -0
  182. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/dsl_definition.rb +176 -0
  183. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/early_time.rb +18 -0
  184. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/ext/core.rb +27 -0
  185. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/ext/module.rb +39 -0
  186. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/ext/string.rb +167 -0
  187. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/ext/time.rb +14 -0
  188. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/file_creation_task.rb +24 -0
  189. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/file_list.rb +403 -0
  190. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/file_task.rb +47 -0
  191. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/file_utils.rb +114 -0
  192. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb +145 -0
  193. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/gempackagetask.rb +15 -0
  194. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/invocation_chain.rb +51 -0
  195. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/invocation_exception_mixin.rb +16 -0
  196. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/loaders/makefile.rb +40 -0
  197. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/multi_task.rb +16 -0
  198. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/name_space.rb +25 -0
  199. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/packagetask.rb +185 -0
  200. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/pathmap.rb +1 -0
  201. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/pseudo_status.rb +24 -0
  202. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/rake_module.rb +29 -0
  203. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb +22 -0
  204. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/rdoctask.rb +234 -0
  205. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/ruby182_test_unit_fix.rb +25 -0
  206. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/rule_recursion_overflow_error.rb +20 -0
  207. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/runtest.rb +21 -0
  208. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/task.rb +327 -0
  209. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/task_argument_error.rb +7 -0
  210. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/task_arguments.rb +78 -0
  211. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/task_manager.rb +307 -0
  212. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/tasklib.rb +22 -0
  213. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/testtask.rb +191 -0
  214. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/version.rb +8 -0
  215. data/vendor/bundle/gems/rake-0.9.2.2/lib/rake/win32.rb +55 -0
  216. data/vendor/bundle/gems/rake-0.9.2.2/test/file_creation.rb +34 -0
  217. data/vendor/bundle/gems/rake-0.9.2.2/test/helper.rb +492 -0
  218. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake.rb +40 -0
  219. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_application.rb +489 -0
  220. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_application_options.rb +335 -0
  221. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_clean.rb +14 -0
  222. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_definitions.rb +80 -0
  223. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_directory_task.rb +46 -0
  224. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_dsl.rb +77 -0
  225. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_early_time.rb +31 -0
  226. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_extension.rb +59 -0
  227. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_file_creation_task.rb +56 -0
  228. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_file_list.rb +628 -0
  229. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_file_list_path_map.rb +8 -0
  230. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_file_task.rb +102 -0
  231. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_file_utils.rb +305 -0
  232. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_ftp_file.rb +59 -0
  233. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_functional.rb +450 -0
  234. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_invocation_chain.rb +52 -0
  235. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_makefile_loader.rb +44 -0
  236. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_multi_task.rb +51 -0
  237. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_name_space.rb +43 -0
  238. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_package_task.rb +79 -0
  239. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_path_map.rb +157 -0
  240. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_path_map_explode.rb +34 -0
  241. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_path_map_partial.rb +18 -0
  242. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_pseudo_status.rb +21 -0
  243. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_rake_test_loader.rb +21 -0
  244. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_rdoc_task.rb +83 -0
  245. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_require.rb +40 -0
  246. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_rules.rb +327 -0
  247. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_task.rb +267 -0
  248. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_task_argument_parsing.rb +103 -0
  249. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_task_arguments.rb +88 -0
  250. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_task_lib.rb +9 -0
  251. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_task_manager.rb +157 -0
  252. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_task_manager_argument_resolution.rb +36 -0
  253. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_task_with_arguments.rb +173 -0
  254. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_test_task.rb +120 -0
  255. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_top_level_functions.rb +111 -0
  256. data/vendor/bundle/gems/rake-0.9.2.2/test/test_rake_win32.rb +72 -0
  257. data/vendor/bundle/gems/rake-0.9.2.2/test/test_sys.rb +20 -0
  258. data/vendor/bundle/specifications/json-1.6.4.gemspec +39 -0
  259. data/vendor/bundle/specifications/rake-0.9.2.2.gemspec +34 -0
  260. metadata +285 -18
@@ -0,0 +1,20 @@
1
+ = Rake Project -- To Do List
2
+
3
+ Send suggestions for this list to mailto:jim@weirichhouse.org or on
4
+ the rake-devel@rubyforge.org mailing list.
5
+
6
+ === To Do
7
+ * Need a nice API for accessing tasks in namespaces, namespaces in an app, etc.
8
+ * Provide a way to disable -w warning mode.
9
+ * Define a set of default rules that work in the absence of any Rakefile
10
+ * What about cyclic dependencies?
11
+ * Java support utilities
12
+ * Installation support utilities
13
+ * Check out installpkg.rb
14
+ * Autogenerate Dependencies
15
+ * Rules should apply to existing tasks if no actions are defined.
16
+ * How to create multiple package tasks without task name collision?
17
+ * Trap "ln -s" commands that fail and use "cp" instead (SMB mounted
18
+ drives have problems with "ln -s".
19
+
20
+ (moved DONE list to CHANGES file)
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #--
4
+ # Copyright (c) 2003, 2004, 2005, 2006, 2007 Jim Weirich
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to
8
+ # deal in the Software without restriction, including without limitation the
9
+ # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10
+ # sell copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in
14
+ # all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22
+ # IN THE SOFTWARE.
23
+ #++
24
+
25
+ begin
26
+ require 'rubygems'
27
+ gem 'rake'
28
+ rescue LoadError
29
+ end
30
+
31
+ require 'rake'
32
+
33
+ Rake.application.run
@@ -0,0 +1,90 @@
1
+ require 'rbconfig'
2
+ require 'find'
3
+ require 'fileutils'
4
+
5
+ include RbConfig
6
+
7
+ $ruby = CONFIG['ruby_install_name']
8
+
9
+ ##
10
+ # Install a binary file. We patch in on the way through to
11
+ # insert a #! line. If this is a Unix install, we name
12
+ # the command (for example) 'rake' and let the shebang line
13
+ # handle running it. Under windows, we add a '.rb' extension
14
+ # and let file associations to their stuff
15
+ #
16
+
17
+ def installBIN(from, opfile)
18
+
19
+ tmp_dir = nil
20
+ for t in [".", "/tmp", "c:/temp", $bindir]
21
+ stat = File.stat(t) rescue next
22
+ if stat.directory? and stat.writable?
23
+ tmp_dir = t
24
+ break
25
+ end
26
+ end
27
+
28
+ fail "Cannot find a temporary directory" unless tmp_dir
29
+ tmp_file = File.join(tmp_dir, "_tmp")
30
+
31
+ File.open(from) do |ip|
32
+ File.open(tmp_file, "w") do |op|
33
+ ruby = File.join($realbindir, $ruby)
34
+ op.puts "#!#{ruby} -w"
35
+ op.write ip.read
36
+ end
37
+ end
38
+
39
+ opfile += ".rb" if CONFIG["target_os"] =~ /mswin/i
40
+ FileUtils.install(tmp_file, File.join($bindir, opfile),
41
+ {:mode => 0755, :verbose => true})
42
+ File.unlink(tmp_file)
43
+ end
44
+
45
+ $sitedir = CONFIG["sitelibdir"]
46
+ unless $sitedir
47
+ version = CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
48
+ $libdir = File.join(CONFIG["libdir"], "ruby", version)
49
+ $sitedir = $:.find {|x| x =~ /site_ruby/}
50
+ if !$sitedir
51
+ $sitedir = File.join($libdir, "site_ruby")
52
+ elsif $sitedir !~ Regexp.quote(version)
53
+ $sitedir = File.join($sitedir, version)
54
+ end
55
+ end
56
+
57
+ $bindir = CONFIG["bindir"]
58
+
59
+ $realbindir = $bindir
60
+
61
+ bindir = CONFIG["bindir"]
62
+ if (destdir = ENV['DESTDIR'])
63
+ $bindir = destdir + $bindir
64
+ $sitedir = destdir + $sitedir
65
+
66
+ FileUtils.mkdir_p($bindir)
67
+ FileUtils.mkdir_p($sitedir)
68
+ end
69
+
70
+ rake_dest = File.join($sitedir, "rake")
71
+ FileUtils.mkdir_p(rake_dest, {:verbose => true})
72
+ File.chmod(0755, rake_dest)
73
+
74
+ # The library files
75
+
76
+ files = Dir.chdir('lib') { Dir['**/*.rb'] }
77
+
78
+ for fn in files
79
+ fn_dir = File.dirname(fn)
80
+ target_dir = File.join($sitedir, fn_dir)
81
+ if ! File.exist?(target_dir)
82
+ FileUtils.mkdir_p(target_dir)
83
+ end
84
+ FileUtils.install(File.join('lib', fn), File.join($sitedir, fn),
85
+ {:mode => 0644, :verbose => true})
86
+ end
87
+
88
+ # and the executable
89
+
90
+ installBIN("bin/rake", "rake")
@@ -0,0 +1,69 @@
1
+ #--
2
+
3
+ # Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com)
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to
7
+ # deal in the Software without restriction, including without limitation the
8
+ # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9
+ # sell copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21
+ # IN THE SOFTWARE.
22
+ #++
23
+
24
+ require 'rake/version'
25
+
26
+ # :stopdoc:
27
+ RAKEVERSION = Rake::VERSION
28
+ # :startdoc:
29
+
30
+ require 'rbconfig'
31
+ require 'fileutils'
32
+ require 'singleton'
33
+ require 'monitor'
34
+ require 'optparse'
35
+ require 'ostruct'
36
+
37
+ require 'rake/ext/module'
38
+ require 'rake/ext/string'
39
+ require 'rake/ext/time'
40
+
41
+ require 'rake/win32'
42
+
43
+ require 'rake/task_argument_error'
44
+ require 'rake/rule_recursion_overflow_error'
45
+ require 'rake/rake_module'
46
+ require 'rake/pseudo_status'
47
+ require 'rake/task_arguments'
48
+ require 'rake/invocation_chain'
49
+ require 'rake/task'
50
+ require 'rake/file_task'
51
+ require 'rake/file_creation_task'
52
+ require 'rake/multi_task'
53
+ require 'rake/dsl_definition'
54
+ require 'rake/file_utils_ext'
55
+ require 'rake/file_list'
56
+ require 'rake/default_loader'
57
+ require 'rake/early_time'
58
+ require 'rake/name_space'
59
+ require 'rake/task_manager'
60
+ require 'rake/application'
61
+
62
+ $trace = false
63
+
64
+ # :stopdoc:
65
+ #
66
+ # Some top level Constants.
67
+
68
+ FileList = Rake::FileList
69
+ RakeFileUtils = Rake::FileUtilsExt
@@ -0,0 +1,109 @@
1
+ #
2
+ # Copyright (c) 2008 James M. Lawrence
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person
5
+ # obtaining a copy of this software and associated documentation files
6
+ # (the "Software"), to deal in the Software without restriction,
7
+ # including without limitation the rights to use, copy, modify, merge,
8
+ # publish, distribute, sublicense, and/or sell copies of the Software,
9
+ # and to permit persons to whom the Software is furnished to do so,
10
+ # subject to the following 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 OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19
+ # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20
+ # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ # SOFTWARE.
23
+ #
24
+
25
+ require 'rbconfig'
26
+
27
+ #
28
+ # Alternate implementations of system() and backticks `` on Windows
29
+ # for ruby-1.8 and earlier.
30
+ #
31
+ module Rake::AltSystem
32
+ WINDOWS = RbConfig::CONFIG["host_os"] =~
33
+ %r!(msdos|mswin|djgpp|mingw|[Ww]indows)!
34
+
35
+ class << self
36
+ def define_module_function(name, &block)
37
+ define_method(name, &block)
38
+ module_function(name)
39
+ end
40
+ end
41
+
42
+ if WINDOWS and RUBY_VERSION < "1.9.0"
43
+ RUNNABLE_EXTS = %w[com exe bat cmd]
44
+ RUNNABLE_PATTERN = %r!\.(#{RUNNABLE_EXTS.join('|')})\Z!i
45
+
46
+ define_module_function :kernel_system, &Kernel.method(:system)
47
+ define_module_function :kernel_backticks, &Kernel.method(:'`')
48
+
49
+ module_function
50
+
51
+ def repair_command(cmd)
52
+ "call " + (
53
+ if cmd =~ %r!\A\s*\".*?\"!
54
+ # already quoted
55
+ cmd
56
+ elsif match = cmd.match(%r!\A\s*(\S+)!)
57
+ if match[1] =~ %r!/!
58
+ # avoid x/y.bat interpretation as x with option /y
59
+ %Q!"#{match[1]}"! + match.post_match
60
+ else
61
+ # a shell command will fail if quoted
62
+ cmd
63
+ end
64
+ else
65
+ # empty or whitespace
66
+ cmd
67
+ end
68
+ )
69
+ end
70
+
71
+ def find_runnable(file)
72
+ if file =~ RUNNABLE_PATTERN
73
+ file
74
+ else
75
+ RUNNABLE_EXTS.each { |ext|
76
+ if File.exist?(test = "#{file}.#{ext}")
77
+ return test
78
+ end
79
+ }
80
+ nil
81
+ end
82
+ end
83
+
84
+ def system(cmd, *args)
85
+ repaired = (
86
+ if args.empty?
87
+ [repair_command(cmd)]
88
+ elsif runnable = find_runnable(cmd)
89
+ [File.expand_path(runnable), *args]
90
+ else
91
+ # non-existent file
92
+ [cmd, *args]
93
+ end
94
+ )
95
+ kernel_system(*repaired)
96
+ end
97
+
98
+ def backticks(cmd)
99
+ kernel_backticks(repair_command(cmd))
100
+ end
101
+
102
+ define_module_function :'`', &method(:backticks)
103
+ else
104
+ # Non-Windows or ruby-1.9+: same as Kernel versions
105
+ define_module_function :system, &Kernel.method(:system)
106
+ define_module_function :backticks, &Kernel.method(:'`')
107
+ define_module_function :'`', &Kernel.method(:'`')
108
+ end
109
+ end
@@ -0,0 +1,595 @@
1
+ require 'shellwords'
2
+ require 'optparse'
3
+
4
+ require 'rake/task_manager'
5
+ require 'rake/win32'
6
+
7
+ module Rake
8
+
9
+ ######################################################################
10
+ # Rake main application object. When invoking +rake+ from the
11
+ # command line, a Rake::Application object is created and run.
12
+ #
13
+ class Application
14
+ include TaskManager
15
+
16
+ # The name of the application (typically 'rake')
17
+ attr_reader :name
18
+
19
+ # The original directory where rake was invoked.
20
+ attr_reader :original_dir
21
+
22
+ # Name of the actual rakefile used.
23
+ attr_reader :rakefile
24
+
25
+ # Number of columns on the terminal
26
+ attr_accessor :terminal_columns
27
+
28
+ # List of the top level task names (task names from the command line).
29
+ attr_reader :top_level_tasks
30
+
31
+ DEFAULT_RAKEFILES = ['rakefile', 'Rakefile', 'rakefile.rb', 'Rakefile.rb'].freeze
32
+
33
+ # Initialize a Rake::Application object.
34
+ def initialize
35
+ super
36
+ @name = 'rake'
37
+ @rakefiles = DEFAULT_RAKEFILES.dup
38
+ @rakefile = nil
39
+ @pending_imports = []
40
+ @imported = []
41
+ @loaders = {}
42
+ @default_loader = Rake::DefaultLoader.new
43
+ @original_dir = Dir.pwd
44
+ @top_level_tasks = []
45
+ add_loader('rb', DefaultLoader.new)
46
+ add_loader('rf', DefaultLoader.new)
47
+ add_loader('rake', DefaultLoader.new)
48
+ @tty_output = STDOUT.tty?
49
+ @terminal_columns = ENV['RAKE_COLUMNS'].to_i
50
+ end
51
+
52
+ # Run the Rake application. The run method performs the following
53
+ # three steps:
54
+ #
55
+ # * Initialize the command line options (+init+).
56
+ # * Define the tasks (+load_rakefile+).
57
+ # * Run the top level tasks (+run_tasks+).
58
+ #
59
+ # If you wish to build a custom rake command, you should call
60
+ # +init+ on your application. Then define any tasks. Finally,
61
+ # call +top_level+ to run your top level tasks.
62
+ def run
63
+ standard_exception_handling do
64
+ init
65
+ load_rakefile
66
+ top_level
67
+ end
68
+ end
69
+
70
+ # Initialize the command line parameters and app name.
71
+ def init(app_name='rake')
72
+ standard_exception_handling do
73
+ @name = app_name
74
+ handle_options
75
+ collect_tasks
76
+ end
77
+ end
78
+
79
+ # Find the rakefile and then load it and any pending imports.
80
+ def load_rakefile
81
+ standard_exception_handling do
82
+ raw_load_rakefile
83
+ end
84
+ end
85
+
86
+ # Run the top level tasks of a Rake application.
87
+ def top_level
88
+ standard_exception_handling do
89
+ if options.show_tasks
90
+ display_tasks_and_comments
91
+ elsif options.show_prereqs
92
+ display_prerequisites
93
+ else
94
+ top_level_tasks.each { |task_name| invoke_task(task_name) }
95
+ end
96
+ end
97
+ end
98
+
99
+ # Add a loader to handle imported files ending in the extension
100
+ # +ext+.
101
+ def add_loader(ext, loader)
102
+ ext = ".#{ext}" unless ext =~ /^\./
103
+ @loaders[ext] = loader
104
+ end
105
+
106
+ # Application options from the command line
107
+ def options
108
+ @options ||= OpenStruct.new
109
+ end
110
+
111
+ # private ----------------------------------------------------------------
112
+
113
+ def invoke_task(task_string)
114
+ name, args = parse_task_string(task_string)
115
+ t = self[name]
116
+ t.invoke(*args)
117
+ end
118
+
119
+ def parse_task_string(string)
120
+ if string =~ /^([^\[]+)(\[(.*)\])$/
121
+ name = $1
122
+ args = $3.split(/\s*,\s*/)
123
+ else
124
+ name = string
125
+ args = []
126
+ end
127
+ [name, args]
128
+ end
129
+
130
+ # Provide standard exception handling for the given block.
131
+ def standard_exception_handling
132
+ begin
133
+ yield
134
+ rescue SystemExit => ex
135
+ # Exit silently with current status
136
+ raise
137
+ rescue OptionParser::InvalidOption => ex
138
+ $stderr.puts ex.message
139
+ exit(false)
140
+ rescue Exception => ex
141
+ # Exit with error message
142
+ display_error_message(ex)
143
+ exit(false)
144
+ end
145
+ end
146
+
147
+ # Display the error message that caused the exception.
148
+ def display_error_message(ex)
149
+ $stderr.puts "#{name} aborted!"
150
+ $stderr.puts ex.message
151
+ if options.trace
152
+ $stderr.puts ex.backtrace.join("\n")
153
+ else
154
+ $stderr.puts rakefile_location(ex.backtrace)
155
+ end
156
+ $stderr.puts "Tasks: #{ex.chain}" if has_chain?(ex)
157
+ $stderr.puts "(See full trace by running task with --trace)" unless options.trace
158
+ end
159
+
160
+ # Warn about deprecated usage.
161
+ #
162
+ # Example:
163
+ # Rake.application.deprecate("import", "Rake.import", caller.first)
164
+ #
165
+ def deprecate(old_usage, new_usage, call_site)
166
+ return if options.ignore_deprecate
167
+ $stderr.puts "WARNING: '#{old_usage}' is deprecated. " +
168
+ "Please use '#{new_usage}' instead.\n" +
169
+ " at #{call_site}"
170
+ end
171
+
172
+ # Does the exception have a task invocation chain?
173
+ def has_chain?(exception)
174
+ exception.respond_to?(:chain) && exception.chain
175
+ end
176
+ private :has_chain?
177
+
178
+ # True if one of the files in RAKEFILES is in the current directory.
179
+ # If a match is found, it is copied into @rakefile.
180
+ def have_rakefile
181
+ @rakefiles.each do |fn|
182
+ if File.exist?(fn)
183
+ others = Dir.glob(fn, File::FNM_CASEFOLD)
184
+ return others.size == 1 ? others.first : fn
185
+ elsif fn == ''
186
+ return fn
187
+ end
188
+ end
189
+ return nil
190
+ end
191
+
192
+ # True if we are outputting to TTY, false otherwise
193
+ def tty_output?
194
+ @tty_output
195
+ end
196
+
197
+ # Override the detected TTY output state (mostly for testing)
198
+ def tty_output=( tty_output_state )
199
+ @tty_output = tty_output_state
200
+ end
201
+
202
+ # We will truncate output if we are outputting to a TTY or if we've been
203
+ # given an explicit column width to honor
204
+ def truncate_output?
205
+ tty_output? || @terminal_columns.nonzero?
206
+ end
207
+
208
+ # Display the tasks and comments.
209
+ def display_tasks_and_comments
210
+ displayable_tasks = tasks.select { |t|
211
+ t.comment && t.name =~ options.show_task_pattern
212
+ }
213
+ case options.show_tasks
214
+ when :tasks
215
+ width = displayable_tasks.collect { |t| t.name_with_args.length }.max || 10
216
+ max_column = truncate_output? ? terminal_width - name.size - width - 7 : nil
217
+
218
+ displayable_tasks.each do |t|
219
+ printf "#{name} %-#{width}s # %s\n",
220
+ t.name_with_args, max_column ? truncate(t.comment, max_column) : t.comment
221
+ end
222
+ when :describe
223
+ displayable_tasks.each do |t|
224
+ puts "#{name} #{t.name_with_args}"
225
+ t.full_comment.split("\n").each do |line|
226
+ puts " #{line}"
227
+ end
228
+ puts
229
+ end
230
+ when :lines
231
+ displayable_tasks.each do |t|
232
+ t.locations.each do |loc|
233
+ printf "#{name} %-30s %s\n",t.name_with_args, loc
234
+ end
235
+ end
236
+ else
237
+ fail "Unknown show task mode: '#{options.show_tasks}'"
238
+ end
239
+ end
240
+
241
+ def terminal_width
242
+ if @terminal_columns.nonzero?
243
+ result = @terminal_columns
244
+ else
245
+ result = unix? ? dynamic_width : 80
246
+ end
247
+ (result < 10) ? 80 : result
248
+ rescue
249
+ 80
250
+ end
251
+
252
+ # Calculate the dynamic width of the
253
+ def dynamic_width
254
+ @dynamic_width ||= (dynamic_width_stty.nonzero? || dynamic_width_tput)
255
+ end
256
+
257
+ def dynamic_width_stty
258
+ %x{stty size 2>/dev/null}.split[1].to_i
259
+ end
260
+
261
+ def dynamic_width_tput
262
+ %x{tput cols 2>/dev/null}.to_i
263
+ end
264
+
265
+ def unix?
266
+ RbConfig::CONFIG['host_os'] =~ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i
267
+ end
268
+
269
+ def windows?
270
+ Win32.windows?
271
+ end
272
+
273
+ def truncate(string, width)
274
+ if string.length <= width
275
+ string
276
+ else
277
+ ( string[0, width-3] || "" ) + "..."
278
+ end
279
+ end
280
+
281
+ # Display the tasks and prerequisites
282
+ def display_prerequisites
283
+ tasks.each do |t|
284
+ puts "#{name} #{t.name}"
285
+ t.prerequisites.each { |pre| puts " #{pre}" }
286
+ end
287
+ end
288
+
289
+ # A list of all the standard options used in rake, suitable for
290
+ # passing to OptionParser.
291
+ def standard_rake_options
292
+ [
293
+ ['--classic-namespace', '-C', "Put Task and FileTask in the top level namespace",
294
+ lambda { |value|
295
+ require 'rake/classic_namespace'
296
+ options.classic_namespace = true
297
+ }
298
+ ],
299
+ ['--describe', '-D [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
300
+ lambda { |value|
301
+ options.show_tasks = :describe
302
+ options.show_task_pattern = Regexp.new(value || '')
303
+ TaskManager.record_task_metadata = true
304
+ }
305
+ ],
306
+ ['--dry-run', '-n', "Do a dry run without executing actions.",
307
+ lambda { |value|
308
+ Rake.verbose(true)
309
+ Rake.nowrite(true)
310
+ options.dryrun = true
311
+ options.trace = true
312
+ }
313
+ ],
314
+ ['--execute', '-e CODE', "Execute some Ruby code and exit.",
315
+ lambda { |value|
316
+ eval(value)
317
+ exit
318
+ }
319
+ ],
320
+ ['--execute-print', '-p CODE', "Execute some Ruby code, print the result, then exit.",
321
+ lambda { |value|
322
+ puts eval(value)
323
+ exit
324
+ }
325
+ ],
326
+ ['--execute-continue', '-E CODE',
327
+ "Execute some Ruby code, then continue with normal task processing.",
328
+ lambda { |value| eval(value) }
329
+ ],
330
+ ['--libdir', '-I LIBDIR', "Include LIBDIR in the search path for required modules.",
331
+ lambda { |value| $:.push(value) }
332
+ ],
333
+ ['--no-search', '--nosearch', '-N', "Do not search parent directories for the Rakefile.",
334
+ lambda { |value| options.nosearch = true }
335
+ ],
336
+ ['--prereqs', '-P', "Display the tasks and dependencies, then exit.",
337
+ lambda { |value| options.show_prereqs = true }
338
+ ],
339
+ ['--quiet', '-q', "Do not log messages to standard output.",
340
+ lambda { |value| Rake.verbose(false) }
341
+ ],
342
+ ['--rakefile', '-f [FILE]', "Use FILE as the rakefile.",
343
+ lambda { |value|
344
+ value ||= ''
345
+ @rakefiles.clear
346
+ @rakefiles << value
347
+ }
348
+ ],
349
+ ['--rakelibdir', '--rakelib', '-R RAKELIBDIR',
350
+ "Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib')",
351
+ # HACK Use File::PATH_SEPARATOR
352
+ lambda { |value| options.rakelib = value.split(':') }
353
+ ],
354
+ ['--require', '-r MODULE', "Require MODULE before executing rakefile.",
355
+ lambda { |value|
356
+ begin
357
+ require value
358
+ rescue LoadError => ex
359
+ begin
360
+ rake_require value
361
+ rescue LoadError
362
+ raise ex
363
+ end
364
+ end
365
+ }
366
+ ],
367
+ ['--rules', "Trace the rules resolution.",
368
+ lambda { |value| options.trace_rules = true }
369
+ ],
370
+ ['--silent', '-s', "Like --quiet, but also suppresses the 'in directory' announcement.",
371
+ lambda { |value|
372
+ Rake.verbose(false)
373
+ options.silent = true
374
+ }
375
+ ],
376
+ ['--system', '-g',
377
+ "Using system wide (global) rakefiles (usually '~/.rake/*.rake').",
378
+ lambda { |value| options.load_system = true }
379
+ ],
380
+ ['--no-system', '--nosystem', '-G',
381
+ "Use standard project Rakefile search paths, ignore system wide rakefiles.",
382
+ lambda { |value| options.ignore_system = true }
383
+ ],
384
+ ['--tasks', '-T [PATTERN]', "Display the tasks (matching optional PATTERN) with descriptions, then exit.",
385
+ lambda { |value|
386
+ options.show_tasks = :tasks
387
+ options.show_task_pattern = Regexp.new(value || '')
388
+ Rake::TaskManager.record_task_metadata = true
389
+ }
390
+ ],
391
+ ['--trace', '-t', "Turn on invoke/execute tracing, enable full backtrace.",
392
+ lambda { |value|
393
+ options.trace = true
394
+ Rake.verbose(true)
395
+ }
396
+ ],
397
+ ['--verbose', '-v', "Log message to standard output.",
398
+ lambda { |value| Rake.verbose(true) }
399
+ ],
400
+ ['--version', '-V', "Display the program version.",
401
+ lambda { |value|
402
+ puts "rake, version #{RAKEVERSION}"
403
+ exit
404
+ }
405
+ ],
406
+ ['--where', '-W [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
407
+ lambda { |value|
408
+ options.show_tasks = :lines
409
+ options.show_task_pattern = Regexp.new(value || '')
410
+ Rake::TaskManager.record_task_metadata = true
411
+ }
412
+ ],
413
+ ['--no-deprecation-warnings', '-X', "Disable the deprecation warnings.",
414
+ lambda { |value|
415
+ options.ignore_deprecate = true
416
+ }
417
+ ],
418
+ ]
419
+ end
420
+
421
+ # Read and handle the command line options.
422
+ def handle_options
423
+ options.rakelib = ['rakelib']
424
+
425
+ OptionParser.new do |opts|
426
+ opts.banner = "rake [-f rakefile] {options} targets..."
427
+ opts.separator ""
428
+ opts.separator "Options are ..."
429
+
430
+ opts.on_tail("-h", "--help", "-H", "Display this help message.") do
431
+ puts opts
432
+ exit
433
+ end
434
+
435
+ standard_rake_options.each { |args| opts.on(*args) }
436
+ opts.environment('RAKEOPT')
437
+ end.parse!
438
+
439
+ # If class namespaces are requested, set the global options
440
+ # according to the values in the options structure.
441
+ if options.classic_namespace
442
+ $show_tasks = options.show_tasks
443
+ $show_prereqs = options.show_prereqs
444
+ $trace = options.trace
445
+ $dryrun = options.dryrun
446
+ $silent = options.silent
447
+ end
448
+ end
449
+
450
+ # Similar to the regular Ruby +require+ command, but will check
451
+ # for *.rake files in addition to *.rb files.
452
+ def rake_require(file_name, paths=$LOAD_PATH, loaded=$")
453
+ fn = file_name + ".rake"
454
+ return false if loaded.include?(fn)
455
+ paths.each do |path|
456
+ full_path = File.join(path, fn)
457
+ if File.exist?(full_path)
458
+ Rake.load_rakefile(full_path)
459
+ loaded << fn
460
+ return true
461
+ end
462
+ end
463
+ fail LoadError, "Can't find #{file_name}"
464
+ end
465
+
466
+ def find_rakefile_location
467
+ here = Dir.pwd
468
+ while ! (fn = have_rakefile)
469
+ Dir.chdir("..")
470
+ if Dir.pwd == here || options.nosearch
471
+ return nil
472
+ end
473
+ here = Dir.pwd
474
+ end
475
+ [fn, here]
476
+ ensure
477
+ Dir.chdir(Rake.original_dir)
478
+ end
479
+
480
+ def print_rakefile_directory(location)
481
+ $stderr.puts "(in #{Dir.pwd})" unless
482
+ options.silent or original_dir == location
483
+ end
484
+
485
+ def raw_load_rakefile # :nodoc:
486
+ rakefile, location = find_rakefile_location
487
+ if (! options.ignore_system) &&
488
+ (options.load_system || rakefile.nil?) &&
489
+ system_dir && File.directory?(system_dir)
490
+ print_rakefile_directory(location)
491
+ glob("#{system_dir}/*.rake") do |name|
492
+ add_import name
493
+ end
494
+ else
495
+ fail "No Rakefile found (looking for: #{@rakefiles.join(', ')})" if
496
+ rakefile.nil?
497
+ @rakefile = rakefile
498
+ Dir.chdir(location)
499
+ print_rakefile_directory(location)
500
+ $rakefile = @rakefile if options.classic_namespace
501
+ Rake.load_rakefile(File.expand_path(@rakefile)) if @rakefile && @rakefile != ''
502
+ options.rakelib.each do |rlib|
503
+ glob("#{rlib}/*.rake") do |name|
504
+ add_import name
505
+ end
506
+ end
507
+ end
508
+ load_imports
509
+ end
510
+
511
+ def glob(path, &block)
512
+ Dir[path.gsub("\\", '/')].each(&block)
513
+ end
514
+ private :glob
515
+
516
+ # The directory path containing the system wide rakefiles.
517
+ def system_dir
518
+ @system_dir ||=
519
+ begin
520
+ if ENV['RAKE_SYSTEM']
521
+ ENV['RAKE_SYSTEM']
522
+ else
523
+ standard_system_dir
524
+ end
525
+ end
526
+ end
527
+
528
+ # The standard directory containing system wide rake files.
529
+ if Win32.windows?
530
+ def standard_system_dir #:nodoc:
531
+ Win32.win32_system_dir
532
+ end
533
+ else
534
+ def standard_system_dir #:nodoc:
535
+ File.join(File.expand_path('~'), '.rake')
536
+ end
537
+ end
538
+ private :standard_system_dir
539
+
540
+ # Collect the list of tasks on the command line. If no tasks are
541
+ # given, return a list containing only the default task.
542
+ # Environmental assignments are processed at this time as well.
543
+ def collect_tasks
544
+ @top_level_tasks = []
545
+ ARGV.each do |arg|
546
+ if arg =~ /^(\w+)=(.*)$/
547
+ ENV[$1] = $2
548
+ else
549
+ @top_level_tasks << arg unless arg =~ /^-/
550
+ end
551
+ end
552
+ @top_level_tasks.push("default") if @top_level_tasks.size == 0
553
+ end
554
+
555
+ # Add a file to the list of files to be imported.
556
+ def add_import(fn)
557
+ @pending_imports << fn
558
+ end
559
+
560
+ # Load the pending list of imported files.
561
+ def load_imports
562
+ while fn = @pending_imports.shift
563
+ next if @imported.member?(fn)
564
+ if fn_task = lookup(fn)
565
+ fn_task.invoke
566
+ end
567
+ ext = File.extname(fn)
568
+ loader = @loaders[ext] || @default_loader
569
+ loader.load(fn)
570
+ @imported << fn
571
+ end
572
+ end
573
+
574
+ # Warn about deprecated use of top level constant names.
575
+ def const_warning(const_name)
576
+ @const_warning ||= false
577
+ if ! @const_warning
578
+ $stderr.puts %{WARNING: Deprecated reference to top-level constant '#{const_name}' } +
579
+ %{found at: #{rakefile_location}} # '
580
+ $stderr.puts %{ Use --classic-namespace on rake command}
581
+ $stderr.puts %{ or 'require "rake/classic_namespace"' in Rakefile}
582
+ end
583
+ @const_warning = true
584
+ end
585
+
586
+ def rakefile_location backtrace = caller
587
+ backtrace.map { |t| t[/([^:]+):/,1] }
588
+
589
+ re = /^#{@rakefile}$/
590
+ re = /#{re.source}/i if windows?
591
+
592
+ backtrace.find { |str| str =~ re } || ''
593
+ end
594
+ end
595
+ end