geminstaller 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,6 @@
1
+ == 0.5.4 / 2009-11-15
2
+ * Add -b / --bundler-export option to create bundler Gemfile - but make sure you only include direct dependencies, and let bundler handle the rest!
3
+
1
4
  == 0.5.3 / 2009-08-25
2
5
  * Many long overdue bugfixes and patches, see http://tinyurl.com/geminstaller-0-5-3-release for details.
3
6
  * Thanks to Greg Fitzgerald, Britt Crawford, John Trupiano, Gabriel Gironda, and Eric Hodel for patches and assistance.
@@ -16,6 +16,7 @@ lib/geminstaller/application.rb
16
16
  lib/geminstaller/arg_parser.rb
17
17
  lib/geminstaller/autogem.rb
18
18
  lib/geminstaller/backward_compatibility.rb
19
+ lib/geminstaller/bundler_exporter.rb
19
20
  lib/geminstaller/config.rb
20
21
  lib/geminstaller/config_builder.rb
21
22
  lib/geminstaller/enhanced_stream_ui.rb
@@ -3,7 +3,7 @@
3
3
  dir = File.dirname(__FILE__)
4
4
 
5
5
  begin
6
- require 'geminstaller'
6
+ require ' geminstaller'
7
7
  rescue LoadError
8
8
  require 'rubygems'
9
9
  begin
@@ -34,7 +34,7 @@ module GemInstaller
34
34
  end
35
35
 
36
36
  def self.version
37
- "0.5.3"
37
+ "0.5.4"
38
38
  end
39
39
 
40
40
  def self.create_application(args = [], registry = nil)
@@ -1,7 +1,7 @@
1
1
  module GemInstaller
2
2
  class Application
3
3
  # we have accessors instead of just writers so that we can ensure it is assembled correctly in the dependency injector test
4
- attr_accessor :config_builder, :install_processor, :output_filter, :arg_parser, :args, :options, :rogue_gem_finder
4
+ attr_accessor :config_builder, :install_processor, :output_filter, :arg_parser, :args, :options, :rogue_gem_finder, :bundler_exporter
5
5
  attr_writer :autogem
6
6
 
7
7
  def initialize
@@ -14,6 +14,10 @@ module GemInstaller
14
14
  if exit_flag_and_return_code[0]
15
15
  return exit_flag_and_return_code[1]
16
16
  end
17
+ if @options[:bundler_export]
18
+ @bundler_exporter.output(@config_builder.build_config)
19
+ return 0
20
+ end
17
21
  gems = create_gems_from_config
18
22
  if @options[:print_rogue_gems]
19
23
  @rogue_gem_finder.print_rogue_gems(gems, @config_builder.config_file_paths_array)
@@ -47,6 +47,7 @@ module GemInstaller
47
47
  help_msg = "Show this message."
48
48
  print_rogue_gems_msg = "Print a report of all locally installed gems which are not specified\n" +
49
49
  " in the geminstaller config file."
50
+ bundler_export_msg = "Export a Bundler manifest Gemfile based on the geminstaller config"
50
51
  rubygems_output_msg = "Comma-delimited list of output types to show from internal:\n" +
51
52
  " RubyGems command invocation.\n" +
52
53
  " Examples:\n" +
@@ -88,6 +89,10 @@ module GemInstaller
88
89
  @options[:print_rogue_gems] = true
89
90
  end
90
91
 
92
+ opts.on("-b", "--bundler-export", bundler_export_msg) do
93
+ @options[:bundler_export] = true
94
+ end
95
+
91
96
  opts.on("-rTYPES", "--rubygems-output=TYPES", String, rubygems_output_msg) do |rubygems_output_flags|
92
97
  @unparsed_rubygems_output_flags = rubygems_output_flags
93
98
  end
@@ -39,7 +39,7 @@ module GemInstaller
39
39
  rescue Gem::Exception => e
40
40
  exception_message = e.message
41
41
  exception_message.strip!
