rubygems-update 0.9.4 → 0.9.5

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

Potentially problematic release.


This version of rubygems-update might be problematic. Click here for more details.

Files changed (225) hide show
  1. data/ChangeLog +587 -0
  2. data/README +0 -1
  3. data/Rakefile +39 -12
  4. data/TODO +0 -5
  5. data/bin/gem +7 -7
  6. data/bin/update_rubygems +1 -1
  7. data/examples/application/an-app.gemspec +1 -1
  8. data/gemspecs/cgikit-1.1.0.gemspec +1 -2
  9. data/gemspecs/jabber4r.gemspec +1 -1
  10. data/gemspecs/linguistics.gemspec +1 -1
  11. data/gemspecs/ook.gemspec +1 -1
  12. data/gemspecs/progressbar.gemspec +1 -1
  13. data/gemspecs/redcloth.gemspec +1 -1
  14. data/gemspecs/rublog.gemspec +1 -1
  15. data/gemspecs/ruby-doom.gemspec +1 -1
  16. data/gemspecs/rubyjdwp.gemspec +1 -1
  17. data/gemspecs/statistics.gemspec +1 -1
  18. data/lib/rubygems.rb +167 -105
  19. data/lib/rubygems/builder.rb +12 -10
  20. data/lib/rubygems/command.rb +177 -60
  21. data/lib/rubygems/command_manager.rb +30 -38
  22. data/lib/rubygems/commands/build_command.rb +42 -46
  23. data/lib/rubygems/commands/cert_command.rb +72 -69
  24. data/lib/rubygems/commands/check_command.rb +63 -63
  25. data/lib/rubygems/commands/cleanup_command.rb +25 -7
  26. data/lib/rubygems/commands/contents_command.rb +70 -62
  27. data/lib/rubygems/commands/dependency_command.rb +131 -86
  28. data/lib/rubygems/commands/environment_command.rb +67 -46
  29. data/lib/rubygems/commands/fetch_command.rb +62 -0
  30. data/lib/rubygems/commands/generate_index_command.rb +57 -0
  31. data/lib/rubygems/commands/help_command.rb +163 -73
  32. data/lib/rubygems/commands/install_command.rb +114 -128
  33. data/lib/rubygems/commands/list_command.rb +10 -8
  34. data/lib/rubygems/commands/lock_command.rb +101 -0
  35. data/lib/rubygems/commands/mirror_command.rb +105 -0
  36. data/lib/rubygems/commands/outdated_command.rb +24 -15
  37. data/lib/rubygems/commands/pristine_command.rb +118 -88
  38. data/lib/rubygems/commands/query_command.rb +109 -77
  39. data/lib/rubygems/commands/rdoc_command.rb +13 -10
  40. data/lib/rubygems/commands/search_command.rb +10 -8
  41. data/lib/rubygems/commands/server_command.rb +48 -0
  42. data/lib/rubygems/commands/sources_command.rb +104 -83
  43. data/lib/rubygems/commands/specification_command.rb +65 -51
  44. data/lib/rubygems/commands/uninstall_command.rb +17 -12
  45. data/lib/rubygems/commands/unpack_command.rb +68 -68
  46. data/lib/rubygems/commands/update_command.rb +72 -25
  47. data/lib/rubygems/commands/which_command.rb +86 -0
  48. data/lib/rubygems/config_file.rb +202 -78
  49. data/lib/rubygems/custom_require.rb +7 -88
  50. data/lib/rubygems/dependency.rb +65 -0
  51. data/lib/rubygems/dependency_installer.rb +232 -0
  52. data/lib/rubygems/dependency_list.rb +133 -105
  53. data/lib/rubygems/digest/md5.rb +4 -1
  54. data/lib/rubygems/digest/sha2.rb +1 -1
  55. data/lib/rubygems/doc_manager.rb +41 -19
  56. data/lib/rubygems/exceptions.rb +63 -0
  57. data/lib/rubygems/ext.rb +18 -0
  58. data/lib/rubygems/ext/builder.rb +56 -0
  59. data/lib/rubygems/ext/configure_builder.rb +24 -0
  60. data/lib/rubygems/ext/ext_conf_builder.rb +23 -0
  61. data/lib/rubygems/ext/rake_builder.rb +27 -0
  62. data/lib/rubygems/format.rb +16 -6
  63. data/lib/rubygems/gem_openssl.rb +43 -6
  64. data/lib/rubygems/gem_path_searcher.rb +84 -0
  65. data/lib/rubygems/gem_runner.rb +20 -5
  66. data/lib/rubygems/indexer.rb +163 -0
  67. data/lib/rubygems/indexer/abstract_index_builder.rb +80 -0
  68. data/lib/rubygems/indexer/marshal_index_builder.rb +17 -0
  69. data/lib/rubygems/indexer/master_index_builder.rb +53 -0
  70. data/lib/rubygems/indexer/quick_index_builder.rb +48 -0
  71. data/lib/rubygems/install_update_options.rb +87 -0
  72. data/lib/rubygems/installer.rb +316 -562
  73. data/lib/rubygems/local_remote_options.rb +106 -0
  74. data/lib/rubygems/old_format.rb +5 -13
  75. data/lib/rubygems/open-uri.rb +2 -0
  76. data/lib/rubygems/package.rb +28 -32
  77. data/lib/rubygems/platform.rb +187 -0
  78. data/lib/rubygems/remote_fetcher.rb +46 -29
  79. data/lib/rubygems/remote_installer.rb +11 -18
  80. data/lib/rubygems/requirement.rb +157 -0
  81. data/lib/rubygems/rubygems_version.rb +1 -1
  82. data/lib/rubygems/security.rb +715 -457
  83. data/lib/rubygems/server.rb +77 -59
  84. data/lib/rubygems/source_index.rb +154 -83
  85. data/lib/rubygems/source_info_cache.rb +73 -30
  86. data/lib/rubygems/source_info_cache_entry.rb +12 -3
  87. data/lib/rubygems/specification.rb +378 -145
  88. data/lib/rubygems/uninstaller.rb +183 -0
  89. data/lib/rubygems/user_interaction.rb +38 -9
  90. data/lib/rubygems/validator.rb +53 -24
  91. data/lib/rubygems/version.rb +126 -289
  92. data/lib/rubygems/version_option.rb +49 -0
  93. data/pkgs/sources/lib/sources.rb +1 -4
  94. data/pkgs/sources/sources.gemspec +3 -3
  95. data/scripts/gemdoc.rb +0 -1
  96. data/setup.rb +166 -1505
  97. data/test/bogussources.rb +0 -1
  98. data/test/data/gem-private_key.pem +27 -0
  99. data/test/data/gem-public_cert.pem +20 -0
  100. data/test/functional.rb +3 -105
  101. data/test/gemutilities.rb +145 -24
  102. data/test/insure_session.rb +0 -1
  103. data/test/{test_datadir.rb → test_config.rb} +7 -13
  104. data/test/test_gem.rb +360 -9
  105. data/test/test_gem_builder.rb +34 -0
  106. data/test/{test_command.rb → test_gem_command.rb} +119 -62
  107. data/test/{test_parse_commands.rb → test_gem_command_manager.rb} +64 -40
  108. data/test/test_gem_commands_build_command.rb +75 -0
  109. data/test/test_gem_commands_cert_command.rb +122 -0
  110. data/test/test_gem_commands_check_command.rb +25 -0
  111. data/test/test_gem_commands_contents_command.rb +92 -0
  112. data/test/test_gem_commands_dependency_command.rb +108 -0
  113. data/test/test_gem_commands_environment_command.rb +117 -0
  114. data/test/test_gem_commands_fetch_command.rb +34 -0
  115. data/test/test_gem_commands_generate_index_command.rb +32 -0
  116. data/test/test_gem_commands_install_command.rb +160 -0
  117. data/test/test_gem_commands_mirror_command.rb +56 -0
  118. data/test/test_gem_commands_pristine_command.rb +100 -0
  119. data/test/test_gem_commands_query_command.rb +82 -0
  120. data/test/test_gem_commands_sources_command.rb +147 -0
  121. data/test/test_gem_commands_specification_command.rb +93 -0
  122. data/test/test_gem_commands_unpack_command.rb +55 -0
  123. data/test/test_gem_config_file.rb +210 -0
  124. data/test/test_gem_dependency.rb +89 -0
  125. data/test/test_gem_dependency_installer.rb +542 -0
  126. data/test/test_gem_dependency_list.rb +212 -0
  127. data/test/test_gem_doc_manager.rb +32 -0
  128. data/test/test_gem_ext_configure_builder.rb +13 -17
  129. data/test/test_gem_ext_ext_conf_builder.rb +9 -9
  130. data/test/test_gem_ext_rake_builder.rb +23 -11
  131. data/test/test_gem_format.rb +69 -0
  132. data/test/test_gem_gem_path_searcher.rb +57 -0
  133. data/test/test_gem_gem_runner.rb +35 -0
  134. data/test/test_gem_indexer.rb +119 -0
  135. data/test/test_gem_install_update_options.rb +40 -0
  136. data/test/test_gem_installer.rb +796 -0
  137. data/test/test_gem_local_remote_options.rb +84 -0
  138. data/test/test_gem_outdated_command.rb +11 -9
  139. data/test/test_gem_platform.rb +240 -0
  140. data/test/{test_remote_fetcher.rb → test_gem_remote_fetcher.rb} +124 -55
  141. data/test/{test_remote_installer.rb → test_gem_remote_installer.rb} +3 -4
  142. data/test/test_gem_requirement.rb +223 -0
  143. data/test/test_gem_server.rb +71 -0
  144. data/test/test_gem_source_index.rb +429 -0
  145. data/test/test_gem_source_info_cache.rb +79 -17
  146. data/test/test_gem_source_info_cache_entry.rb +11 -9
  147. data/test/test_gem_specification.rb +738 -0
  148. data/test/test_gem_stream_ui.rb +117 -0
  149. data/test/test_gem_validator.rb +70 -0
  150. data/test/test_gem_version.rb +191 -0
  151. data/test/test_gem_version_option.rb +77 -0
  152. data/test/{test_require_gem.rb → test_kernel.rb} +19 -12
  153. data/test/test_open_uri.rb +1 -2
  154. data/test/test_package.rb +45 -34
  155. metadata +116 -141
  156. data/Releases +0 -127
  157. data/bin/gem_mirror +0 -73
  158. data/bin/gem_server +0 -6
  159. data/bin/gemlock +0 -127
  160. data/bin/gemri +0 -24
  161. data/bin/gemwhich +0 -89
  162. data/bin/index_gem_repository.rb +0 -302
  163. data/lib/gemconfigure.rb +0 -24
  164. data/lib/rubygems/gem_commands.rb +0 -273
  165. data/pkgs/sources/sources-0.0.1.gem +0 -0
  166. data/post-install.rb +0 -121
  167. data/test/brokenbuildgem.rb +0 -35
  168. data/test/data/PostMessage-0.0.1.gem +0 -0
  169. data/test/data/a-0.0.1.gem +0 -0
  170. data/test/data/a-0.0.2.gem +0 -0
  171. data/test/data/b-0.0.2.gem +0 -0
  172. data/test/data/broken-1.0.0.gem +0 -0
  173. data/test/data/broken_build/broken-build.gemspec +0 -20
  174. data/test/data/broken_build/ext/extconf.rb +0 -3
  175. data/test/data/broken_build/ext/foo.c +0 -1
  176. data/test/data/c-1.2.gem +0 -0
  177. data/test/data/gemhome/cache/a-0.0.1.gem +0 -0
  178. data/test/data/gemhome/cache/a-0.0.2.gem +0 -0
  179. data/test/data/gemhome/cache/b-0.0.2.gem +0 -0
  180. data/test/data/gemhome/cache/c-1.2.gem +0 -0
  181. data/test/data/gemhome/gems/a-0.0.1/lib/code.rb +0 -1
  182. data/test/data/gemhome/gems/a-0.0.2/lib/code.rb +0 -1
  183. data/test/data/gemhome/gems/b-0.0.2/lib/code.rb +0 -1
  184. data/test/data/gemhome/gems/c-1.2/lib/code.rb +0 -1
  185. data/test/data/gemhome/specifications/a-0.0.1.gemspec +0 -8
  186. data/test/data/gemhome/specifications/a-0.0.2.gemspec +0 -8
  187. data/test/data/gemhome/specifications/b-0.0.2.gemspec +0 -8
  188. data/test/data/gemhome/specifications/c-1.2.gemspec +0 -8
  189. data/test/data/legacy/keyedlist-0.4.0.ruby +0 -11
  190. data/test/data/legacy/keyedlist-0.4.0.yaml +0 -16
  191. data/test/data/lib/code.rb +0 -1
  192. data/test/data/one/README.one +0 -1
  193. data/test/data/one/lib/one.rb +0 -9
  194. data/test/data/one/one-0.0.1.gem +0 -0
  195. data/test/data/one/one.gemspec +0 -17
  196. data/test/data/one/one.yaml +0 -40
  197. data/test/data/post_install.gemspec +0 -19
  198. data/test/functional_extension_gems.rb +0 -48
  199. data/test/functional_generate_yaml_index.rb +0 -104
  200. data/test/gemenvironment.rb +0 -59
  201. data/test/io_capture.rb +0 -33
  202. data/test/mock/gems/gems/sources-0.0.1/lib/sources.rb +0 -11
  203. data/test/mock/gems/specifications/sources-0.0.1.gemspec +0 -8
  204. data/test/onegem.rb +0 -35
  205. data/test/test_builder.rb +0 -34
  206. data/test/test_check_command.rb +0 -34
  207. data/test/test_configfile.rb +0 -42
  208. data/test/test_dependency_list.rb +0 -169
  209. data/test/test_file_list.rb +0 -101
  210. data/test/test_format.rb +0 -49
  211. data/test/test_gem_sources_command.rb +0 -135
  212. data/test/test_gemloadpaths.rb +0 -51
  213. data/test/test_gempaths.rb +0 -170
  214. data/test/test_installer.rb +0 -369
  215. data/test/test_loadmanager.rb +0 -48
  216. data/test/test_process_commands.rb +0 -52
  217. data/test/test_source_index.rb +0 -231
  218. data/test/test_specific_extras.rb +0 -46
  219. data/test/test_specification.rb +0 -565
  220. data/test/test_user_interaction.rb +0 -48
  221. data/test/test_validator.rb +0 -59
  222. data/test/test_version_comparison.rb +0 -321
  223. data/test/testgem.rc +0 -7
  224. data/test/user_capture.rb +0 -7
  225. data/test/yaml_data.rb +0 -63
