slimgems 1.3.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. data/ChangeLog +5811 -0
  2. data/History.txt +887 -0
  3. data/LICENSE.txt +51 -0
  4. data/README.md +87 -0
  5. data/Rakefile +120 -0
  6. data/bin/gem +25 -0
  7. data/bin/update_slimgems +35 -0
  8. data/bootstrap/Rakefile +4 -0
  9. data/hide_lib_for_update/note.txt +5 -0
  10. data/lib/gauntlet_rubygems.rb +50 -0
  11. data/lib/rbconfig/datadir.rb +20 -0
  12. data/lib/rubygems.rb +1220 -0
  13. data/lib/rubygems/builder.rb +102 -0
  14. data/lib/rubygems/command.rb +534 -0
  15. data/lib/rubygems/command_manager.rb +182 -0
  16. data/lib/rubygems/commands/build_command.rb +53 -0
  17. data/lib/rubygems/commands/cert_command.rb +86 -0
  18. data/lib/rubygems/commands/check_command.rb +80 -0
  19. data/lib/rubygems/commands/cleanup_command.rb +106 -0
  20. data/lib/rubygems/commands/contents_command.rb +98 -0
  21. data/lib/rubygems/commands/dependency_command.rb +195 -0
  22. data/lib/rubygems/commands/environment_command.rb +132 -0
  23. data/lib/rubygems/commands/fetch_command.rb +67 -0
  24. data/lib/rubygems/commands/generate_index_command.rb +133 -0
  25. data/lib/rubygems/commands/help_command.rb +172 -0
  26. data/lib/rubygems/commands/install_command.rb +178 -0
  27. data/lib/rubygems/commands/list_command.rb +35 -0
  28. data/lib/rubygems/commands/lock_command.rb +110 -0
  29. data/lib/rubygems/commands/mirror_command.rb +111 -0
  30. data/lib/rubygems/commands/outdated_command.rb +33 -0
  31. data/lib/rubygems/commands/owner_command.rb +75 -0
  32. data/lib/rubygems/commands/pristine_command.rb +93 -0
  33. data/lib/rubygems/commands/push_command.rb +56 -0
  34. data/lib/rubygems/commands/query_command.rb +280 -0
  35. data/lib/rubygems/commands/rdoc_command.rb +91 -0
  36. data/lib/rubygems/commands/search_command.rb +31 -0
  37. data/lib/rubygems/commands/server_command.rb +86 -0
  38. data/lib/rubygems/commands/setup_command.rb +387 -0
  39. data/lib/rubygems/commands/sources_command.rb +157 -0
  40. data/lib/rubygems/commands/specification_command.rb +125 -0
  41. data/lib/rubygems/commands/stale_command.rb +27 -0
  42. data/lib/rubygems/commands/uninstall_command.rb +83 -0
  43. data/lib/rubygems/commands/unpack_command.rb +121 -0
  44. data/lib/rubygems/commands/update_command.rb +212 -0
  45. data/lib/rubygems/commands/which_command.rb +86 -0
  46. data/lib/rubygems/config_file.rb +345 -0
  47. data/lib/rubygems/custom_require.rb +44 -0
  48. data/lib/rubygems/defaults.rb +101 -0
  49. data/lib/rubygems/dependency.rb +227 -0
  50. data/lib/rubygems/dependency_installer.rb +286 -0
  51. data/lib/rubygems/dependency_list.rb +208 -0
  52. data/lib/rubygems/doc_manager.rb +242 -0
  53. data/lib/rubygems/errors.rb +35 -0
  54. data/lib/rubygems/exceptions.rb +91 -0
  55. data/lib/rubygems/ext.rb +18 -0
  56. data/lib/rubygems/ext/builder.rb +56 -0
  57. data/lib/rubygems/ext/configure_builder.rb +25 -0
  58. data/lib/rubygems/ext/ext_conf_builder.rb +24 -0
  59. data/lib/rubygems/ext/rake_builder.rb +39 -0
  60. data/lib/rubygems/format.rb +81 -0
  61. data/lib/rubygems/gem_openssl.rb +92 -0
  62. data/lib/rubygems/gem_path_searcher.rb +100 -0
  63. data/lib/rubygems/gem_runner.rb +79 -0
  64. data/lib/rubygems/gemcutter_utilities.rb +49 -0
  65. data/lib/rubygems/indexer.rb +720 -0
  66. data/lib/rubygems/install_update_options.rb +125 -0
  67. data/lib/rubygems/installer.rb +604 -0
  68. data/lib/rubygems/local_remote_options.rb +135 -0
  69. data/lib/rubygems/old_format.rb +153 -0
  70. data/lib/rubygems/package.rb +97 -0
  71. data/lib/rubygems/package/f_sync_dir.rb +23 -0
  72. data/lib/rubygems/package/tar_header.rb +266 -0
  73. data/lib/rubygems/package/tar_input.rb +222 -0
  74. data/lib/rubygems/package/tar_output.rb +144 -0
  75. data/lib/rubygems/package/tar_reader.rb +106 -0
  76. data/lib/rubygems/package/tar_reader/entry.rb +141 -0
  77. data/lib/rubygems/package/tar_writer.rb +241 -0
  78. data/lib/rubygems/package_task.rb +126 -0
  79. data/lib/rubygems/platform.rb +183 -0
  80. data/lib/rubygems/remote_fetcher.rb +414 -0
  81. data/lib/rubygems/require_paths_builder.rb +18 -0
  82. data/lib/rubygems/requirement.rb +153 -0
  83. data/lib/rubygems/security.rb +814 -0
  84. data/lib/rubygems/server.rb +872 -0
  85. data/lib/rubygems/source_index.rb +597 -0
  86. data/lib/rubygems/source_info_cache.rb +395 -0
  87. data/lib/rubygems/source_info_cache_entry.rb +56 -0
  88. data/lib/rubygems/spec_fetcher.rb +337 -0
  89. data/lib/rubygems/specification.rb +1486 -0
  90. data/lib/rubygems/test_utilities.rb +147 -0
  91. data/lib/rubygems/text.rb +65 -0
  92. data/lib/rubygems/uninstaller.rb +278 -0
  93. data/lib/rubygems/user_interaction.rb +527 -0
  94. data/lib/rubygems/validator.rb +240 -0
  95. data/lib/rubygems/version.rb +316 -0
  96. data/lib/rubygems/version_option.rb +65 -0
  97. data/lib/ubygems.rb +10 -0
  98. data/setup.rb +42 -0
  99. data/test/bogussources.rb +8 -0
  100. data/test/data/gem-private_key.pem +27 -0
  101. data/test/data/gem-public_cert.pem +20 -0
  102. data/test/fake_certlib/openssl.rb +7 -0
  103. data/test/foo/discover.rb +0 -0
  104. data/test/functional.rb +92 -0
  105. data/test/gem_installer_test_case.rb +97 -0
  106. data/test/gem_package_tar_test_case.rb +132 -0
  107. data/test/gemutilities.rb +605 -0
  108. data/test/insure_session.rb +43 -0
  109. data/test/mockgemui.rb +56 -0
  110. data/test/plugin/exception/rubygems_plugin.rb +2 -0
  111. data/test/plugin/load/rubygems_plugin.rb +1 -0
  112. data/test/plugin/standarderror/rubygems_plugin.rb +2 -0
  113. data/test/private_key.pem +27 -0
  114. data/test/public_cert.pem +20 -0
  115. data/test/rubygems_plugin.rb +21 -0
  116. data/test/simple_gem.rb +66 -0
  117. data/test/test_config.rb +12 -0
  118. data/test/test_gem.rb +766 -0
  119. data/test/test_gem_builder.rb +27 -0
  120. data/test/test_gem_command.rb +178 -0
  121. data/test/test_gem_command_manager.rb +207 -0
  122. data/test/test_gem_commands_build_command.rb +74 -0
  123. data/test/test_gem_commands_cert_command.rb +124 -0
  124. data/test/test_gem_commands_check_command.rb +18 -0
  125. data/test/test_gem_commands_contents_command.rb +156 -0
  126. data/test/test_gem_commands_dependency_command.rb +216 -0
  127. data/test/test_gem_commands_environment_command.rb +144 -0
  128. data/test/test_gem_commands_fetch_command.rb +76 -0
  129. data/test/test_gem_commands_generate_index_command.rb +135 -0
  130. data/test/test_gem_commands_install_command.rb +315 -0
  131. data/test/test_gem_commands_list_command.rb +36 -0
  132. data/test/test_gem_commands_lock_command.rb +68 -0
  133. data/test/test_gem_commands_mirror_command.rb +60 -0
  134. data/test/test_gem_commands_outdated_command.rb +40 -0
  135. data/test/test_gem_commands_owner_command.rb +105 -0
  136. data/test/test_gem_commands_pristine_command.rb +108 -0
  137. data/test/test_gem_commands_push_command.rb +81 -0
  138. data/test/test_gem_commands_query_command.rb +426 -0
  139. data/test/test_gem_commands_server_command.rb +59 -0
  140. data/test/test_gem_commands_sources_command.rb +209 -0
  141. data/test/test_gem_commands_specification_command.rb +139 -0
  142. data/test/test_gem_commands_stale_command.rb +38 -0
  143. data/test/test_gem_commands_uninstall_command.rb +83 -0
  144. data/test/test_gem_commands_unpack_command.rb +199 -0
  145. data/test/test_gem_commands_update_command.rb +353 -0
  146. data/test/test_gem_commands_which_command.rb +66 -0
  147. data/test/test_gem_config_file.rb +287 -0
  148. data/test/test_gem_dependency.rb +149 -0
  149. data/test/test_gem_dependency_installer.rb +661 -0
  150. data/test/test_gem_dependency_list.rb +230 -0
  151. data/test/test_gem_doc_manager.rb +31 -0
  152. data/test/test_gem_ext_configure_builder.rb +84 -0
  153. data/test/test_gem_ext_ext_conf_builder.rb +173 -0
  154. data/test/test_gem_ext_rake_builder.rb +81 -0
  155. data/test/test_gem_format.rb +70 -0
  156. data/test/test_gem_gem_path_searcher.rb +78 -0
  157. data/test/test_gem_gem_runner.rb +45 -0
  158. data/test/test_gem_gemcutter_utilities.rb +103 -0
  159. data/test/test_gem_indexer.rb +673 -0
  160. data/test/test_gem_install_update_options.rb +68 -0
  161. data/test/test_gem_installer.rb +857 -0
  162. data/test/test_gem_local_remote_options.rb +97 -0
  163. data/test/test_gem_package_tar_header.rb +130 -0
  164. data/test/test_gem_package_tar_input.rb +112 -0
  165. data/test/test_gem_package_tar_output.rb +97 -0
  166. data/test/test_gem_package_tar_reader.rb +46 -0
  167. data/test/test_gem_package_tar_reader_entry.rb +109 -0
  168. data/test/test_gem_package_tar_writer.rb +144 -0
  169. data/test/test_gem_package_task.rb +59 -0
  170. data/test/test_gem_platform.rb +264 -0
  171. data/test/test_gem_remote_fetcher.rb +740 -0
  172. data/test/test_gem_requirement.rb +292 -0
  173. data/test/test_gem_server.rb +356 -0
  174. data/test/test_gem_silent_ui.rb +113 -0
  175. data/test/test_gem_source_index.rb +461 -0
  176. data/test/test_gem_spec_fetcher.rb +410 -0
  177. data/test/test_gem_specification.rb +1291 -0
  178. data/test/test_gem_stream_ui.rb +218 -0
  179. data/test/test_gem_text.rb +43 -0
  180. data/test/test_gem_uninstaller.rb +146 -0
  181. data/test/test_gem_validator.rb +63 -0
  182. data/test/test_gem_version.rb +181 -0
  183. data/test/test_gem_version_option.rb +89 -0
  184. data/test/test_kernel.rb +59 -0
  185. metadata +413 -0
