geminstaller 0.2.5 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/LICENSE +1 -1
- data/Manifest.txt +6 -2
- data/README.txt +6 -4
- data/TODO.txt +35 -30
- data/ci/README_CI.txt +22 -0
- data/ci/cruise +50 -0
- data/cruise_config.rb +11 -0
- data/focused_spec.sh +2 -0
- data/focused_spec_debug.sh +2 -0
- data/geminstaller.yml +5 -3
- data/lib/geminstaller.rb +1 -1
- data/lib/geminstaller/autogem.rb +2 -2
- data/lib/geminstaller/backward_compatibility.rb +1 -1
- data/lib/geminstaller/dependency_injector.rb +5 -3
- data/lib/geminstaller/enhanced_stream_ui.rb +17 -7
- data/lib/geminstaller/gem_command_manager.rb +15 -12
- data/lib/geminstaller/gem_interaction_handler.rb +8 -0
- data/lib/geminstaller/gem_list_checker.rb +1 -1
- data/lib/geminstaller/gem_runner_proxy.rb +1 -1
- data/lib/geminstaller/gem_spec_manager.rb +25 -13
- data/lib/geminstaller/install_processor.rb +21 -6
- data/lib/geminstaller/missing_dependency_finder.rb +5 -0
- data/lib/geminstaller/requires.rb +16 -6
- data/lib/geminstaller/ruby_gem.rb +7 -2
- data/lib/geminstaller/rubygems_version_checker.rb +11 -5
- data/lib/geminstaller/source_index_search_adapter.rb +41 -0
- data/lib/geminstaller/valid_platform_selector.rb +5 -0
- data/start_local_gem_server.sh +1 -1
- data/test/test_all.rb +15 -10
- data/website/metainfo.yaml +8 -2
- data/website/src/code/index.page +49 -2
- data/website/src/community/index.page +1 -1
- data/website/src/community/links.page +2 -0
- data/website/src/documentation/documentation.page +14 -11
- data/website/src/documentation/tutorials.page +16 -10
- data/website/src/faq.page +15 -0
- data/website/src/index.page +21 -7
- metadata +51 -39
- data/ci/cruisecontrol +0 -50
- data/lib/geminstaller/gem_command_line_proxy.rb +0 -32
data/History.txt
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
== 0.x.y / yyyy-mm-dd
|
2
2
|
|
3
|
+
== 0.3.0 / 2008-01-01
|
4
|
+
* Changes to work with RubyGems >= 0.9.5 and take advantage of new platform and auto-install features. See notes at http://geminstaller.rubyforge.org/code/index.html#rubygems_compatibility
|
5
|
+
* On Linux/Mac, you can now specify a RUBYGEMS_VERSION environment var to test against a specific version of RubyGems.
|
6
|
+
* Improved smoketest.rb and autogem_test.rb
|
7
|
+
* Tests now run on windows (only against latest rubygems, with it installed, and only via test/test_all.rb, not rake)
|
8
|
+
* deprecated/disabled prefer_binary_platform
|
9
|
+
* many other small cleanups
|
10
|
+
|
3
11
|
== 0.2.5 / 2007-10-24
|
4
12
|
* Add 'include_config' directive to yaml config file, allowing other files to be included via ERB.
|
5
13
|
* Fix broken links in docs - patch from Maciej Kozak (macio)
|
data/LICENSE
CHANGED
data/Manifest.txt
CHANGED
@@ -7,7 +7,11 @@ README.txt
|
|
7
7
|
Rakefile
|
8
8
|
TODO.txt
|
9
9
|
bin/geminstaller
|
10
|
-
ci/
|
10
|
+
ci/README_CI.txt
|
11
|
+
ci/cruise
|
12
|
+
cruise_config.rb
|
13
|
+
focused_spec.sh
|
14
|
+
focused_spec_debug.sh
|
11
15
|
geminstaller.yml
|
12
16
|
lib/geminstaller.rb
|
13
17
|
lib/geminstaller/application.rb
|
@@ -21,7 +25,6 @@ lib/geminstaller/enhanced_stream_ui.rb
|
|
21
25
|
lib/geminstaller/exact_match_list_command.rb
|
22
26
|
lib/geminstaller/file_reader.rb
|
23
27
|
lib/geminstaller/gem_arg_processor.rb
|
24
|
-
lib/geminstaller/gem_command_line_proxy.rb
|
25
28
|
lib/geminstaller/gem_command_manager.rb
|
26
29
|
lib/geminstaller/gem_interaction_handler.rb
|
27
30
|
lib/geminstaller/gem_list_checker.rb
|
@@ -45,6 +48,7 @@ lib/geminstaller/ruby_gem.rb
|
|
45
48
|
lib/geminstaller/rubygems_exit.rb
|
46
49
|
lib/geminstaller/rubygems_extensions.rb
|
47
50
|
lib/geminstaller/rubygems_version_checker.rb
|
51
|
+
lib/geminstaller/source_index_search_adapter.rb
|
48
52
|
lib/geminstaller/unauthorized_dependency_prompt_error.rb
|
49
53
|
lib/geminstaller/unexpected_prompt_error.rb
|
50
54
|
lib/geminstaller/valid_platform_selector.rb
|
data/README.txt
CHANGED
@@ -13,10 +13,12 @@ GemInstaller provides automated management of RubyGems. It uses a simple YAML c
|
|
13
13
|
* Automatically install the correct versions of all required gems wherever your app runs.
|
14
14
|
* Automatically ensure installed gems and versions are consistent across multiple applications, machines, platforms, and environments
|
15
15
|
* Automatically add correct versions of gems to the ruby load path when your app runs ('require_gem'/'gem')
|
16
|
-
* Automatically reinstall missing dependency gems
|
17
|
-
* Automatically
|
16
|
+
* Automatically reinstall missing dependency gems (built in to RubyGems > 1.0)
|
17
|
+
* Automatically detect correct platform to install for multi-platform gems (built in to RubyGems > 1.0)
|
18
18
|
* Print YAML for "rogue gems" which are not specified in the current config, to easily bootstrap your config file, or find gems that were manually installed without GemInstaller.
|
19
|
-
*
|
19
|
+
* Allow for common configs to be reused across projects or environments by supporting multiple config files, including common config file snippets, and defaults with overrides.
|
20
|
+
* Allow for dynamic selection of gems, versions, and platforms to be used based on environment vars or any other logic.
|
21
|
+
* Avoid the "works on demo, breaks on production" syndrome
|
20
22
|
|
21
23
|
== SYNOPSYS:
|
22
24
|
|
@@ -38,7 +40,7 @@ See http://geminstaller.rubyforge.org/documentation/index.html
|
|
38
40
|
|
39
41
|
(The MIT License)
|
40
42
|
|
41
|
-
Copyright (c)
|
43
|
+
Copyright (c) 2008 Chad Woolley
|
42
44
|
|
43
45
|
Permission is hereby granted, free of charge, to any person obtaining
|
44
46
|
a copy of this software and associated documentation files (the
|
data/TODO.txt
CHANGED
@@ -1,29 +1,40 @@
|
|
1
|
+
|
1
2
|
=============== Unfiled =============
|
2
|
-
*
|
3
|
-
|
4
|
-
*
|
5
|
-
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
|
9
|
-
*
|
10
|
-
* docs -
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
|
16
|
-
*
|
17
|
-
================ 0.3.0 release =====================
|
18
|
-
* update docs with details on how to handle unmet dependencies when -y is not specified
|
19
|
-
* tutorial: using common or shared config files, with different configs for different environments - test (rspec) vs. dev (capistrano) vs. demo/staging/prod
|
3
|
+
* release with support for rubygems >= 0.9.5
|
4
|
+
================ 0.3.0 release ===================
|
5
|
+
* turn smoketest into rake task, with correct return code handling, and hook up to cruise
|
6
|
+
* look into and explain mongrel/webrick installation errors
|
7
|
+
* add top-level method for uninstall of gems, and document (requested by Alex Chaffee and others)
|
8
|
+
* Rename API: deprecate 'autogem' and rename to 'load'; change current 'run' to 'install'; add new 'run' which automatically calls both 'install' and 'load', add 'no-load' option (only applicable when invoked programatically) to supress automatic 'load'
|
9
|
+
|
10
|
+
* docs - add example of using environment variable to control gem version without changing code (Rails)
|
11
|
+
* docs - document and add sample file for preinitializer boot hook. Explain why it can't be in environment.rb vs boot.rb or prinitializer (bottom line: env is not processed before Initializer, so can't be used to load rails gems)
|
12
|
+
* tutorial: using common or shared config files, with different configs for different environments - test (rspec) vs. dev (capistrano) vs. demo/staging/prod, mention include_config option and pros/cons of different approaches
|
13
|
+
* docs - rename "Documentation" page to "Manual"
|
14
|
+
* rogue gems config generation - add warning and instructions for cleaning up auto-generated file. For example, deleting rails dependencies
|
15
|
+
* faq - mention 'cannot load error' from load, and why it happens (rubygems can only load one version)
|
16
|
+
* faq - mention tradeoffs of optimistic version requirement (>=) vs pessimistic (=), specifically how mongrel specifies its dependencies
|
17
|
+
* put mongrel/rails startup bug in tracker, add link in "known bugs" section on home page.
|
20
18
|
* tutorial: running via capistrano
|
21
19
|
* crossreference front page, tutorials, and docs
|
22
|
-
|
23
|
-
*
|
24
|
-
*
|
25
|
-
|
26
|
-
*
|
20
|
+
================ 0.3.1 release ===================
|
21
|
+
* Namespace remaining un-namespaced constants
|
22
|
+
* Allow array or eval'able string of gems to be passed as --gems arg or instead of args
|
23
|
+
* Add @options[:gems], should be parsed from command line* root-owned gems: add -S | --sudo-only-if-allowed option, will only invoke sudo if GEMINSTALLER_ALLOW(S)_SUDO env var is set
|
24
|
+
* root-owned gems: add automatic re-invoke with sudo option (with warning message) if permission error is caught
|
25
|
+
* root-owned gems: Dynamically detect posix platform and check if gem repo is completely writeable. Ignorable prompt?
|
26
|
+
* docs - clean up sudo section. Should be clearer about sudoers entry, and make sure that NOPASSWD is the last entry. Rename from #dealing_with_sudo to #dealing_with_root_owned_gems, rewrite to reflect new best practices (different GEM_PATH or auto-sudo via capistrano)
|
27
|
+
* tutorial: update running via capistrano to reference new sudo docs
|
28
|
+
================ 0.3.2 release ===================
|
29
|
+
* handle installation of gem from file (requested by Alex Chaffee)
|
30
|
+
* Investigate gem_plugin. Plugin for mongrel???
|
31
|
+
* Investigate making a Rails plugin
|
32
|
+
================ 0.3.3 release ===================
|
33
|
+
* Why does RubyGems reinstall BlueCloth even though it is already installed?!?!? (remove from FAQ after solved)
|
34
|
+
* Figure out how to suppress webrick messages from embedded gem server
|
35
|
+
* add option to warn if any rogue gems are found
|
36
|
+
================ 0.3.4 release =====================
|
37
|
+
================ 0.3.5 finishing website ===================
|
27
38
|
* autogem and run args can be passed as string or array
|
28
39
|
* better test coverage for --sudo and --exception options
|
29
40
|
* use rspec context_setup
|
@@ -69,25 +80,20 @@
|
|
69
80
|
* reconcile methods for testing error messages - manually vs proc_should_raise_with_message. Probably should patch rspec.
|
70
81
|
* remove test_gem_home.reset from geminstaller_spec.rb WITHOUT breaking the test suite.
|
71
82
|
* tests fail on windows - seems to be related to test_gem_home running twice. smoketest still passes.
|
72
|
-
* Use rubygems executables from test_gem_home. In order to do this, we must run test_gem_home and ensure it is on the load path BEFORE the system installation of rubygems ever gets initialized. We will also have to manually include all geminstaller test dependency gems in test_gem_home or on the path. Tried this once and failed, patch on linux box...
|
73
|
-
* clean up spec_utils - remove duplication of class and instance methods
|
74
|
-
* spec_utils global teardown method which uninstalls all gems
|
75
83
|
* can't run binary out of source dir unless running it via ruby
|
76
84
|
* running binary via ruby out of bin dir will pick up gem first on load path if it is installed
|
77
85
|
* verify that >= version spec works with a specific platform, if that platform is not available for the highest version
|
78
86
|
* Check for write access, and exit with warning to use sudo if there is no write access.
|
79
87
|
* store rubygems dist as a tar, and untar it on demand
|
80
88
|
* Add spec file name to all contexts (or see if rspec can do it automatically)
|
81
|
-
* Make GemInstaller.run take a parameter to not fail if there is any error
|
82
89
|
* Embedded gem_server process doesn't get killed on windows during tests - need to use ruby services, see comment in embedded_gem_server.rb
|
83
90
|
* Embedded gem_server ports aren't handled correctly on linux during tests - port conflict on startup, open ports die off slowly after tests finish
|
84
91
|
* Do a port check before starting embedded gem server, give option to kill process or at least exit with a descriptive warning.
|
85
|
-
* Clean up spec_helper, find out simplest way to invoke rspec via test_unit, and still provide proper return codes/output
|
86
92
|
* remove cruft from test output - intercept output streams from gem_server and rubygems setup
|
87
93
|
* enhance DependencyInjector - allow items to be substituted prior to initialization - then geminstaller_spec could simply set a mock output_proxy on the registry instead of explicitly setting it every place it is used.
|
88
94
|
* ensure --debug install option works as expected
|
89
95
|
* fix all Zentest warnings
|
90
|
-
* Rename RubyGem class to RubyGemAction
|
96
|
+
* Rename RubyGem class to RubyGemAction (or maybe RubyGemDependency to match 1.x)
|
91
97
|
* Automate process for creating a stubgem
|
92
98
|
* Give nice error message if gem server is unavailable (check socket)
|
93
99
|
* Make tests run under RadRails debugger
|
@@ -97,5 +103,4 @@
|
|
97
103
|
* make verbose option specify --backtrace on all gem commands
|
98
104
|
* Add support, syntax, and options for uninstalling gems - completely, or down to highest specified version.
|
99
105
|
* add feature to automatically warn if there is a more recent version of the gem available and check_for_upgrade == false. Use "gem outdated" command
|
100
|
-
* auto-generate geminstaller.yml files (possibly by parsing source, or based on all gems installed locally)
|
101
106
|
================ 0.later.1 Unprioritized ===================
|
data/ci/README_CI.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Use these steps to run GemInstaller under CruiseControl.rb:
|
2
|
+
|
3
|
+
* Create project with name 'geminstaller_using_rubygems_x-y-z', where 'x-y-z' is the version of RubyGems to test against.
|
4
|
+
|
5
|
+
* symlink geminstaller/ci/cruise to /etc/init.d/cruise and follow instructions it contains to hook up init script and update-rc.d.
|
6
|
+
|
7
|
+
* gem install mongrel and daemons (TODO: add these to geminstaller config)
|
8
|
+
|
9
|
+
* Edit ~/.cruise/site_config.rb to have the following entries:
|
10
|
+
|
11
|
+
# builds must run in serial for now, to prevent conflicts
|
12
|
+
Configuration.serialize_builds = true
|
13
|
+
|
14
|
+
# use dedicated gmail account for mailing
|
15
|
+
ActionMailer::Base.smtp_settings = {
|
16
|
+
:address => "smtp.gmail.com",
|
17
|
+
:port => 587,
|
18
|
+
:domain => "thewoolleyweb.com",
|
19
|
+
:authentication => :plain,
|
20
|
+
:user_name => "thewoolleyweb.smtp",
|
21
|
+
:password => "????"
|
22
|
+
}
|
data/ci/cruise
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/local/bin/ruby
|
2
|
+
|
3
|
+
ENV['PATH']="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11"
|
4
|
+
|
5
|
+
# in order to make cruise run as daemon, you need:
|
6
|
+
# 1. cp $CCRB_HOME/daemon/cruise.sample $CCRB_HOME/daemon/cruise
|
7
|
+
# 2. specify your cruise_path to $CCRB_HOME in $CCRB_HOME/daemon/cruise file
|
8
|
+
# 3. ln -s $CCRB_HOME/daemon/cruise /etc/init.d/cruise (you may need to 'sudo' this)
|
9
|
+
# 4. update-rc.d cruise (you may want to choose options by yourself, and you may need to 'sudo' this)
|
10
|
+
# 5. it's done :>
|
11
|
+
|
12
|
+
require "fileutils"
|
13
|
+
include FileUtils
|
14
|
+
|
15
|
+
require "rubygems"
|
16
|
+
|
17
|
+
begin
|
18
|
+
gem 'mongrel'
|
19
|
+
rescue => e
|
20
|
+
puts "Error: daemon mode of CC.rb requires mongrel installed"
|
21
|
+
exit 1
|
22
|
+
end
|
23
|
+
|
24
|
+
def cruise_path
|
25
|
+
"/home/woolley/workspace/cruisecontrolrb"
|
26
|
+
end
|
27
|
+
|
28
|
+
def cruise_user
|
29
|
+
"woolley"
|
30
|
+
end
|
31
|
+
|
32
|
+
command = ARGV.shift
|
33
|
+
|
34
|
+
case command
|
35
|
+
when 'start'
|
36
|
+
#cd cruise_path
|
37
|
+
system "su - woolley -c 'cd #{cruise_path} && ./cruise start -d'"
|
38
|
+
exit 0
|
39
|
+
when 'stop'
|
40
|
+
system "mongrel_rails stop -P #{cruise_path}/tmp/pids/mongrel.pid"
|
41
|
+
Dir["#{cruise_path}/tmp/pids/builders/*.pid"].each do |pid_file|
|
42
|
+
pid = File.open(pid_file){|f| f.read }
|
43
|
+
system "kill -9 #{pid}"
|
44
|
+
rm pid_file
|
45
|
+
end
|
46
|
+
exit 0
|
47
|
+
else
|
48
|
+
p "Usage: /etc/init.d/cruise start|stop"
|
49
|
+
exit 1
|
50
|
+
end
|
data/cruise_config.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# Project-specific configuration for CruiseControl.rb
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
Project.configure do |project|
|
5
|
+
project.email_notifier.emails = ['thewoolleyman@gmail.com']
|
6
|
+
if project.name =~ /rubygems[_-](.*)$/ # geminstaller_using_rubygems_0-9-4
|
7
|
+
rubygems_version = $1
|
8
|
+
rubygems_version.gsub!('-','.')
|
9
|
+
ENV['RUBYGEMS_VERSION'] = rubygems_version
|
10
|
+
end
|
11
|
+
end
|
data/focused_spec.sh
ADDED
data/geminstaller.yml
CHANGED
@@ -7,7 +7,7 @@ gems:
|
|
7
7
|
- name: diff-lcs
|
8
8
|
version: '>= 1.1.2'
|
9
9
|
- name: hoe
|
10
|
-
version: '>= 1.
|
10
|
+
version: '>= 1.4.0'
|
11
11
|
- name: rake
|
12
12
|
version: '>= 0.7.1'
|
13
13
|
- name: rcov
|
@@ -16,14 +16,16 @@ gems:
|
|
16
16
|
- name: RedCloth
|
17
17
|
version: '>= 3.0.4'
|
18
18
|
- name: rspec
|
19
|
-
version: '>= 1.
|
19
|
+
version: '>= 1.1.1'
|
20
20
|
- name: cmdparse
|
21
21
|
version: '>= 2.0.2'
|
22
|
+
- name: ruby-debug
|
23
|
+
version: '>= 0.9.3'
|
22
24
|
- name: webgen
|
23
25
|
version: '>= 0.4.2'
|
24
26
|
<% if RUBY_PLATFORM =~ /mswin/ %>
|
25
27
|
- name: win32-process
|
26
|
-
version: '>= 0.5.
|
28
|
+
version: '>= 0.5.5'
|
27
29
|
platform: 'mswin32'
|
28
30
|
- name: win32console
|
29
31
|
version: '>= 1.0.8'
|
data/lib/geminstaller.rb
CHANGED
data/lib/geminstaller/autogem.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module GemInstaller
|
2
2
|
class Autogem
|
3
|
-
attr_writer :gem_command_manager, :
|
3
|
+
attr_writer :gem_command_manager, :gem_source_index_proxy
|
4
4
|
def autogem(gems)
|
5
5
|
@gem_source_index_proxy.refresh!
|
6
6
|
@completed_names = []
|
@@ -20,7 +20,7 @@ module GemInstaller
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def invoke_require_gem_command(name, version)
|
23
|
-
if
|
23
|
+
if GemInstaller::RubyGemsVersionChecker.matches?('< 0.9')
|
24
24
|
require_gem(name, version)
|
25
25
|
else
|
26
26
|
# TODO: should we check true/false result of gem method?
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# this file supports backward compatibility for prior versions of RubyGems
|
2
2
|
|
3
3
|
# 0.9.3 reorganized commands to Gem::Commands:: module from Gem::
|
4
|
-
if
|
4
|
+
if GemInstaller::RubyGemsVersionChecker.matches?('<0.9.3')
|
5
5
|
LIST_COMMAND_CLASS = Gem::ListCommand
|
6
6
|
QUERY_COMMAND_CLASS = Gem::QueryCommand
|
7
7
|
else
|
@@ -15,7 +15,7 @@ module GemInstaller
|
|
15
15
|
attr_accessor :gem_runner, :gem_command_manager, :gem_list_checker, :app, :arg_parser, :options, :noninteractive_chooser
|
16
16
|
attr_accessor :gem_interaction_handler, :install_processor, :missing_dependency_finder, :valid_platform_selector
|
17
17
|
attr_accessor :output_listener, :outs_output_observer, :errs_output_observer, :output_filter, :autogem, :rogue_gem_finder
|
18
|
-
attr_accessor :gem_spec_manager
|
18
|
+
attr_accessor :gem_spec_manager, :source_index_search_adapter
|
19
19
|
|
20
20
|
def initialize
|
21
21
|
@options = {}
|
@@ -49,6 +49,9 @@ module GemInstaller
|
|
49
49
|
@gem_source_index_proxy = GemInstaller::GemSourceIndexProxy.new
|
50
50
|
@gem_source_index_proxy.gem_source_index = @gem_source_index
|
51
51
|
|
52
|
+
@source_index_search_adapter = GemInstaller::SourceIndexSearchAdapter.new
|
53
|
+
@source_index_search_adapter.gem_source_index_proxy = @gem_source_index_proxy
|
54
|
+
|
52
55
|
@gem_interaction_handler = GemInstaller::GemInteractionHandler.new
|
53
56
|
@noninteractive_chooser_class = GemInstaller::NoninteractiveChooser
|
54
57
|
@gem_interaction_handler.noninteractive_chooser_class = @noninteractive_chooser_class
|
@@ -80,7 +83,7 @@ module GemInstaller
|
|
80
83
|
|
81
84
|
@gem_spec_manager = GemInstaller::GemSpecManager.new
|
82
85
|
@gem_spec_manager.valid_platform_selector = @valid_platform_selector
|
83
|
-
@gem_spec_manager.
|
86
|
+
@gem_spec_manager.source_index_search_adapter = @source_index_search_adapter
|
84
87
|
@gem_spec_manager.output_filter = @output_filter
|
85
88
|
|
86
89
|
@gem_command_manager = GemInstaller::GemCommandManager.new
|
@@ -96,7 +99,6 @@ module GemInstaller
|
|
96
99
|
@autogem = GemInstaller::Autogem.new
|
97
100
|
@autogem.gem_command_manager = @gem_command_manager
|
98
101
|
@autogem.gem_source_index_proxy = @gem_source_index_proxy
|
99
|
-
@autogem.gem_spec_manager = @gem_spec_manager
|
100
102
|
|
101
103
|
@gem_list_checker = GemInstaller::GemListChecker.new
|
102
104
|
@gem_list_checker.gem_command_manager = @gem_command_manager
|
@@ -7,12 +7,15 @@ module GemInstaller
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def ask_yes_no(question, default=nil)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
if GemInstaller::RubyGemsVersionChecker.matches?('<=0.9.4')
|
11
|
+
# Using defaults, we expect no interactive prompts RubyGems >= 0.9.5
|
12
|
+
begin
|
13
|
+
@gem_interaction_handler.handle_ask_yes_no(question)
|
14
|
+
rescue Exception => e
|
15
|
+
@outs.print(question)
|
16
|
+
@outs.flush
|
17
|
+
raise e
|
18
|
+
end
|
16
19
|
end
|
17
20
|
raise_unexpected_prompt_error(question)
|
18
21
|
end
|
@@ -22,7 +25,14 @@ module GemInstaller
|
|
22
25
|
end
|
23
26
|
|
24
27
|
def choose_from_list(question, list)
|
25
|
-
|
28
|
+
if GemInstaller::RubyGemsVersionChecker.matches?('<=0.9.4')
|
29
|
+
# Using defaults, we expect no interactive prompts RubyGems >= 0.9.5
|
30
|
+
@gem_interaction_handler.handle_choose_from_list(question, list)
|
31
|
+
else
|
32
|
+
list_string = list.join("\n")
|
33
|
+
question_and_list = "#{question}\n#{list_string}"
|
34
|
+
raise_unexpected_prompt_error(question_and_list)
|
35
|
+
end
|
26
36
|
end
|
27
37
|
|
28
38
|
def terminate_interaction!(status=-1)
|
@@ -3,7 +3,7 @@ module GemInstaller
|
|
3
3
|
attr_writer :gem_spec_manager, :gem_runner_proxy, :gem_interaction_handler
|
4
4
|
|
5
5
|
def list_remote_gem(gem, additional_options)
|
6
|
-
run_args = ["list",gem.name,"--remote"]
|
6
|
+
run_args = ["list",gem.name,"--remote","--details"]
|
7
7
|
run_args += additional_options
|
8
8
|
@gem_runner_proxy.run(run_args)
|
9
9
|
end
|
@@ -11,21 +11,21 @@ module GemInstaller
|
|
11
11
|
def uninstall_gem(gem)
|
12
12
|
return if !@gem_spec_manager.is_gem_installed?(gem)
|
13
13
|
@gem_interaction_handler.dependent_gem = gem
|
14
|
-
run_gem_command('uninstall',gem)
|
14
|
+
run_gem_command('uninstall', gem, gem.uninstall_options)
|
15
15
|
end
|
16
16
|
|
17
|
-
def install_gem(gem)
|
18
|
-
return if @gem_spec_manager.is_gem_installed?(gem)
|
17
|
+
def install_gem(gem, force_reinstall = false)
|
18
|
+
return [] if @gem_spec_manager.is_gem_installed?(gem) && !force_reinstall
|
19
19
|
@gem_interaction_handler.dependent_gem = gem
|
20
|
-
run_gem_command('install',gem)
|
20
|
+
run_gem_command('install', gem, gem.install_options)
|
21
21
|
end
|
22
22
|
|
23
23
|
def dependency(name, version, additional_options = [])
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
|
28
|
-
run_args = ["dependency"
|
24
|
+
# rubygems has bug up to 0.9.4 where the pipe options uses 'puts', instead of 'say', so we can't capture it
|
25
|
+
# with enhanced_stream_ui. Patched: http://rubyforge.org/tracker/index.php?func=detail&aid=9020&group_id=126&atid=577
|
26
|
+
# TODO: use pipe option on later versions which support it
|
27
|
+
|
28
|
+
run_args = ["dependency","^#{name}$","--version",version]
|
29
29
|
run_args += additional_options
|
30
30
|
output_lines = @gem_runner_proxy.run(run_args)
|
31
31
|
# dependency output has all lines in the first element
|
@@ -48,9 +48,12 @@ module GemInstaller
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
def run_gem_command(gem_command,gem)
|
51
|
+
def run_gem_command(gem_command, gem, options)
|
52
52
|
run_args = [gem_command,gem.name,"--version", "#{gem.version}"]
|
53
|
-
|
53
|
+
if GemInstaller::RubyGemsVersionChecker.matches?('>=0.9.5')
|
54
|
+
run_args += ['--platform', "#{gem.platform}"]
|
55
|
+
end
|
56
|
+
run_args += options
|
54
57
|
@gem_runner_proxy.run(run_args)
|
55
58
|
end
|
56
59
|
end
|