42
- error_message = "Error: GemInstaller failed to actiate gem '#{name}', version '#{version}'. This is probably because GemInstaller processes gems in order (was alphabetical prior to 0.5.0), and an earlier gem in your geminstaller.yml config already activated another version. Use the 'gem dependency [-R]' command to track this down, and reorder/edit your config as necessary. Original Gem::Exception was: '#{exception_message}'"
42
+ error_message = "Error: GemInstaller failed to activate gem '#{name}', version '#{version}'. This may be because GemInstaller processes gems in order (was alphabetical prior to 0.5.0), and an earlier gem in your geminstaller.yml config already activated another version. Use the 'gem dependency [-R]' command to track this down, and reorder/edit your config as necessary. Original Gem::Exception was: '#{exception_message}'"
43
43
  raise GemInstaller::GemInstallerError.new(error_message)
44
44
  end
45
45
  end
@@ -8,3 +8,10 @@ else
8
8
  LIST_COMMAND_CLASS = Gem::Commands::ListCommand
9
9
  QUERY_COMMAND_CLASS = Gem::Commands::QueryCommand
10
10
  end
11
+
12
+ # >1.3.5 changed Gem::Version::Requirement to Gem::Requirement
13
+ if GemInstaller::RubyGemsVersionChecker.matches?('>1.3.5')
14
+ GemInstaller::REQUIREMENT_CLASS = Gem::Requirement
15
+ else
16
+ GemInstaller::REQUIREMENT_CLASS = Gem::Version::Requirement
17
+ end
@@ -0,0 +1,19 @@
1
+ module GemInstaller
2
+ class BundlerExporter
3
+ attr_writer :output_proxy
4
+
5
+ def output(config)
6
+ output_string = convert(config)
7
+ @output_proxy.sysout output_string
8
+ output_string
9
+ end
10
+
11
+ def convert(config)
12
+ manifest = ""
13
+ config.gems.each do |gem|
14
+ manifest += %Q{gem "#{gem.name}", "#{gem.version}"\n}
15
+ end
16
+ manifest
17
+ end
18
+ end
19
+ end
@@ -4,7 +4,7 @@ module GemInstaller
4
4
  attr_accessor :gem_runner, :gem_command_manager, :gem_list_checker, :app, :arg_parser, :options
5
5
  attr_accessor :install_processor, :missing_dependency_finder, :valid_platform_selector
6
6
  attr_accessor :output_listener, :outs_output_observer, :errs_output_observer, :output_filter, :autogem, :rogue_gem_finder
7
- attr_accessor :gem_spec_manager, :source_index_search_adapter
7
+ attr_accessor :gem_spec_manager, :source_index_search_adapter, :bundler_exporter
8
8
 
9
9
  if GemInstaller::RubyGemsVersionChecker.matches?('<=0.9.4')
10
10
  attr_accessor :gem_interaction_handler, :noninteractive_chooser
@@ -37,6 +37,9 @@ module GemInstaller
37
37
  @config_builder.file_reader = @file_reader
38
38
  @config_builder.yaml_loader = @yaml_loader
39
39
  @config_builder.output_filter = @output_filter
40
+
41
+ @bundler_exporter = GemInstaller::BundlerExporter.new
42
+ @bundler_exporter.output_proxy = @output_proxy
40
43
 
41
44
  @gem_source_index = Gem::SourceIndex.from_installed_gems
42
45
  @gem_source_index_proxy = GemInstaller::GemSourceIndexProxy.new
@@ -117,6 +120,7 @@ module GemInstaller
117
120
  @app = GemInstaller::Application.new
118
121
  @app.autogem = @autogem
119
122
  @app.rogue_gem_finder = @rogue_gem_finder
123
+ @app.bundler_exporter = @bundler_exporter
120
124
  @app.options = @options
121
125
  @app.arg_parser = @arg_parser
122
126
  @app.config_builder = @config_builder
@@ -46,6 +46,7 @@ require File.expand_path("#{dir}/../geminstaller")
46
46
  require File.expand_path("#{dir}/application")
47
47
  require File.expand_path("#{dir}/arg_parser")
48
48
  require File.expand_path("#{dir}/autogem")
49
+ require File.expand_path("#{dir}/bundler_exporter")
49
50
  require File.expand_path("#{dir}/config")
50
51
  require File.expand_path("#{dir}/config_builder")
51
52
  require File.expand_path("#{dir}/registry")
