Commit 761c1f69 authored by Samuel E. Giddins's avatar Samuel E. Giddins

[RuboCop] Enable Style/RegexpLiteral

parent da544fa9
...@@ -26,8 +26,3 @@ Metrics/PerceivedComplexity: ...@@ -26,8 +26,3 @@ Metrics/PerceivedComplexity:
# Configuration parameters: AllowedVariables. # Configuration parameters: AllowedVariables.
Style/GlobalVars: Style/GlobalVars:
Enabled: false Enabled: false
# Offense count: 12
# Configuration parameters: MaxSlashes.
Style/RegexpLiteral:
Enabled: false
...@@ -25,7 +25,7 @@ module Pod ...@@ -25,7 +25,7 @@ module Pod
end end
def run def run
if repo_id_match = (@url || @name_or_url).match(/github.com\/([^\/\.]*\/[^\/\.]*)\.*/) if repo_id_match = (@url || @name_or_url).match(%r{github.com/([^/\.]*\/[^/\.]*)\.*})
repo_id = repo_id_match[1] repo_id = repo_id_match[1]
data = github_data_for_template(repo_id) data = github_data_for_template(repo_id)
data[:name] = @name_or_url if @url data[:name] = @name_or_url if @url
......
...@@ -76,7 +76,7 @@ module Pod ...@@ -76,7 +76,7 @@ module Pod
files = [] files = []
@podspecs_paths << '.' if @podspecs_paths.empty? @podspecs_paths << '.' if @podspecs_paths.empty?
@podspecs_paths.each do |path| @podspecs_paths.each do |path|
if path =~ /https?:\/\// if path =~ %r{https?://}
require 'open-uri' require 'open-uri'
output_path = podspecs_tmp_dir + File.basename(path) output_path = podspecs_tmp_dir + File.basename(path)
output_path.dirname.mkpath output_path.dirname.mkpath
......
...@@ -441,7 +441,7 @@ module Pod ...@@ -441,7 +441,7 @@ module Pod
base = 'master' base = 'master'
when %r{github.com[:/]+(.+)/(.+)} when %r{github.com[:/]+(.+)/(.+)}
base = Regexp.last_match[1] base = Regexp.last_match[1]
when %r{^\S+@(\S+)[:/]+(.+)$} when /^\S+@(\S+)[:\/]+(.+)$/
host, path = Regexp.last_match.captures host, path = Regexp.last_match.captures
base = base_from_host_and_path[host, path] base = base_from_host_and_path[host, path]
when URI.regexp when URI.regexp
......
...@@ -510,7 +510,7 @@ module Pod ...@@ -510,7 +510,7 @@ module Pod
l.include?('note: ') && (l !~ /expanded from macro/) l.include?('note: ') && (l !~ /expanded from macro/)
end end
selected_lines.map do |l| selected_lines.map do |l|
new = l.gsub(/\/tmp\/CocoaPods\/Lint\/Pods\//, '') new = l.gsub(%r{/tmp/CocoaPods/Lint/Pods/}, '')
new.gsub!(/^ */, ' ') new.gsub!(/^ */, ' ')
end end
end end
......
...@@ -55,7 +55,7 @@ module Pod ...@@ -55,7 +55,7 @@ module Pod
# prepare the spec # prepare the spec
spec = (fixture('spec-repos') + 'test_repo/JSONKit/1.4/JSONKit.podspec').read spec = (fixture('spec-repos') + 'test_repo/JSONKit/1.4/JSONKit.podspec').read
spec_fix = spec.gsub(/https:\/\/github\.com\/johnezang\/JSONKit\.git/, fixture('integration/JSONKit').to_s) spec_fix = spec.gsub(%r{https://github\.com/johnezang/JSONKit\.git}, fixture('integration/JSONKit').to_s)
spec_add = spec.gsub(/'JSONKit'/, "'PushTest'") spec_add = spec.gsub(/'JSONKit'/, "'PushTest'")
spec_clean = (fixture('spec-repos') + 'test_repo/BananaLib/1.0/BananaLib.podspec').read spec_clean = (fixture('spec-repos') + 'test_repo/BananaLib/1.0/BananaLib.podspec').read
......
...@@ -64,7 +64,7 @@ CLIntegracon.configure do |c| ...@@ -64,7 +64,7 @@ CLIntegracon.configure do |c|
end end
# Register special handling for YAML files # Register special handling for YAML files
paths = [%r{Podfile\.lock}, %r{Manifest\.lock$}, %r{xcodeproj\.yaml$}] paths = [/Podfile\.lock/, /Manifest\.lock$/, /xcodeproj\.yaml$/]
c.has_special_handling_for(*paths) do |path| c.has_special_handling_for(*paths) do |path|
# Remove CocoaPods version # Remove CocoaPods version
yaml = File.open(path) { |f| YAML.load(f) } yaml = File.open(path) { |f| YAML.load(f) }
...@@ -73,7 +73,7 @@ CLIntegracon.configure do |c| ...@@ -73,7 +73,7 @@ CLIntegracon.configure do |c|
end end
# So we don't need to compare them directly # So we don't need to compare them directly
c.ignores %r{\.xcodeproj/} c.ignores /\.xcodeproj\//
c.ignores 'Podfile' c.ignores 'Podfile'
# Ignore certain OSX files # Ignore certain OSX files
...@@ -109,8 +109,8 @@ describe_cli 'pod' do ...@@ -109,8 +109,8 @@ describe_cli 'pod' do
s.replace_path `which git`.chomp, 'GIT_BIN' s.replace_path `which git`.chomp, 'GIT_BIN'
s.replace_path `which hg`.chomp, 'HG_BIN' if has_mercurial s.replace_path `which hg`.chomp, 'HG_BIN' if has_mercurial
s.replace_user_path 'Library/Caches/CocoaPods', 'CACHES_DIR' s.replace_user_path 'Library/Caches/CocoaPods', 'CACHES_DIR'
s.replace_pattern %r(\d{4}-\d\d-\d\d \d\d:\d\d:\d\d [-+]\d{4}), '<#DATE#>' s.replace_pattern /\d{4}-\d\d-\d\d \d\d:\d\d:\d\d [-+]\d{4}/, '<#DATE#>'
s.replace_pattern %r{\(Took \d+.\d+ seconds\)}, '(Took <#DURATION#> seconds)' s.replace_pattern /\(Took \d+.\d+ seconds\)/, '(Took <#DURATION#> seconds)'
end end
describe 'Pod install' do describe 'Pod install' do
......
...@@ -26,7 +26,7 @@ module Pod ...@@ -26,7 +26,7 @@ module Pod
end end
it 'returns the description' do it 'returns the description' do
@subject.description.should.match %r{from `.*integration/Reachability`} @subject.description.should.match /from `.*integration\/Reachability`/
end end
it 'marks the Pod as local in the sandbox' do it 'marks the Pod as local in the sandbox' do
......
...@@ -16,7 +16,7 @@ module Pod ...@@ -16,7 +16,7 @@ module Pod
end end
it 'returns the description' do it 'returns the description' do
@subject.description.should.match %r{from `.*Reachability/Reachability.podspec`} @subject.description.should.match /from `.*Reachability\/Reachability.podspec`/
end end
describe 'Helpers' do describe 'Helpers' do
......
...@@ -270,8 +270,8 @@ module Pod ...@@ -270,8 +270,8 @@ module Pod
analyzer.analyze analyzer.analyze
UI.warnings.should.match /duplicate dependencies on `RestKit`/ UI.warnings.should.match /duplicate dependencies on `RestKit`/
UI.warnings.should.match %r{RestKit \(~> 0.23.0\)} UI.warnings.should.match /RestKit \(~> 0.23.0\)/
UI.warnings.should.match %r{RestKit \(<= 0.23.2\)} UI.warnings.should.match /RestKit \(<= 0.23.2\)/
end end
#--------------------------------------# #--------------------------------------#
...@@ -635,7 +635,7 @@ module Pod ...@@ -635,7 +635,7 @@ module Pod
e.message.should.match /different sources for `RestKit`/ e.message.should.match /different sources for `RestKit`/
e.message.should.match %r{RestKit \(from `https://github.com/RestKit/RestKit.git`\)} e.message.should.match %r{RestKit \(from `https://github.com/RestKit/RestKit.git`\)}
e.message.should.match %r{RestKit \(~> 0.23.0\)} e.message.should.match /RestKit \(~> 0.23.0\)/
end end
end end
......
...@@ -303,7 +303,7 @@ module Pod ...@@ -303,7 +303,7 @@ module Pod
describe 'Master repo' do describe 'Master repo' do
it 'returns the master repo dir' do it 'returns the master repo dir' do
SourcesManager.master_repo_dir.to_s.should.match /fixtures\/spec-repos\/master/ SourcesManager.master_repo_dir.to_s.should.match %r{fixtures/spec-repos/master}
end end
it 'returns whether the master repo is functional' do it 'returns whether the master repo is functional' do
......
...@@ -31,7 +31,7 @@ module Pod ...@@ -31,7 +31,7 @@ module Pod
# #
def stub_podspec(pattern = nil, replacement = nil) def stub_podspec(pattern = nil, replacement = nil)
spec = (fixture('spec-repos') + 'master/Specs/JSONKit/1.4/JSONKit.podspec.json').read spec = (fixture('spec-repos') + 'master/Specs/JSONKit/1.4/JSONKit.podspec.json').read
spec.gsub!(/https:\/\/github\.com\/johnezang\/JSONKit\.git/, fixture('integration/JSONKit').to_s) spec.gsub!(%r{https://github\.com/johnezang/JSONKit\.git}, fixture('integration/JSONKit').to_s)
spec.gsub!(pattern, replacement) if pattern && replacement spec.gsub!(pattern, replacement) if pattern && replacement
spec spec
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment