bundler-prehistoric 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (284) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +100 -0
  5. data/CHANGELOG.md +1640 -0
  6. data/CONTRIBUTING.md +32 -0
  7. data/DEVELOPMENT.md +117 -0
  8. data/Gemfile +3 -0
  9. data/ISSUES.md +96 -0
  10. data/LICENSE.md +23 -0
  11. data/README.md +46 -0
  12. data/Rakefile +256 -0
  13. data/UPGRADING.md +103 -0
  14. data/bin/bundle +21 -0
  15. data/bin/bundle_ruby +56 -0
  16. data/bin/bundler +21 -0
  17. data/bundler.gemspec +33 -0
  18. data/lib/bundler.rb +442 -0
  19. data/lib/bundler/backports/time.rb +7 -0
  20. data/lib/bundler/capistrano.rb +16 -0
  21. data/lib/bundler/cli.rb +395 -0
  22. data/lib/bundler/cli/binstubs.rb +38 -0
  23. data/lib/bundler/cli/cache.rb +34 -0
  24. data/lib/bundler/cli/check.rb +35 -0
  25. data/lib/bundler/cli/clean.rb +19 -0
  26. data/lib/bundler/cli/common.rb +54 -0
  27. data/lib/bundler/cli/config.rb +84 -0
  28. data/lib/bundler/cli/console.rb +39 -0
  29. data/lib/bundler/cli/exec.rb +37 -0
  30. data/lib/bundler/cli/gem.rb +101 -0
  31. data/lib/bundler/cli/init.rb +33 -0
  32. data/lib/bundler/cli/inject.rb +33 -0
  33. data/lib/bundler/cli/install.rb +133 -0
  34. data/lib/bundler/cli/open.rb +23 -0
  35. data/lib/bundler/cli/outdated.rb +80 -0
  36. data/lib/bundler/cli/package.rb +36 -0
  37. data/lib/bundler/cli/platform.rb +43 -0
  38. data/lib/bundler/cli/show.rb +48 -0
  39. data/lib/bundler/cli/update.rb +73 -0
  40. data/lib/bundler/cli/viz.rb +27 -0
  41. data/lib/bundler/constants.rb +5 -0
  42. data/lib/bundler/current_ruby.rb +155 -0
  43. data/lib/bundler/definition.rb +604 -0
  44. data/lib/bundler/dep_proxy.rb +43 -0
  45. data/lib/bundler/dependency.rb +106 -0
  46. data/lib/bundler/deployment.rb +59 -0
  47. data/lib/bundler/deprecate.rb +15 -0
  48. data/lib/bundler/dsl.rb +305 -0
  49. data/lib/bundler/endpoint_specification.rb +76 -0
  50. data/lib/bundler/env.rb +56 -0
  51. data/lib/bundler/environment.rb +42 -0
  52. data/lib/bundler/fetcher.rb +396 -0
  53. data/lib/bundler/friendly_errors.rb +42 -0
  54. data/lib/bundler/gem_helper.rb +169 -0
  55. data/lib/bundler/gem_helpers.rb +25 -0
  56. data/lib/bundler/gem_installer.rb +9 -0
  57. data/lib/bundler/gem_path_manipulation.rb +8 -0
  58. data/lib/bundler/gem_tasks.rb +2 -0
  59. data/lib/bundler/graph.rb +169 -0
  60. data/lib/bundler/index.rb +184 -0
  61. data/lib/bundler/injector.rb +64 -0
  62. data/lib/bundler/installer.rb +332 -0
  63. data/lib/bundler/lazy_specification.rb +83 -0
  64. data/lib/bundler/lockfile_parser.rb +146 -0
  65. data/lib/bundler/match_platform.rb +13 -0
  66. data/lib/bundler/parallel_workers.rb +18 -0
  67. data/lib/bundler/parallel_workers/thread_worker.rb +30 -0
  68. data/lib/bundler/parallel_workers/unix_worker.rb +101 -0
  69. data/lib/bundler/parallel_workers/worker.rb +69 -0
  70. data/lib/bundler/psyched_yaml.rb +26 -0
  71. data/lib/bundler/remote_specification.rb +57 -0
  72. data/lib/bundler/resolver.rb +534 -0
  73. data/lib/bundler/retry.rb +60 -0
  74. data/lib/bundler/ruby_dsl.rb +11 -0
  75. data/lib/bundler/ruby_version.rb +117 -0
  76. data/lib/bundler/rubygems_ext.rb +171 -0
  77. data/lib/bundler/rubygems_integration.rb +578 -0
  78. data/lib/bundler/runtime.rb +310 -0
  79. data/lib/bundler/settings.rb +176 -0
  80. data/lib/bundler/setup.rb +23 -0
  81. data/lib/bundler/shared_helpers.rb +110 -0
  82. data/lib/bundler/similarity_detector.rb +63 -0
  83. data/lib/bundler/source.rb +29 -0
  84. data/lib/bundler/source/git.rb +289 -0
  85. data/lib/bundler/source/git/git_proxy.rb +158 -0
  86. data/lib/bundler/source/path.rb +225 -0
  87. data/lib/bundler/source/path/installer.rb +38 -0
  88. data/lib/bundler/source/rubygems.rb +334 -0
  89. data/lib/bundler/source/svn.rb +260 -0
  90. data/lib/bundler/source/svn/svn_proxy.rb +110 -0
  91. data/lib/bundler/spec_set.rb +154 -0
  92. data/lib/bundler/ssl_certs/.document +1 -0
  93. data/lib/bundler/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +14 -0
  94. data/lib/bundler/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +23 -0
  95. data/lib/bundler/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +28 -0
  96. data/lib/bundler/ssl_certs/GeoTrustGlobalCA.pem +20 -0
  97. data/lib/bundler/ssl_certs/certificate_manager.rb +41 -0
  98. data/lib/bundler/templates/Executable +16 -0
  99. data/lib/bundler/templates/Executable.standalone +12 -0
  100. data/lib/bundler/templates/Gemfile +4 -0
  101. data/lib/bundler/templates/newgem/.travis.yml.tt +3 -0
  102. data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
  103. data/lib/bundler/templates/newgem/LICENSE.txt.tt +22 -0
  104. data/lib/bundler/templates/newgem/README.md.tt +31 -0
  105. data/lib/bundler/templates/newgem/Rakefile.tt +26 -0
  106. data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
  107. data/lib/bundler/templates/newgem/consolerc.tt +3 -0
  108. data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
  109. data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
  110. data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
  111. data/lib/bundler/templates/newgem/gitignore.tt +16 -0
  112. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +12 -0
  113. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
  114. data/lib/bundler/templates/newgem/newgem.gemspec.tt +38 -0
  115. data/lib/bundler/templates/newgem/rspec.tt +2 -0
  116. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +11 -0
  117. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
  118. data/lib/bundler/templates/newgem/test/minitest_helper.rb.tt +4 -0
  119. data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +11 -0
  120. data/lib/bundler/ui.rb +7 -0
  121. data/lib/bundler/ui/rg_proxy.rb +21 -0
  122. data/lib/bundler/ui/shell.rb +98 -0
  123. data/lib/bundler/ui/silent.rb +44 -0
  124. data/lib/bundler/vendor/.document +0 -0
  125. data/lib/bundler/vendor/net/http/faster.rb +26 -0
  126. data/lib/bundler/vendor/net/http/persistent.rb +1230 -0
  127. data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +128 -0
  128. data/lib/bundler/vendor/thor.rb +480 -0
  129. data/lib/bundler/vendor/thor/actions.rb +319 -0
  130. data/lib/bundler/vendor/thor/actions/create_file.rb +103 -0
  131. data/lib/bundler/vendor/thor/actions/create_link.rb +59 -0
  132. data/lib/bundler/vendor/thor/actions/directory.rb +118 -0
  133. data/lib/bundler/vendor/thor/actions/empty_directory.rb +135 -0
  134. data/lib/bundler/vendor/thor/actions/file_manipulation.rb +316 -0
  135. data/lib/bundler/vendor/thor/actions/inject_into_file.rb +107 -0
  136. data/lib/bundler/vendor/thor/base.rb +656 -0
  137. data/lib/bundler/vendor/thor/command.rb +133 -0
  138. data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +77 -0
  139. data/lib/bundler/vendor/thor/core_ext/io_binary_read.rb +10 -0
  140. data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +98 -0
  141. data/lib/bundler/vendor/thor/error.rb +32 -0
  142. data/lib/bundler/vendor/thor/group.rb +281 -0
  143. data/lib/bundler/vendor/thor/invocation.rb +173 -0
  144. data/lib/bundler/vendor/thor/line_editor.rb +17 -0
  145. data/lib/bundler/vendor/thor/line_editor/basic.rb +35 -0
  146. data/lib/bundler/vendor/thor/line_editor/readline.rb +88 -0
  147. data/lib/bundler/vendor/thor/parser.rb +4 -0
  148. data/lib/bundler/vendor/thor/parser/argument.rb +73 -0
  149. data/lib/bundler/vendor/thor/parser/arguments.rb +175 -0
  150. data/lib/bundler/vendor/thor/parser/option.rb +121 -0
  151. data/lib/bundler/vendor/thor/parser/options.rb +218 -0
  152. data/lib/bundler/vendor/thor/rake_compat.rb +71 -0
  153. data/lib/bundler/vendor/thor/runner.rb +322 -0
  154. data/lib/bundler/vendor/thor/shell.rb +81 -0
  155. data/lib/bundler/vendor/thor/shell/basic.rb +420 -0
  156. data/lib/bundler/vendor/thor/shell/color.rb +149 -0
  157. data/lib/bundler/vendor/thor/shell/html.rb +126 -0
  158. data/lib/bundler/vendor/thor/util.rb +267 -0
  159. data/lib/bundler/vendor/thor/version.rb +3 -0
  160. data/lib/bundler/vendored_persistent.rb +3 -0
  161. data/lib/bundler/vendored_thor.rb +8 -0
  162. data/lib/bundler/version.rb +6 -0
  163. data/lib/bundler/vlad.rb +11 -0
  164. data/man/bundle-config.ronn +155 -0
  165. data/man/bundle-exec.ronn +136 -0
  166. data/man/bundle-install.ronn +372 -0
  167. data/man/bundle-package.ronn +59 -0
  168. data/man/bundle-platform.ronn +42 -0
  169. data/man/bundle-update.ronn +179 -0
  170. data/man/bundle.ronn +92 -0
  171. data/man/gemfile.5.ronn +369 -0
  172. data/man/index.txt +7 -0
  173. data/spec/bundler/bundler_spec.rb +74 -0
  174. data/spec/bundler/cli_spec.rb +16 -0
  175. data/spec/bundler/definition_spec.rb +21 -0
  176. data/spec/bundler/dsl_spec.rb +108 -0
  177. data/spec/bundler/friendly_errors_spec.rb +13 -0
  178. data/spec/bundler/gem_helper_spec.rb +225 -0
  179. data/spec/bundler/psyched_yaml_spec.rb +8 -0
  180. data/spec/bundler/retry_spec.rb +59 -0
  181. data/spec/bundler/settings_spec.rb +13 -0
  182. data/spec/bundler/source_spec.rb +25 -0
  183. data/spec/cache/gems_spec.rb +316 -0
  184. data/spec/cache/git_spec.rb +188 -0
  185. data/spec/cache/path_spec.rb +121 -0
  186. data/spec/cache/platform_spec.rb +53 -0
  187. data/spec/cache/svn_spec.rb +82 -0
  188. data/spec/commands/binstubs_spec.rb +246 -0
  189. data/spec/commands/check_spec.rb +278 -0
  190. data/spec/commands/clean_spec.rb +652 -0
  191. data/spec/commands/config_spec.rb +227 -0
  192. data/spec/commands/console_spec.rb +102 -0
  193. data/spec/commands/exec_spec.rb +367 -0
  194. data/spec/commands/help_spec.rb +39 -0
  195. data/spec/commands/init_spec.rb +39 -0
  196. data/spec/commands/inject_spec.rb +78 -0
  197. data/spec/commands/licenses_spec.rb +31 -0
  198. data/spec/commands/newgem_spec.rb +451 -0
  199. data/spec/commands/open_spec.rb +80 -0
  200. data/spec/commands/outdated_spec.rb +168 -0
  201. data/spec/commands/package_spec.rb +128 -0
  202. data/spec/commands/show_spec.rb +152 -0
  203. data/spec/install/binstubs_spec.rb +24 -0
  204. data/spec/install/bundler_spec.rb +146 -0
  205. data/spec/install/deploy_spec.rb +237 -0
  206. data/spec/install/gemfile/gemspec_spec.rb +170 -0
  207. data/spec/install/gemfile/git_spec.rb +967 -0
  208. data/spec/install/gemfile/path_spec.rb +480 -0
  209. data/spec/install/gemfile/svn_spec.rb +582 -0
  210. data/spec/install/gemfile_spec.rb +44 -0
  211. data/spec/install/gems/c_ext_spec.rb +48 -0
  212. data/spec/install/gems/dependency_api_spec.rb +580 -0
  213. data/spec/install/gems/env_spec.rb +107 -0
  214. data/spec/install/gems/flex_spec.rb +314 -0
  215. data/spec/install/gems/groups_spec.rb +308 -0
  216. data/spec/install/gems/mirror_spec.rb +39 -0
  217. data/spec/install/gems/platform_spec.rb +221 -0
  218. data/spec/install/gems/post_install_spec.rb +121 -0
  219. data/spec/install/gems/resolving_spec.rb +124 -0
  220. data/spec/install/gems/simple_case_spec.rb +386 -0
  221. data/spec/install/gems/standalone_spec.rb +260 -0
  222. data/spec/install/gems/sudo_spec.rb +136 -0
  223. data/spec/install/gems/win32_spec.rb +26 -0
  224. data/spec/install/gemspecs_spec.rb +50 -0
  225. data/spec/install/path_spec.rb +150 -0
  226. data/spec/install/post_bundle_message_spec.rb +142 -0
  227. data/spec/install/prereleases_spec.rb +43 -0
  228. data/spec/install/security_policy_spec.rb +77 -0
  229. data/spec/install/upgrade_spec.rb +26 -0
  230. data/spec/lock/git_spec.rb +34 -0
  231. data/spec/lock/lockfile_spec.rb +912 -0
  232. data/spec/lock/svn_spec.rb +35 -0
  233. data/spec/other/bundle_ruby_spec.rb +142 -0
  234. data/spec/other/cli_dispatch_spec.rb +21 -0
  235. data/spec/other/ext_spec.rb +60 -0
  236. data/spec/other/platform_spec.rb +1285 -0
  237. data/spec/other/ssl_cert_spec.rb +10 -0
  238. data/spec/quality_spec.rb +88 -0
  239. data/spec/realworld/dependency_api_spec.rb +60 -0
  240. data/spec/realworld/edgecases_spec.rb +177 -0
  241. data/spec/realworld/parallel_spec.rb +69 -0
  242. data/spec/resolver/basic_spec.rb +66 -0
  243. data/spec/resolver/platform_spec.rb +88 -0
  244. data/spec/runtime/executable_spec.rb +149 -0
  245. data/spec/runtime/load_spec.rb +107 -0
  246. data/spec/runtime/platform_spec.rb +90 -0
  247. data/spec/runtime/require_spec.rb +332 -0
  248. data/spec/runtime/setup_spec.rb +856 -0
  249. data/spec/runtime/with_clean_env_spec.rb +91 -0
  250. data/spec/spec_helper.rb +114 -0
  251. data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
  252. data/spec/support/artifice/endpoint.rb +71 -0
  253. data/spec/support/artifice/endpoint_500.rb +37 -0
  254. data/spec/support/artifice/endpoint_api_missing.rb +16 -0
  255. data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
  256. data/spec/support/artifice/endpoint_creds_diff_host.rb +38 -0
  257. data/spec/support/artifice/endpoint_extra.rb +31 -0
  258. data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
  259. data/spec/support/artifice/endpoint_fallback.rb +17 -0
  260. data/spec/support/artifice/endpoint_host_redirect.rb +15 -0
  261. data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
  262. data/spec/support/artifice/endpoint_redirect.rb +15 -0
  263. data/spec/support/artifice/endpoint_strict_basic_authentication.rb +18 -0
  264. data/spec/support/artifice/endpoint_timeout.rb +13 -0
  265. data/spec/support/builders.rb +748 -0
  266. data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
  267. data/spec/support/fakeweb/windows.rb +23 -0
  268. data/spec/support/hax.rb +22 -0
  269. data/spec/support/helpers.rb +348 -0
  270. data/spec/support/indexes.rb +280 -0
  271. data/spec/support/less_than_proc.rb +14 -0
  272. data/spec/support/matchers.rb +77 -0
  273. data/spec/support/path.rb +81 -0
  274. data/spec/support/permissions.rb +10 -0
  275. data/spec/support/platforms.rb +94 -0
  276. data/spec/support/ruby_ext.rb +20 -0
  277. data/spec/support/rubygems_ext.rb +39 -0
  278. data/spec/support/streams.rb +13 -0
  279. data/spec/support/sudo.rb +16 -0
  280. data/spec/update/gems_spec.rb +201 -0
  281. data/spec/update/git_spec.rb +236 -0
  282. data/spec/update/source_spec.rb +63 -0
  283. data/spec/update/svn_spec.rb +100 -0
  284. metadata +486 -0
