libgems 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) 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 +113 -0
  6. data/lib/gauntlet_libgems.rb +50 -0
  7. data/lib/libgems.rb +1246 -0
  8. data/lib/libgems/builder.rb +102 -0
  9. data/lib/libgems/command.rb +534 -0
  10. data/lib/libgems/command_manager.rb +182 -0
  11. data/lib/libgems/commands/build_command.rb +53 -0
  12. data/lib/libgems/commands/cert_command.rb +86 -0
  13. data/lib/libgems/commands/check_command.rb +80 -0
  14. data/lib/libgems/commands/cleanup_command.rb +106 -0
  15. data/lib/libgems/commands/contents_command.rb +98 -0
  16. data/lib/libgems/commands/dependency_command.rb +195 -0
  17. data/lib/libgems/commands/environment_command.rb +133 -0
  18. data/lib/libgems/commands/fetch_command.rb +67 -0
  19. data/lib/libgems/commands/generate_index_command.rb +133 -0
  20. data/lib/libgems/commands/help_command.rb +172 -0
  21. data/lib/libgems/commands/install_command.rb +178 -0
  22. data/lib/libgems/commands/list_command.rb +35 -0
  23. data/lib/libgems/commands/lock_command.rb +110 -0
  24. data/lib/libgems/commands/mirror_command.rb +111 -0
  25. data/lib/libgems/commands/outdated_command.rb +33 -0
  26. data/lib/libgems/commands/owner_command.rb +75 -0
  27. data/lib/libgems/commands/pristine_command.rb +93 -0
  28. data/lib/libgems/commands/push_command.rb +56 -0
  29. data/lib/libgems/commands/query_command.rb +280 -0
  30. data/lib/libgems/commands/rdoc_command.rb +91 -0
  31. data/lib/libgems/commands/search_command.rb +31 -0
  32. data/lib/libgems/commands/server_command.rb +86 -0
  33. data/lib/libgems/commands/sources_command.rb +157 -0
  34. data/lib/libgems/commands/specification_command.rb +125 -0
  35. data/lib/libgems/commands/stale_command.rb +27 -0
  36. data/lib/libgems/commands/uninstall_command.rb +83 -0
  37. data/lib/libgems/commands/unpack_command.rb +121 -0
  38. data/lib/libgems/commands/update_command.rb +160 -0
  39. data/lib/libgems/commands/which_command.rb +86 -0
  40. data/lib/libgems/config_file.rb +345 -0
  41. data/lib/libgems/custom_require.rb +44 -0
  42. data/lib/libgems/defaults.rb +101 -0
  43. data/lib/libgems/dependency.rb +227 -0
  44. data/lib/libgems/dependency_installer.rb +286 -0
  45. data/lib/libgems/dependency_list.rb +208 -0
  46. data/lib/libgems/doc_manager.rb +242 -0
  47. data/lib/libgems/errors.rb +35 -0
  48. data/lib/libgems/exceptions.rb +91 -0
  49. data/lib/libgems/ext.rb +18 -0
  50. data/lib/libgems/ext/builder.rb +56 -0
  51. data/lib/libgems/ext/configure_builder.rb +25 -0
  52. data/lib/libgems/ext/ext_conf_builder.rb +24 -0
  53. data/lib/libgems/ext/rake_builder.rb +39 -0
  54. data/lib/libgems/format.rb +81 -0
  55. data/lib/libgems/gem_openssl.rb +92 -0
  56. data/lib/libgems/gem_path_searcher.rb +100 -0
  57. data/lib/libgems/gem_runner.rb +79 -0
  58. data/lib/libgems/gemcutter_utilities.rb +49 -0
  59. data/lib/libgems/indexer.rb +720 -0
  60. data/lib/libgems/install_update_options.rb +125 -0
  61. data/lib/libgems/installer.rb +604 -0
  62. data/lib/libgems/local_remote_options.rb +135 -0
  63. data/lib/libgems/old_format.rb +153 -0
  64. data/lib/libgems/package.rb +97 -0
  65. data/lib/libgems/package/f_sync_dir.rb +23 -0
  66. data/lib/libgems/package/tar_header.rb +266 -0
  67. data/lib/libgems/package/tar_input.rb +222 -0
  68. data/lib/libgems/package/tar_output.rb +144 -0
  69. data/lib/libgems/package/tar_reader.rb +106 -0
  70. data/lib/libgems/package/tar_reader/entry.rb +141 -0
  71. data/lib/libgems/package/tar_writer.rb +241 -0
  72. data/lib/libgems/package_task.rb +126 -0
  73. data/lib/libgems/platform.rb +183 -0
  74. data/lib/libgems/remote_fetcher.rb +414 -0
  75. data/lib/libgems/require_paths_builder.rb +18 -0
  76. data/lib/libgems/requirement.rb +153 -0
  77. data/lib/libgems/security.rb +814 -0
  78. data/lib/libgems/server.rb +872 -0
  79. data/lib/libgems/source_index.rb +597 -0
  80. data/lib/libgems/source_info_cache.rb +395 -0
  81. data/lib/libgems/source_info_cache_entry.rb +56 -0
  82. data/lib/libgems/spec_fetcher.rb +337 -0
  83. data/lib/libgems/specification.rb +1487 -0
  84. data/lib/libgems/test_utilities.rb +147 -0
  85. data/lib/libgems/text.rb +65 -0
  86. data/lib/libgems/uninstaller.rb +278 -0
  87. data/lib/libgems/user_interaction.rb +527 -0
  88. data/lib/libgems/validator.rb +240 -0
  89. data/lib/libgems/version.rb +316 -0
  90. data/lib/libgems/version_option.rb +65 -0
  91. data/lib/rbconfig/datadir.rb +20 -0
  92. data/test/bogussources.rb +8 -0
  93. data/test/data/gem-private_key.pem +27 -0
  94. data/test/data/gem-public_cert.pem +20 -0
  95. data/test/fake_certlib/openssl.rb +7 -0
  96. data/test/foo/discover.rb +0 -0
  97. data/test/gem_installer_test_case.rb +97 -0
  98. data/test/gem_package_tar_test_case.rb +132 -0
  99. data/test/gemutilities.rb +605 -0
  100. data/test/insure_session.rb +43 -0
  101. data/test/mockgemui.rb +56 -0
  102. data/test/plugin/exception/libgems_plugin.rb +2 -0
  103. data/test/plugin/load/libgems_plugin.rb +1 -0
  104. data/test/plugin/standarderror/libgems_plugin.rb +2 -0
  105. data/test/private_key.pem +27 -0
  106. data/test/public_cert.pem +20 -0
  107. data/test/rubygems_plugin.rb +21 -0
  108. data/test/simple_gem.rb +66 -0
  109. data/test/test_config.rb +12 -0
  110. data/test/test_gem.rb +780 -0
  111. data/test/test_gem_builder.rb +27 -0
  112. data/test/test_gem_command.rb +178 -0
  113. data/test/test_gem_command_manager.rb +207 -0
  114. data/test/test_gem_commands_build_command.rb +74 -0
  115. data/test/test_gem_commands_cert_command.rb +124 -0
  116. data/test/test_gem_commands_check_command.rb +18 -0
  117. data/test/test_gem_commands_contents_command.rb +156 -0
  118. data/test/test_gem_commands_dependency_command.rb +216 -0
  119. data/test/test_gem_commands_environment_command.rb +144 -0
  120. data/test/test_gem_commands_fetch_command.rb +76 -0
  121. data/test/test_gem_commands_generate_index_command.rb +135 -0
  122. data/test/test_gem_commands_install_command.rb +315 -0
  123. data/test/test_gem_commands_list_command.rb +36 -0
  124. data/test/test_gem_commands_lock_command.rb +68 -0
  125. data/test/test_gem_commands_mirror_command.rb +60 -0
  126. data/test/test_gem_commands_outdated_command.rb +40 -0
  127. data/test/test_gem_commands_owner_command.rb +105 -0
  128. data/test/test_gem_commands_pristine_command.rb +108 -0
  129. data/test/test_gem_commands_push_command.rb +81 -0
  130. data/test/test_gem_commands_query_command.rb +426 -0
  131. data/test/test_gem_commands_server_command.rb +59 -0
  132. data/test/test_gem_commands_sources_command.rb +209 -0
  133. data/test/test_gem_commands_specification_command.rb +139 -0
  134. data/test/test_gem_commands_stale_command.rb +38 -0
  135. data/test/test_gem_commands_uninstall_command.rb +83 -0
  136. data/test/test_gem_commands_unpack_command.rb +199 -0
  137. data/test/test_gem_commands_update_command.rb +207 -0
  138. data/test/test_gem_commands_which_command.rb +66 -0
  139. data/test/test_gem_config_file.rb +287 -0
  140. data/test/test_gem_dependency.rb +149 -0
  141. data/test/test_gem_dependency_installer.rb +661 -0
  142. data/test/test_gem_dependency_list.rb +230 -0
  143. data/test/test_gem_doc_manager.rb +31 -0
  144. data/test/test_gem_ext_configure_builder.rb +84 -0
  145. data/test/test_gem_ext_ext_conf_builder.rb +173 -0
  146. data/test/test_gem_ext_rake_builder.rb +81 -0
  147. data/test/test_gem_format.rb +70 -0
  148. data/test/test_gem_gem_path_searcher.rb +78 -0
  149. data/test/test_gem_gem_runner.rb +45 -0
  150. data/test/test_gem_gemcutter_utilities.rb +103 -0
  151. data/test/test_gem_indexer.rb +673 -0
  152. data/test/test_gem_install_update_options.rb +68 -0
  153. data/test/test_gem_installer.rb +857 -0
  154. data/test/test_gem_local_remote_options.rb +97 -0
  155. data/test/test_gem_package_tar_header.rb +130 -0
  156. data/test/test_gem_package_tar_input.rb +112 -0
  157. data/test/test_gem_package_tar_output.rb +97 -0
  158. data/test/test_gem_package_tar_reader.rb +46 -0
  159. data/test/test_gem_package_tar_reader_entry.rb +109 -0
  160. data/test/test_gem_package_tar_writer.rb +144 -0
  161. data/test/test_gem_package_task.rb +59 -0
  162. data/test/test_gem_platform.rb +264 -0
  163. data/test/test_gem_remote_fetcher.rb +740 -0
  164. data/test/test_gem_requirement.rb +292 -0
  165. data/test/test_gem_server.rb +356 -0
  166. data/test/test_gem_silent_ui.rb +113 -0
  167. data/test/test_gem_source_index.rb +461 -0
  168. data/test/test_gem_spec_fetcher.rb +410 -0
  169. data/test/test_gem_specification.rb +1334 -0
  170. data/test/test_gem_stream_ui.rb +218 -0
  171. data/test/test_gem_text.rb +43 -0
  172. data/test/test_gem_uninstaller.rb +146 -0
  173. data/test/test_gem_validator.rb +63 -0
  174. data/test/test_gem_version.rb +181 -0
  175. data/test/test_gem_version_option.rb +89 -0
  176. data/test/test_kernel.rb +59 -0
  177. metadata +402 -0