data/Releases DELETED
@@ -1,127 +0,0 @@
1
- = RubyGems Release History
2
-
3
- == Release 0.8.3: Dec 7, 2004
4
-
5
- * Added workaround for the null byte in Dir string issue. (see
6
- http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/121702).
7
- (Thanks to Mauricio Fern�ndez for the quick response on this one).
8
-
9
- * Added workaround for old version of Zlib on windows that caused
10
- Ruwiki to fail to install. (see
11
- http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/121770)
12
-
13
- * Added workaround for large YAML file issues. (We dynamically cut
14
- down the size of the source index YAML file and seem to have worked
15
- around immediate issues.
16
-
17
- * A user specific source index cache can be used when the site-wide
18
- cache is unwritable (i.e. because you are running as a non-admin).
19
- This *greatly* speeds up gem commands run in non-admin mode when the
20
- site-wide cache is out of date.
21
-
22
- * The gem command now used an HTTP HEAD command to detect if the
23
- server's source index needs to be downloaed.
24
-
25
- * gem check gemname --test will run unit tests on installed gems that
26
- have unit tests.
27
-
28
- == Release 0.8.1: Sep 14, 2004
29
-
30
- * Quick release to capture some bug fixes.
31
-
32
- == Release 0.8.0: Sep 12, 2004
33
-
34
- * Remove need for library stubs. Set the RUBYOPT environment variable
35
- to include "rrubygems", and a normal require will find gem files.
36
- Continue to use 'require_gem gem_name, version' to specify gem
37
- versions.
38
- * Deprecated "test_suite_file" gemspec attribute in favor of "test_files" array.
39
- * Generates rdoc by default on installs.
40
- * Adopted tar/gzip file format, thanks to Mauricio Fernandez.
41
- * "gem rdoc" allows generation of rdoc after gem installation (will add a "gem test"
42
- * Application stubs can now accept an optional parameter of _VERSION_ that will run
43
- an arbitrary version of the application requested.
44
- * Various bug fixes
45
- * Various platform-independency improvements
46
- * "gem spec --all" displays spec info for all installed version of a given gem.
47
- * Dynamic caching of sources
48
- * Support for user-definable sources on the command line (thanks Assaph Mehr)
49
- * More intelligent support for platform-dependent gems. Use Platform::CURRENT when
50
- building a gem to set its platform to the one you're building on. Installation
51
- displays a choice of platform-dependent gems, allowing the user to pick.
52
- * Added "gem unpack" for "unpacking" a gem to the current directory
53
-
54
- == Release 0.7.0: Jul 9, 2004
55
-
56
- * See ChangeLog.
57
-
58
- == Release 0.6.0: Jun 8, 2004
59
- * Collapse output of --search and --list (and gem_server) operations so
60
- that each gem is listed only once, with each of its versions listed
61
- on the same line.
62
-
63
- * bin/gem: new --upgrade-all option allows one to upgrade every
64
- installed gem
65
-
66
- * new #required_ruby_version attribute added to gem specification for
67
- specifying a dependency on which version of ruby the gem needs.
68
- Format it accepts is the same as the Gem::Version::Requirement
69
- format:
70
- spec.required_ruby_version = "> 1.8.0"
71
-
72
- * --install-stub defaults to true, so library stubs are created
73
-
74
- == Release 0.5.0: Jun 6, 2004
75
-
76
- * Jim added the ability to specify version constraints to avoid API
77
- incompatibilities. This has been the subject of much debate for
78
- the past couple of months, with many ideas and code contributed by
79
- Eivind Eklund and Mauricio Fernandez. The following set of
80
- assertions shows how it works:
81
-
82
- assert_inadequate("1.3", "~> 1.4")
83
- assert_adequate( "1.4", "~> 1.4")
84
- assert_adequate( "1.5", "~> 1.4")
85
- assert_inadequate("2.0", "~> 1.4") # This one is key--the new operator disallows major version number differences.
86
-
87
- * Group gem search output when multiple versions exist for a given gem:
88
-
89
- activerecord (0.7.8, 0.7.7, 0.7.6, 0.7.5)
90
- Implements the ActiveRecord pattern for ORM.
91
-
92
- * Add arbitrary RDoc-able files via gemspec (not just Ruby source
93
- files) for people who have, for example, README.rdoc in their
94
- distributions. Add to gemspec via: spec.extra_rdoc_files = ["list",
95
- "of", "files"]. Ruby files are automatically included.
96
-
97
- * Some small bug fixes
98
-
99
-
100
- == Release 0.4.0: May 31, 2004
101
-
102
- * Minor bug fixes including Windows compatability issues
103
-
104
- == Release 0.3.0: April 30, 2004
105
-
106
- * Cleanup of command-line arguments and handling. Most commands
107
- accept a --local or --remote modifier.
108
- * Creation of Application Gems (packages that include executable
109
- programs). See
110
- http://rubygems.rubyforge.org/wiki/wiki.pl?DeveloperGuide for
111
- information on how to use it.
112
- * Basic functionality for installing binary gems from source
113
- (:extensions property of gem specification holds an array of paths
114
- to extconf.rb files to be used for compilation)
115
- * Install library "stub" allowing a normal 'require' to work (which then does the rubygems require and 'require_gem'
116
- * --run-tests runs the test suite specified by the "test_suite_file"
117
- property of a gem specification
118
- * HTTP Proxy support works. Rewrite of HTTP code.
119
- * Unit and functional tests added (see Rakefile).
120
- * Prompt before remote-installing dependencies during gem installation.
121
- * Config file for storing preferences for 'gem' command usage.
122
- * Generally improved error messages (still more work to do)
123
- * Rearranged gem directory structure for cleanliness.
124
-
125
- == Release 0.2.0: March 14, 2004
126
-
127
- * Initial public release
@@ -1,73 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #--
3
- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
4
- # All rights reserved.
5
- # See LICENSE.txt for permissions.
6
- #++
7
-
8
-
9
- # sample ~/.gemmirrorc:
10
- #---
11
- #-
12
- # from: http://gems.rubyforge.org/
13
- # to: /Users/glasser/MyGEMS/gems.rubyforge.org
14
-
15
- require 'yaml'
16
- require 'rubygems'
17
- require 'open-uri'
18
-
19
- config_file = File.join(Gem.user_home, '.gemmirrorrc')
20
-
21
- raise "Config file #{config_file} not found" unless File.exist?(config_file)
22
-
23
- mirrors = YAML.load_file(config_file)
24
-
25
- mirrors.each do |mir|
26
- raise "mirror missing 'from' field" unless mir.has_key?('from')
27
- raise "mirror missing 'to' field" unless mir.has_key?('to')
28
-
29
- get_from = mir['from']
30
- save_to = mir['to']
31
-
32
- raise "Directory not found: #{save_to}" unless File.exist?(save_to)
33
- raise "Not a directory: #{save_to}" unless File.directory?(save_to)
34
-
35
- gems_dir = save_to + "/gems"
36
- if File.exist?(gems_dir)
37
- raise "Not a directory: #{gems_dir}" unless File.directory?(gems_dir)
38
- else
39
- Dir.mkdir(gems_dir)
40
- end
41
-
42
- sourceindex_text = ''
43
-
44
- open(get_from + "/yaml", "r") do |y|
45
- sourceindex_text = y.read
46
- open(save_to + "/yaml", "wb") do |out|
47
- out.write(sourceindex_text)
48
- end
49
- end
50
-
51
- sourceindex = YAML.load(sourceindex_text)
52
-
53
- sourceindex.each do |fullname, gem|
54
- gem_file = fullname + '.gem'
55
- unless File.exists?(gems_dir + "/" + gem_file)
56
- puts "fetching: " + gem_file
57
-
58
- begin
59
- open(get_from + "/gems/" + gem_file, "r") do |g|
60
- contents = g.read
61
- open(gems_dir + "/" + gem_file, "wb") do |out|
62
- out.write(contents)
63
- end
64
- end
65
- rescue
66
- old_gf = gem_file
67
- gem_file = gem_file.downcase
68
- retry if old_gf != gem_file
69
- puts $!
70
- end
71
- end
72
- end
73
- end
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems/server'
4
-
5
- Gem::Server.run ARGV
6
-
@@ -1,127 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # -*- ruby -*-
3
- #--
4
- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
5
- # All rights reserved.
6
- # See LICENSE.txt for permissions.
7
- #++
8
-
9
-
10
- # gemlock -- Generate a lockdown list of a set of gems
11
- #
12
- # Usage: gemlock gem_name-version...
13
- #
14
- # gemlock will generate a list of +gem+ statements that will
15
- # lock down the versions for the gem given in the command line. It
16
- # will specify exact versions in the requirements list to ensure that
17
- # the gems loaded will always be consistent. A full recursive search
18
- # of all effected gems will be generated.
19
- #
20
- # Example:
21
- #
22
- # gemlock rails-1.0.0 >lockdown.rb
23
- #
24
- # will produce in lockdown.rb:
25
- #
26
- # require "rubygems"
27
- # gem 'rails', '= 1.0.0'
28
- # gem 'rake', '= 0.7.0.1'
29
- # gem 'activesupport', '= 1.2.5'
30
- # gem 'activerecord', '= 1.13.2'
31
- # gem 'actionpack', '= 1.11.2'
32
- # gem 'actionmailer', '= 1.1.5'
33
- # gem 'actionwebservice', '= 1.0.0'
34
- #
35
- # Just load lockdown.rb from your application to ensure that the
36
- # current versions are loaded. Make sure that lockdown.rb is loaded
37
- # *before* any other require statements.
38
- #
39
- # Notice that rails 1.0.0 only requires that rake 0.6.2 or better be
40
- # used. Rake-0.7.0.1 is the most recent version installed that
41
- # satisfies that, so we lock it down to the exact version.
42
-
43
- require 'rubygems'
44
- require 'ostruct'
45
- require 'optparse'
46
- require 'yaml'
47
-
48
- Gem.manage_gems
49
-
50
- def handle_options(args)
51
- options = OpenStruct.new
52
- options.verbose = false
53
- options.strict = false
54
- opts = OptionParser.new do |opts|
55
- opts.banner = "Usage: #$0 [options] GEM_NAME-VERSION..."
56
- opts.separator ""
57
- opts.separator "Where options are:"
58
-
59
- opts.on('--verbose', '-v', 'Verbose output') do |value|
60
- options.verbose = value
61
- end
62
-
63
- opts.on('--[no-]strict', '-s',
64
- 'Fail if unable to satisfy a dependency') do |value|
65
- options.strict = value
66
- end
67
-
68
- opts.on_tail('--help', '-h', 'Show this message') do
69
- puts opts
70
- exit
71
- end
72
-
73
- opts.on_tail('--version', '-V', 'Show version') do
74
- puts "gemlock (#{Gem::RubyGemsVersion})"
75
- exit
76
- end
77
- end
78
- options.usage = opts
79
-
80
- opts.parse!(args)
81
- options
82
- end
83
-
84
- def spec_path(gem_full_name)
85
- File.join(Gem.path, "specifications", gem_full_name + ".gemspec")
86
- end
87
-
88
- def complain(message, options)
89
- if options.strict
90
- fail message
91
- else
92
- puts "# #{message}"
93
- end
94
- end
95
-
96
- def lock_down(pending, options)
97
- puts 'require "rubygems"'
98
- locked = {}
99
- while ! pending.empty?
100
- full_name = pending.shift
101
- spec = Gem::SourceIndex.load_specification(spec_path(full_name))
102
- puts "gem '#{spec.name}', '= #{spec.version}'" unless locked[spec.name]
103
- locked[spec.name] = true
104
- spec.dependencies.each do |dep|
105
- next if locked[dep.name]
106
- candidates = Gem.source_index.search(dep.name, dep.requirement_list)
107
- if candidates.empty?
108
- complain(
109
- "Unable to satisfy '#{dep}' from currently installed gems.",
110
- options)
111
- else
112
- pending << candidates.last.full_name
113
- end
114
- end
115
- end
116
- end
117
-
118
- if __FILE__ == $0 then
119
- options = handle_options(ARGV)
120
- if ARGV.empty?
121
- puts options.usage
122
- exit(1)
123
- else
124
- lock_down(ARGV, options)
125
- end
126
- end
127
-
data/bin/gemri DELETED
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # -*- ruby -*-
3
- #--
4
- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
5
- # All rights reserved.
6
- # See LICENSE.txt for permissions.
7
- #++
8
-
9
- # Gem version of the 'ri' command. Adds the gem-generated ri
10
- # documents to the search path of ri.
11
-
12
- require 'rdoc/ri/ri_driver'
13
-
14
- begin
15
- require 'rubygems'
16
- Dir["#{Gem.path}/doc/*/ri"].each do |path|
17
- RI::Paths::PATH << path
18
- end
19
- rescue LoadError
20
- end
21
-
22
- ARGV.unshift('-T') if ENV['TERM'] =~ /dumb|emacs/
23
- ri = RiDriver.new
24
- ri.process_args
@@ -1,89 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #--
3
- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
4
- # All rights reserved.
5
- # See LICENSE.txt for permissions.
6
- #++
7
-
8
-
9
- require 'rubygems'
10
- require 'optparse'
11
-
12
- EXT = %w( .rb .rbw .so .dll )
13
-
14
- $search_gems_first = false
15
- $show_all = false
16
-
17
- options = OptionParser.new
18
- options.banner = "gemwhich -- Find the location of a library module."
19
- options.separator("")
20
- options.separator("Usage: gemwhich [options] libname...")
21
- options.on('-a', '--all',
22
- "Show all matching files"
23
- ) do |value|
24
- $show_all = true
25
- end
26
- options.on('-g', '--gems-first',
27
- "Search GEM libraries before non-GEMs"
28
- ) do |value|
29
- $search_gems_first = true
30
- end
31
- options.on_tail('-v', '--verbose',
32
- "Enable verbose output"
33
- ) do |value|
34
- $verbose = value
35
- end
36
- options.on_tail('-h', '--help',
37
- "Display this help message"
38
- ) do |value|
39
- puts options
40
- exit
41
- end
42
- ARGV << '-h' if ARGV.empty?
43
-
44
- begin
45
- options.parse!(ARGV)
46
- rescue OptionParser::InvalidOption => ex
47
- puts "Error: #{ex.message}"
48
- exit
49
- end
50
-
51
- def find_paths(package_name, dirs)
52
- result = []
53
- dirs.each do |dir|
54
- EXT.each do |ext|
55
- full_path = File.join(dir, "#{package_name}#{ext}")
56
- if File.exist?(full_path)
57
- result << full_path
58
- return result unless $show_all
59
- end
60
- end
61
- end
62
- result
63
- end
64
-
65
- def gem_paths(spec)
66
- spec.require_paths.collect { |d|
67
- File.join(spec.full_gem_path,d)
68
- }
69
- end
70
-
71
- searcher = Gem::GemPathSearcher.new
72
- ARGV.each do |arg|
73
- dirs = $LOAD_PATH
74
- spec = searcher.find(arg)
75
- if spec
76
- if $search_gems_first
77
- dirs = gem_paths(spec) + $LOAD_PATH
78
- else
79
- dirs = $LOAD_PATH + gem_paths(spec)
80
- end
81
- puts "(checking gem #{spec.full_name} for #{arg})" if $verbose
82
- end
83
- paths = find_paths(arg, dirs)
84
- if paths.empty?
85
- puts "Can't find #{arg}"
86
- else
87
- puts paths
88
- end
89
- end