diff options
author | Andre Arko <andre@arko.net> | 2015-07-18 16:42:16 -0600 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2015-07-18 16:44:56 -0600 |
commit | 14a7eb25ee03c9fb4ecf3e4c6b1f44a8267a413a (patch) | |
tree | 080c4590629671f0bf0fc23225b9b4b5e5e16e95 | |
parent | 6537566d7179d3aee3451ece710cbe79ced95d4c (diff) | |
download | bundler-14a7eb25ee03c9fb4ecf3e4c6b1f44a8267a413a.tar.gz |
Fix Style/SpaceInsideBlockBraces
closes #3850
52 files changed, 152 insertions, 155 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index d5e7780e..b4b986c6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -21,6 +21,9 @@ Lint/EndAlignment: Style/MultilineOperationIndentation: EnforcedStyle: indented +Style/SpaceInsideBlockBraces: + SpaceBeforeBlockParameters: false + # We adopted raise instead of fail. Style/SignalException: EnforcedStyle: only_raise diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 2512c96e..bf81c967 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -439,12 +439,6 @@ Style/SpaceAroundOperators: Style/SpaceBeforeBlockBraces: Enabled: false -# Offense count: 117 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. -Style/SpaceInsideBlockBraces: - Enabled: false - # Offense count: 4 # Cop supports --auto-correct. Style/SpaceInsideStringInterpolation: @@ -31,7 +31,7 @@ def clean_files(files, regex, replacement = "") files.each do |file| contents = File.read(file) contents.gsub!(regex, replacement) - File.open(file, "w") { |f| f << contents } + File.open(file, "w") {|f| f << contents } end end @@ -43,7 +43,7 @@ namespace :molinillo do end task :clean do - files = Dir.glob("lib/bundler/vendor/molinillo*/*", File::FNM_DOTMATCH).reject { |f| %(. .. lib).include? f.split("/").last } + files = Dir.glob("lib/bundler/vendor/molinillo*/*", File::FNM_DOTMATCH).reject {|f| %(. .. lib).include? f.split("/").last } rm_r files end @@ -68,7 +68,7 @@ namespace :thor do end task :clean do - files = Dir.glob("lib/bundler/vendor/thor*/*", File::FNM_DOTMATCH).reject { |f| %(. .. lib).include? f.split("/").last } + files = Dir.glob("lib/bundler/vendor/thor*/*", File::FNM_DOTMATCH).reject {|f| %(. .. lib).include? f.split("/").last } rm_r files end @@ -318,7 +318,7 @@ begin rm_rf "lib/bundler/man" end - task(:require) { } + task(:require) {} end rescue LoadError diff --git a/bundler.gemspec b/bundler.gemspec index 0190b3a2..3f069b90 100644 --- a/bundler.gemspec +++ b/bundler.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |s| s.add_development_dependency "ronn", "~> 0.7.3" s.add_development_dependency "rspec", "~> 3.0" - s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) } # we don't check in man pages, but we need to ship them because # we use them to generate the long-form help for each command. s.files += Dir.glob("lib/bundler/man/**/*") diff --git a/exe/bundle_ruby b/exe/bundle_ruby index 734e5a78..9356d7ed 100755 --- a/exe/bundle_ruby +++ b/exe/bundle_ruby @@ -18,7 +18,7 @@ module Bundler end def eval_gemfile(gemfile, contents = nil) - contents ||= File.open(gemfile, "rb") { |f| f.read } + contents ||= File.open(gemfile, "rb") {|f| f.read } instance_eval(contents, gemfile.to_s, 1) rescue SyntaxError => e bt = e.message.split("\n")[1..-1] diff --git a/lib/bundler.rb b/lib/bundler.rb index f2df9a76..8a8741ed 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -251,7 +251,7 @@ module Bundler def with_clean_env with_original_env do ENV["MANPATH"] = ENV["BUNDLE_ORIG_MANPATH"] - ENV.delete_if { |k,_| k[0,7] == "BUNDLE_" } + ENV.delete_if {|k,_| k[0,7] == "BUNDLE_" } if ENV.has_key? "RUBYOPT" ENV["RUBYOPT"] = ENV["RUBYOPT"].sub "-rbundler/setup", "" ENV["RUBYOPT"] = ENV["RUBYOPT"].sub "-I#{File.expand_path("..", __FILE__)}", "" @@ -352,7 +352,7 @@ module Bundler end def read_file(file) - File.open(file, "rb") { |f| f.read } + File.open(file, "rb") {|f| f.read } end def load_marshal(data) @@ -419,7 +419,7 @@ module Bundler def eval_gemspec(path, contents) eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s) rescue ScriptError, StandardError => e - original_line = e.backtrace.find { |line| line.include?(path.to_s) } + original_line = e.backtrace.find {|line| line.include?(path.to_s) } msg = "There was a #{e.class} while loading #{path.basename}: \n#{e.message}" msg << " from\n #{original_line}" if original_line msg << "\n" diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index cdccdf8e..bbc0fac6 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -316,7 +316,7 @@ module Bundler desc "licenses", "Prints the license of all gems in the bundle" def licenses - Bundler.load.specs.sort_by { |s| s.license.to_s }.reverse.each do |s| + Bundler.load.specs.sort_by {|s| s.license.to_s }.reverse.each do |s| gem_name = s.name license = s.license || s.licenses diff --git a/lib/bundler/cli/check.rb b/lib/bundler/cli/check.rb index da008863..996f5e9d 100644 --- a/lib/bundler/cli/check.rb +++ b/lib/bundler/cli/check.rb @@ -22,7 +22,7 @@ module Bundler if not_installed.any? Bundler.ui.error "The following gems are missing" - not_installed.each { |s| Bundler.ui.error " * #{s.name} (#{s.version})" } + not_installed.each {|s| Bundler.ui.error " * #{s.name} (#{s.version})" } Bundler.ui.warn "Install missing gems with `bundle install`" exit 1 elsif !Bundler.default_lockfile.exist? && Bundler.settings[:frozen] diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb index 28dce524..40d52932 100644 --- a/lib/bundler/cli/common.rb +++ b/lib/bundler/cli/common.rb @@ -46,7 +46,7 @@ module Bundler def self.gem_not_found_message(missing_gem_name, alternatives) require "bundler/similarity_detector" message = "Could not find gem '#{missing_gem_name}'." - alternate_names = alternatives.map { |a| a.respond_to?(:name) ? a.name : a } + alternate_names = alternatives.map {|a| a.respond_to?(:name) ? a.name : a } suggestions = SimilarityDetector.new(alternate_names).similar_word_list(missing_gem_name) message += "\nDid you mean #{suggestions}?" if suggestions message diff --git a/lib/bundler/cli/config.rb b/lib/bundler/cli/config.rb index 7dcdea3f..91633b02 100644 --- a/lib/bundler/cli/config.rb +++ b/lib/bundler/cli/config.rb @@ -41,7 +41,7 @@ module Bundler if args.empty? Bundler.ui.confirm "Settings for `#{name}` in order of priority. The top value will be used" thor.with_padding do - Bundler.settings.pretty_values_for(name).each { |line| Bundler.ui.info line } + Bundler.settings.pretty_values_for(name).each {|line| Bundler.ui.info line } end return end diff --git a/lib/bundler/cli/inject.rb b/lib/bundler/cli/inject.rb index e4660b37..2f797be7 100644 --- a/lib/bundler/cli/inject.rb +++ b/lib/bundler/cli/inject.rb @@ -23,7 +23,7 @@ module Bundler if added.any? Bundler.ui.confirm "Added to Gemfile:" - Bundler.ui.confirm added.map{ |g| " #{g}" }.join("\n") + Bundler.ui.confirm added.map{|g| " #{g}" }.join("\n") else Bundler.ui.confirm "All injected gems were already present in the Gemfile" end diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index be4ee3d1..f4b1880a 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -128,7 +128,7 @@ module Bundler Bundler.ui.error "Warning: the gem '#{name}' was found in multiple sources." Bundler.ui.error "Installed from: #{installed_from_uri}" Bundler.ui.error "Also found in:" - also_found_in_uris.each { |uri| Bundler.ui.error " * #{uri}" } + also_found_in_uris.each {|uri| Bundler.ui.error " * #{uri}" } Bundler.ui.error "You should add a source requirement to restrict this gem to your preferred source." Bundler.ui.error "For example:" Bundler.ui.error " gem '#{name}', :source => '#{installed_from_uri}'" diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb index 9b820796..b80519fb 100644 --- a/lib/bundler/cli/outdated.rb +++ b/lib/bundler/cli/outdated.rb @@ -18,7 +18,7 @@ module Bundler Bundler.definition.validate_ruby! current_specs = Bundler.ui.silence { Bundler.load.specs } current_dependencies = {} - Bundler.ui.silence { Bundler.load.dependencies.each { |dep| current_dependencies[dep.name] = dep } } + Bundler.ui.silence { Bundler.load.dependencies.each {|dep| current_dependencies[dep.name] = dep } } if gems.empty? && sources.empty? # We're doing a full update @@ -32,18 +32,18 @@ module Bundler out_count = 0 # Loop through the current specs - gemfile_specs, dependency_specs = current_specs.partition { |spec| current_dependencies.has_key? spec.name } + gemfile_specs, dependency_specs = current_specs.partition {|spec| current_dependencies.has_key? spec.name } [gemfile_specs.sort_by(&:name), dependency_specs.sort_by(&:name)].flatten.each do |current_spec| next if !gems.empty? && !gems.include?(current_spec.name) dependency = current_dependencies[current_spec.name] if options["strict"] - active_spec = definition.specs.detect { |spec| spec.name == current_spec.name } + active_spec = definition.specs.detect {|spec| spec.name == current_spec.name } else active_spec = definition.index[current_spec.name].sort_by(&:version) if !current_spec.version.prerelease? && !options[:pre] && active_spec.size > 1 - active_spec = active_spec.delete_if { |b| b.respond_to?(:version) && b.version.prerelease? } + active_spec = active_spec.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? } end active_spec = active_spec.last end diff --git a/lib/bundler/cli/show.rb b/lib/bundler/cli/show.rb index 824b3936..7c72c8d3 100644 --- a/lib/bundler/cli/show.rb +++ b/lib/bundler/cli/show.rb @@ -39,7 +39,7 @@ module Bundler Bundler.load.specs.sort_by(&:name).each do |s| desc = " * #{s.name} (#{s.version}#{s.git_version})" if @verbose - latest = latest_specs.find { |l| l.name == s.name } + latest = latest_specs.find {|l| l.name == s.name } Bundler.ui.info <<-END.gsub(/^ +/, "") #{desc} \tSummary: #{s.summary || "No description available."} diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 45a4df1d..47e4cdce 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -85,7 +85,7 @@ module Bundler @unlock[:gems] ||= [] @unlock[:sources] ||= [] - current_platform = Bundler.rubygems.platforms.map { |p| generic(p) }.compact.last + current_platform = Bundler.rubygems.platforms.map {|p| generic(p) }.compact.last @new_platform = !@platforms.include?(current_platform) @platforms |= [current_platform] @@ -109,7 +109,7 @@ module Bundler # with a mismatch on #type. # Test coverage to catch a regression on this is in gemspec_spec.rb @dependencies.each do |d| - if ld = @locked_deps.find { |l| l.name == d.name } + if ld = @locked_deps.find {|l| l.name == d.name } ld.instance_variable_set(:@type, d.type) end end @@ -175,12 +175,12 @@ module Bundler end def current_dependencies - dependencies.reject { |d| !d.should_include? } + dependencies.reject {|d| !d.should_include? } end def specs_for(groups) - deps = dependencies.select { |d| (d.groups & groups).any? } - deps.delete_if { |d| !d.should_include? } + deps = dependencies.select {|d| (d.groups & groups).any? } + deps.delete_if {|d| !d.should_include? } specs.for(expand_dependencies(deps)) end @@ -288,7 +288,7 @@ module Bundler out << source.to_lock # Find all specs for this source resolve. - select { |s| source.can_lock?(s) }. + select {|s| source.can_lock?(s) }. # This needs to be sorted by full name so that # gems with the same name, but different platform # are ordered consistently @@ -345,11 +345,11 @@ module Bundler deleted_sources = @locked_sources - gemfile_sources if new_sources.any? - added.concat new_sources.map { |source| "* source: #{source}" } + added.concat new_sources.map {|source| "* source: #{source}" } end if deleted_sources.any? - deleted.concat deleted_sources.map { |source| "* source: #{source}" } + deleted.concat deleted_sources.map {|source| "* source: #{source}" } end end @@ -357,16 +357,16 @@ module Bundler deleted_deps = @locked_deps - @dependencies if new_deps.any? - added.concat new_deps.map { |d| "* #{pretty_dep(d)}" } + added.concat new_deps.map {|d| "* #{pretty_dep(d)}" } end if deleted_deps.any? - deleted.concat deleted_deps.map { |d| "* #{pretty_dep(d)}" } + deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } end - both_sources = Hash.new { |h,k| h[k] = [] } - @dependencies.each { |d| both_sources[d.name][0] = d } - @locked_deps.each { |d| both_sources[d.name][1] = d.source } + both_sources = Hash.new {|h,k| h[k] = [] } + @dependencies.each {|d| both_sources[d.name][0] = d } + @locked_deps.each {|d| both_sources[d.name][1] = d.source } both_sources.each do |name, (dep, lock_source)| if (dep.nil? && !lock_source.nil?) || (!dep.nil? && !lock_source.nil? && !lock_source.can_lock?(dep)) @@ -442,8 +442,8 @@ module Bundler end def dependencies_for_source_changed?(source) - deps_for_source = @dependencies.select { |s| s.source == source } - locked_deps_for_source = @locked_deps.select { |s| s.source == source } + deps_for_source = @dependencies.select {|s| s.source == source } + locked_deps_for_source = @locked_deps.select {|s| s.source == source } deps_for_source != locked_deps_for_source end @@ -455,7 +455,7 @@ module Bundler locals = [] Bundler.settings.local_overrides.map do |k,v| - spec = @dependencies.find { |s| s.name == k } + spec = @dependencies.find {|s| s.name == k } source = spec && spec.source if source && source.respond_to?(:local_override!) source.unlock! if @unlock[:gems].include?(spec.name) @@ -464,7 +464,7 @@ module Bundler end locals.any? do |source, changed| - changed || specs_changed?(source) { |o| source.class == o.class && source.uri == o.uri } + changed || specs_changed?(source) {|o| source.class == o.class && source.uri == o.uri } end end @@ -480,7 +480,7 @@ module Bundler changes = false # Get the Rubygems sources from the Gemfile.lock - locked_gem_sources = @locked_sources.select { |s| s.kind_of?(Source::Rubygems) } + locked_gem_sources = @locked_sources.select {|s| s.kind_of?(Source::Rubygems) } # Get the Rubygems remotes from the Gemfile actual_remotes = sources.rubygems_remotes @@ -531,7 +531,7 @@ module Bundler # and Gemfile.lock. If the Gemfile modified a dependency, but # the gem in the Gemfile.lock still satisfies it, this is fine # too. - locked_deps_hash = @locked_deps.inject({}) { |hsh, dep| hsh[dep] = dep; hsh } + locked_deps_hash = @locked_deps.inject({}) {|hsh, dep| hsh[dep] = dep; hsh } @dependencies.each do |dep| locked_dep = locked_deps_hash[dep] @@ -543,14 +543,14 @@ module Bundler end dep.source.unlock! if dep.source.respond_to?(:unlock!) - dep.source.specs.each { |s| @unlock[:gems] << s.name } + dep.source.specs.each {|s| @unlock[:gems] << s.name } end end converged = [] @locked_specs.each do |s| # Replace the locked dependency's source with the equivalent source from the Gemfile - dep = @dependencies.find { |d| s.satisfies?(d) } + dep = @dependencies.find {|d| s.satisfies?(d) } s.source = (dep && dep.source) || sources.get(s.source) # Don't add a spec to the list if its source is expired. For example, @@ -567,7 +567,7 @@ module Bundler # commonly happens if the version changed in the gemspec next unless other - deps2 = other.dependencies.select { |d| d.type != :development } + deps2 = other.dependencies.select {|d| d.type != :development } # If the dependencies of the path source have changed, unlock it next unless s.dependencies.sort == deps2.sort end @@ -583,8 +583,8 @@ module Bundler sources.all_sources.each do |source| next unless source.respond_to?(:unlock!) - unless resolve.any? { |s| s.source == source } - source.unlock! if !diff.empty? && diff.any? { |s| s.source == source } + unless resolve.any? {|s| s.source == source } + source.unlock! if !diff.empty? && diff.any? {|s| s.source == source } end end @@ -599,7 +599,7 @@ module Bundler end def satisfies_locked_spec?(dep) - @locked_specs.any? { |s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) } + @locked_specs.any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) } end def expanded_dependencies @@ -621,7 +621,7 @@ module Bundler def requested_dependencies groups = requested_groups groups.map!(&:to_sym) - dependencies.reject { |d| !d.should_include? || (d.groups & groups).empty? } + dependencies.reject {|d| !d.should_include? || (d.groups & groups).empty? } end def source_requirements diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 750c549d..01b3c213 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -79,7 +79,7 @@ module Bundler dep = Dependency.new(name, version, options) # if there's already a dependency with this name we try to prefer one - if current = @dependencies.find { |d| d.name == dep.name } + if current = @dependencies.find {|d| d.name == dep.name } if current.requirement != dep.requirement if current.type == :development @dependencies.delete current @@ -216,7 +216,7 @@ module Bundler "git://github.com/#{repo_name}.git" end - git_source(:gist){ |repo_name| "https://gist.github.com/#{repo_name}.git" } + git_source(:gist){|repo_name| "https://gist.github.com/#{repo_name}.git" } git_source(:bitbucket) do |repo_name| user_name, repo_name = repo_name.split "/" @@ -432,7 +432,7 @@ module Bundler return m unless backtrace && dsl_path && contents - trace_line = backtrace.find { |l| l.include?(dsl_path.to_s) } || trace_line + trace_line = backtrace.find {|l| l.include?(dsl_path.to_s) } || trace_line return m unless trace_line line_numer = trace_line.split(":")[1].to_i - 1 return m unless line_numer diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index 7592d173..120f2a27 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -132,7 +132,7 @@ module Bundler if remote_uri.scheme == "file" || Bundler::Fetcher.disable_endpoint @use_api = false else - fetchers.reject! { |f| f.api_fetcher? && !f.api_available? } + fetchers.reject! {|f| f.api_fetcher? && !f.api_available? } @use_api = fetchers.any?(&:api_fetcher?) end end @@ -169,7 +169,7 @@ module Bundler end def fetchers - @fetchers ||= FETCHERS.map { |f| f.new(downloader, remote_uri, fetch_uri, uri) } + @fetchers ||= FETCHERS.map {|f| f.new(downloader, remote_uri, fetch_uri, uri) } end def inspect @@ -192,7 +192,7 @@ module Bundler "CI_NAME" => ENV["CI_NAME"], "CI" => "ci" } - env_cis.find_all{ |env, ci| ENV[env]}.map{ |env, ci| ci } + env_cis.find_all{|env, ci| ENV[env] }.map{|env, ci| ci } end def connection @@ -224,7 +224,7 @@ module Bundler # cached gem specification path, if one exists def gemspec_cached_path spec_file_name - paths = Bundler.rubygems.spec_cache_dirs.map { |dir| File.join(dir, spec_file_name) } + paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) } paths = paths.select {|path| File.file? path } paths.first end @@ -247,7 +247,7 @@ module Bundler else store.set_default_paths certs = File.expand_path("../ssl_certs/*.pem", __FILE__) - Dir.glob(certs).each { |c| store.add_file c } + Dir.glob(certs).each {|c| store.add_file c } end store end diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb index 58d4b209..b7bd92e6 100644 --- a/lib/bundler/gem_helper.rb +++ b/lib/bundler/gem_helper.rb @@ -100,7 +100,7 @@ module Bundler end def built_gem_path - Dir[File.join(base, "#{name}-*.gem")].sort_by{|f| File.mtime(f)}.last + Dir[File.join(base, "#{name}-*.gem")].sort_by{|f| File.mtime(f) }.last end def git_push(remote = "") diff --git a/lib/bundler/graph.rb b/lib/bundler/graph.rb index 8b1b36d3..78d6f21b 100644 --- a/lib/bundler/graph.rb +++ b/lib/bundler/graph.rb @@ -12,7 +12,7 @@ module Bundler @without_groups = without.map(&:to_sym) @groups = [] - @relations = Hash.new {|h, k| h[k] = Set.new} + @relations = Hash.new {|h, k| h[k] = Set.new } @node_options = {} @edge_options = {} @@ -54,7 +54,7 @@ module Bundler end def _groups - relations = Hash.new {|h, k| h[k] = Set.new} + relations = Hash.new {|h, k| h[k] = Set.new } @env.current_dependencies.each do |dependency| dependency.groups.each do |group| next if @without_groups.include?(group) diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb index 5091d0a1..9385ff12 100644 --- a/lib/bundler/index.rb +++ b/lib/bundler/index.rb @@ -16,16 +16,16 @@ module Bundler def initialize @sources = [] @cache = {} - @specs = Hash.new { |h,k| h[k] = Hash.new } - @all_specs = Hash.new { |h,k| h[k] = [] } + @specs = Hash.new {|h,k| h[k] = Hash.new } + @all_specs = Hash.new {|h,k| h[k] = [] } end def initialize_copy(o) super @sources = @sources.dup @cache = {} - @specs = Hash.new { |h,k| h[k] = Hash.new } - @all_specs = Hash.new { |h,k| h[k] = [] } + @specs = Hash.new {|h,k| h[k] = Hash.new } + @all_specs = Hash.new {|h,k| h[k] = [] } o.specs.each do |name, hash| @specs[name] = hash.dup @@ -56,7 +56,7 @@ module Bundler # about, returning all of the results. def search(query, base = nil) results = local_search(query, base) - seen = Set.new(results.map { |spec| [spec.name, spec.version, spec.platform] }) + seen = Set.new(results.map {|spec| [spec.name, spec.version, spec.platform] }) @sources.each do |source| source.search(query, base).each do |spec| @@ -165,7 +165,7 @@ module Bundler only_prerelease = specs.all? {|spec| spec.version.prerelease? } unless wants_prerelease || only_prerelease - found.reject! { |spec| spec.version.prerelease? } + found.reject! {|spec| spec.version.prerelease? } end found diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb index c152a7ea..fdc1ece7 100644 --- a/lib/bundler/installer/parallel_installer.rb +++ b/lib/bundler/installer/parallel_installer.rb @@ -63,7 +63,7 @@ class ParallelInstaller @size = size @standalone = standalone @force = force - @specs = all_specs.map { |s| SpecInstallation.new(s) } + @specs = all_specs.map {|s| SpecInstallation.new(s) } end def call diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb index ee6b159b..f0d591a4 100644 --- a/lib/bundler/lockfile_parser.rb +++ b/lib/bundler/lockfile_parser.rb @@ -102,7 +102,7 @@ module Bundler @current_source = TYPES[@type].from_lock(@opts) # Strip out duplicate GIT sections if @sources.include?(@current_source) - @current_source = @sources.find { |s| s == @current_source } + @current_source = @sources.find {|s| s == @current_source } else @sources << @current_source end diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index 68eff387..6e04326a 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -82,7 +82,7 @@ module Bundler @specs = {} ALL.each do |p| - @specs[p] = reverse.find { |s| s.match_platform(p) } + @specs[p] = reverse.find {|s| s.match_platform(p) } end end @@ -139,11 +139,11 @@ module Bundler end def dependencies_for_activated_platforms - @activated.map { |p| __dependencies[p] }.flatten + @activated.map {|p| __dependencies[p] }.flatten end def platforms_for_dependency_named(dependency) - __dependencies.select { |p, deps| deps.map(&:name).include? dependency }.keys + __dependencies.select {|p, deps| deps.map(&:name).include? dependency }.keys end private @@ -189,7 +189,7 @@ module Bundler @resolver = Molinillo::Resolver.new(self, self) @search_for = {} @base_dg = Molinillo::DependencyGraph.new - @base.each { |ls| @base_dg.add_root_vertex ls.name, Dependency.new(ls.name, ls.version) } + @base.each {|ls| @base_dg.add_root_vertex ls.name, Dependency.new(ls.name, ls.version) } end def start(requirements) @@ -199,7 +199,7 @@ module Bundler rescue Molinillo::VersionConflict => e raise VersionConflict.new(e.conflicts.keys.uniq, e.message) rescue Molinillo::CircularDependencyError => e - names = e.dependencies.sort_by(&:name).map { |d| "gem '#{d.name}'"} + names = e.dependencies.sort_by(&:name).map {|d| "gem '#{d.name}'" } raise CyclicDependencyError, "Your bundle requires gems that depend" \ " on each other, creating an infinite loop. Please remove" \ " #{names.count > 1 ? "either " : "" }#{names.join(" or ")}" \ @@ -216,7 +216,7 @@ module Bundler if debug? debug_info = yield debug_info = debug_info.inspect unless debug_info.is_a?(String) - STDERR.puts debug_info.split("\n").map { |s| " " * depth + s } + STDERR.puts debug_info.split("\n").map {|s| " " * depth + s } end end @@ -263,13 +263,13 @@ module Bundler end nested.last << spec end - groups = nested.map { |a| SpecGroup.new(a) } - !locked_requirement ? groups : groups.select { |sg| locked_requirement.satisfied_by? sg.version } + groups = nested.map {|a| SpecGroup.new(a) } + !locked_requirement ? groups : groups.select {|sg| locked_requirement.satisfied_by? sg.version } else [] end end - search.select { |sg| sg.for?(platform) }.each { |sg| sg.activate_platform(platform) } + search.select {|sg| sg.for?(platform) }.each {|sg| sg.activate_platform(platform) } end def name_for(dependency) diff --git a/lib/bundler/retry.rb b/lib/bundler/retry.rb index 75365070..25141f52 100644 --- a/lib/bundler/retry.rb +++ b/lib/bundler/retry.rb @@ -44,7 +44,7 @@ module Bundler def fail(e) @failed = true - raise e if last_attempt? || @exceptions.any?{ |k| e.is_a?(k) } + raise e if last_attempt? || @exceptions.any?{|k| e.is_a?(k) } return true unless name Bundler.ui.warn "Retrying#{" #{name}" if name} due to error (#{current_run.next}/#{total_runs}): #{e.class} #{e.message}" end diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index cf3d36d9..6d5d3890 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -10,7 +10,7 @@ require "rubygems/specification" require "bundler/match_platform" module Gem - @loaded_stacks = Hash.new { |h,k| h[k] = [] } + @loaded_stacks = Hash.new {|h,k| h[k] = [] } class Specification attr_accessor :remote, :location, :relative_loaded_from @@ -116,7 +116,7 @@ module Gem end def to_yaml_properties - instance_variables.reject { |p| ["@source", "@groups"].include?(p.to_s) } + instance_variables.reject {|p| ["@source", "@groups"].include?(p.to_s) } end def to_lock diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 3d99ad9b..69b421d4 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -116,9 +116,9 @@ module Bundler def spec_cache_dirs @spec_cache_dirs ||= begin - dirs = gem_path.map {|dir| File.join(dir, "specifications")} + dirs = gem_path.map {|dir| File.join(dir, "specifications") } dirs << Gem.spec_cache_dir if Gem.respond_to?(:spec_cache_dir) # Not in Rubygems 2.0.3 or earlier - dirs.uniq.select {|dir| File.directory? dir} + dirs.uniq.select {|dir| File.directory? dir } end end @@ -151,7 +151,7 @@ module Bundler # RubyGems 2.2+ can put binary extension into dedicated folders, # therefore use RubyGems facilities to obtain their load paths. if Gem::Specification.method_defined? :full_require_paths - loaded_gem_paths = Gem.loaded_specs.map {|n, s| s.full_require_paths} + loaded_gem_paths = Gem.loaded_specs.map {|n, s| s.full_require_paths } loaded_gem_paths.flatten else $LOAD_PATH.select do |p| @@ -239,7 +239,7 @@ module Bundler end def security_policy_keys - %w{High Medium Low AlmostNo No}.map { |level| "#{level}Security" } + %w{High Medium Low AlmostNo No}.map {|level| "#{level}Security" } end def security_policies @@ -278,7 +278,7 @@ module Bundler dep = Gem::Dependency.new(dep, reqs) end - spec = specs.find { |s| s.name == dep.name } + spec = specs.find {|s| s.name == dep.name } if spec.nil? @@ -341,7 +341,7 @@ module Bundler spec = nil if exec_name - spec = specs.find { |s| s.executables.include?(exec_name) } + spec = specs.find {|s| s.executables.include?(exec_name) } spec or raise Gem::Exception, "can't find executable #{exec_name}" unless spec.name == name warn "Bundler is using a binstub that was created for a different gem.\n" \ @@ -349,7 +349,7 @@ module Bundler "to work around a system/bundle conflict." end else - spec = specs.find { |s| s.name == name } + spec = specs.find {|s| s.name == name } exec_name = spec.default_executable or raise Gem::Exception, "no default executable for #{spec.full_name}" end @@ -363,7 +363,7 @@ module Bundler # we don't #refresh, so stub it out. def replace_refresh gem_class = (class << Gem; self; end) - redefine_method(gem_class, :refresh) { } + redefine_method(gem_class, :refresh) {} end # Replace or hook into Rubygems to provide a bundlerized view diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index ee260fbc..5c06685c 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -35,7 +35,7 @@ module Bundler end Bundler.rubygems.mark_loaded(spec) - load_paths = spec.load_paths.reject {|path| $LOAD_PATH.include?(path)} + load_paths = spec.load_paths.reject {|path| $LOAD_PATH.include?(path) } $LOAD_PATH.unshift(*load_paths) end @@ -76,7 +76,7 @@ module Bundler Kernel.require file end rescue LoadError => e - REQUIRE_ERRORS.find { |r| r =~ e.message } + REQUIRE_ERRORS.find {|r| r =~ e.message } raise if dep.autorequire || $1 != required_file if dep.autorequire.nil? && dep.name.include?("-") @@ -84,7 +84,7 @@ module Bundler namespaced_file = dep.name.gsub("-", "/") Kernel.require namespaced_file rescue LoadError => e - REQUIRE_ERRORS.find { |r| r =~ e.message } + REQUIRE_ERRORS.find {|r| r =~ e.message } raise if $1 != namespaced_file end end @@ -96,7 +96,7 @@ module Bundler if groups.empty? dependencies else - dependencies.select { |d| (groups & d.groups).any? } + dependencies.select {|d| (groups & d.groups).any? } end end @@ -200,10 +200,10 @@ module Bundler end unless dry_run - stale_gem_bins.each { |bin| FileUtils.rm(bin) if File.exist?(bin) } - stale_gem_files.each { |file| FileUtils.rm(file) if File.exist?(file) } - stale_gemspec_files.each { |file| FileUtils.rm(file) if File.exist?(file) } - stale_git_cache_dirs.each { |dir| FileUtils.rm_rf(dir) if File.exist?(dir) } + stale_gem_bins.each {|bin| FileUtils.rm(bin) if File.exist?(bin) } + stale_gem_files.each {|file| FileUtils.rm(file) if File.exist?(file) } + stale_gemspec_files.each {|file| FileUtils.rm(file) if File.exist?(file) } + stale_git_cache_dirs.each {|dir| FileUtils.rm_rf(dir) if File.exist?(dir) } end output diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 981ba447..14d3f4d6 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -42,7 +42,7 @@ module Bundler end def all - env_keys = ENV.keys.select { |k| k =~ /BUNDLE_.*/ } + env_keys = ENV.keys.select {|k| k =~ /BUNDLE_.*/ } keys = @global_config.keys | @local_config.keys | env_keys @@ -208,7 +208,7 @@ module Bundler hash.delete(key) if value.nil? FileUtils.mkdir_p(file.dirname) require "bundler/psyched_yaml" - File.open(file, "w") { |f| f.puts YAML.dump(hash) } + File.open(file, "w") {|f| f.puts YAML.dump(hash) } end value diff --git a/lib/bundler/similarity_detector.rb b/lib/bundler/similarity_detector.rb index d67bfbae..c4caab71 100644 --- a/lib/bundler/similarity_detector.rb +++ b/lib/bundler/similarity_detector.rb @@ -9,8 +9,8 @@ module Bundler # return an array of words similar to 'word' from the corpus def similar_words(word, limit = 3) - words_by_similarity = @corpus.map{|w| SimilarityScore.new(w, levenshtein_distance(word, w))} - words_by_similarity.select{|s| s.distance<=limit}.sort_by(&:distance).map(&:string) + words_by_similarity = @corpus.map{|w| SimilarityScore.new(w, levenshtein_distance(word, w)) } + words_by_similarity.select{|s| s.distance<=limit }.sort_by(&:distance).map(&:string) end # return the result of 'similar_words', concatenated into a list @@ -34,7 +34,7 @@ module Bundler dm = [] # distance matrix # Initialize first row values - dm[0] = (0..this.length).collect { |i| i * ins } + dm[0] = (0..this.length).collect {|i| i * ins } fill = [0] * (this.length - 1) # Initialize first column values diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index 73aab9b8..0bcf9c3c 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -14,7 +14,7 @@ module Bundler message = "#{spec.name} #{spec.version}" if Bundler.locked_gems - locked_spec = Bundler.locked_gems.specs.find { |s| s.name == spec.name } + locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name } locked_spec_version = locked_spec.version if locked_spec if locked_spec_version && spec.version != locked_spec_version message << " (was #{locked_spec_version})" diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index 28c03f6e..f0447215 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -140,11 +140,11 @@ module Bundler if Bundler::WINDOWS # Windows quoting requires double quotes only, with double quotes # inside the string escaped by being doubled. - '"' + uri.gsub('"') {|s| '""'} + '"' + '"' + uri.gsub('"') {|s| '""' } + '"' else # Bash requires single quoted strings, with the single quotes escaped # by ending the string, escaping the quote, and restarting the string. - "'" + uri.gsub("'") {|s| "'\\''"} + "'" + "'" + uri.gsub("'") {|s| "'\\''" } + "'" end end diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index 21e16ba6..9ec140f3 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -131,7 +131,7 @@ module Bundler if File.directory?(expanded_path) # We sort depth-first since `<<` will override the earlier-found specs - Dir["#{expanded_path}/#{@glob}"].sort_by { |p| -p.split(File::SEPARATOR).size }.each do |file| + Dir["#{expanded_path}/#{@glob}"].sort_by {|p| -p.split(File::SEPARATOR).size }.each do |file| if spec = Bundler.load_gemspec(file, :validate) spec.loaded_from = file.to_s spec.source = self diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index ec52c918..aec68776 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -249,8 +249,8 @@ module Bundler end def cached_path(spec) - possibilities = @caches.map { |p| "#{p}/#{spec.file_name}" } - possibilities.find { |p| File.exist?(p) } + possibilities = @caches.map {|p| "#{p}/#{spec.file_name}" } + possibilities.find {|p| File.exist?(p) } end def normalize_uri(uri) @@ -262,7 +262,7 @@ module Bundler end def suppress_configured_credentials(remote) - remote_nouser = remote.dup.tap { |uri| uri.user = uri.password = nil }.to_s + remote_nouser = remote.dup.tap {|uri| uri.user = uri.password = nil }.to_s if remote.userinfo && remote.userinfo == Bundler.settings[remote_nouser] remote_nouser else diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb index 49efbf7a..60625bb7 100644 --- a/lib/bundler/source_list.rb +++ b/lib/bundler/source_list.rb @@ -40,7 +40,7 @@ module Bundler end def get(source) - source_list_for(source).find { |s| source == s } + source_list_for(source).find {|s| source == s } end def lock_sources @@ -53,12 +53,12 @@ module Bundler [path_sources, git_sources].each do |source_list| source_list.map! do |source| - replacement_sources.find { |s| s == source } || source + replacement_sources.find {|s| s == source } || source end end replacement_rubygems = - replacement_sources.detect { |s| s.is_a?(Source::Rubygems) } + replacement_sources.detect {|s| s.is_a?(Source::Rubygems) } @rubygems_aggregate = replacement_rubygems if replacement_rubygems # Return true if there were changes diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb index 9e9c88bb..61e6400d 100644 --- a/lib/bundler/spec_set.rb +++ b/lib/bundler/spec_set.rb @@ -99,7 +99,7 @@ module Bundler def merge(set) arr = sorted.dup set.each do |s| - next if arr.any? { |s2| s2.name == s.name && s2.version == s.version && s2.platform == s.platform } + next if arr.any? {|s2| s2.name == s.name && s2.version == s.version && s2.platform == s.platform } arr << s end SpecSet.new(arr) @@ -108,7 +108,7 @@ module Bundler private def sorted - rake = @specs.find { |s| s.name == "rake" } + rake = @specs.find {|s| s.name == "rake" } begin @sorted ||= ([rake] + tsort).compact.uniq rescue TSort::Cyclic => error @@ -129,7 +129,7 @@ module Bundler def lookup @lookup ||= begin - lookup = Hash.new { |h,k| h[k] = [] } + lookup = Hash.new {|h,k| h[k] = [] } specs = @specs.sort_by do |s| s.platform.to_s == "ruby" ? "\0" : s.platform.to_s end @@ -141,13 +141,13 @@ module Bundler end def tsort_each_node - @specs.each { |s| yield s } + @specs.each {|s| yield s } end def tsort_each_child(s) s.dependencies.sort_by(&:name).each do |d| next if d.type == :development - lookup[d.name].each { |s2| yield s2 } + lookup[d.name].each {|s2| yield s2 } end end end diff --git a/lib/bundler/worker.rb b/lib/bundler/worker.rb index 8102328d..da7eac0b 100644 --- a/lib/bundler/worker.rb +++ b/lib/bundler/worker.rb @@ -19,7 +19,7 @@ module Bundler @request_queue = Queue.new @response_queue = Queue.new @func = func - @threads = size.times.map { |i| Thread.start { process_queue(i) } } + @threads = size.times.map {|i| Thread.start { process_queue(i) } } trap("INT") { abort_threads } end diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb index 686e1f94..869e5a8c 100644 --- a/spec/bundler/dsl_spec.rb +++ b/spec/bundler/dsl_spec.rb @@ -8,8 +8,8 @@ describe Bundler::Dsl do describe "#git_source" do it "registers custom hosts" do - subject.git_source(:example){ |repo_name| "git@git.example.com:#{repo_name}.git" } - subject.git_source(:foobar){ |repo_name| "git@foobar.com:#{repo_name}.git" } + subject.git_source(:example){|repo_name| "git@git.example.com:#{repo_name}.git" } + subject.git_source(:foobar){|repo_name| "git@foobar.com:#{repo_name}.git" } subject.gem("dobry-pies", :example => "strzalek/dobry-pies") example_uri = "git@git.example.com:strzalek/dobry-pies.git" expect(subject.dependencies.first.source.uri).to eq(example_uri) @@ -17,7 +17,7 @@ describe Bundler::Dsl do it "raises exception on invalid hostname" do expect { - subject.git_source(:group){ |repo_name| "git@git.example.com:#{repo_name}.git" } + subject.git_source(:group){|repo_name| "git@git.example.com:#{repo_name}.git" } }.to raise_error(Bundler::InvalidOption) end @@ -147,7 +147,7 @@ describe Bundler::Dsl do it "from a single repo" do rails_gems = ["railties", "action_pack", "active_model"] subject.git "https://github.com/rails/rails.git" do - rails_gems.each { |rails_gem| subject.send :gem, rails_gem } + rails_gems.each {|rails_gem| subject.send :gem, rails_gem } end expect(subject.dependencies.map(&:name)).to match_array rails_gems end @@ -162,7 +162,7 @@ describe Bundler::Dsl do it "from github" do spree_gems = ["spree_core", "spree_api", "spree_backend"] subject.github "spree" do - spree_gems.each { |spree_gem| subject.send :gem, spree_gem } + spree_gems.each {|spree_gem| subject.send :gem, spree_gem } end subject.dependencies.each do |d| diff --git a/spec/bundler/fetcher_spec.rb b/spec/bundler/fetcher_spec.rb index f3125623..d7da9377 100644 --- a/spec/bundler/fetcher_spec.rb +++ b/spec/bundler/fetcher_spec.rb @@ -20,14 +20,14 @@ describe Bundler::Fetcher do describe "include CI information" do it "from one CI" do with_env_vars({ "JENKINS_URL" => "foo" }) do - ci_part = fetcher.user_agent.split(" ").find{|x| x.match(/\Aci\//)} + ci_part = fetcher.user_agent.split(" ").find{|x| x.match(/\Aci\//) } expect(ci_part).to match("jenkins") end end it "from many CI" do with_env_vars({ "TRAVIS" => "foo", "CI_NAME" => "my_ci" }) do - ci_part = fetcher.user_agent.split(" ").find{|x| x.match(/\Aci\//)} + ci_part = fetcher.user_agent.split(" ").find{|x| x.match(/\Aci\//) } expect(ci_part).to match("travis") expect(ci_part).to match("my_ci") end diff --git a/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb index f46b0f04..d90dd12e 100644 --- a/spec/bundler/gem_helper_spec.rb +++ b/spec/bundler/gem_helper_spec.rb @@ -76,7 +76,7 @@ describe Bundler::GemHelper do before(:each) do content = app_gemspec_content.gsub("TODO: ", "") content.sub!(/homepage\s+= ".*"/, 'homepage = ""') - File.open(app_gemspec_path, "w") { |file| file << content } + File.open(app_gemspec_path, "w") {|file| file << content } end def remove_push_guard(gemspec_content) @@ -138,7 +138,7 @@ describe Bundler::GemHelper do context "when build failed" do it "raises an error with appropriate message" do # break the gemspec by adding back the TODOs - File.open(app_gemspec_path, "w"){ |file| file << app_gemspec_content } + File.open(app_gemspec_path, "w"){|file| file << app_gemspec_content } expect { subject.build_gem }.to raise_error(/TODO/) end end diff --git a/spec/cache/git_spec.rb b/spec/cache/git_spec.rb index 3ac19f6b..332513ab 100644 --- a/spec/cache/git_spec.rb +++ b/spec/cache/git_spec.rb @@ -172,7 +172,7 @@ end # Insert a gemspec method that shells out spec_lines = lib_path("foo-1.0/foo.gemspec").read.split("\n") spec_lines.insert(-2, "s.description = `echo bob`") - update_git("foo"){ |s| s.write "foo.gemspec", spec_lines.join("\n") } + update_git("foo"){|s| s.write "foo.gemspec", spec_lines.join("\n") } install_gemfile <<-G gem "foo", :git => '#{lib_path("foo-1.0")}' diff --git a/spec/commands/outdated_spec.rb b/spec/commands/outdated_spec.rb index a0d5f303..1d071e82 100644 --- a/spec/commands/outdated_spec.rb +++ b/spec/commands/outdated_spec.rb @@ -32,7 +32,7 @@ describe "bundle outdated" do expect(out).to include("foo (newest 1.0") # Gem names are one per-line, between "*" and their parenthesized version. - gem_list = out.split("\n").map { |g| g[/\* (.*) \(/, 1] }.compact + gem_list = out.split("\n").map {|g| g[/\* (.*) \(/, 1] }.compact expect(gem_list).to eq(gem_list.sort) end diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb index 1e24f113..9da787c8 100644 --- a/spec/commands/show_spec.rb +++ b/spec/commands/show_spec.rb @@ -56,7 +56,7 @@ describe "bundle show" do expect(out).to include(default_bundle_path("gems", "rails-2.3.2").to_s) # Gem names are the last component of their path. - gem_list = out.split.map { |p| p.split("/").last } + gem_list = out.split.map {|p| p.split("/").last } expect(gem_list).to eq(gem_list.sort) end diff --git a/spec/install/post_bundle_message_spec.rb b/spec/install/post_bundle_message_spec.rb index 640d44ba..1c7847ce 100644 --- a/spec/install/post_bundle_message_spec.rb +++ b/spec/install/post_bundle_message_spec.rb @@ -13,11 +13,11 @@ describe "post bundle message" do G end - let(:bundle_show_message) {"Use `bundle show [gemname]` to see where a bundled gem is installed."} - let(:bundle_deployment_message) {"Bundled gems are installed into ./vendor"} - let(:bundle_complete_message) {"Bundle complete!"} - let(:bundle_updated_message) {"Bundle updated!"} - let(:installed_gems_stats) {"4 Gemfile dependencies, 5 gems now installed."} + let(:bundle_show_message) { "Use `bundle show [gemname]` to see where a bundled gem is installed." } + let(:bundle_deployment_message) { "Bundled gems are installed into ./vendor" } + let(:bundle_complete_message) { "Bundle complete!" } + let(:bundle_updated_message) { "Bundle updated!" } + let(:installed_gems_stats) { "4 Gemfile dependencies, 5 gems now installed." } describe "for fresh bundle install" do it "without any options" do diff --git a/spec/runtime/gem_tasks_spec.rb b/spec/runtime/gem_tasks_spec.rb index da88310b..c7641cfe 100644 --- a/spec/runtime/gem_tasks_spec.rb +++ b/spec/runtime/gem_tasks_spec.rb @@ -28,7 +28,7 @@ describe "require 'bundler/gem_tasks'" do "rake install", "rake release[remote]", ] - tasks = out.lines.to_a.map { |s| s.split("#").first.strip } + tasks = out.lines.to_a.map {|s| s.split("#").first.strip } expect(tasks & expected_tasks).to eq(expected_tasks) expect(exitstatus).to eq(0) if exitstatus end diff --git a/spec/runtime/inline_spec.rb b/spec/runtime/inline_spec.rb index accbf7ce..73ced322 100644 --- a/spec/runtime/inline_spec.rb +++ b/spec/runtime/inline_spec.rb @@ -4,7 +4,7 @@ describe "bundler/inline#gemfile" do def script(code, options = {}) requires = ["bundler/inline"] requires.unshift File.expand_path("../../support/artifice/"+options.delete(:artifice)+".rb", __FILE__) if options.key?(:artifice) - requires = requires.map { |r| "require '#{r}'" }.join("\n") + requires = requires.map {|r| "require '#{r}'" }.join("\n") @out = ruby("#{requires}\n\n" << code, options) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abd70545..8b564904 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,7 +9,7 @@ require "digest/sha1" begin require "rubygems" spec = Gem::Specification.load("bundler.gemspec") - rspec = spec.dependencies.find { |d| d.name == "rspec" } + rspec = spec.dependencies.find {|d| d.name == "rspec" } gem "rspec", rspec.requirement.to_s require "rspec" rescue LoadError diff --git a/spec/support/builders.rb b/spec/support/builders.rb index 4d7ad444..c9159e64 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -409,7 +409,7 @@ module Spec end def versions(versions) - versions.split(/\s+/).each { |version| yield v(version) } + versions.split(/\s+/).each {|version| yield v(version) } end end @@ -517,7 +517,7 @@ module Spec @files.each do |file, source| file = Pathname.new(path).join(file) FileUtils.mkdir_p(file.dirname) - File.open(file, "w") { |f| f.puts source } + File.open(file, "w") {|f| f.puts source } end @spec.files = @files.keys path diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index d179ea3b..cf8c6d2e 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -66,9 +66,9 @@ module Spec requires = options.delete(:requires) || [] requires << File.expand_path("../fakeweb/"+options.delete(:fakeweb)+".rb", __FILE__) if options.key?(:fakeweb) requires << File.expand_path("../artifice/"+options.delete(:artifice)+".rb", __FILE__) if options.key?(:artifice) - requires_str = requires.map{|r| "-r#{r}"}.join(" ") + requires_str = requires.map{|r| "-r#{r}" }.join(" ") - env = (options.delete(:env) || {}).map{|k, v| "#{k}='#{v}'"}.join(" ") + env = (options.delete(:env) || {}).map{|k, v| "#{k}='#{v}'" }.join(" ") args = options.map do |k, v| v == true ? " --#{k}" : " --#{k} #{v}" if v end.join @@ -86,9 +86,9 @@ module Spec requires = options.delete(:requires) || [] requires << File.expand_path("../fakeweb/"+options.delete(:fakeweb)+".rb", __FILE__) if options.key?(:fakeweb) requires << File.expand_path("../artifice/"+options.delete(:artifice)+".rb", __FILE__) if options.key?(:artifice) - requires_str = requires.map{|r| "-r#{r}"}.join(" ") + requires_str = requires.map{|r| "-r#{r}" }.join(" ") - env = (options.delete(:env) || {}).map{|k, v| "#{k}='#{v}' "}.join + env = (options.delete(:env) || {}).map{|k, v| "#{k}='#{v}' " }.join cmd = "#{env}#{Gem.ruby} -I#{lib} #{requires_str} #{bundle_bin}" sys_exec(cmd, expect_err){|i| yield i if block_given? } @@ -96,7 +96,7 @@ module Spec def ruby(ruby, options = {}) expect_err = options.delete(:expect_err) - env = (options.delete(:env) || {}).map{|k, v| "#{k}='#{v}' "}.join + env = (options.delete(:env) || {}).map{|k, v| "#{k}='#{v}' " }.join ruby.gsub!(/["`\$]/) {|m| "\\#{m}" } lib_option = options[:no_lib] ? "" : " -I#{lib}" sys_exec(%{#{env}#{Gem.ruby}#{lib_option} -e "#{ruby}"}, expect_err) @@ -355,7 +355,7 @@ module Spec changed_lines = pathname.readlines.map do |line| yield line end - File.open(pathname, "w") { |file| file.puts(changed_lines.join) } + File.open(pathname, "w") {|file| file.puts(changed_lines.join) } end def with_env_vars(env_hash, &block) diff --git a/spec/support/indexes.rb b/spec/support/indexes.rb index 9761a2cb..119197d4 100644 --- a/spec/support/indexes.rb +++ b/spec/support/indexes.rb @@ -7,7 +7,7 @@ module Spec def platform(*args) @platforms ||= [] - @platforms.concat args.map { |p| Gem::Platform.new(p) } + @platforms.concat args.map {|p| Gem::Platform.new(p) } end alias platforms platform diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index b4b18e78..5d5e4a05 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -4,13 +4,13 @@ module Spec dep = Bundler::Dependency.new(*args) match do |actual| - actual.length == 1 && actual.all? { |d| d == dep } + actual.length == 1 && actual.all? {|d| d == dep } end end RSpec::Matchers.define :have_gem do |*args| match do |actual| - actual.length == args.length && actual.all? { |a| args.include?(a.full_name) } + actual.length == args.length && actual.all? {|a| args.include?(a.full_name) } end end diff --git a/spec/support/platforms.rb b/spec/support/platforms.rb index 05122786..fa12523a 100644 --- a/spec/support/platforms.rb +++ b/spec/support/platforms.rb @@ -39,7 +39,7 @@ module Spec end def not_local - all_platforms.find { |p| p != generic(Gem::Platform.local) } + all_platforms.find {|p| p != generic(Gem::Platform.local) } end def local_tag @@ -51,7 +51,7 @@ module Spec end def not_local_tag - [:ruby, :jruby].find { |tag| tag != local_tag } + [:ruby, :jruby].find {|tag| tag != local_tag } end def local_ruby_engine diff --git a/spec/support/streams.rb b/spec/support/streams.rb index 6a099513..f89c506c 100644 --- a/spec/support/streams.rb +++ b/spec/support/streams.rb @@ -4,10 +4,10 @@ def capture(*streams) streams.map!(&:to_s) begin result = StringIO.new - streams.each { |stream| eval "$#{stream} = result" } + streams.each {|stream| eval "$#{stream} = result" } yield ensure - streams.each { |stream| eval("$#{stream} = #{stream.upcase}") } + streams.each {|stream| eval("$#{stream} = #{stream.upcase}") } end result.string end |