@@ -0,0 +1,103 @@
1
+ ## Bundler 0.9 to 1.0 and above
2
+
3
+ Upgrading from Bundler 0.9 to 1.0 is relatively painless. The
4
+ Gemfile API is the same, so your old Gemfiles should continue
5
+ to work.
6
+
7
+ The "env" file that 0.9 created at `.bundle/environment.rb` has been
8
+ removed. As a side effect of this, Passenger will only find your
9
+ bundled gems if you install with `bundle install --deployment`.
10
+ Alternatively, you can tell Passenger where you gems are installed,
11
+ [something like this](http://andre.arko.net/2010/08/16/using-passengerpane-with-gem_home-set/).
12
+
13
+ The `bundle lock` command is no longer needed, as the
14
+ Gemfile.lock file is now automatically generated by `bundle install`.
15
+ If you have not yet done so, add your Gemfile.lock to source control
16
+ and check it in.
17
+
18
+ Running `bundle install` no longer updates the versions of your gems.
19
+ If you need to update just one gem, run `bundle update GEMNAME`. To
20
+ update all gems to the newest versions possible, run `bundle update`.
21
+
22
+ Bundler now supports multiple platforms, using a block syntax to
23
+ declare platform-specific gems:
24
+
25
+ platform :jruby do
26
+ gem "jruby-maven-plugins"
27
+ end
28
+
29
+ Deploying using Bundler is even easier than it was before, as Bundler
30
+ now includes a Capistrano recipe. Simply add this line to the top of
31
+ your deploy.rb file to run Bundler automatically as part of deploying:
32
+
33
+ require 'bundler/capistrano'
34
+
35
+ For more details on deploying using bundler, see the documentation
36
+ for the bundler cap task, and the [documentation on deploying](http://bundler.io/deploying.html).
37
+
38
+
39
+ ## Bundler 0.8 to 0.9 and above
40
+
41
+ Upgrading to Bundler 0.9 from Bundler 0.8 requires upgrading several
42
+ API calls in your Gemfile, and some workarounds if you are using Rails 2.3.
43
+
44
+ ### Gemfile Removals
45
+
46
+ Bundler 0.9 removes the following Bundler 0.8 Gemfile APIs:
47
+
48
+ 1. `disable_system_gems`: This is now the default (and only) option
49
+ for bundler. Bundler uses the system gems you have specified
50
+ in the Gemfile, and only the system gems you have specified
51
+ (and their dependencies)
52
+ 2. `disable_rubygems`: This is no longer supported. We are looking
53
+ into ways to get the fastest performance out of each supported
54
+ scenario, and we will make speed the default where possible.
55
+ 3. `clear_sources`: Bundler now defaults to an empty source
56
+ list. If you want to include Rubygems, you can add the source
57
+ via source "http://gemcutter.org". If you use bundle init, this
58
+ source will be automatically added for you in the generated
59
+ Gemfile
60
+ 4. `bundle_path`: You can specify this setting when installing
61
+ via `bundle install /path/to/bundle`. Bundler will remember
62
+ where you installed the dependencies to on a particular
63
+ machine for future installs, loads, setups, etc.
64
+ 5. `bin_path`: Bundler no longer generates executables in the root
65
+ of your app. You should use `bundle exec` to execute executables
66
+ in the current context.
67
+
68
+ ### Gemfile Changes
69
+
70
+ Bundler 0.9 changes the following Bundler 0.8 Gemfile APIs:
71
+
72
+ 1. Bundler 0.8 supported :only and :except as APIs for describing
73
+ groups of gems. Bundler 0.9 supports a single `group` method,
74
+ which you can use to group gems together. See the above "Group"
75
+ section for more information.
76
+
77
+ This means that `gem "foo", :only => :production` becomes
78
+ `gem "foo", :group => :production`, and
79
+ `only :production { gem "foo" }` becomes
80
+ `group :production { gem "foo" }`
81
+
82
+ The short version is: group your gems together logically, and
83
+ use the available commands to make use of the groups you've
84
+ created.
85
+
86
+ 2. `:require_as` becomes `:require`
87
+
88
+ 3. `:vendored_at` is fully removed; you should use `:path`
89
+
90
+ ### API Changes
91
+
92
+ 1. `Bundler.require_env(:environment)` becomes
93
+ `Bundler.require(:multiple, :groups)`. You must
94
+ now specify the default group (the default group is the
95
+ group made up of the gems not assigned to any group)
96
+ explicitly. So `Bundler.require_env(:test)` becomes
97
+ `Bundler.require(:default, :test)`
98
+
99
+ 2. `require 'vendor/gems/environment'`: In unlocked
100
+ mode, where using system gems, this becomes
101
+ `Bundler.setup(:multiple, :groups)`. If you don't
102
+ specify any groups, this puts all groups on the load
103
+ path. In locked mode, it becomes `require '.bundle/environment'`
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Exit cleanly from an early interrupt
4
+ Signal.trap("INT") { exit 1 }
5
+
6
+ require 'bundler'
7
+ # Check if an older version of bundler is installed
8
+ $LOAD_PATH.each do |path|
9
+ if path =~ %r'/bundler-0.(\d+)' && $1.to_i < 9
10
+ err = "Looks like you have a version of bundler that's older than 0.9.\n"
11
+ err << "Please remove your old versions.\n"
12
+ err << "An easy way to do this is by running `gem cleanup bundler`."
13
+ abort(err)
14
+ end
15
+ end
16
+
17
+ require 'bundler/friendly_errors'
18
+ Bundler.with_friendly_errors do
19
+ require 'bundler/cli'
20
+ Bundler::CLI.start(ARGV, :debug => true)
21
+ end
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ Signal.trap("INT") { exit 1 }
4
+
5
+ require 'bundler/ruby_version'
6
+ require 'bundler/ruby_dsl'
7
+ require 'bundler/shared_helpers'
8
+
9
+ module Bundler
10
+ class GemfileError < RuntimeError; end
11
+ class Dsl
12
+ include RubyDsl
13
+
14
+ attr_accessor :ruby_version
15
+
16
+ def initialize
17
+ @ruby_version = nil
18
+ end
19
+
20
+ def eval_gemfile(gemfile, contents = nil)
21
+ contents ||= File.open(gemfile, "rb") { |f| f.read }
22
+ instance_eval(contents, gemfile.to_s, 1)
23
+ rescue SyntaxError => e
24
+ bt = e.message.split("\n")[1..-1]
25
+ raise GemfileError, ["Gemfile syntax error:", *bt].join("\n")
26
+ rescue ScriptError, RegexpError, NameError, ArgumentError => e
27
+ e.backtrace[0] = "#{e.backtrace[0]}: #{e.message} (#{e.class})"
28
+ STDERR.puts e.backtrace.join("\n ")
29
+ raise GemfileError, "There was an error in your Gemfile," \
30
+ " and Bundler cannot continue."
31
+ end
32
+
33
+ def source(source, options = {})
34
+ end
35
+
36
+ def gem(name, *args)
37
+ end
38
+
39
+ def group(*args, &blk)
40
+ end
41
+ end
42
+ end
43
+
44
+ dsl = Bundler::Dsl.new
45
+ begin
46
+ dsl.eval_gemfile(Bundler::SharedHelpers.default_gemfile)
47
+ ruby_version = dsl.ruby_version
48
+ if ruby_version
49
+ puts ruby_version
50
+ else
51
+ puts "No ruby version specified"
52
+ end
53
+ rescue Bundler::GemfileError => e
54
+ puts e.message
55
+ exit(-1)
56
+ end
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Exit cleanly from an early interrupt
4
+ Signal.trap("INT") { exit 1 }
5
+
6
+ require 'bundler'
7
+ # Check if an older version of bundler is installed
8
+ $LOAD_PATH.each do |path|
9
+ if path =~ %r'/bundler-0.(\d+)' && $1.to_i < 9
10
+ err = "Looks like you have a version of bundler that's older than 0.9.\n"
11
+ err << "Please remove your old versions.\n"
12
+ err << "An easy way to do this is by running `gem cleanup bundler`."
13
+ abort(err)
14
+ end
15
+ end
16
+
17
+ require 'bundler/friendly_errors'
18
+ Bundler.with_friendly_errors do
19
+ require 'bundler/cli'
20
+ Bundler::CLI.start(ARGV, :debug => true)
21
+ end
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $:.unshift lib unless $:.include?(lib)
4
+ require 'bundler/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'bundler-prehistoric'
8
+ spec.version = Bundler::VERSION
9
+ spec.licenses = ['MIT']
10
+ spec.authors = ["André Arko", "Terence Lee", "Carl Lerche", "Yehuda Katz"]
11
+ spec.email = ["andre.arko+terence.lee@gmail.com"]
12
+ spec.homepage = "http://bundler.io"
13
+ spec.summary = %q{The best way to manage your application's dependencies}
14
+ spec.description = %q{Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably}
15
+
16
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.8.7')
17
+ spec.add_dependency 'rubysl-securerandom'
18
+ spec.add_dependency 'backports'
19
+ end
20
+
21
+ spec.add_development_dependency 'rdiscount', '~> 1.6'
22
+ spec.add_development_dependency 'ronn', '~> 0.7.3'
23
+ spec.add_development_dependency 'rspec', '~> 3.0.0.beta1'
24
+
25
+ spec.files = `git ls-files -z`.split("\x0")
26
+ # we don't check in man pages, but we need to ship them because
27
+ # we use them to generate the long-form help for each command.
28
+ spec.files += Dir.glob('lib/bundler/man/**/*')
29
+
30
+ spec.test_files = spec.files.grep(%r{^spec/})
31
+ spec.executables = %w(bundle bundler)
32
+ spec.require_paths = ["lib"]
33
+ end
@@ -0,0 +1,442 @@
1
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.8.7')
2
+ require 'backports'
3
+ require 'bundler/backports/time'
4
+ end
5
+
6
+ require 'fileutils'
7
+ require 'pathname'
8
+ require 'rbconfig'
9
+ require 'bundler/gem_path_manipulation'
10
+ require 'bundler/rubygems_ext'
11
+ require 'bundler/rubygems_integration'
12
+ require 'bundler/version'
13
+ require 'bundler/constants'
14
+ require 'bundler/current_ruby'
15
+
16
+ module Bundler
17
+ preserve_gem_path
18
+ ORIGINAL_ENV = ENV.to_hash
19
+
20
+ autoload :Definition, 'bundler/definition'
21
+ autoload :Dependency, 'bundler/dependency'
22
+ autoload :DepProxy, 'bundler/dep_proxy'
23
+ autoload :Deprecate, 'bundler/deprecate'
24
+ autoload :Dsl, 'bundler/dsl'
25
+ autoload :EndpointSpecification, 'bundler/endpoint_specification'
26
+ autoload :Environment, 'bundler/environment'
27
+ autoload :Env, 'bundler/env'
28
+ autoload :Fetcher, 'bundler/fetcher'
29
+ autoload :GemHelper, 'bundler/gem_helper'
30
+ autoload :GemHelpers, 'bundler/gem_helpers'
31
+ autoload :GemInstaller, 'bundler/gem_installer'
32
+ autoload :Graph, 'bundler/graph'
33
+ autoload :Index, 'bundler/index'
34
+ autoload :Installer, 'bundler/installer'
35
+ autoload :Injector, 'bundler/injector'
36
+ autoload :LazySpecification, 'bundler/lazy_specification'
37
+ autoload :LockfileParser, 'bundler/lockfile_parser'
38
+ autoload :MatchPlatform, 'bundler/match_platform'
39
+ autoload :RemoteSpecification, 'bundler/remote_specification'
40
+ autoload :Resolver, 'bundler/resolver'
41
+ autoload :Retry, 'bundler/retry'
42
+ autoload :RubyVersion, 'bundler/ruby_version'
43
+ autoload :RubyDsl, 'bundler/ruby_dsl'
44
+ autoload :Runtime, 'bundler/runtime'
45
+ autoload :Settings, 'bundler/settings'
46
+ autoload :SharedHelpers, 'bundler/shared_helpers'
47
+ autoload :SpecSet, 'bundler/spec_set'
48
+ autoload :Source, 'bundler/source'
49
+ autoload :Specification, 'bundler/shared_helpers'
50
+ autoload :SystemRubyVersion, 'bundler/ruby_version'
51
+ autoload :UI, 'bundler/ui'
52
+
53
+ class BundlerError < StandardError
54
+ def self.status_code(code)
55
+ define_method(:status_code) { code }
56
+ end
57
+ end
58
+
59
+ class GemfileNotFound < BundlerError; status_code(10) ; end
60
+ class GemNotFound < BundlerError; status_code(7) ; end
61
+ class GemfileError < BundlerError; status_code(4) ; end
62
+ class InstallError < BundlerError; status_code(5) ; end
63
+ class InstallHookError < BundlerError; status_code(8) ; end
64
+ class PathError < BundlerError; status_code(13) ; end
65
+ class GitError < BundlerError; status_code(11) ; end
66
+ class SVNError < BundlerError; status_code(23) ; end
67
+ class DeprecatedError < BundlerError; status_code(12) ; end
68
+ class GemspecError < BundlerError; status_code(14) ; end
69
+ class InvalidOption < BundlerError; status_code(15) ; end
70
+ class ProductionError < BundlerError; status_code(16) ; end
71
+ class HTTPError < BundlerError; status_code(17) ; end
72
+ class RubyVersionMismatch < BundlerError; status_code(18) ; end
73
+ class SecurityError < BundlerError; status_code(19) ; end
74
+ class LockfileError < BundlerError; status_code(20) ; end
75
+ class CyclicDependencyError < BundlerError; status_code(21) ; end
76
+ class GemfileLockNotFound < BundlerError; status_code(22) ; end
77
+
78
+ # Internal errors, should be rescued
79
+ class VersionConflict < BundlerError
80
+ attr_reader :conflicts
81
+
82
+ def initialize(conflicts, msg = nil)
83
+ super(msg)
84
+ @conflicts = conflicts
85
+ end
86
+
87
+ status_code(6)
88
+ end
89
+
90
+ class MarshalError < StandardError; end
91
+
92
+ class << self
93
+ attr_writer :ui, :bundle_path
94
+
95
+ def configure
96
+ @configured ||= configure_gem_home_and_path
97
+ end
98
+
99
+ def ui
100
+ @ui ||= UI::Silent.new
101
+ end
102
+
103
+ # Returns absolute path of where gems are installed on the filesystem.
104
+ def bundle_path
105
+ @bundle_path ||= Pathname.new(settings.path).expand_path(root)
106
+ end
107
+
108
+ # Returns absolute location of where binstubs are installed to.
109
+ def bin_path
110
+ @bin_path ||= begin
111
+ path = settings[:bin] || "bin"
112
+ path = Pathname.new(path).expand_path(root).expand_path
113
+ FileUtils.mkdir_p(path)
114
+ path
115
+ end
116
+ end
117
+
118
+ def setup(*groups)
119
+ # Just return if all groups are already loaded
120
+ return @setup if defined?(@setup)
121
+
122
+ definition.validate_ruby!
123
+
124
+ if groups.empty?
125
+ # Load all groups, but only once
126
+ @setup = load.setup
127
+ else
128
+ @completed_groups ||= []
129
+ # Figure out which groups haven't been loaded yet
130
+ unloaded = groups - @completed_groups
131
+ # Record groups that are now loaded
132
+ @completed_groups = groups
133
+ unloaded.any? ? load.setup(*groups) : load
134
+ end
135
+ end
136
+
137
+ def require(*groups)
138
+ setup(*groups).require(*groups)
139
+ end
140
+
141
+ def load
142
+ @load ||= Runtime.new(root, definition)
143
+ end
144
+
145
+ def environment
146
+ Bundler::Environment.new(root, definition)
147
+ end
148
+
149
+ # Returns an instance of Bundler::Definition for given Gemfile and lockfile
150
+ #
151
+ # @param unlock [Hash, Boolean, nil] Gems that have been requested
152
+ # to be updated or true if all gems should be updated
153
+ # @return [Bundler::Definition]
154
+ def definition(unlock = nil)
155
+ @definition = nil if unlock
156
+ @definition ||= begin
157
+ configure
158
+ upgrade_lockfile
159
+ Definition.build(default_gemfile, default_lockfile, unlock)
160
+ end
161
+ end
162
+
163
+ def locked_gems
164
+ return @locked_gems if defined?(@locked_gems)
165
+ if Bundler.default_lockfile.exist?
166
+ lock = Bundler.read_file(Bundler.default_lockfile)
167
+ @locked_gems = LockfileParser.new(lock)
168
+ else
169
+ @locked_gems = nil
170
+ end
171
+ end
172
+
173
+ def ruby_scope
174
+ "#{Bundler.rubygems.ruby_engine}/#{Bundler.rubygems.config_map[:ruby_version]}"
175
+ end
176
+
177
+ def user_bundle_path
178
+ Pathname.new(Bundler.rubygems.user_home).join(".bundler")
179
+ end
180
+
181
+ def home
182
+ bundle_path.join("bundler")
183
+ end
184
+
185
+ def install_path
186
+ home.join("gems")
187
+ end
188
+
189
+ def specs_path
190
+ bundle_path.join("specifications")
191
+ end
192
+
193
+ def cache
194
+ bundle_path.join("cache/bundler")
195
+ end
196
+
197
+ def root
198
+ default_gemfile.dirname.expand_path
199
+ end
200
+
201
+ def app_config_path
202
+ ENV['BUNDLE_APP_CONFIG'] ?
203
+ Pathname.new(ENV['BUNDLE_APP_CONFIG']).expand_path(root) :
204
+ root.join('.bundle')
205
+ end
206
+
207
+ def app_cache(custom_path = nil)
208
+ path = custom_path || root
209
+ path.join("vendor/cache")
210
+ end
211
+
212
+ def tmp(name = Process.pid.to_s)
213
+ @tmp ||= Pathname.new Dir.mktmpdir("bundler")
214
+ @tmp.join(name)
215
+ end
216
+
217
+ def settings
218
+ @settings ||= begin
219
+ Settings.new(app_config_path)
220
+ rescue GemfileNotFound
221
+ Settings.new
222
+ end
223
+ end
224
+
225
+ def with_original_env
226
+ bundled_env = ENV.to_hash
227
+ ENV.replace(ORIGINAL_ENV)
228
+ yield
229
+ ensure
230
+ ENV.replace(bundled_env.to_hash)
231
+ end
232
+
233
+ def with_clean_env
234
+ with_original_env do
235
+ ENV['MANPATH'] = ENV['BUNDLE_ORIG_MANPATH']
236
+ ENV.delete_if { |k,_| k[0,7] == 'BUNDLE_' }
237
+ if ENV.has_key? 'RUBYOPT'
238
+ ENV['RUBYOPT'] = ENV['RUBYOPT'].sub '-rbundler/setup', ''
239
+ ENV['RUBYOPT'] = ENV['RUBYOPT'].sub "-I#{File.expand_path('..', __FILE__)}", ''
240
+ end
241
+ yield
242
+ end
243
+ end
244
+
245
+ def clean_system(*args)
246
+ with_clean_env { Kernel.system(*args) }
247
+ end
248
+
249
+ def clean_exec(*args)
250
+ with_clean_env { Kernel.exec(*args) }
251
+ end
252
+
253
+ def default_gemfile
254
+ SharedHelpers.default_gemfile
255
+ end
256
+
257
+ def default_lockfile
258
+ SharedHelpers.default_lockfile
259
+ end
260
+
261
+ def system_bindir
262
+ # Gem.bindir doesn't always return the location that Rubygems will install
263
+ # system binaries. If you put '-n foo' in your .gemrc, Rubygems will
264
+ # install binstubs there instead. Unfortunately, Rubygems doesn't expose
265
+ # that directory at all, so rather than parse .gemrc ourselves, we allow
266
+ # the directory to be set as well, via `bundle config bindir foo`.
267
+ Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir
268
+ end
269
+
270
+ def requires_sudo?
271
+ return @requires_sudo if defined?(@requires_sudo_ran)
272
+
273
+ if settings.allow_sudo?
274
+ sudo_present = which "sudo"
275
+ end
276
+
277
+ if sudo_present
278
+ # the bundle path and subdirectories need to be writable for Rubygems
279
+ # to be able to unpack and install gems without exploding
280
+ path = bundle_path
281
+ path = path.parent until path.exist?
282
+
283
+ # bins are written to a different location on OS X
284
+ bin_dir = Pathname.new(Bundler.system_bindir)
285
+ bin_dir = bin_dir.parent until bin_dir.exist?
286
+
287
+ # if any directory is not writable, we need sudo
288
+ files = [path, bin_dir] | Dir[path.join('build_info/*').to_s] | Dir[path.join('*').to_s]
289
+ sudo_needed = files.any?{|f| !File.writable?(f) }
290
+ end
291
+
292
+ @requires_sudo_ran = true
293
+ @requires_sudo = settings.allow_sudo? && sudo_present && sudo_needed
294
+ end
295
+
296
+ def mkdir_p(path)
297
+ if requires_sudo?
298
+ sudo "mkdir -p '#{path}'" unless File.exist?(path)
299
+ else
300
+ FileUtils.mkdir_p(path)
301
+ end
302
+ end
303
+
304
+ def which(executable)
305
+ if File.file?(executable) && File.executable?(executable)
306
+ executable
307
+ elsif ENV['PATH']
308
+ path = ENV['PATH'].split(File::PATH_SEPARATOR).find do |p|
309
+ File.executable?(File.join(p, executable))
310
+ end
311
+ path && File.expand_path(executable, path)
312
+ end
313
+ end
314
+
315
+ def sudo(str)
316
+ prompt = "\n\n" + <<-PROMPT.gsub(/^ {6}/, '').strip + " "
317
+ Your user account isn't allowed to install to the system Rubygems.
318
+ You can cancel this installation and run:
319
+
320
+ bundle install --path vendor/bundle
321
+
322
+ to install the gems into ./vendor/bundle/, or you can enter your password
323
+ and install the bundled gems to Rubygems using sudo.
324
+
325
+ Password:
326
+ PROMPT
327
+
328
+ `sudo -p "#{prompt}" #{str}`
329
+ end
330
+
331
+ def read_file(file)
332
+ File.open(file, "rb") { |f| f.read }
333
+ end
334
+
335
+ def load_marshal(data)
336
+ Marshal.load(data)
337
+ rescue => e
338
+ raise MarshalError, "#{e.class}: #{e.message}"
339
+ end
340
+
341
+ def load_gemspec(file)
342
+ @gemspec_cache ||= {}
343
+ key = File.expand_path(file)
344
+ spec = ( @gemspec_cache[key] ||= load_gemspec_uncached(file) )
345
+ # Protect against caching side-effected gemspecs by returning a
346
+ # new instance each time.
347
+ spec.dup if spec
348
+ end
349
+
350
+ def load_gemspec_uncached(file)
351
+ path = Pathname.new(file)
352
+ # Eval the gemspec from its parent directory, because some gemspecs
353
+ # depend on "./" relative paths.
354
+ SharedHelpers.chdir(path.dirname.to_s) do
355
+ contents = path.read
356
+ if contents[0..2] == "---" # YAML header
357
+ eval_yaml_gemspec(path, contents)
358
+ else
359
+ eval_gemspec(path, contents)
360
+ end
361
+ end
362
+ end
363
+
364
+ def clear_gemspec_cache
365
+ @gemspec_cache = {}
366
+ end
367
+
368
+ def git_present?
369
+ return @git_present if defined?(@git_present)
370
+ @git_present = Bundler.which("git") || Bundler.which("git.exe")
371
+ end
372
+
373
+ def svn_present?
374
+ return @svn_present if defined?(@svn_present)
375
+ @svn_present = Bundler.which("svn") || Bundler.which("svn.exe")
376
+ end
377
+
378
+ def ruby_version
379
+ @ruby_version ||= SystemRubyVersion.new
380
+ end
381
+
382
+ def reset!
383
+ @definition = nil
384
+ end
385
+
386
+ private
387
+
388
+ def eval_yaml_gemspec(path, contents)
389
+ # If the YAML is invalid, Syck raises an ArgumentError, and Psych
390
+ # raises a Psych::SyntaxError. See psyched_yaml.rb for more info.
391
+ Gem::Specification.from_yaml(contents)
392
+ rescue YamlSyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception
393
+ eval_gemspec(path, contents)
394
+ end
395
+
396
+ def eval_gemspec(path, contents)
397
+ eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s)
398
+ rescue ScriptError, StandardError => e
399
+ original_line = e.backtrace.find { |line| line.include?(path.to_s) }
400
+ msg = "There was a #{e.class} while loading #{path.basename}: \n#{e.message}"
401
+ msg << " from\n #{original_line}" if original_line
402
+ msg << "\n"
403
+
404
+ if e.is_a?(LoadError) && RUBY_VERSION >= "1.9"
405
+ msg << "\nDoes it try to require a relative path? That's been removed in Ruby 1.9."
406
+ end
407
+
408
+ raise GemspecError, msg
409
+ end
410
+
411
+ def configure_gem_home_and_path
412
+ blank_home = ENV['GEM_HOME'].nil? || ENV['GEM_HOME'].empty?
413
+ if settings[:disable_shared_gems]
414
+ ENV['GEM_PATH'] = ''
415
+ elsif blank_home || Bundler.rubygems.gem_dir != bundle_path.to_s
416
+ possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]
417
+ paths = possibles.flatten.compact.uniq.reject { |p| p.empty? }
418
+ ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
419
+ end
420
+
421
+ configure_gem_home
422
+ bundle_path
423
+ end
424
+
425
+ def configure_gem_home
426
+ # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
427
+ FileUtils.mkdir_p bundle_path.to_s rescue nil
428
+
429
+ ENV['GEM_HOME'] = File.expand_path(bundle_path, root)
430
+ Bundler.rubygems.clear_paths
431
+ end
432
+
433
+ def upgrade_lockfile
434
+ lockfile = default_lockfile
435
+ if lockfile.exist? && lockfile.read(3) == "---"
436
+ Bundler.ui.warn "Detected Gemfile.lock generated by 0.9, deleting..."
437
+ lockfile.rmtree
438
+ end
439
+ end
440
+
441
+ end
442
+ end