bundler 2.0.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bundler might be problematic. Click here for more details.

Files changed (303) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +3111 -0
  3. data/LICENSE.md +23 -0
  4. data/README.md +63 -0
  5. data/bundler.gemspec +65 -0
  6. data/exe/bundle +31 -0
  7. data/exe/bundle_ruby +60 -0
  8. data/exe/bundler +4 -0
  9. data/lib/bundler.rb +567 -0
  10. data/lib/bundler/build_metadata.rb +53 -0
  11. data/lib/bundler/capistrano.rb +22 -0
  12. data/lib/bundler/cli.rb +792 -0
  13. data/lib/bundler/cli/add.rb +35 -0
  14. data/lib/bundler/cli/binstubs.rb +49 -0
  15. data/lib/bundler/cli/cache.rb +36 -0
  16. data/lib/bundler/cli/check.rb +38 -0
  17. data/lib/bundler/cli/clean.rb +25 -0
  18. data/lib/bundler/cli/common.rb +102 -0
  19. data/lib/bundler/cli/config.rb +119 -0
  20. data/lib/bundler/cli/console.rb +43 -0
  21. data/lib/bundler/cli/doctor.rb +140 -0
  22. data/lib/bundler/cli/exec.rb +105 -0
  23. data/lib/bundler/cli/gem.rb +252 -0
  24. data/lib/bundler/cli/info.rb +50 -0
  25. data/lib/bundler/cli/init.rb +47 -0
  26. data/lib/bundler/cli/inject.rb +60 -0
  27. data/lib/bundler/cli/install.rb +218 -0
  28. data/lib/bundler/cli/issue.rb +40 -0
  29. data/lib/bundler/cli/list.rb +58 -0
  30. data/lib/bundler/cli/lock.rb +63 -0
  31. data/lib/bundler/cli/open.rb +26 -0
  32. data/lib/bundler/cli/outdated.rb +266 -0
  33. data/lib/bundler/cli/package.rb +49 -0
  34. data/lib/bundler/cli/platform.rb +46 -0
  35. data/lib/bundler/cli/plugin.rb +24 -0
  36. data/lib/bundler/cli/pristine.rb +47 -0
  37. data/lib/bundler/cli/remove.rb +18 -0
  38. data/lib/bundler/cli/show.rb +75 -0
  39. data/lib/bundler/cli/update.rb +91 -0
  40. data/lib/bundler/cli/viz.rb +31 -0
  41. data/lib/bundler/compact_index_client.rb +109 -0
  42. data/lib/bundler/compact_index_client/cache.rb +118 -0
  43. data/lib/bundler/compact_index_client/updater.rb +116 -0
  44. data/lib/bundler/compatibility_guard.rb +13 -0
  45. data/lib/bundler/constants.rb +7 -0
  46. data/lib/bundler/current_ruby.rb +94 -0
  47. data/lib/bundler/definition.rb +995 -0
  48. data/lib/bundler/dep_proxy.rb +48 -0
  49. data/lib/bundler/dependency.rb +139 -0
  50. data/lib/bundler/deployment.rb +69 -0
  51. data/lib/bundler/deprecate.rb +44 -0
  52. data/lib/bundler/dsl.rb +615 -0
  53. data/lib/bundler/endpoint_specification.rb +141 -0
  54. data/lib/bundler/env.rb +149 -0
  55. data/lib/bundler/environment_preserver.rb +59 -0
  56. data/lib/bundler/errors.rb +158 -0
  57. data/lib/bundler/feature_flag.rb +75 -0
  58. data/lib/bundler/fetcher.rb +312 -0
  59. data/lib/bundler/fetcher/base.rb +52 -0
  60. data/lib/bundler/fetcher/compact_index.rb +126 -0
  61. data/lib/bundler/fetcher/dependency.rb +82 -0
  62. data/lib/bundler/fetcher/downloader.rb +84 -0
  63. data/lib/bundler/fetcher/index.rb +52 -0
  64. data/lib/bundler/friendly_errors.rb +131 -0
  65. data/lib/bundler/gem_helper.rb +217 -0
  66. data/lib/bundler/gem_helpers.rb +101 -0
  67. data/lib/bundler/gem_remote_fetcher.rb +43 -0
  68. data/lib/bundler/gem_tasks.rb +7 -0
  69. data/lib/bundler/gem_version_promoter.rb +190 -0
  70. data/lib/bundler/gemdeps.rb +29 -0
  71. data/lib/bundler/graph.rb +152 -0
  72. data/lib/bundler/index.rb +213 -0
  73. data/lib/bundler/injector.rb +253 -0
  74. data/lib/bundler/inline.rb +74 -0
  75. data/lib/bundler/installer.rb +318 -0
  76. data/lib/bundler/installer/gem_installer.rb +85 -0
  77. data/lib/bundler/installer/parallel_installer.rb +229 -0
  78. data/lib/bundler/installer/standalone.rb +53 -0
  79. data/lib/bundler/lazy_specification.rb +123 -0
  80. data/lib/bundler/lockfile_generator.rb +95 -0
  81. data/lib/bundler/lockfile_parser.rb +256 -0
  82. data/lib/bundler/match_platform.rb +24 -0
  83. data/lib/bundler/mirror.rb +223 -0
  84. data/lib/bundler/plugin.rb +294 -0
  85. data/lib/bundler/plugin/api.rb +81 -0
  86. data/lib/bundler/plugin/api/source.rb +306 -0
  87. data/lib/bundler/plugin/dsl.rb +53 -0
  88. data/lib/bundler/plugin/events.rb +61 -0
  89. data/lib/bundler/plugin/index.rb +165 -0
  90. data/lib/bundler/plugin/installer.rb +96 -0
  91. data/lib/bundler/plugin/installer/git.rb +38 -0
  92. data/lib/bundler/plugin/installer/rubygems.rb +27 -0
  93. data/lib/bundler/plugin/source_list.rb +27 -0
  94. data/lib/bundler/process_lock.rb +24 -0
  95. data/lib/bundler/psyched_yaml.rb +37 -0
  96. data/lib/bundler/remote_specification.rb +114 -0
  97. data/lib/bundler/resolver.rb +373 -0
  98. data/lib/bundler/resolver/spec_group.rb +106 -0
  99. data/lib/bundler/retry.rb +66 -0
  100. data/lib/bundler/ruby_dsl.rb +18 -0
  101. data/lib/bundler/ruby_version.rb +152 -0
  102. data/lib/bundler/rubygems_ext.rb +209 -0
  103. data/lib/bundler/rubygems_gem_installer.rb +99 -0
  104. data/lib/bundler/rubygems_integration.rb +915 -0
  105. data/lib/bundler/runtime.rb +322 -0
  106. data/lib/bundler/settings.rb +464 -0
  107. data/lib/bundler/settings/validator.rb +102 -0
  108. data/lib/bundler/setup.rb +28 -0
  109. data/lib/bundler/shared_helpers.rb +386 -0
  110. data/lib/bundler/similarity_detector.rb +63 -0
  111. data/lib/bundler/source.rb +94 -0
  112. data/lib/bundler/source/gemspec.rb +18 -0
  113. data/lib/bundler/source/git.rb +329 -0
  114. data/lib/bundler/source/git/git_proxy.rb +262 -0
  115. data/lib/bundler/source/metadata.rb +62 -0
  116. data/lib/bundler/source/path.rb +249 -0
  117. data/lib/bundler/source/path/installer.rb +74 -0
  118. data/lib/bundler/source/rubygems.rb +539 -0
  119. data/lib/bundler/source/rubygems/remote.rb +69 -0
  120. data/lib/bundler/source_list.rb +186 -0
  121. data/lib/bundler/spec_set.rb +208 -0
  122. data/lib/bundler/ssl_certs/.document +1 -0
  123. data/lib/bundler/ssl_certs/certificate_manager.rb +66 -0
  124. data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
  125. data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +23 -0
  126. data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +25 -0
  127. data/lib/bundler/stub_specification.rb +108 -0
  128. data/lib/bundler/templates/.document +1 -0
  129. data/lib/bundler/templates/Executable +29 -0
  130. data/lib/bundler/templates/Executable.bundler +105 -0
  131. data/lib/bundler/templates/Executable.standalone +14 -0
  132. data/lib/bundler/templates/Gemfile +7 -0
  133. data/lib/bundler/templates/gems.rb +8 -0
  134. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +74 -0
  135. data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
  136. data/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
  137. data/lib/bundler/templates/newgem/README.md.tt +47 -0
  138. data/lib/bundler/templates/newgem/Rakefile.tt +29 -0
  139. data/lib/bundler/templates/newgem/bin/console.tt +14 -0
  140. data/lib/bundler/templates/newgem/bin/setup.tt +8 -0
  141. data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
  142. data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
  143. data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
  144. data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
  145. data/lib/bundler/templates/newgem/gitignore.tt +20 -0
  146. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +13 -0
  147. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
  148. data/lib/bundler/templates/newgem/newgem.gemspec.tt +50 -0
  149. data/lib/bundler/templates/newgem/rspec.tt +3 -0
  150. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +9 -0
  151. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +14 -0
  152. data/lib/bundler/templates/newgem/test/newgem_test.rb.tt +11 -0
  153. data/lib/bundler/templates/newgem/test/test_helper.rb.tt +8 -0
  154. data/lib/bundler/templates/newgem/travis.yml.tt +7 -0
  155. data/lib/bundler/ui.rb +9 -0
  156. data/lib/bundler/ui/rg_proxy.rb +19 -0
  157. data/lib/bundler/ui/shell.rb +146 -0
  158. data/lib/bundler/ui/silent.rb +69 -0
  159. data/lib/bundler/uri_credentials_filter.rb +37 -0
  160. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1741 -0
  161. data/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +5 -0
  162. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +12 -0
  163. data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
  164. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +57 -0
  165. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +81 -0
  166. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +223 -0
  167. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +36 -0
  168. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +66 -0
  169. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +62 -0
  170. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +63 -0
  171. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +61 -0
  172. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +126 -0
  173. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +46 -0
  174. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +36 -0
  175. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +136 -0
  176. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +143 -0
  177. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +6 -0
  178. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +101 -0
  179. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +67 -0
  180. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +837 -0
  181. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +46 -0
  182. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +58 -0
  183. data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +27 -0
  184. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1233 -0
  185. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +129 -0
  186. data/lib/bundler/vendor/thor/lib/thor.rb +509 -0
  187. data/lib/bundler/vendor/thor/lib/thor/actions.rb +331 -0
  188. data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +104 -0
  189. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +60 -0
  190. data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +118 -0
  191. data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +143 -0
  192. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +373 -0
  193. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +109 -0
  194. data/lib/bundler/vendor/thor/lib/thor/base.rb +678 -0
  195. data/lib/bundler/vendor/thor/lib/thor/command.rb +135 -0
  196. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +97 -0
  197. data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +12 -0
  198. data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +129 -0
  199. data/lib/bundler/vendor/thor/lib/thor/error.rb +114 -0
  200. data/lib/bundler/vendor/thor/lib/thor/group.rb +281 -0
  201. data/lib/bundler/vendor/thor/lib/thor/invocation.rb +177 -0
  202. data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
  203. data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +37 -0
  204. data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
  205. data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
  206. data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +70 -0
  207. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +175 -0
  208. data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +146 -0
  209. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +226 -0
  210. data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +71 -0
  211. data/lib/bundler/vendor/thor/lib/thor/runner.rb +324 -0
  212. data/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
  213. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +482 -0
  214. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +149 -0
  215. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +126 -0
  216. data/lib/bundler/vendor/thor/lib/thor/util.rb +268 -0
  217. data/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
  218. data/lib/bundler/vendored_fileutils.rb +9 -0
  219. data/lib/bundler/vendored_molinillo.rb +4 -0
  220. data/lib/bundler/vendored_persistent.rb +52 -0
  221. data/lib/bundler/vendored_thor.rb +8 -0
  222. data/lib/bundler/version.rb +28 -0
  223. data/lib/bundler/version_ranges.rb +76 -0
  224. data/lib/bundler/vlad.rb +17 -0
  225. data/lib/bundler/worker.rb +106 -0
  226. data/lib/bundler/yaml_serializer.rb +90 -0
  227. data/man/bundle-add.1 +58 -0
  228. data/man/bundle-add.1.txt +52 -0
  229. data/man/bundle-add.ronn +40 -0
  230. data/man/bundle-binstubs.1 +40 -0
  231. data/man/bundle-binstubs.1.txt +48 -0
  232. data/man/bundle-binstubs.ronn +43 -0
  233. data/man/bundle-check.1 +31 -0
  234. data/man/bundle-check.1.txt +33 -0
  235. data/man/bundle-check.ronn +26 -0
  236. data/man/bundle-clean.1 +24 -0
  237. data/man/bundle-clean.1.txt +26 -0
  238. data/man/bundle-clean.ronn +18 -0
  239. data/man/bundle-config.1 +497 -0
  240. data/man/bundle-config.1.txt +529 -0
  241. data/man/bundle-config.ronn +397 -0
  242. data/man/bundle-doctor.1 +44 -0
  243. data/man/bundle-doctor.1.txt +44 -0
  244. data/man/bundle-doctor.ronn +33 -0
  245. data/man/bundle-exec.1 +165 -0
  246. data/man/bundle-exec.1.txt +178 -0
  247. data/man/bundle-exec.ronn +152 -0
  248. data/man/bundle-gem.1 +80 -0
  249. data/man/bundle-gem.1.txt +91 -0
  250. data/man/bundle-gem.ronn +78 -0
  251. data/man/bundle-info.1 +20 -0
  252. data/man/bundle-info.1.txt +21 -0
  253. data/man/bundle-info.ronn +17 -0
  254. data/man/bundle-init.1 +25 -0
  255. data/man/bundle-init.1.txt +34 -0
  256. data/man/bundle-init.ronn +29 -0
  257. data/man/bundle-inject.1 +33 -0
  258. data/man/bundle-inject.1.txt +32 -0
  259. data/man/bundle-inject.ronn +22 -0
  260. data/man/bundle-install.1 +308 -0
  261. data/man/bundle-install.1.txt +396 -0
  262. data/man/bundle-install.ronn +378 -0
  263. data/man/bundle-list.1 +50 -0
  264. data/man/bundle-list.1.txt +43 -0
  265. data/man/bundle-list.ronn +33 -0
  266. data/man/bundle-lock.1 +84 -0
  267. data/man/bundle-lock.1.txt +93 -0
  268. data/man/bundle-lock.ronn +94 -0
  269. data/man/bundle-open.1 +32 -0
  270. data/man/bundle-open.1.txt +29 -0
  271. data/man/bundle-open.ronn +19 -0
  272. data/man/bundle-outdated.1 +155 -0
  273. data/man/bundle-outdated.1.txt +131 -0
  274. data/man/bundle-outdated.ronn +111 -0
  275. data/man/bundle-package.1 +55 -0
  276. data/man/bundle-package.1.txt +79 -0
  277. data/man/bundle-package.ronn +72 -0
  278. data/man/bundle-platform.1 +61 -0
  279. data/man/bundle-platform.1.txt +57 -0
  280. data/man/bundle-platform.ronn +42 -0
  281. data/man/bundle-pristine.1 +34 -0
  282. data/man/bundle-pristine.1.txt +44 -0
  283. data/man/bundle-pristine.ronn +34 -0
  284. data/man/bundle-remove.1 +31 -0
  285. data/man/bundle-remove.1.txt +34 -0
  286. data/man/bundle-remove.ronn +23 -0
  287. data/man/bundle-show.1 +23 -0
  288. data/man/bundle-show.1.txt +27 -0
  289. data/man/bundle-show.ronn +21 -0
  290. data/man/bundle-update.1 +394 -0
  291. data/man/bundle-update.1.txt +391 -0
  292. data/man/bundle-update.ronn +350 -0
  293. data/man/bundle-viz.1 +39 -0
  294. data/man/bundle-viz.1.txt +39 -0
  295. data/man/bundle-viz.ronn +30 -0
  296. data/man/bundle.1 +136 -0
  297. data/man/bundle.1.txt +116 -0
  298. data/man/bundle.ronn +111 -0
  299. data/man/gemfile.5 +689 -0
  300. data/man/gemfile.5.ronn +521 -0
  301. data/man/gemfile.5.txt +653 -0
  302. data/man/index.txt +25 -0
  303. metadata +463 -0
