diff options
author | Andre Arko <andre@arko.net> | 2015-07-18 16:44:14 -0600 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2015-07-18 16:45:36 -0600 |
commit | 0f8bc78180ce4f8bae5dc48e2078b44cd4fafe44 (patch) | |
tree | c175c911a748afd50c0045038499a5a349fec135 | |
parent | 14a7eb25ee03c9fb4ecf3e4c6b1f44a8267a413a (diff) | |
download | bundler-0f8bc78180ce4f8bae5dc48e2078b44cd4fafe44.tar.gz |
Fix Style/SpaceInsideBlockBraces
closes #3853
40 files changed, 68 insertions, 74 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index bf81c967b7..eeff964d4b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -433,12 +433,6 @@ Style/SpaceAfterComma: Style/SpaceAroundOperators: Enabled: false -# Offense count: 76 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles. -Style/SpaceBeforeBlockBraces: - Enabled: false - # Offense count: 4 # Cop supports --auto-correct. Style/SpaceInsideStringInterpolation: @@ -98,7 +98,7 @@ namespace :spec do deps.delete("rdiscount") end - deps.sort_by{|name, _| name }.each do |name, version| + deps.sort_by {|name, _| name }.each do |name, version| sh %{#{Gem.ruby} -S gem list -i "^#{name}$" -v "#{version}" || } + %{#{Gem.ruby} -S gem install #{name} -v "#{version}" --no-ri --no-rdoc} end @@ -135,7 +135,7 @@ namespace :spec do end begin - rspec = BUNDLER_SPEC.development_dependencies.find{|d| d.name == "rspec" } + rspec = BUNDLER_SPEC.development_dependencies.find {|d| d.name == "rspec" } gem "rspec", rspec.requirement.to_s require "rspec/core/rake_task" @@ -286,7 +286,7 @@ begin namespace :man do directory "lib/bundler/man" - sources = Dir["man/*.ronn"].map{|f| File.basename(f, ".ronn") } + sources = Dir["man/*.ronn"].map {|f| File.basename(f, ".ronn") } sources.map do |basename| ronn = "man/#{basename}.ronn" roff = "lib/bundler/man/#{basename}" diff --git a/lib/bundler.rb b/lib/bundler.rb index 8a8741ed34..53fc98e0ab 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -308,7 +308,7 @@ module Bundler # if any directory is not writable, we need sudo files = [path, bin_dir] | Dir[path.join("build_info/*").to_s] | Dir[path.join("*").to_s] - sudo_needed = files.any?{|f| !File.writable?(f) } + sudo_needed = files.any? {|f| !File.writable?(f) } end @requires_sudo_ran = true diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index bbc0fac6bd..82359eb6cc 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -348,7 +348,7 @@ module Bundler method_option :bin, :type => :boolean, :default => false, :aliases => "-b", :desc => "Generate a binary for your library." method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config gem.coc true`." method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR", - :lazy_default => [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find{|e| !e.nil? && !e.empty? }, + :lazy_default => [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }, :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)" method_option :ext, :type => :boolean, :default => false, :desc => "Generate the boilerplate for C extension code" method_option :mit, :type => :boolean, :desc => "Generate an MIT license file" diff --git a/lib/bundler/cli/binstubs.rb b/lib/bundler/cli/binstubs.rb index 7c67b7d75c..cf9ce02c4d 100644 --- a/lib/bundler/cli/binstubs.rb +++ b/lib/bundler/cli/binstubs.rb @@ -20,7 +20,7 @@ module Bundler end gems.each do |gem_name| - spec = installer.specs.find{|s| s.name == gem_name } + spec = installer.specs.find {|s| s.name == gem_name } unless spec raise GemNotFound, Bundler::CLI::Common.gem_not_found_message( gem_name, Bundler.definition.specs) diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb index 40d5293228..53b30d2045 100644 --- a/lib/bundler/cli/common.rb +++ b/lib/bundler/cli/common.rb @@ -3,7 +3,7 @@ module Bundler def self.without_groups_message groups = Bundler.settings.without group_list = [groups[0...-1].join(", "), groups[-1..-1]]. - reject{|s| s.to_s.empty? }.join(" and ") + reject {|s| s.to_s.empty? }.join(" and ") group_str = (groups.size == 1) ? "group" : "groups" "Gems in the #{group_str} #{group_list} were not installed." end diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index 7918397055..383602d6ec 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -20,7 +20,7 @@ module Bundler underscored_name = name.tr("-", "_") namespaced_path = name.tr("-", "/") - constant_name = name.gsub(/-[_-]*(?![_-]|$)/){ "::" }.gsub(/([_-]+|(::)|^)(.|$)/){ $2.to_s + $3.upcase } + constant_name = name.gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase } constant_array = constant_name.split("::") test_task = options[:test] == "minitest" ? "test" : "spec" diff --git a/lib/bundler/cli/inject.rb b/lib/bundler/cli/inject.rb index 2f797be7ad..a17bce036f 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/open.rb b/lib/bundler/cli/open.rb index b6bfda4d25..0bf42038d9 100644 --- a/lib/bundler/cli/open.rb +++ b/lib/bundler/cli/open.rb @@ -10,7 +10,7 @@ module Bundler end def run - editor = [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find{|e| !e.nil? && !e.empty? } + editor = [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? } return Bundler.ui.info("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") unless editor path = Bundler::CLI::Common.select_spec(name, :regex_match).full_gem_path Dir.chdir(path) do diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 47e4cdce59..37cc4d9de9 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -265,7 +265,7 @@ module Bundler return end - File.open(file, "wb"){|f| f.puts(contents) } + File.open(file, "wb") {|f| f.puts(contents) } rescue Errno::EACCES raise PermissionError.new(file) end diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 01b3c213be..0d0255ac99 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -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 "/" @@ -321,7 +321,7 @@ module Bundler def validate_keys(command, opts, valid_keys) invalid_keys = opts.keys - valid_keys if invalid_keys.any? - message = "You passed #{invalid_keys.map{|k| ":"+k }.join(", ")} " + message = "You passed #{invalid_keys.map {|k| ":"+k }.join(", ")} " message << if invalid_keys.size > 1 "as options for #{command}, but they are invalid." else diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index 120f2a27aa..7391c2884d 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -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 diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb index b7bd92e603..b7b9b7b203 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/index.rb b/lib/bundler/index.rb index 9385ff1227..ad36b75640 100644 --- a/lib/bundler/index.rb +++ b/lib/bundler/index.rb @@ -98,13 +98,13 @@ module Bundler # returns a list of the dependencies def unmet_dependency_names names = dependency_names - names.delete_if{|n| n == "bundler" } - names.select{|n| search(n).empty? } + names.delete_if {|n| n == "bundler" } + names.select {|n| search(n).empty? } end def dependency_names names = [] - each{|s| names.push(*s.dependencies.map(&:name)) } + each {|s| names.push(*s.dependencies.map(&:name)) } names.uniq end diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 29d41bad4f..3295fc840d 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -125,7 +125,7 @@ module Bundler if options.any? Bundler.ui.warn "#{spec.name} has no executables, but you may want " + "one from a gem it depends on." - options.each{|name,bins| Bundler.ui.warn " #{name} has: #{bins.join(", ")}" } + options.each {|name,bins| Bundler.ui.warn " #{name} has: #{bins.join(", ")}" } else Bundler.ui.warn "There are no executables for the gem #{spec.name}." end diff --git a/lib/bundler/retry.rb b/lib/bundler/retry.rb index 25141f5200..c0563e346b 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 6d5d389011..b7cf99c076 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -122,7 +122,7 @@ module Gem def to_lock out = " #{name}" unless requirement == Gem::Requirement.default - reqs = requirement.requirements.map{|o,v| "#{o} #{v}" }.sort.reverse + reqs = requirement.requirements.map {|o,v| "#{o} #{v}" }.sort.reverse out << " (#{reqs.join(", ")})" end out diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 69b421d4b7..efd00a49b5 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -111,7 +111,7 @@ module Bundler end def gem_cache - gem_path.map{|p| File.expand_path("cache", p) } + gem_path.map {|p| File.expand_path("cache", p) } end def spec_cache_dirs @@ -155,7 +155,7 @@ module Bundler loaded_gem_paths.flatten else $LOAD_PATH.select do |p| - Bundler.rubygems.gem_path.any?{|gp| p =~ /^#{Regexp.escape(gp)}/ } + Bundler.rubygems.gem_path.any? {|gp| p =~ /^#{Regexp.escape(gp)}/ } end end end diff --git a/lib/bundler/similarity_detector.rb b/lib/bundler/similarity_detector.rb index c4caab71a8..dc770c4281 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 diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb index 992a908cec..400b0a650b 100644 --- a/lib/bundler/source/git.rb +++ b/lib/bundler/source/git.rb @@ -17,7 +17,7 @@ module Bundler @allow_remote = false # Stringify options that could be set as symbols - %w(ref branch tag revision).each{|k| options[k] = options[k].to_s if options[k] } + %w(ref branch tag revision).each {|k| options[k] = options[k].to_s if options[k] } @uri = options["uri"] || "" @branch = options["branch"] diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index 9ec140f39c..57f8bc0190 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -150,8 +150,8 @@ module Bundler s.authors = ["no one"] if expanded_path.join("bin").exist? executables = expanded_path.join("bin").children - executables.reject!{|p| File.directory?(p) } - s.executables = executables.map{|c| c.basename.to_s } + executables.reject! {|p| File.directory?(p) } + s.executables = executables.map {|c| c.basename.to_s } end end end diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index aec687768a..9bd908fb60 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -22,7 +22,7 @@ module Bundler @allow_cached = false @caches = [Bundler.app_cache, *Bundler.rubygems.gem_cache] - Array(options["remotes"] || []).reverse_each{|r| add_remote(r) } + Array(options["remotes"] || []).reverse_each {|r| add_remote(r) } end def remote! diff --git a/spec/bundler/definition_spec.rb b/spec/bundler/definition_spec.rb index 481c355bd1..076f2c8632 100644 --- a/spec/bundler/definition_spec.rb +++ b/spec/bundler/definition_spec.rb @@ -3,19 +3,19 @@ require "bundler/definition" describe Bundler::Definition do before do - allow(Bundler).to receive(:settings){ Bundler::Settings.new(".") } - allow(Bundler).to receive(:default_gemfile){ Pathname.new("Gemfile") } - allow(Bundler).to receive(:ui){ double("UI", :info => "") } + allow(Bundler).to receive(:settings) { Bundler::Settings.new(".") } + allow(Bundler).to receive(:default_gemfile) { Pathname.new("Gemfile") } + allow(Bundler).to receive(:ui) { double("UI", :info => "") } end describe "#lock" do context "when it's not possible to write to the file" do - subject{ Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) } + subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) } it "raises an PermissionError with explanation" do expect(File).to receive(:open).with("Gemfile.lock", "wb"). and_raise(Errno::EACCES) - expect{ subject.lock("Gemfile.lock") }. + expect { subject.lock("Gemfile.lock") }. to raise_error(Bundler::PermissionError, /Gemfile\.lock/) end end diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb index 869e5a8c5e..c8586bfa31 100644 --- a/spec/bundler/dsl_spec.rb +++ b/spec/bundler/dsl_spec.rb @@ -3,13 +3,13 @@ require "spec_helper" describe Bundler::Dsl do before do @rubygems = double("rubygems") - allow(Bundler::Source::Rubygems).to receive(:new){ @rubygems } + allow(Bundler::Source::Rubygems).to receive(:new) { @rubygems } end 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,12 +17,12 @@ 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 it "expects block passed" do - expect{ subject.git_source(:example) }.to raise_error(Bundler::InvalidOption) + expect { subject.git_source(:example) }.to raise_error(Bundler::InvalidOption) end context "default hosts (git, gist)" do diff --git a/spec/bundler/fetcher_spec.rb b/spec/bundler/fetcher_spec.rb index d7da93774e..4e9a8d18e9 100644 --- a/spec/bundler/fetcher_spec.rb +++ b/spec/bundler/fetcher_spec.rb @@ -5,7 +5,7 @@ describe Bundler::Fetcher do subject(:fetcher) { Bundler::Fetcher.new(double("remote", :uri => URI("https://example.com"))) } before do - allow(Bundler).to receive(:root){ Pathname.new("root") } + allow(Bundler).to receive(:root) { Pathname.new("root") } end describe "#user_agent" do @@ -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 d90dd12ef9..e1496f47fe 100644 --- a/spec/bundler/gem_helper_spec.rb +++ b/spec/bundler/gem_helper_spec.rb @@ -33,7 +33,7 @@ describe Bundler::GemHelper do if Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.0") content = File.read(app_gemspec_path) content.sub!(/raise "RubyGems 2\.0 or newer.*/, "") - File.open(app_gemspec_path, "w"){|f| f.write(content) } + File.open(app_gemspec_path, "w") {|f| f.write(content) } end end @@ -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/bundler/psyched_yaml_spec.rb b/spec/bundler/psyched_yaml_spec.rb index 76b57604f5..fbb58464ef 100644 --- a/spec/bundler/psyched_yaml_spec.rb +++ b/spec/bundler/psyched_yaml_spec.rb @@ -3,6 +3,6 @@ require "bundler/psyched_yaml" describe Bundler::YamlSyntaxError do it "is raised on YAML parse errors" do - expect{ YAML.parse "{foo" }.to raise_error(Bundler::YamlSyntaxError) + expect { YAML.parse "{foo" }.to raise_error(Bundler::YamlSyntaxError) end end diff --git a/spec/bundler/retry_spec.rb b/spec/bundler/retry_spec.rb index 8a5623058a..23e6668438 100644 --- a/spec/bundler/retry_spec.rb +++ b/spec/bundler/retry_spec.rb @@ -12,7 +12,7 @@ describe Bundler::Retry do end it "returns the first valid result" do - jobs = [Proc.new{ raise "foo" }, Proc.new{ :bar }, Proc.new{ raise "foo" }] + jobs = [Proc.new { raise "foo" }, Proc.new { :bar }, Proc.new { raise "foo" }] attempts = 0 result = Bundler::Retry.new(nil, nil, 3).attempt do attempts += 1 diff --git a/spec/bundler/settings_spec.rb b/spec/bundler/settings_spec.rb index 3578155265..8be5d98cb2 100644 --- a/spec/bundler/settings_spec.rb +++ b/spec/bundler/settings_spec.rb @@ -9,7 +9,7 @@ describe Bundler::Settings do subject(:settings) { described_class.new(nil) } it "raises a GemfileNotFound error with explanation" do - expect{ subject.set_local("foo", "bar") }. + expect { subject.set_local("foo", "bar") }. to raise_error(Bundler::GemfileNotFound, "Could not locate Gemfile") end end @@ -45,7 +45,7 @@ describe Bundler::Settings do it "raises an PermissionError with explanation" do expect(FileUtils).to receive(:mkdir_p).with(settings.send(:local_config_file).dirname). and_raise(Errno::EACCES) - expect{ settings[:frozen] = "1" }. + expect { settings[:frozen] = "1" }. to raise_error(Bundler::PermissionError, /config/) end end @@ -56,7 +56,7 @@ describe Bundler::Settings do it "raises an PermissionError with explanation" do expect(FileUtils).to receive(:mkdir_p).with(settings.send(:global_config_file).dirname). and_raise(Errno::EACCES) - expect{ settings.set_global(:frozen, "1") }. + expect { settings.set_global(:frozen, "1") }. to raise_error(Bundler::PermissionError, /\.bundle\/config/) end end diff --git a/spec/bundler/source/rubygems_spec.rb b/spec/bundler/source/rubygems_spec.rb index fea680657f..af959a770e 100644 --- a/spec/bundler/source/rubygems_spec.rb +++ b/spec/bundler/source/rubygems_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" describe Bundler::Source::Rubygems do before do - allow(Bundler).to receive(:root){ Pathname.new("root") } + allow(Bundler).to receive(:root) { Pathname.new("root") } end describe "caches" do diff --git a/spec/cache/gems_spec.rb b/spec/cache/gems_spec.rb index 3d9651bf20..1d26f5011b 100644 --- a/spec/cache/gems_spec.rb +++ b/spec/cache/gems_spec.rb @@ -244,7 +244,7 @@ describe "bundle cache" do it "handles directories and non .gem files in the cache" do bundled_app("vendor/cache/foo").mkdir - File.open(bundled_app("vendor/cache/bar"), "w"){|f| f.write("not a gem") } + File.open(bundled_app("vendor/cache/bar"), "w") {|f| f.write("not a gem") } bundle :cache end diff --git a/spec/cache/git_spec.rb b/spec/cache/git_spec.rb index 332513abad..5aacd5a0f2 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/newgem_spec.rb b/spec/commands/newgem_spec.rb index e648366614..fafc9a5f35 100644 --- a/spec/commands/newgem_spec.rb +++ b/spec/commands/newgem_spec.rb @@ -11,7 +11,7 @@ describe "bundle gem" do if Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.0") path = "#{gem_name}/#{gem_name}.gemspec" content = File.read(path).sub(/raise "RubyGems 2\.0 or newer.*/, "") - File.open(path, "w"){|f| f.write(content) } + File.open(path, "w") {|f| f.write(content) } end end diff --git a/spec/install/force_spec.rb b/spec/install/force_spec.rb index 0211b077cf..2135c4d7b0 100644 --- a/spec/install/force_spec.rb +++ b/spec/install/force_spec.rb @@ -13,7 +13,7 @@ describe "bundle install" do rack_lib = default_bundle_path("gems/rack-1.0.0/lib/rack.rb") bundle "install" - rack_lib.open("w"){|f| f.write("blah blah blah") } + rack_lib.open("w") {|f| f.write("blah blah blah") } bundle "install --force" expect(exitstatus).to eq(0) if exitstatus diff --git a/spec/install/upgrade_spec.rb b/spec/install/upgrade_spec.rb index a855e44331..a57f974bbb 100644 --- a/spec/install/upgrade_spec.rb +++ b/spec/install/upgrade_spec.rb @@ -11,14 +11,14 @@ describe "bundle install for the first time with v1.0" do end it "removes lockfiles in 0.9 YAML format" do - File.open("Gemfile.lock", "w"){|f| YAML.dump({}, f) } + File.open("Gemfile.lock", "w") {|f| YAML.dump({}, f) } bundle :install expect(File.read("Gemfile.lock")).not_to match(/^---/) end it "removes env.rb if it exists" do bundled_app.join(".bundle").mkdir - bundled_app.join(".bundle/environment.rb").open("w"){|f| f.write("raise 'nooo'") } + bundled_app.join(".bundle/environment.rb").open("w") {|f| f.write("raise 'nooo'") } bundle :install expect(bundled_app.join(".bundle/environment.rb")).not_to exist end diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb index fa5d7e9dad..5204e86092 100644 --- a/spec/lock/lockfile_spec.rb +++ b/spec/lock/lockfile_spec.rb @@ -1232,7 +1232,7 @@ describe "the lockfile format" do it "preserves Gemfile.lock \\n\\r line endings" do update_repo2 win_lock = File.read(bundled_app("Gemfile.lock")).gsub(/\n/, "\r\n") - File.open(bundled_app("Gemfile.lock"), "wb"){|f| f.puts(win_lock) } + File.open(bundled_app("Gemfile.lock"), "wb") {|f| f.puts(win_lock) } set_lockfile_mtime_to_known_value expect { bundle "update" }.to change { File.mtime(bundled_app("Gemfile.lock")) } @@ -1253,7 +1253,7 @@ describe "the lockfile format" do it "preserves Gemfile.lock \\n\\r line endings" do win_lock = File.read(bundled_app("Gemfile.lock")).gsub(/\n/, "\r\n") - File.open(bundled_app("Gemfile.lock"), "wb"){|f| f.puts(win_lock) } + File.open(bundled_app("Gemfile.lock"), "wb") {|f| f.puts(win_lock) } set_lockfile_mtime_to_known_value expect { ruby <<-RUBY diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb index 05715a6867..029c0f39fd 100644 --- a/spec/quality_spec.rb +++ b/spec/quality_spec.rb @@ -88,7 +88,7 @@ describe "The library itself" do it "does not contain any warnings" do Dir.chdir(root.join("lib")) exclusions = /bundler\/capistrano\.rb|bundler\/vlad\.rb|bundler\/gem_tasks\.rb|tmp\/rubygems/ - lib_files = `git ls-files -z -- **/*.rb`.split("\x0").reject{|f| f =~ exclusions } + lib_files = `git ls-files -z -- **/*.rb`.split("\x0").reject {|f| f =~ exclusions } sys_exec("ruby -w -I. ", :expect_err) do |input| lib_files.each do |f| input.puts "require '#{f.gsub(/\.rb$/, "")}'" diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index d451780519..9dbd4ff86a 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -291,7 +291,7 @@ describe "Bundler.setup" do context "when the ruby stdlib is a substring of Gem.path" do it "does not reject the stdlib from $LOAD_PATH" do - substring = "/" + $LOAD_PATH.find{|p| p =~ /vendor_ruby/ }.split("/")[2] + substring = "/" + $LOAD_PATH.find {|p| p =~ /vendor_ruby/ }.split("/")[2] run "puts 'worked!'", :env => { "GEM_PATH" => substring } expect(out).to eq("worked!") end diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index cf8c6d2e3e..6014764d82 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -66,15 +66,15 @@ 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 cmd = "#{env} #{sudo} #{Gem.ruby} -I#{lib} #{requires_str} #{bundle_bin} #{cmd}#{args}" - sys_exec(cmd, expect_err){|i| yield i if block_given? } + sys_exec(cmd, expect_err) {|i| yield i if block_given? } end def bundle_ruby(options = {}) @@ -86,17 +86,17 @@ 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? } + sys_exec(cmd, expect_err) {|i| yield i if block_given? } end 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) diff --git a/spec/support/less_than_proc.rb b/spec/support/less_than_proc.rb index 74f593d750..04195dfbae 100644 --- a/spec/support/less_than_proc.rb +++ b/spec/support/less_than_proc.rb @@ -9,7 +9,7 @@ class LessThanProc < Proc else provided < Gem::Version.new(required) end - end.tap{|l| l.present = present } + end.tap {|l| l.present = present } end def inspect |