@@ -0,0 +1,133 @@
1
+ require 'libgems/command'
2
+ require 'libgems/indexer'
3
+
4
+ ##
5
+ # Generates a index files for use as a gem server.
6
+ #
7
+ # See `gem help generate_index`
8
+
9
+ class LibGems::Commands::GenerateIndexCommand < LibGems::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 #{LibGems::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 #{LibGems::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 #{LibGems::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 #{LibGems::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 = LibGems::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 'libgems/command'
2
+
3
+ class LibGems::Commands::HelpCommand < LibGems::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 #{LibGems::NAME}:
48
+
49
+ gem environment
50
+
51
+ * Update all gems on your system:
52
+
53
+ gem update
54
+ EOF
55
+
56
+ PLATFORMS = <<-'EOF'
57
+ #{LibGems::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
+ #{LibGems::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
+ #{LibGems::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
+ LibGems::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 = LibGems::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 LibGems::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 LibGems::Command::HELP
168
+ end
169
+ end
170
+
171
+ end
172
+
@@ -0,0 +1,178 @@
1
+ require 'libgems/command'
2
+ require 'libgems/doc_manager'
3
+ require 'libgems/install_update_options'
4
+ require 'libgems/dependency_installer'
5
+ require 'libgems/local_remote_options'
6
+ require 'libgems/validator'
7
+ require 'libgems/version_option'
8
+
9
+ ##
10
+ # LibGems installer command line tool
11
+ #
12
+ # See `gem help install`
13
+
14
+ class LibGems::Commands::InstallCommand < LibGems::Command
15
+
16
+ include LibGems::VersionOption
17
+ include LibGems::LocalRemoteOptions
18
+ include LibGems::InstallUpdateOptions
19
+
20
+ def initialize
21
+ defaults = LibGems::DependencyInstaller::DEFAULT_OPTIONS.merge({
22
+ :generate_rdoc => true,
23
+ :generate_ri => true,
24
+ :format_executable => false,
25
+ :test => false,
26
+ :version => LibGems::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 '#{LibGems::Requirement.default}' --rdoc --ri --no-force\n" \
44
+ "--no-test --install-dir #{LibGems.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 #{LibGems::NAME}'
62
+ options and the extension's build options:
63
+
64
+ $ gem install some_extension_gem
65
+ [build fails]
66
+ LibGems 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
+ LibGems 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] && LibGems.available?(gem_name, options[:version])
119
+
120
+ inst = LibGems::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 LibGems::InstallError => e
129
+ alert_error "Error installing #{gem_name}:\n\t#{e.message}"
130
+ exit_code |= 1
131
+ rescue LibGems::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
+ LibGems::DocManager.new(gem, options[:rdoc_args]).generate_ri
149
+ end
150
+
151
+ LibGems::DocManager.update_ri_cache
152
+ end
153
+
154
+ if options[:generate_rdoc] then
155
+ installed_gems.each do |gem|
156
+ LibGems::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 = LibGems::SourceIndex.from_installed_gems.find_name(spec.name, spec.version.version).first
163
+ result = LibGems::Validator.new.unit_test(gem_spec)
164
+ if result and not result.passed?
165
+ unless ask_yes_no("...keep LibGems?", true)
166
+ require 'libgems/uninstaller'
167
+ LibGems::Uninstaller.new(spec.name, :version => spec.version.version).uninstall
168
+ end
169
+ end
170
+ end
171
+ end
172
+ end
173
+
174
+ raise LibGems::SystemExitException, exit_code
175
+ end
176
+
177
+ end
178
+