@@ -0,0 +1,109 @@
1
+ require "bundler/vendor/thor/lib/thor/actions/empty_directory"
2
+
3
+ class Bundler::Thor
4
+ module Actions
5
+ # Injects the given content into a file. Different from gsub_file, this
6
+ # method is reversible.
7
+ #
8
+ # ==== Parameters
9
+ # destination<String>:: Relative path to the destination root
10
+ # data<String>:: Data to add to the file. Can be given as a block.
11
+ # config<Hash>:: give :verbose => false to not log the status and the flag
12
+ # for injection (:after or :before) or :force => true for
13
+ # insert two or more times the same content.
14
+ #
15
+ # ==== Examples
16
+ #
17
+ # insert_into_file "config/environment.rb", "config.gem :thor", :after => "Rails::Initializer.run do |config|\n"
18
+ #
19
+ # insert_into_file "config/environment.rb", :after => "Rails::Initializer.run do |config|\n" do
20
+ # gems = ask "Which gems would you like to add?"
21
+ # gems.split(" ").map{ |gem| " config.gem :#{gem}" }.join("\n")
22
+ # end
23
+ #
24
+ def insert_into_file(destination, *args, &block)
25
+ data = block_given? ? block : args.shift
26
+ config = args.shift
27
+ action InjectIntoFile.new(self, destination, data, config)
28
+ end
29
+ alias_method :inject_into_file, :insert_into_file
30
+
31
+ class InjectIntoFile < EmptyDirectory #:nodoc:
32
+ attr_reader :replacement, :flag, :behavior
33
+
34
+ def initialize(base, destination, data, config)
35
+ super(base, destination, {:verbose => true}.merge(config))
36
+
37
+ @behavior, @flag = if @config.key?(:after)
38
+ [:after, @config.delete(:after)]
39
+ else
40
+ [:before, @config.delete(:before)]
41
+ end
42
+
43
+ @replacement = data.is_a?(Proc) ? data.call : data
44
+ @flag = Regexp.escape(@flag) unless @flag.is_a?(Regexp)
45
+ end
46
+
47
+ def invoke!
48
+ say_status :invoke
49
+
50
+ content = if @behavior == :after
51
+ '\0' + replacement
52
+ else
53
+ replacement + '\0'
54
+ end
55
+
56
+ if exists?
57
+ replace!(/#{flag}/, content, config[:force])
58
+ else
59
+ unless pretend?
60
+ raise Bundler::Thor::Error, "The file #{ destination } does not appear to exist"
61
+ end
62
+ end
63
+ end
64
+
65
+ def revoke!
66
+ say_status :revoke
67
+
68
+ regexp = if @behavior == :after
69
+ content = '\1\2'
70
+ /(#{flag})(.*)(#{Regexp.escape(replacement)})/m
71
+ else
72
+ content = '\2\3'
73
+ /(#{Regexp.escape(replacement)})(.*)(#{flag})/m
74
+ end
75
+
76
+ replace!(regexp, content, true)
77
+ end
78
+
79
+ protected
80
+
81
+ def say_status(behavior)
82
+ status = if behavior == :invoke
83
+ if flag == /\A/
84
+ :prepend
85
+ elsif flag == /\z/
86
+ :append
87
+ else
88
+ :insert
89
+ end
90
+ else
91
+ :subtract
92
+ end
93
+
94
+ super(status, config[:verbose])
95
+ end
96
+
97
+ # Adds the content to the file.
98
+ #
99
+ def replace!(regexp, string, force)
100
+ return if pretend?
101
+ content = File.read(destination)
102
+ if force || !content.include?(replacement)
103
+ content.gsub!(regexp, string)
104
+ File.open(destination, "wb") { |file| file.write(content) }
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,678 @@
1
+ require "bundler/vendor/thor/lib/thor/command"
2
+ require "bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access"
3
+ require "bundler/vendor/thor/lib/thor/core_ext/ordered_hash"
4
+ require "bundler/vendor/thor/lib/thor/error"
5
+ require "bundler/vendor/thor/lib/thor/invocation"
6
+ require "bundler/vendor/thor/lib/thor/parser"
7
+ require "bundler/vendor/thor/lib/thor/shell"
8
+ require "bundler/vendor/thor/lib/thor/line_editor"
9
+ require "bundler/vendor/thor/lib/thor/util"
10
+
11
+ class Bundler::Thor
12
+ autoload :Actions, "bundler/vendor/thor/lib/thor/actions"
13
+ autoload :RakeCompat, "bundler/vendor/thor/lib/thor/rake_compat"
14
+ autoload :Group, "bundler/vendor/thor/lib/thor/group"
15
+
16
+ # Shortcuts for help.
17
+ HELP_MAPPINGS = %w(-h -? --help -D)
18
+
19
+ # Bundler::Thor methods that should not be overwritten by the user.
20
+ THOR_RESERVED_WORDS = %w(invoke shell options behavior root destination_root relative_root
21
+ action add_file create_file in_root inside run run_ruby_script)
22
+
23
+ TEMPLATE_EXTNAME = ".tt"
24
+
25
+ module Base
26
+ attr_accessor :options, :parent_options, :args
27
+
28
+ # It receives arguments in an Array and two hashes, one for options and
29
+ # other for configuration.
30
+ #
31
+ # Notice that it does not check if all required arguments were supplied.
32
+ # It should be done by the parser.
33
+ #
34
+ # ==== Parameters
35
+ # args<Array[Object]>:: An array of objects. The objects are applied to their
36
+ # respective accessors declared with <tt>argument</tt>.
37
+ #
38
+ # options<Hash>:: An options hash that will be available as self.options.
39
+ # The hash given is converted to a hash with indifferent
40
+ # access, magic predicates (options.skip?) and then frozen.
41
+ #
42
+ # config<Hash>:: Configuration for this Bundler::Thor class.
43
+ #
44
+ def initialize(args = [], local_options = {}, config = {})
45
+ parse_options = self.class.class_options
46
+
47
+ # The start method splits inbound arguments at the first argument
48
+ # that looks like an option (starts with - or --). It then calls
49
+ # new, passing in the two halves of the arguments Array as the
50
+ # first two parameters.
51
+
52
+ command_options = config.delete(:command_options) # hook for start
53
+ parse_options = parse_options.merge(command_options) if command_options
54
+ if local_options.is_a?(Array)
55
+ array_options = local_options
56
+ hash_options = {}
57
+ else
58
+ # Handle the case where the class was explicitly instantiated
59
+ # with pre-parsed options.
60
+ array_options = []
61
+ hash_options = local_options
62
+ end
63
+
64
+ # Let Bundler::Thor::Options parse the options first, so it can remove
65
+ # declared options from the array. This will leave us with
66
+ # a list of arguments that weren't declared.
67
+ stop_on_unknown = self.class.stop_on_unknown_option? config[:current_command]
68
+ disable_required_check = self.class.disable_required_check? config[:current_command]
69
+ opts = Bundler::Thor::Options.new(parse_options, hash_options, stop_on_unknown, disable_required_check)
70
+ self.options = opts.parse(array_options)
71
+ self.options = config[:class_options].merge(options) if config[:class_options]
72
+
73
+ # If unknown options are disallowed, make sure that none of the
74
+ # remaining arguments looks like an option.
75
+ opts.check_unknown! if self.class.check_unknown_options?(config)
76
+
77
+ # Add the remaining arguments from the options parser to the
78
+ # arguments passed in to initialize. Then remove any positional
79
+ # arguments declared using #argument (this is primarily used
80
+ # by Bundler::Thor::Group). Tis will leave us with the remaining
81
+ # positional arguments.
82
+ to_parse = args
83
+ to_parse += opts.remaining unless self.class.strict_args_position?(config)
84
+
85
+ thor_args = Bundler::Thor::Arguments.new(self.class.arguments)
86
+ thor_args.parse(to_parse).each { |k, v| __send__("#{k}=", v) }
87
+ @args = thor_args.remaining
88
+ end
89
+
90
+ class << self
91
+ def included(base) #:nodoc:
92
+ base.extend ClassMethods
93
+ base.send :include, Invocation
94
+ base.send :include, Shell
95
+ end
96
+
97
+ # Returns the classes that inherits from Bundler::Thor or Bundler::Thor::Group.
98
+ #
99
+ # ==== Returns
100
+ # Array[Class]
101
+ #
102
+ def subclasses
103
+ @subclasses ||= []
104
+ end
105
+
106
+ # Returns the files where the subclasses are kept.
107
+ #
108
+ # ==== Returns
109
+ # Hash[path<String> => Class]
110
+ #
111
+ def subclass_files
112
+ @subclass_files ||= Hash.new { |h, k| h[k] = [] }
113
+ end
114
+
115
+ # Whenever a class inherits from Bundler::Thor or Bundler::Thor::Group, we should track the
116
+ # class and the file on Bundler::Thor::Base. This is the method responsable for it.
117
+ #
118
+ def register_klass_file(klass) #:nodoc:
119
+ file = caller[1].match(/(.*):\d+/)[1]
120
+ Bundler::Thor::Base.subclasses << klass unless Bundler::Thor::Base.subclasses.include?(klass)
121
+
122
+ file_subclasses = Bundler::Thor::Base.subclass_files[File.expand_path(file)]
123
+ file_subclasses << klass unless file_subclasses.include?(klass)
124
+ end
125
+ end
126
+
127
+ module ClassMethods
128
+ def attr_reader(*) #:nodoc:
129
+ no_commands { super }
130
+ end
131
+
132
+ def attr_writer(*) #:nodoc:
133
+ no_commands { super }
134
+ end
135
+
136
+ def attr_accessor(*) #:nodoc:
137
+ no_commands { super }
138
+ end
139
+
140
+ # If you want to raise an error for unknown options, call check_unknown_options!
141
+ # This is disabled by default to allow dynamic invocations.
142
+ def check_unknown_options!
143
+ @check_unknown_options = true
144
+ end
145
+
146
+ def check_unknown_options #:nodoc:
147
+ @check_unknown_options ||= from_superclass(:check_unknown_options, false)
148
+ end
149
+
150
+ def check_unknown_options?(config) #:nodoc:
151
+ !!check_unknown_options
152
+ end
153
+
154
+ # If you want to raise an error when the default value of an option does not match
155
+ # the type call check_default_type!
156
+ # This is disabled by default for compatibility.
157
+ def check_default_type!
158
+ @check_default_type = true
159
+ end
160
+
161
+ def check_default_type #:nodoc:
162
+ @check_default_type ||= from_superclass(:check_default_type, false)
163
+ end
164
+
165
+ def check_default_type? #:nodoc:
166
+ !!check_default_type
167
+ end
168
+
169
+ # If true, option parsing is suspended as soon as an unknown option or a
170
+ # regular argument is encountered. All remaining arguments are passed to
171
+ # the command as regular arguments.
172
+ def stop_on_unknown_option?(command_name) #:nodoc:
173
+ false
174
+ end
175
+
176
+ # If true, option set will not suspend the execution of the command when
177
+ # a required option is not provided.
178
+ def disable_required_check?(command_name) #:nodoc:
179
+ false
180
+ end
181
+
182
+ # If you want only strict string args (useful when cascading thor classes),
183
+ # call strict_args_position! This is disabled by default to allow dynamic
184
+ # invocations.
185
+ def strict_args_position!
186
+ @strict_args_position = true
187
+ end
188
+
189
+ def strict_args_position #:nodoc:
190
+ @strict_args_position ||= from_superclass(:strict_args_position, false)
191
+ end
192
+
193
+ def strict_args_position?(config) #:nodoc:
194
+ !!strict_args_position
195
+ end
196
+
197
+ # Adds an argument to the class and creates an attr_accessor for it.
198
+ #
199
+ # Arguments are different from options in several aspects. The first one
200
+ # is how they are parsed from the command line, arguments are retrieved
201
+ # from position:
202
+ #
203
+ # thor command NAME
204
+ #
205
+ # Instead of:
206
+ #
207
+ # thor command --name=NAME
208
+ #
209
+ # Besides, arguments are used inside your code as an accessor (self.argument),
210
+ # while options are all kept in a hash (self.options).
211
+ #
212
+ # Finally, arguments cannot have type :default or :boolean but can be
213
+ # optional (supplying :optional => :true or :required => false), although
214
+ # you cannot have a required argument after a non-required argument. If you
215
+ # try it, an error is raised.
216
+ #
217
+ # ==== Parameters
218
+ # name<Symbol>:: The name of the argument.
219
+ # options<Hash>:: Described below.
220
+ #
221
+ # ==== Options
222
+ # :desc - Description for the argument.
223
+ # :required - If the argument is required or not.
224
+ # :optional - If the argument is optional or not.
225
+ # :type - The type of the argument, can be :string, :hash, :array, :numeric.
226
+ # :default - Default value for this argument. It cannot be required and have default values.
227
+ # :banner - String to show on usage notes.
228
+ #
229
+ # ==== Errors
230
+ # ArgumentError:: Raised if you supply a required argument after a non required one.
231
+ #
232
+ def argument(name, options = {})
233
+ is_thor_reserved_word?(name, :argument)
234
+ no_commands { attr_accessor name }
235
+
236
+ required = if options.key?(:optional)
237
+ !options[:optional]
238
+ elsif options.key?(:required)
239
+ options[:required]
240
+ else
241
+ options[:default].nil?
242
+ end
243
+
244
+ remove_argument name
245
+
246
+ if required
247
+ arguments.each do |argument|
248
+ next if argument.required?
249
+ raise ArgumentError, "You cannot have #{name.to_s.inspect} as required argument after " \
250
+ "the non-required argument #{argument.human_name.inspect}."
251
+ end
252
+ end
253
+
254
+ options[:required] = required
255
+
256
+ arguments << Bundler::Thor::Argument.new(name, options)
257
+ end
258
+
259
+ # Returns this class arguments, looking up in the ancestors chain.
260
+ #
261
+ # ==== Returns
262
+ # Array[Bundler::Thor::Argument]
263
+ #
264
+ def arguments
265
+ @arguments ||= from_superclass(:arguments, [])
266
+ end
267
+
268
+ # Adds a bunch of options to the set of class options.
269
+ #
270
+ # class_options :foo => false, :bar => :required, :baz => :string
271
+ #
272
+ # If you prefer more detailed declaration, check class_option.
273
+ #
274
+ # ==== Parameters
275
+ # Hash[Symbol => Object]
276
+ #
277
+ def class_options(options = nil)
278
+ @class_options ||= from_superclass(:class_options, {})
279
+ build_options(options, @class_options) if options
280
+ @class_options
281
+ end
282
+
283
+ # Adds an option to the set of class options
284
+ #
285
+ # ==== Parameters
286
+ # name<Symbol>:: The name of the argument.
287
+ # options<Hash>:: Described below.
288
+ #
289
+ # ==== Options
290
+ # :desc:: -- Description for the argument.
291
+ # :required:: -- If the argument is required or not.
292
+ # :default:: -- Default value for this argument.
293
+ # :group:: -- The group for this options. Use by class options to output options in different levels.
294
+ # :aliases:: -- Aliases for this option. <b>Note:</b> Bundler::Thor follows a convention of one-dash-one-letter options. Thus aliases like "-something" wouldn't be parsed; use either "\--something" or "-s" instead.
295
+ # :type:: -- The type of the argument, can be :string, :hash, :array, :numeric or :boolean.
296
+ # :banner:: -- String to show on usage notes.
297
+ # :hide:: -- If you want to hide this option from the help.
298
+ #
299
+ def class_option(name, options = {})
300
+ build_option(name, options, class_options)
301
+ end
302
+
303
+ # Removes a previous defined argument. If :undefine is given, undefine
304
+ # accessors as well.
305
+ #
306
+ # ==== Parameters
307
+ # names<Array>:: Arguments to be removed
308
+ #
309
+ # ==== Examples
310
+ #
311
+ # remove_argument :foo
312
+ # remove_argument :foo, :bar, :baz, :undefine => true
313
+ #
314
+ def remove_argument(*names)
315
+ options = names.last.is_a?(Hash) ? names.pop : {}
316
+
317
+ names.each do |name|
318
+ arguments.delete_if { |a| a.name == name.to_s }
319
+ undef_method name, "#{name}=" if options[:undefine]
320
+ end
321
+ end
322
+
323
+ # Removes a previous defined class option.
324
+ #
325
+ # ==== Parameters
326
+ # names<Array>:: Class options to be removed
327
+ #
328
+ # ==== Examples
329
+ #
330
+ # remove_class_option :foo
331
+ # remove_class_option :foo, :bar, :baz
332
+ #
333
+ def remove_class_option(*names)
334
+ names.each do |name|
335
+ class_options.delete(name)
336
+ end
337
+ end
338
+
339
+ # Defines the group. This is used when thor list is invoked so you can specify
340
+ # that only commands from a pre-defined group will be shown. Defaults to standard.
341
+ #
342
+ # ==== Parameters
343
+ # name<String|Symbol>
344
+ #
345
+ def group(name = nil)
346
+ if name
347
+ @group = name.to_s
348
+ else
349
+ @group ||= from_superclass(:group, "standard")
350
+ end
351
+ end
352
+
353
+ # Returns the commands for this Bundler::Thor class.
354
+ #
355
+ # ==== Returns
356
+ # OrderedHash:: An ordered hash with commands names as keys and Bundler::Thor::Command
357
+ # objects as values.
358
+ #
359
+ def commands
360
+ @commands ||= Bundler::Thor::CoreExt::OrderedHash.new
361
+ end
362
+ alias_method :tasks, :commands
363
+
364
+ # Returns the commands for this Bundler::Thor class and all subclasses.
365
+ #
366
+ # ==== Returns
367
+ # OrderedHash:: An ordered hash with commands names as keys and Bundler::Thor::Command
368
+ # objects as values.
369
+ #
370
+ def all_commands
371
+ @all_commands ||= from_superclass(:all_commands, Bundler::Thor::CoreExt::OrderedHash.new)
372
+ @all_commands.merge!(commands)
373
+ end
374
+ alias_method :all_tasks, :all_commands
375
+
376
+ # Removes a given command from this Bundler::Thor class. This is usually done if you
377
+ # are inheriting from another class and don't want it to be available
378
+ # anymore.
379
+ #
380
+ # By default it only remove the mapping to the command. But you can supply
381
+ # :undefine => true to undefine the method from the class as well.
382
+ #
383
+ # ==== Parameters
384
+ # name<Symbol|String>:: The name of the command to be removed
385
+ # options<Hash>:: You can give :undefine => true if you want commands the method
386
+ # to be undefined from the class as well.
387
+ #
388
+ def remove_command(*names)
389
+ options = names.last.is_a?(Hash) ? names.pop : {}
390
+
391
+ names.each do |name|
392
+ commands.delete(name.to_s)
393
+ all_commands.delete(name.to_s)
394
+ undef_method name if options[:undefine]
395
+ end
396
+ end
397
+ alias_method :remove_task, :remove_command
398
+
399
+ # All methods defined inside the given block are not added as commands.
400
+ #
401
+ # So you can do:
402
+ #
403
+ # class MyScript < Bundler::Thor
404
+ # no_commands do
405
+ # def this_is_not_a_command
406
+ # end
407
+ # end
408
+ # end
409
+ #
410
+ # You can also add the method and remove it from the command list:
411
+ #
412
+ # class MyScript < Bundler::Thor
413
+ # def this_is_not_a_command
414
+ # end
415
+ # remove_command :this_is_not_a_command
416
+ # end
417
+ #
418
+ def no_commands
419
+ @no_commands = true
420
+ yield
421
+ ensure
422
+ @no_commands = false
423
+ end
424
+ alias_method :no_tasks, :no_commands
425
+
426
+ # Sets the namespace for the Bundler::Thor or Bundler::Thor::Group class. By default the
427
+ # namespace is retrieved from the class name. If your Bundler::Thor class is named
428
+ # Scripts::MyScript, the help method, for example, will be called as:
429
+ #
430
+ # thor scripts:my_script -h
431
+ #
432
+ # If you change the namespace:
433
+ #
434
+ # namespace :my_scripts
435
+ #
436
+ # You change how your commands are invoked:
437
+ #
438
+ # thor my_scripts -h
439
+ #
440
+ # Finally, if you change your namespace to default:
441
+ #
442
+ # namespace :default
443
+ #
444
+ # Your commands can be invoked with a shortcut. Instead of:
445
+ #
446
+ # thor :my_command
447
+ #
448
+ def namespace(name = nil)
449
+ if name
450
+ @namespace = name.to_s
451
+ else
452
+ @namespace ||= Bundler::Thor::Util.namespace_from_thor_class(self)
453
+ end
454
+ end
455
+
456
+ # Parses the command and options from the given args, instantiate the class
457
+ # and invoke the command. This method is used when the arguments must be parsed
458
+ # from an array. If you are inside Ruby and want to use a Bundler::Thor class, you
459
+ # can simply initialize it:
460
+ #
461
+ # script = MyScript.new(args, options, config)
462
+ # script.invoke(:command, first_arg, second_arg, third_arg)
463
+ #
464
+ def start(given_args = ARGV, config = {})
465
+ config[:shell] ||= Bundler::Thor::Base.shell.new
466
+ dispatch(nil, given_args.dup, nil, config)
467
+ rescue Bundler::Thor::Error => e
468
+ config[:debug] || ENV["THOR_DEBUG"] == "1" ? (raise e) : config[:shell].error(e.message)
469
+ exit(false) if exit_on_failure?
470
+ rescue Errno::EPIPE
471
+ # This happens if a thor command is piped to something like `head`,
472
+ # which closes the pipe when it's done reading. This will also
473
+ # mean that if the pipe is closed, further unnecessary
474
+ # computation will not occur.
475
+ exit(true)
476
+ end
477
+
478
+ # Allows to use private methods from parent in child classes as commands.
479
+ #
480
+ # ==== Parameters
481
+ # names<Array>:: Method names to be used as commands
482
+ #
483
+ # ==== Examples
484
+ #
485
+ # public_command :foo
486
+ # public_command :foo, :bar, :baz
487
+ #
488
+ def public_command(*names)
489
+ names.each do |name|
490
+ class_eval "def #{name}(*); super end"
491
+ end
492
+ end
493
+ alias_method :public_task, :public_command
494
+
495
+ def handle_no_command_error(command, has_namespace = $thor_runner) #:nodoc:
496
+ raise UndefinedCommandError.new(command, all_commands.keys, (namespace if has_namespace))
497
+ end
498
+ alias_method :handle_no_task_error, :handle_no_command_error
499
+
500
+ def handle_argument_error(command, error, args, arity) #:nodoc:
501
+ name = [command.ancestor_name, command.name].compact.join(" ")
502
+ msg = "ERROR: \"#{basename} #{name}\" was called with ".dup
503
+ msg << "no arguments" if args.empty?
504
+ msg << "arguments " << args.inspect unless args.empty?
505
+ msg << "\nUsage: #{banner(command).inspect}"
506
+ raise InvocationError, msg
507
+ end
508
+
509
+ protected
510
+
511
+ # Prints the class options per group. If an option does not belong to
512
+ # any group, it's printed as Class option.
513
+ #
514
+ def class_options_help(shell, groups = {}) #:nodoc:
515
+ # Group options by group
516
+ class_options.each do |_, value|
517
+ groups[value.group] ||= []
518
+ groups[value.group] << value
519
+ end
520
+
521
+ # Deal with default group
522
+ global_options = groups.delete(nil) || []
523
+ print_options(shell, global_options)
524
+
525
+ # Print all others
526
+ groups.each do |group_name, options|
527
+ print_options(shell, options, group_name)
528
+ end
529
+ end
530
+
531
+ # Receives a set of options and print them.
532
+ def print_options(shell, options, group_name = nil)
533
+ return if options.empty?
534
+
535
+ list = []
536
+ padding = options.map { |o| o.aliases.size }.max.to_i * 4
537
+
538
+ options.each do |option|
539
+ next if option.hide
540
+ item = [option.usage(padding)]
541
+ item.push(option.description ? "# #{option.description}" : "")
542
+
543
+ list << item
544
+ list << ["", "# Default: #{option.default}"] if option.show_default?
545
+ list << ["", "# Possible values: #{option.enum.join(', ')}"] if option.enum
546
+ end
547
+
548
+ shell.say(group_name ? "#{group_name} options:" : "Options:")
549
+ shell.print_table(list, :indent => 2)
550
+ shell.say ""
551
+ end
552
+
553
+ # Raises an error if the word given is a Bundler::Thor reserved word.
554
+ def is_thor_reserved_word?(word, type) #:nodoc:
555
+ return false unless THOR_RESERVED_WORDS.include?(word.to_s)
556
+ raise "#{word.inspect} is a Bundler::Thor reserved word and cannot be defined as #{type}"
557
+ end
558
+
559
+ # Build an option and adds it to the given scope.
560
+ #
561
+ # ==== Parameters
562
+ # name<Symbol>:: The name of the argument.
563
+ # options<Hash>:: Described in both class_option and method_option.
564
+ # scope<Hash>:: Options hash that is being built up
565
+ def build_option(name, options, scope) #:nodoc:
566
+ scope[name] = Bundler::Thor::Option.new(name, options.merge(:check_default_type => check_default_type?))
567
+ end
568
+
569
+ # Receives a hash of options, parse them and add to the scope. This is a
570
+ # fast way to set a bunch of options:
571
+ #
572
+ # build_options :foo => true, :bar => :required, :baz => :string
573
+ #
574
+ # ==== Parameters
575
+ # Hash[Symbol => Object]
576
+ def build_options(options, scope) #:nodoc:
577
+ options.each do |key, value|
578
+ scope[key] = Bundler::Thor::Option.parse(key, value)
579
+ end
580
+ end
581
+
582
+ # Finds a command with the given name. If the command belongs to the current
583
+ # class, just return it, otherwise dup it and add the fresh copy to the
584
+ # current command hash.
585
+ def find_and_refresh_command(name) #:nodoc:
586
+ if commands[name.to_s]
587
+ commands[name.to_s]
588
+ elsif command = all_commands[name.to_s] # rubocop:disable AssignmentInCondition
589
+ commands[name.to_s] = command.clone
590
+ else
591
+ raise ArgumentError, "You supplied :for => #{name.inspect}, but the command #{name.inspect} could not be found."
592
+ end
593
+ end
594
+ alias_method :find_and_refresh_task, :find_and_refresh_command
595
+
596
+ # Everytime someone inherits from a Bundler::Thor class, register the klass
597
+ # and file into baseclass.
598
+ def inherited(klass)
599
+ Bundler::Thor::Base.register_klass_file(klass)
600
+ klass.instance_variable_set(:@no_commands, false)
601
+ end
602
+
603
+ # Fire this callback whenever a method is added. Added methods are
604
+ # tracked as commands by invoking the create_command method.
605
+ def method_added(meth)
606
+ meth = meth.to_s
607
+
608
+ if meth == "initialize"
609
+ initialize_added
610
+ return
611
+ end
612
+
613
+ # Return if it's not a public instance method
614
+ return unless public_method_defined?(meth.to_sym)
615
+
616
+ @no_commands ||= false
617
+ return if @no_commands || !create_command(meth)
618
+
619
+ is_thor_reserved_word?(meth, :command)
620
+ Bundler::Thor::Base.register_klass_file(self)
621
+ end
622
+
623
+ # Retrieves a value from superclass. If it reaches the baseclass,
624
+ # returns default.
625
+ def from_superclass(method, default = nil)
626
+ if self == baseclass || !superclass.respond_to?(method, true)
627
+ default
628
+ else
629
+ value = superclass.send(method)
630
+
631
+ # Ruby implements `dup` on Object, but raises a `TypeError`
632
+ # if the method is called on immediates. As a result, we
633
+ # don't have a good way to check whether dup will succeed
634
+ # without calling it and rescuing the TypeError.
635
+ begin
636
+ value.dup
637
+ rescue TypeError
638
+ value
639
+ end
640
+
641
+ end
642
+ end
643
+
644
+ # A flag that makes the process exit with status 1 if any error happens.
645
+ def exit_on_failure?
646
+ false
647
+ end
648
+
649
+ #
650
+ # The basename of the program invoking the thor class.
651
+ #
652
+ def basename
653
+ File.basename($PROGRAM_NAME).split(" ").first
654
+ end
655
+
656
+ # SIGNATURE: Sets the baseclass. This is where the superclass lookup
657
+ # finishes.
658
+ def baseclass #:nodoc:
659
+ end
660
+
661
+ # SIGNATURE: Creates a new command if valid_command? is true. This method is
662
+ # called when a new method is added to the class.
663
+ def create_command(meth) #:nodoc:
664
+ end
665
+ alias_method :create_task, :create_command
666
+
667
+ # SIGNATURE: Defines behavior when the initialize method is added to the
668
+ # class.
669
+ def initialize_added #:nodoc:
670
+ end
671
+
672
+ # SIGNATURE: The hook invoked by start.
673
+ def dispatch(command, given_args, given_opts, config) #:nodoc:
674
+ raise NotImplementedError
675
+ end
676
+ end
677
+ end
678
+ end