@@ -0,0 +1,133 @@
1
+ require 'rubygems/command'
2
+ require 'rubygems/indexer'
3
+
4
+ ##
5
+ # Generates a index files for use as a gem server.
6
+ #
7
+ # See `gem help generate_index`
8
+
9
+ class Gem::Commands::GenerateIndexCommand < Gem::Command
10
+
11
+ def initialize
12
+ super 'generate_index',
13
+ 'Generates the index files for a gem server directory',
14
+ :directory => '.', :build_legacy => true, :build_modern => true
15
+
16
+ add_option '-d', '--directory=DIRNAME',
17
+ 'repository base dir containing gems subdir' do |dir, options|
18
+ options[:directory] = File.expand_path dir
19
+ end
20
+
21
+ add_option '--[no-]legacy',
22
+ "Generate indexes for #{Gem::NAME} older than",
23
+ '1.2.0' do |value, options|
24
+ unless options[:build_modern] or value then
25
+ raise OptionParser::InvalidOption, 'no indicies will be built'
26
+ end
27
+
28
+ options[:build_legacy] = value
29
+ end
30
+
31
+ add_option '--[no-]modern',
32
+ "Generate indexes for #{Gem::NAME} newer",
33
+ 'than 1.2.0' do |value, options|
34
+ unless options[:build_legacy] or value then
35
+ raise OptionParser::InvalidOption, 'no indicies will be built'
36
+ end
37
+
38
+ options[:build_modern] = value
39
+ end
40
+
41
+ add_option '--update',
42
+ 'Update modern indexes with gems added',
43
+ 'since the last update' do |value, options|
44
+ options[:update] = value
45
+ end
46
+
47
+ add_option :RSS, '--rss-gems-host=GEM_HOST',
48
+ 'Host name where gems are served from,',
49
+ 'used for GUID and enclosure values' do |value, options|
50
+ options[:rss_gems_host] = value
51
+ end
52
+
53
+ add_option :RSS, '--rss-host=HOST',
54
+ 'Host name for more gems information,',
55
+ 'used for RSS feed link' do |value, options|
56
+ options[:rss_host] = value
57
+ end
58
+
59
+ add_option :RSS, '--rss-title=TITLE',
60
+ 'Set title for RSS feed' do |value, options|
61
+ options[:rss_title] = value
62
+ end
63
+ end
64
+
65
+ def defaults_str # :nodoc:
66
+ "--directory . --legacy --modern"
67
+ end
68
+
69
+ def description # :nodoc:
70
+ <<-EOF
71
+ The generate_index command creates a set of indexes for serving gems
72
+ statically. The command expects a 'gems' directory under the path given to
73
+ the --directory option. The given directory will be the directory you serve
74
+ as the gem repository.
75
+
76
+ For `gem generate_index --directory /path/to/repo`, expose /path/to/repo via
77
+ your HTTP server configuration (not /path/to/repo/gems).
78
+
79
+ When done, it will generate a set of files like this:
80
+
81
+ gems/*.gem # .gem files you want to
82
+ # index
83
+
84
+ specs.<version>.gz # specs index
85
+ latest_specs.<version>.gz # latest specs index
86
+ prerelease_specs.<version>.gz # prerelease specs index
87
+ quick/Marshal.<version>/<gemname>.gemspec.rz # Marshal quick index file
88
+
89
+ # these files support legacy #{Gem::NAME}
90
+ quick/index
91
+ quick/index.rz # quick index manifest
92
+ quick/<gemname>.gemspec.rz # legacy YAML quick index
93
+ # file
94
+ Marshal.<version>
95
+ Marshal.<version>.Z # Marshal full index
96
+ yaml
97
+ yaml.Z # legacy YAML full index
98
+
99
+ The .Z and .rz extension files are compressed with the inflate algorithm.
100
+ The Marshal version number comes from ruby's Marshal::MAJOR_VERSION and
101
+ Marshal::MINOR_VERSION constants. It is used to ensure compatibility.
102
+ The yaml indexes exist for legacy #{Gem::NAME} clients and fallback in case of
103
+ Marshal version changes.
104
+
105
+ If --rss-host and --rss-gem-host are given an RSS feed will be generated at
106
+ index.rss containing gems released in the last two days.
107
+ EOF
108
+ end
109
+
110
+ def execute
111
+ if options[:update] and
112
+ (options[:rss_host] or options[:rss_gems_host]) then
113
+ alert_error '--update not compatible with RSS generation'
114
+ terminate_interaction 1
115
+ end
116
+
117
+ if not File.exist?(options[:directory]) or
118
+ not File.directory?(options[:directory]) then
119
+ alert_error "unknown directory name #{directory}."
120
+ terminate_interaction 1
121
+ else
122
+ indexer = Gem::Indexer.new options.delete(:directory), options
123
+
124
+ if options[:update] then
125
+ indexer.update_index
126
+ else
127
+ indexer.generate_index
128
+ end
129
+ end
130
+ end
131
+
132
+ end
133
+
@@ -0,0 +1,172 @@
1
+ require 'rubygems/command'
2
+
3
+ class Gem::Commands::HelpCommand < Gem::Command
4
+
5
+ # :stopdoc:
6
+ EXAMPLES = <<-EOF
7
+ Some examples of 'gem' usage.
8
+
9
+ * Install 'rake', either from local directory or remote server:
10
+
11
+ gem install rake
12
+
13
+ * Install 'rake', only from remote server:
14
+
15
+ gem install rake --remote
16
+
17
+ * Install 'rake' from remote server, and run unit tests,
18
+ and generate RDocs:
19
+
20
+ gem install --remote rake --test --rdoc --ri
21
+
22
+ * Install 'rake', but only version 0.3.1, even if dependencies
23
+ are not met, and into a user-specific directory:
24
+
25
+ gem install rake --version 0.3.1 --force --user-install
26
+
27
+ * List local gems whose name begins with 'D':
28
+
29
+ gem list D
30
+
31
+ * List local and remote gems whose name contains 'log':
32
+
33
+ gem search log --both
34
+
35
+ * List only remote gems whose name contains 'log':
36
+
37
+ gem search log --remote
38
+
39
+ * Uninstall 'rake':
40
+
41
+ gem uninstall rake
42
+
43
+ * Create a gem:
44
+
45
+ See http://rubygems.rubyforge.org/wiki/wiki.pl?CreateAGemInTenMinutes
46
+
47
+ * See information about #{Gem::NAME}:
48
+
49
+ gem environment
50
+
51
+ * Update all gems on your system:
52
+
53
+ gem update
54
+ EOF
55
+
56
+ PLATFORMS = <<-'EOF'
57
+ #{Gem::NAME} platforms are composed of three parts, a CPU, an OS, and a
58
+ version. These values are taken from values in rbconfig.rb. You can view
59
+ your current platform by running `gem environment`.
60
+
61
+ #{Gem::NAME} matches platforms as follows:
62
+
63
+ * The CPU must match exactly, unless one of the platforms has
64
+ "universal" as the CPU.
65
+ * The OS must match exactly.
66
+ * The versions must match exactly unless one of the versions is nil.
67
+
68
+ For commands that install, uninstall and list gems, you can override what
69
+ #{Gem::NAME} thinks your platform is with the --platform option. The platform
70
+ you pass must match "#{cpu}-#{os}" or "#{cpu}-#{os}-#{version}". On mswin
71
+ platforms, the version is the compiler version, not the OS version. (Ruby
72
+ compiled with VC6 uses "60" as the compiler version, VC8 uses "80".)
73
+
74
+ Example platforms:
75
+
76
+ x86-freebsd # Any FreeBSD version on an x86 CPU
77
+ universal-darwin-8 # Darwin 8 only gems that run on any CPU
78
+ x86-mswin32-80 # Windows gems compiled with VC8
79
+
80
+ When building platform gems, set the platform in the gem specification to
81
+ Gem::Platform::CURRENT. This will correctly mark the gem with your ruby's
82
+ platform.
83
+ EOF
84
+ # :startdoc:
85
+
86
+ def initialize
87
+ super 'help', "Provide help on the 'gem' command"
88
+ end
89
+
90
+ def arguments # :nodoc:
91
+ args = <<-EOF
92
+ commands List all 'gem' commands
93
+ examples Show examples of 'gem' usage
94
+ <command> Show specific help for <command>
95
+ EOF
96
+ return args.gsub(/^\s+/, '')
97
+ end
98
+
99
+ def usage # :nodoc:
100
+ "#{program_name} ARGUMENT"
101
+ end
102
+
103
+ def execute
104
+ command_manager = Gem::CommandManager.instance
105
+ arg = options[:args][0]
106
+
107
+ if begins? "commands", arg then
108
+ out = []
109
+ out << "GEM commands are:"
110
+ out << nil
111
+
112
+ margin_width = 4
113
+
114
+ desc_width = command_manager.command_names.map { |n| n.size }.max + 4
115
+
116
+ summary_width = 80 - margin_width - desc_width
117
+ wrap_indent = ' ' * (margin_width + desc_width)
118
+ format = "#{' ' * margin_width}%-#{desc_width}s%s"
119
+
120
+ command_manager.command_names.each do |cmd_name|
121
+ summary = command_manager[cmd_name].summary
122
+ summary = wrap(summary, summary_width).split "\n"
123
+ out << sprintf(format, cmd_name, summary.shift)
124
+ until summary.empty? do
125
+ out << "#{wrap_indent}#{summary.shift}"
126
+ end
127
+ end
128
+
129
+ out << nil
130
+ out << "For help on a particular command, use 'gem help COMMAND'."
131
+ out << nil
132
+ out << "Commands may be abbreviated, so long as they are unambiguous."
133
+ out << "e.g. 'gem i rake' is short for 'gem install rake'."
134
+
135
+ say out.join("\n")
136
+
137
+ elsif begins? "options", arg then
138
+ say Gem::Command::HELP
139
+
140
+ elsif begins? "examples", arg then
141
+ say EXAMPLES
142
+
143
+ elsif begins? "platforms", arg then
144
+ say PLATFORMS
145
+
146
+ elsif options[:help] then
147
+ command = command_manager[options[:help]]
148
+ if command
149
+ # help with provided command
150
+ command.invoke("--help")
151
+ else
152
+ alert_error "Unknown command #{options[:help]}. Try 'gem help commands'"
153
+ end
154
+
155
+ elsif arg then
156
+ possibilities = command_manager.find_command_possibilities(arg.downcase)
157
+ if possibilities.size == 1
158
+ command = command_manager[possibilities.first]
159
+ command.invoke("--help")
160
+ elsif possibilities.size > 1
161
+ alert_warning "Ambiguous command #{arg} (#{possibilities.join(', ')})"
162
+ else
163
+ alert_warning "Unknown command #{arg}. Try gem help commands"
164
+ end
165
+
166
+ else
167
+ say Gem::Command::HELP
168
+ end
169
+ end
170
+
171
+ end
172
+
@@ -0,0 +1,178 @@
1
+ require 'rubygems/command'
2
+ require 'rubygems/doc_manager'
3
+ require 'rubygems/install_update_options'
4
+ require 'rubygems/dependency_installer'
5
+ require 'rubygems/local_remote_options'
6
+ require 'rubygems/validator'
7
+ require 'rubygems/version_option'
8
+
9
+ ##
10
+ # Gem installer command line tool
11
+ #
12
+ # See `gem help install`
13
+
14
+ class Gem::Commands::InstallCommand < Gem::Command
15
+
16
+ include Gem::VersionOption
17
+ include Gem::LocalRemoteOptions
18
+ include Gem::InstallUpdateOptions
19
+
20
+ def initialize
21
+ defaults = Gem::DependencyInstaller::DEFAULT_OPTIONS.merge({
22
+ :generate_rdoc => true,
23
+ :generate_ri => true,
24
+ :format_executable => false,
25
+ :test => false,
26
+ :version => Gem::Requirement.default,
27
+ })
28
+
29
+ super 'install', 'Install a gem into the local repository', defaults
30
+
31
+ add_install_update_options
32
+ add_local_remote_options
33
+ add_platform_option
34
+ add_version_option
35
+ add_prerelease_option "to be installed. (Only for listed gems)"
36
+ end
37
+
38
+ def arguments # :nodoc:
39
+ "GEMNAME name of gem to install"
40
+ end
41
+
42
+ def defaults_str # :nodoc:
43
+ "--both --version '#{Gem::Requirement.default}' --rdoc --ri --no-force\n" \
44
+ "--no-test --install-dir #{Gem.dir}"
45
+ end
46
+
47
+ def description # :nodoc:
48
+ <<-EOF
49
+ The install command installs local or remote gem into a gem repository.
50
+
51
+ For gems with executables ruby installs a wrapper file into the executable
52
+ directory by default. This can be overridden with the --no-wrappers option.
53
+ The wrapper allows you to choose among alternate gem versions using _version_.
54
+
55
+ For example `rake _0.7.3_ --version` will run rake version 0.7.3 if a newer
56
+ version is also installed.
57
+
58
+ If an extension fails to compile during gem installation the gem
59
+ specification is not written out, but the gem remains unpacked in the
60
+ repository. You may need to specify the path to the library's headers and
61
+ libraries to continue. You can do this by adding a -- between #{Gem::NAME}'
62
+ options and the extension's build options:
63
+
64
+ $ gem install some_extension_gem
65
+ [build fails]
66
+ Gem files will remain installed in \\
67
+ /path/to/gems/some_extension_gem-1.0 for inspection.
68
+ Results logged to /path/to/gems/some_extension_gem-1.0/gem_make.out
69
+ $ gem install some_extension_gem -- --with-extension-lib=/path/to/lib
70
+ [build succeeds]
71
+ $ gem list some_extension_gem
72
+
73
+ *** LOCAL GEMS ***
74
+
75
+ some_extension_gem (1.0)
76
+ $
77
+
78
+ If you correct the compilation errors by editing the gem files you will need
79
+ to write the specification by hand. For example:
80
+
81
+ $ gem install some_extension_gem
82
+ [build fails]
83
+ Gem files will remain installed in \\
84
+ /path/to/gems/some_extension_gem-1.0 for inspection.
85
+ Results logged to /path/to/gems/some_extension_gem-1.0/gem_make.out
86
+ $ [cd /path/to/gems/some_extension_gem-1.0]
87
+ $ [edit files or what-have-you and run make]
88
+ $ gem spec ../../cache/some_extension_gem-1.0.gem --ruby > \\
89
+ ../../specifications/some_extension_gem-1.0.gemspec
90
+ $ gem list some_extension_gem
91
+
92
+ *** LOCAL GEMS ***
93
+
94
+ some_extension_gem (1.0)
95
+ $
96
+
97
+ EOF
98
+ end
99
+
100
+ def usage # :nodoc:
101
+ "#{program_name} GEMNAME [GEMNAME ...] [options] -- --build-flags"
102
+ end
103
+
104
+ def execute
105
+ if options[:include_dependencies] then
106
+ alert "`gem install -y` is now default and will be removed"
107
+ alert "use --ignore-dependencies to install only the gems you list"
108
+ end
109
+
110
+ installed_gems = []
111
+
112
+ ENV.delete 'GEM_PATH' if options[:install_dir].nil? and RUBY_VERSION > '1.9'
113
+
114
+ exit_code = 0
115
+
116
+ get_all_gem_names.each do |gem_name|
117
+ begin
118
+ next if options[:conservative] && Gem.available?(gem_name, options[:version])
119
+
120
+ inst = Gem::DependencyInstaller.new options
121
+ inst.install gem_name, options[:version]
122
+
123
+ inst.installed_gems.each do |spec|
124
+ say "Successfully installed #{spec.full_name}"
125
+ end
126
+
127
+ installed_gems.push(*inst.installed_gems)
128
+ rescue Gem::InstallError => e
129
+ alert_error "Error installing #{gem_name}:\n\t#{e.message}"
130
+ exit_code |= 1
131
+ rescue Gem::GemNotFoundException => e
132
+ show_lookup_failure e.name, e.version, e.errors, options[:domain]
133
+
134
+ exit_code |= 2
135
+ end
136
+ end
137
+
138
+ unless installed_gems.empty? then
139
+ gems = installed_gems.length == 1 ? 'gem' : 'gems'
140
+ say "#{installed_gems.length} #{gems} installed"
141
+
142
+ # NOTE: *All* of the RI documents must be generated first. For some
143
+ # reason, RI docs cannot be generated after any RDoc documents are
144
+ # generated.
145
+
146
+ if options[:generate_ri] then
147
+ installed_gems.each do |gem|
148
+ Gem::DocManager.new(gem, options[:rdoc_args]).generate_ri
149
+ end
150
+
151
+ Gem::DocManager.update_ri_cache
152
+ end
153
+
154
+ if options[:generate_rdoc] then
155
+ installed_gems.each do |gem|
156
+ Gem::DocManager.new(gem, options[:rdoc_args]).generate_rdoc
157
+ end
158
+ end
159
+
160
+ if options[:test] then
161
+ installed_gems.each do |spec|
162
+ gem_spec = Gem::SourceIndex.from_installed_gems.find_name(spec.name, spec.version.version).first
163
+ result = Gem::Validator.new.unit_test(gem_spec)
164
+ if result and not result.passed?
165
+ unless ask_yes_no("...keep Gem?", true)
166
+ require 'rubygems/uninstaller'
167
+ Gem::Uninstaller.new(spec.name, :version => spec.version.version).uninstall
168
+ end
169
+ end
170
+ end
171
+ end
172
+ end
173
+
174
+ raise Gem::SystemExitException, exit_code
175
+ end
176
+
177
+ end
178
+