@@ -16,7 +16,7 @@ module GemInstaller
16
16
  config_match_found_for_local = false
17
17
  @config_gems_with_dependencies.each do |config_gem|
18
18
  name_matches = config_gem.name == local_gem.name
19
- config_gem_version_requirement = Gem::Version::Requirement.new [config_gem.version]
19
+ config_gem_version_requirement = GemInstaller::REQUIREMENT_CLASS.new [config_gem.version]
20
20
  local_gem_version = Gem::Version.new(local_gem.version)
21
21
  version_matches = config_gem_version_requirement.satisfied_by?(local_gem_version)
22
22
  if (name_matches and version_matches)
@@ -7,7 +7,15 @@ module GemInstaller
7
7
  # system-rubygems version instead of the geminstaller-overridden version. Need to figure out how
8
8
  # to re-parse 'rubygems/rubygems_version' and let it redefine 'Gem::RubyGemsVersion'
9
9
  rubygems_version = options[:rubygems_version] ||= Gem::RubyGemsVersion
10
- Gem::Version::Requirement.new(version_spec).satisfied_by?(Gem::Version.new(rubygems_version))
10
+
11
+ # Manually check here in addition to backward_compatibility.rb, to avoid circular dependency
12
+ if defined?(Gem::Requirement)
13
+ requirement_class = Gem::Requirement
14
+ else
15
+ requirement_class = Gem::Version::Requirement
16
+ end
17
+
18
+ requirement_class.new(version_spec).satisfied_by?(Gem::Version.new(rubygems_version))
11
19
  end
12
20
  end
13
21
  end
@@ -3,7 +3,7 @@ module GemInstaller
3
3
  # NOTE: available_versions should be sorted in descending order (highest versions first)
4
4
  # This method will return the first matching version
5
5
  def specify(version_requirement, available_versions, gem_name = nil)
6
- rubygems_version_requirement = Gem::Version::Requirement.new [version_requirement]
6
+ rubygems_version_requirement = GemInstaller::REQUIREMENT_CLASS.new [version_requirement]
7
7
  if available_versions.respond_to? :to_str
8
8
  available_versions = available_versions.split(', ')
9
9
  end
@@ -46,6 +46,8 @@ Please "report any others that you find":http://thewoolleyweb.lighthouseapp.com/
46
46
 
47
47
  h2(#history). History
48
48
 
49
+ * 0.5.4
50
+ ** Add -b / --bundler-export option to create bundler Gemfile - but make sure you only include direct dependencies, and let bundler handle the rest!
49
51
  * 0.5.3
50
52
  ** Many long overdue bugfixes and patches, see http://tinyurl.com/geminstaller-0-5-3-release for details.
51
53
  ** Thanks to Greg Fitzgerald, Britt Crawford, John Trupiano, Gabriel Gironda, and Eric Hodel for patches and assistance.
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geminstaller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 5
8
+ - 4
9
+ version: 0.5.4
5
10
  platform: ruby
6
11
  authors:
7
12
  - Chad Woolley
@@ -9,7 +14,7 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-08-25 00:00:00 -07:00
17
+ date: 2009-11-15 00:00:00 -07:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
@@ -44,6 +49,7 @@ files:
44
49
  - lib/geminstaller/arg_parser.rb
45
50
  - lib/geminstaller/autogem.rb
46
51
  - lib/geminstaller/backward_compatibility.rb
52
+ - lib/geminstaller/bundler_exporter.rb
47
53
  - lib/geminstaller/config.rb
48
54
  - lib/geminstaller/config_builder.rb
49
55
  - lib/geminstaller/enhanced_stream_ui.rb
@@ -116,14 +122,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
116
122
  requirements:
117
123
  - - ">="
118
124
  - !ruby/object:Gem::Version
125
+ segments:
126
+ - 0
119
127
  version: "0"
120
- version:
121
128
  required_rubygems_version: !ruby/object:Gem::Requirement
122
129
  requirements:
123
130
  - - ">="
124
131
  - !ruby/object:Gem::Version
132
+ segments:
133
+ - 0
125
134
  version: "0"
126
- version:
127
135
  requirements: []
128
136
 
129
137
  rubyforge_project: geminstaller