aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.rubocop_todo.yml6
-rw-r--r--lib/bundler/constants.rb2
-rw-r--r--lib/bundler/lockfile_parser.rb6
-rw-r--r--lib/bundler/shared_helpers.rb2
-rw-r--r--lib/bundler/source/git/git_proxy.rb2
-rw-r--r--lib/bundler/source/path.rb2
-rw-r--r--spec/bundler/fetcher_spec.rb12
-rw-r--r--spec/bundler/settings_spec.rb2
-rw-r--r--spec/commands/init_spec.rb2
-rw-r--r--spec/commands/newgem_spec.rb10
-rw-r--r--spec/install/gemfile/path_spec.rb2
-rw-r--r--spec/quality_spec.rb2
-rw-r--r--spec/spec_helper.rb2
13 files changed, 23 insertions, 29 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index ff44d7f8..8925ddbf 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -337,12 +337,6 @@ Style/RedundantReturn:
Style/RedundantSelf:
Enabled: false
-# Offense count: 24
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
-Style/RegexpLiteral:
- Enabled: false
-
# Offense count: 3
Style/RescueModifier:
Enabled: false
diff --git a/lib/bundler/constants.rb b/lib/bundler/constants.rb
index d9bf6830..704bcac8 100644
--- a/lib/bundler/constants.rb
+++ b/lib/bundler/constants.rb
@@ -1,5 +1,5 @@
module Bundler
- WINDOWS = RbConfig::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
+ WINDOWS = RbConfig::CONFIG["host_os"] =~ /(msdos|mswin|djgpp|mingw)/
FREEBSD = RbConfig::CONFIG["host_os"] =~ /bsd/
NULL = WINDOWS ? "NUL" : "/dev/null"
end
diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb
index 78d5cb9d..5fa1f5aa 100644
--- a/lib/bundler/lockfile_parser.rb
+++ b/lib/bundler/lockfile_parser.rb
@@ -132,9 +132,9 @@ module Bundler
end
NAME_VERSION = '(?! )(.*?)(?: \(([^-]*)(?:-(.*))?\))?'
- NAME_VERSION_2 = %r{^ {2}#{NAME_VERSION}(!)?$}
- NAME_VERSION_4 = %r{^ {4}#{NAME_VERSION}$}
- NAME_VERSION_6 = %r{^ {6}#{NAME_VERSION}$}
+ NAME_VERSION_2 = /^ {2}#{NAME_VERSION}(!)?$/
+ NAME_VERSION_4 = /^ {4}#{NAME_VERSION}$/
+ NAME_VERSION_6 = /^ {6}#{NAME_VERSION}$/
def parse_dependency(line)
if line =~ NAME_VERSION_2
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index 33689123..1f6c4910 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -81,7 +81,7 @@ module Bundler
# Set RUBYOPT
rubyopt = [ENV["RUBYOPT"]].compact
- if rubyopt.empty? || rubyopt.first !~ /-rbundler\/setup/
+ if rubyopt.empty? || rubyopt.first !~ %r{-rbundler/setup}
rubyopt.unshift %|-rbundler/setup|
ENV["RUBYOPT"] = rubyopt.join(" ")
end
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb
index b3f8816c..f49ab4b0 100644
--- a/lib/bundler/source/git/git_proxy.rb
+++ b/lib/bundler/source/git/git_proxy.rb
@@ -86,7 +86,7 @@ module Bundler
git_retry %|clone --no-checkout --quiet "#{path}" "#{destination}"|
File.chmod(((File.stat(destination).mode | 0777) & ~File.umask), destination)
rescue Errno::EEXIST => e
- file_path = e.message[/.*?(\/.*)/, 1]
+ file_path = e.message[%r{.*?(/.*)}, 1]
raise GitError, "Bundler could not install a gem because it needs to " \
"create a directory, but a file exists - #{file_path}. Please delete " \
"this file and try again."
diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb
index 0c408b4b..1772a819 100644
--- a/lib/bundler/source/path.rb
+++ b/lib/bundler/source/path.rb
@@ -165,7 +165,7 @@ module Bundler
end
def relative_path
- if path.to_s.match(%r{^#{Regexp.escape Bundler.root.to_s}})
+ if path.to_s.start_with?(Bundler.root.to_s)
return path.relative_path_from(Bundler.root)
end
path
diff --git a/spec/bundler/fetcher_spec.rb b/spec/bundler/fetcher_spec.rb
index 16370828..fd72f457 100644
--- a/spec/bundler/fetcher_spec.rb
+++ b/spec/bundler/fetcher_spec.rb
@@ -11,23 +11,23 @@ describe Bundler::Fetcher do
describe "#user_agent" do
it "builds user_agent with current ruby version and Bundler settings" do
allow(Bundler.settings).to receive(:all).and_return(%w[foo bar])
- expect(fetcher.user_agent).to match(/bundler\/(\d.)/)
- expect(fetcher.user_agent).to match(/rubygems\/(\d.)/)
- expect(fetcher.user_agent).to match(/ruby\/(\d.)/)
- expect(fetcher.user_agent).to match(/options\/foo,bar/)
+ expect(fetcher.user_agent).to match(%r{bundler/(\d.)})
+ expect(fetcher.user_agent).to match(%r{rubygems/(\d.)})
+ expect(fetcher.user_agent).to match(%r{ruby/(\d.)})
+ expect(fetcher.user_agent).to match(%r{options/foo,bar})
end
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(%r{\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(%r{\Aci/}) }
expect(ci_part).to match("travis")
expect(ci_part).to match("my_ci")
end
diff --git a/spec/bundler/settings_spec.rb b/spec/bundler/settings_spec.rb
index 8be5d98c..6cc79515 100644
--- a/spec/bundler/settings_spec.rb
+++ b/spec/bundler/settings_spec.rb
@@ -57,7 +57,7 @@ describe Bundler::Settings do
expect(FileUtils).to receive(:mkdir_p).with(settings.send(:global_config_file).dirname).
and_raise(Errno::EACCES)
expect { settings.set_global(:frozen, "1") }.
- to raise_error(Bundler::PermissionError, /\.bundle\/config/)
+ to raise_error(Bundler::PermissionError, %r{\.bundle/config})
end
end
end
diff --git a/spec/commands/init_spec.rb b/spec/commands/init_spec.rb
index 33b21a36..548033e4 100644
--- a/spec/commands/init_spec.rb
+++ b/spec/commands/init_spec.rb
@@ -31,7 +31,7 @@ describe "bundle init" do
bundle :init, :gemspec => spec_file
gemfile = bundled_app("Gemfile").read
- expect(gemfile).to match(/source 'https:\/\/rubygems.org'/)
+ expect(gemfile).to match(%r{source 'https://rubygems.org'})
expect(gemfile.scan(/gem "rack", "= 1.0.1"/).size).to eq(1)
expect(gemfile.scan(/gem "rspec", "= 1.2"/).size).to eq(1)
expect(gemfile.scan(/group :development/).size).to eq(1)
diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb
index b644d1ba..a9c939f0 100644
--- a/spec/commands/newgem_spec.rb
+++ b/spec/commands/newgem_spec.rb
@@ -178,7 +178,7 @@ describe "bundle gem" do
end
it "requires the version file" do
- expect(bundled_app("test_gem/lib/test_gem.rb").read).to match(/require "test_gem\/version"/)
+ expect(bundled_app("test_gem/lib/test_gem.rb").read).to match(%r{require "test_gem/version"})
end
it "runs rake without problems" do
@@ -332,7 +332,7 @@ describe "bundle gem" do
end
it "creates a .travis.yml file to test the library against the current Ruby version on Travis CI" do
- expect(bundled_app("test_gem/.travis.yml").read).to match(%r(- #{RUBY_VERSION}))
+ expect(bundled_app("test_gem/.travis.yml").read).to match(/- #{RUBY_VERSION}/)
end
end
@@ -435,7 +435,7 @@ describe "bundle gem" do
end
it "requires the version file" do
- expect(bundled_app("test-gem/lib/test/gem.rb").read).to match(/require "test\/gem\/version"/)
+ expect(bundled_app("test-gem/lib/test/gem.rb").read).to match(%r{require "test/gem/version"})
end
it "runs rake without problems" do
@@ -468,7 +468,7 @@ describe "bundle gem" do
end
it "requires 'test/gem'" do
- expect(bundled_app("test-gem/exe/test-gem").read).to match(/require "test\/gem"/)
+ expect(bundled_app("test-gem/exe/test-gem").read).to match(%r{require "test/gem"})
end
end
@@ -536,7 +536,7 @@ describe "bundle gem" do
end
it "requires 'test/gem'" do
- expect(bundled_app("test-gem/test/test_helper.rb").read).to match(/require 'test\/gem'/)
+ expect(bundled_app("test-gem/test/test_helper.rb").read).to match(%r{require 'test/gem'})
end
it "requires 'test_helper'" do
diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb
index d0f30787..65d6577d 100644
--- a/spec/install/gemfile/path_spec.rb
+++ b/spec/install/gemfile/path_spec.rb
@@ -469,7 +469,7 @@ describe "bundle install with explicit source paths" do
Dir.chdir(lib_path("private_lib")) do
bundle :install, :env => { "DEBUG" => 1 }, :artifice => "endpoint"
- expect(out).to match(/^HTTP GET http:\/\/localgemserver\.test\/api\/v1\/dependencies\?gems=rack$/)
+ expect(out).to match(%r{^HTTP GET http://localgemserver\.test/api/v1/dependencies\?gems=rack$})
expect(out).not_to match(/^HTTP GET.*private_lib/)
should_be_installed "private_lib 2.2"
should_be_installed "rack 1.0"
diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb
index 029c0f39..c9c7e7d8 100644
--- a/spec/quality_spec.rb
+++ b/spec/quality_spec.rb
@@ -87,7 +87,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/
+ exclusions = %r{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 }
sys_exec("ruby -w -I. ", :expect_err) do |input|
lib_files.each do |f|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 8b564904..ede6ffaf 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -30,7 +30,7 @@ else
end
Dir["#{File.expand_path("../support", __FILE__)}/*.rb"].each do |file|
- require file unless file =~ /fakeweb\/.*\.rb/
+ require file unless file =~ %r{fakeweb/.*\.rb}
end
$debug = false