Commit 45704437 authored by Kyle Fuller's avatar Kyle Fuller

[Rubocop] Enable Style/StringLiterals

parent 3e9536da
...@@ -7,3 +7,4 @@ inherit_from: ...@@ -7,3 +7,4 @@ inherit_from:
AllCops: AllCops:
Exclude: Exclude:
- spec/fixtures/**/*.rb - spec/fixtures/**/*.rb
- spec/fixtures/banana-lib/libPusher/Scripts/pusher
...@@ -67,12 +67,6 @@ Style/SelfAssignment: ...@@ -67,12 +67,6 @@ Style/SelfAssignment:
Style/SpaceInsideHashLiteralBraces: Style/SpaceInsideHashLiteralBraces:
Enabled: false Enabled: false
# Offense count: 49
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/StringLiterals:
Enabled: false
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles. # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
......
# Bootstrap task # Bootstrap task
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
desc "Initializes your working copy to run the specs" desc 'Initializes your working copy to run the specs'
task :bootstrap, :use_bundle_dir? do |_, args| task :bootstrap, :use_bundle_dir? do |_, args|
title "Environment bootstrap" title 'Environment bootstrap'
puts "Updating submodules" puts 'Updating submodules'
execute_command "git submodule update --init --recursive" execute_command 'git submodule update --init --recursive'
if system('which bundle') if system('which bundle')
puts "Installing gems" puts 'Installing gems'
if args[:use_bundle_dir?] if args[:use_bundle_dir?]
execute_command "env bundle install --path ./travis_bundle_dir" execute_command 'env bundle install --path ./travis_bundle_dir'
else else
execute_command "env bundle install" execute_command 'env bundle install'
end end
else else
$stderr.puts "\033[0;31m" \ $stderr.puts "\033[0;31m" \
...@@ -27,15 +27,15 @@ end ...@@ -27,15 +27,15 @@ end
begin begin
task :build do task :build do
title "Building the gem" title 'Building the gem'
end end
require "bundler/gem_tasks" require 'bundler/gem_tasks'
# Pre release # Pre release
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
desc "Prepares for a release" desc 'Prepares for a release'
task :pre_release do task :pre_release do
unless File.exist?('../Specs') unless File.exist?('../Specs')
raise 'Ensure that the specs repo exits in the `../Specs` location' raise 'Ensure that the specs repo exits in the `../Specs` location'
...@@ -45,14 +45,14 @@ begin ...@@ -45,14 +45,14 @@ begin
# Post release # Post release
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
desc "Updates the last know version of CocoaPods in the specs repo" desc 'Updates the last know version of CocoaPods in the specs repo'
task :post_release do task :post_release do
title "Updating last known version in Specs repo" title 'Updating last known version in Specs repo'
specs_branch = 'master' specs_branch = 'master'
Dir.chdir('../Specs') do Dir.chdir('../Specs') do
puts Dir.pwd puts Dir.pwd
sh "git checkout #{specs_branch}" sh "git checkout #{specs_branch}"
sh "git pull" sh 'git pull'
yaml_file = 'CocoaPods-version.yml' yaml_file = 'CocoaPods-version.yml'
unless File.exist?(yaml_file) unless File.exist?(yaml_file)
...@@ -62,12 +62,12 @@ begin ...@@ -62,12 +62,12 @@ begin
require 'yaml' require 'yaml'
cocoapods_version = YAML.load_file(yaml_file) cocoapods_version = YAML.load_file(yaml_file)
cocoapods_version['last'] = gem_version cocoapods_version['last'] = gem_version
File.open(yaml_file, "w") do |f| File.open(yaml_file, 'w') do |f|
f.write(cocoapods_version.to_yaml) f.write(cocoapods_version.to_yaml)
end end
sh "git commit #{yaml_file} -m 'CocoaPods release #{gem_version}'" sh "git commit #{yaml_file} -m 'CocoaPods release #{gem_version}'"
sh "git push" sh 'git push'
end end
end end
...@@ -82,28 +82,28 @@ begin ...@@ -82,28 +82,28 @@ begin
#--------------------------------------# #--------------------------------------#
desc "Automatically run specs for updated files" desc 'Automatically run specs for updated files'
task :kick do task :kick do
exec "bundle exec kicker -c" exec 'bundle exec kicker -c'
end end
#--------------------------------------# #--------------------------------------#
unit_specs_command = "bundle exec bacon #{specs('unit/**/*')}" unit_specs_command = "bundle exec bacon #{specs('unit/**/*')}"
desc "Run the unit specs" desc 'Run the unit specs'
task :unit => :unpack_fixture_tarballs do task :unit => :unpack_fixture_tarballs do
sh unit_specs_command sh unit_specs_command
end end
desc "Run the unit specs quietly (fail fast, display only one failure)" desc 'Run the unit specs quietly (fail fast, display only one failure)'
task :unit_quiet => :unpack_fixture_tarballs do task :unit_quiet => :unpack_fixture_tarballs do
sh "#{unit_specs_command} -q" sh "#{unit_specs_command} -q"
end end
#--------------------------------------# #--------------------------------------#
desc "Run the functional specs" desc 'Run the functional specs'
task :functional, [:spec] => :unpack_fixture_tarballs do |_t, args| task :functional, [:spec] => :unpack_fixture_tarballs do |_t, args|
args.with_defaults(:spec => '**/*') args.with_defaults(:spec => '**/*')
sh "bundle exec bacon #{specs("functional/#{args[:spec]}")}" sh "bundle exec bacon #{specs("functional/#{args[:spec]}")}"
...@@ -111,14 +111,14 @@ begin ...@@ -111,14 +111,14 @@ begin
#--------------------------------------# #--------------------------------------#
desc "Run the integration spec" desc 'Run the integration spec'
task :integration do task :integration do
unless File.exist?('spec/cocoapods-integration-specs') unless File.exist?('spec/cocoapods-integration-specs')
$stderr.puts red("Integration files not checked out. Run `rake bootstrap`") $stderr.puts red('Integration files not checked out. Run `rake bootstrap`')
exit 1 exit 1
end end
sh "bundle exec bacon spec/integration.rb" sh 'bundle exec bacon spec/integration.rb'
end end
# Default task # Default task
...@@ -135,7 +135,7 @@ begin ...@@ -135,7 +135,7 @@ begin
sh "bundle exec bacon #{specs('**/*')}" sh "bundle exec bacon #{specs('**/*')}"
title 'Running Integration tests' title 'Running Integration tests'
sh "bundle exec bacon spec/integration.rb" sh 'bundle exec bacon spec/integration.rb'
title 'Running examples' title 'Running examples'
Rake::Task['examples:build'].invoke Rake::Task['examples:build'].invoke
...@@ -144,7 +144,7 @@ begin ...@@ -144,7 +144,7 @@ begin
Rake::Task['rubocop'].invoke Rake::Task['rubocop'].invoke
end end
desc "Rebuild all the fixture tarballs" desc 'Rebuild all the fixture tarballs'
task :rebuild_fixture_tarballs do task :rebuild_fixture_tarballs do
tarballs = FileList['spec/fixtures/**/*.tar.gz'] tarballs = FileList['spec/fixtures/**/*.tar.gz']
tarballs.each do |tarball| tarballs.each do |tarball|
...@@ -153,7 +153,7 @@ begin ...@@ -153,7 +153,7 @@ begin
end end
end end
desc "Unpacks all the fixture tarballs" desc 'Unpacks all the fixture tarballs'
task :unpack_fixture_tarballs do task :unpack_fixture_tarballs do
tarballs = FileList['spec/fixtures/**/*.tar.gz'] tarballs = FileList['spec/fixtures/**/*.tar.gz']
tarballs.each do |tarball| tarballs.each do |tarball|
...@@ -164,12 +164,12 @@ begin ...@@ -164,12 +164,12 @@ begin
end end
end end
desc "Removes the stored VCR fixture" desc 'Removes the stored VCR fixture'
task :clean_vcr do task :clean_vcr do
sh "rm -f spec/fixtures/vcr/tarballs.yml" sh 'rm -f spec/fixtures/vcr/tarballs.yml'
end end
desc "Rebuilds integration fixtures" desc 'Rebuilds integration fixtures'
task :rebuild_integration_fixtures do task :rebuild_integration_fixtures do
if `which hg` && !$?.success? if `which hg` && !$?.success?
puts red('[!] Mercurial (`hg`) must be installed to rebuild the integration fixtures.') puts red('[!] Mercurial (`hg`) must be installed to rebuild the integration fixtures.')
...@@ -199,19 +199,19 @@ begin ...@@ -199,19 +199,19 @@ begin
end end
puts puts
puts "Integration fixtures updated, commit and push in the `spec/cocoapods-integration-specs` submodule" puts 'Integration fixtures updated, commit and push in the `spec/cocoapods-integration-specs` submodule'
end end
task :clean_env => [:clean_vcr, :unpack_fixture_tarballs, "ext:cleanbuild"] task :clean_env => [:clean_vcr, :unpack_fixture_tarballs, 'ext:cleanbuild']
end end
# Examples # Examples
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
task :examples => "examples:build" task :examples => 'examples:build'
namespace :examples do namespace :examples do
desc "Open all example workspaces in Xcode, which recreates the schemes." desc 'Open all example workspaces in Xcode, which recreates the schemes.'
task :recreate_workspace_schemes do task :recreate_workspace_schemes do
examples.each do |example| examples.each do |example|
Dir.chdir(example.to_s) do Dir.chdir(example.to_s) do
...@@ -223,19 +223,19 @@ begin ...@@ -223,19 +223,19 @@ begin
end end
end end
desc "Build all examples" desc 'Build all examples'
task :build do task :build do
Bundler.require 'xcodeproj', :development Bundler.require 'xcodeproj', :development
Dir['examples/*'].each do |dir| Dir['examples/*'].each do |dir|
Dir.chdir(dir) do Dir.chdir(dir) do
puts "Example: #{dir}" puts "Example: #{dir}"
puts " Installing Pods" puts ' Installing Pods'
# pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/sandbox-pod' # pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/sandbox-pod'
# TODO: The sandbox is blocking local git repos making bundler crash # TODO: The sandbox is blocking local git repos making bundler crash
pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/pod' pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/pod'
execute_command "rm -rf Pods" execute_command 'rm -rf Pods'
execute_command "#{pod_command} install --verbose --no-repo-update" execute_command "#{pod_command} install --verbose --no-repo-update"
workspace_path = 'Examples.xcworkspace' workspace_path = 'Examples.xcworkspace'
...@@ -265,7 +265,7 @@ begin ...@@ -265,7 +265,7 @@ begin
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
desc "Run all specs" desc 'Run all specs'
task :spec => 'spec:all' task :spec => 'spec:all'
task :default => :spec task :default => :spec
...@@ -309,9 +309,9 @@ end ...@@ -309,9 +309,9 @@ end
def title(title) def title(title)
cyan_title = "\033[0;36m#{title}\033[0m" cyan_title = "\033[0;36m#{title}\033[0m"
puts puts
puts "-" * 80 puts '-' * 80
puts cyan_title puts cyan_title
puts "-" * 80 puts '-' * 80
puts puts
end end
......
...@@ -67,7 +67,7 @@ module Pod ...@@ -67,7 +67,7 @@ module Pod
if source_version > lockfile_version if source_version > lockfile_version
matching_spec = unlocked_pods.find { |s| s.name == pod_name } matching_spec = unlocked_pods.find { |s| s.name == pod_name }
matching_version = matching_version =
matching_spec ? matching_spec.version : "(unused)" matching_spec ? matching_spec.version : '(unused)'
[pod_name, lockfile_version, matching_version, source_version] [pod_name, lockfile_version, matching_version, source_version]
else else
nil nil
......
...@@ -9,7 +9,7 @@ module Pod ...@@ -9,7 +9,7 @@ module Pod
DESC DESC
def self.options def self.options
[["--count-only", "Show the total number of repos"]].concat(super) [['--count-only', 'Show the total number of repos']].concat(super)
end end
def initialize(argv) def initialize(argv)
...@@ -52,10 +52,10 @@ module Pod ...@@ -52,10 +52,10 @@ module Pod
url = url_of_git_repo(remote_name) url = url_of_git_repo(remote_name)
UI.puts "- URL: #{url}" UI.puts "- URL: #{url}"
else else
UI.puts "- Type: git (no remote information available)" UI.puts '- Type: git (no remote information available)'
end end
else else
UI.puts "- Type: local copy" UI.puts '- Type: local copy'
end end
UI.puts "- Path: #{path}" UI.puts "- Path: #{path}"
end end
......
...@@ -41,7 +41,7 @@ module Pod ...@@ -41,7 +41,7 @@ module Pod
end end
end end
UI.puts "Setup completed".green UI.puts 'Setup completed'.green
end end
#--------------------------------------# #--------------------------------------#
......
...@@ -37,7 +37,7 @@ module Pod ...@@ -37,7 +37,7 @@ module Pod
# @return [String] # @return [String]
# #
def generate def generate
result = "" result = ''
result << generate_platform_import_header result << generate_platform_import_header
result << "\n" result << "\n"
......
...@@ -325,7 +325,7 @@ module Pod ...@@ -325,7 +325,7 @@ module Pod
deps_with_different_sources = podfile.dependencies.group_by(&:root_name). deps_with_different_sources = podfile.dependencies.group_by(&:root_name).
select { |_root_name, dependencies| dependencies.map(&:external_source).uniq.count > 1 } select { |_root_name, dependencies| dependencies.map(&:external_source).uniq.count > 1 }
deps_with_different_sources.each do |root_name, dependencies| deps_with_different_sources.each do |root_name, dependencies|
raise Informative, "There are multiple dependencies with different " \ raise Informative, 'There are multiple dependencies with different ' \
"sources for `#{root_name}` in #{UI.path podfile.defined_in_file}:" \ "sources for `#{root_name}` in #{UI.path podfile.defined_in_file}:" \
"\n\n- #{dependencies.map(&:to_s).join("\n- ")}" "\n\n- #{dependencies.map(&:to_s).join("\n- ")}"
end end
...@@ -646,7 +646,7 @@ module Pod ...@@ -646,7 +646,7 @@ module Pod
end end
archs = archs.compact.uniq.sort archs = archs.compact.uniq.sort
UI.message("Using `ARCHS` setting to build architectures of " \ UI.message('Using `ARCHS` setting to build architectures of ' \
"target `#{target_definition.label}`: " \ "target `#{target_definition.label}`: " \
"(`#{archs.join('`, `')}`)") "(`#{archs.join('`, `')}`)")
archs.length > 1 ? archs : archs.first archs.length > 1 ? archs : archs.first
......
...@@ -195,7 +195,7 @@ module Pod ...@@ -195,7 +195,7 @@ module Pod
# @return [Pathname] the absolute path of the Info.plist file. # @return [Pathname] the absolute path of the Info.plist file.
# #
def info_plist_path def info_plist_path
support_files_dir + "Info.plist" support_files_dir + 'Info.plist'
end end
# @return [Pathname] the path of the dummy source generated by CocoaPods # @return [Pathname] the path of the dummy source generated by CocoaPods
......
...@@ -66,7 +66,7 @@ module Pod ...@@ -66,7 +66,7 @@ module Pod
# #
def uses_swift? def uses_swift?
file_accessors.any? do |file_accessor| file_accessors.any? do |file_accessor|
file_accessor.source_files.any? { |sf| sf.extname == ".swift" } file_accessor.source_files.any? { |sf| sf.extname == '.swift' }
end end
end end
......
...@@ -72,7 +72,7 @@ module Pod ...@@ -72,7 +72,7 @@ module Pod
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
describe "if a pod target does not contain source files" do describe 'if a pod target does not contain source files' do
before do before do
@pod_target.file_accessors.first.stubs(:source_files).returns([]) @pod_target.file_accessors.first.stubs(:source_files).returns([])
...@@ -154,7 +154,7 @@ module Pod ...@@ -154,7 +154,7 @@ module Pod
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
describe "serializing and deserializing" do describe 'serializing and deserializing' do
before do before do
@path = temporary_directory + 'sample.xcconfig' @path = temporary_directory + 'sample.xcconfig'
......
...@@ -143,14 +143,14 @@ module Pod ...@@ -143,14 +143,14 @@ module Pod
end end
hash = {} hash = {}
hash['PODS'] = [ hash['PODS'] = [
{"AFNetworkActivityLogger (2.0.3)" => ["AFNetworking/NSURLConnection (~> 2.0)", "AFNetworking/NSURLSession (~> 2.0)"]}, {'AFNetworkActivityLogger (2.0.3)' => ['AFNetworking/NSURLConnection (~> 2.0)', 'AFNetworking/NSURLSession (~> 2.0)']},
{"AFNetworking (2.4.0)" => ["AFNetworking/NSURLConnection (= 2.4.0)", "AFNetworking/NSURLSession (= 2.4.0)", "AFNetworking/Reachability (= 2.4.0)", "AFNetworking/Security (= 2.4.0)", "AFNetworking/Serialization (= 2.4.0)", "AFNetworking/UIKit (= 2.4.0)"]}, {'AFNetworking (2.4.0)' => ['AFNetworking/NSURLConnection (= 2.4.0)', 'AFNetworking/NSURLSession (= 2.4.0)', 'AFNetworking/Reachability (= 2.4.0)', 'AFNetworking/Security (= 2.4.0)', 'AFNetworking/Serialization (= 2.4.0)', 'AFNetworking/UIKit (= 2.4.0)']},
{"AFNetworking/NSURLConnection (2.4.0)" => ["AFNetworking/Reachability", "AFNetworking/Security", "AFNetworking/Serialization"]}, {'AFNetworking/NSURLConnection (2.4.0)' => ['AFNetworking/Reachability', 'AFNetworking/Security', 'AFNetworking/Serialization']},
{"AFNetworking/NSURLSession (2.4.0)" => ["AFNetworking/Reachability", "AFNetworking/Security", "AFNetworking/Serialization"]}, {'AFNetworking/NSURLSession (2.4.0)' => ['AFNetworking/Reachability', 'AFNetworking/Security', 'AFNetworking/Serialization']},
"AFNetworking/Reachability (2.4.0)", 'AFNetworking/Reachability (2.4.0)',
"AFNetworking/Security (2.4.0)", 'AFNetworking/Security (2.4.0)',
"AFNetworking/Serialization (2.4.0)", 'AFNetworking/Serialization (2.4.0)',
{"AFNetworking/UIKit (2.4.0)" => ["AFNetworking/NSURLConnection", "AFNetworking/NSURLSession"]} {'AFNetworking/UIKit (2.4.0)' => ['AFNetworking/NSURLConnection', 'AFNetworking/NSURLSession']}
] ]
hash['DEPENDENCIES'] = ['AFNetworkActivityLogger', 'AFNetworking (2.4.0)'] hash['DEPENDENCIES'] = ['AFNetworkActivityLogger', 'AFNetworking (2.4.0)']
hash['SPEC CHECKSUMS'] = {} hash['SPEC CHECKSUMS'] = {}
......
...@@ -88,7 +88,7 @@ module Pod ...@@ -88,7 +88,7 @@ module Pod
end end
it "ignores certain build settings which don't inherit the settings form the CocoaPods xcconfig" do it "ignores certain build settings which don't inherit the settings form the CocoaPods xcconfig" do
@user_target_build_settings = { 'CODE_SIGN_IDENTITY' => "Mac Developer" } @user_target_build_settings = { 'CODE_SIGN_IDENTITY' => 'Mac Developer' }
behaves_like 'warn_about_xcconfig_overrides' behaves_like 'warn_about_xcconfig_overrides'
UI.warnings.should.not.include 'CODE_SIGN_IDENTITY' UI.warnings.should.not.include 'CODE_SIGN_IDENTITY'
end end
......
...@@ -170,7 +170,7 @@ module Pod ...@@ -170,7 +170,7 @@ module Pod
ref.hierarchy_path.should == '/Pods/BananaLib/file.m' ref.hierarchy_path.should == '/Pods/BananaLib/file.m'
end end
it "adds subgroups for a file reference if requested" do it 'adds subgroups for a file reference if requested' do
ref = @project.add_file_reference(@nested_file, @group, true) ref = @project.add_file_reference(@nested_file, @group, true)
ref.hierarchy_path.should == '/Pods/BananaLib/Dir/SubDir/nested_file.m' ref.hierarchy_path.should == '/Pods/BananaLib/Dir/SubDir/nested_file.m'
end end
......
...@@ -12,7 +12,7 @@ module Pod ...@@ -12,7 +12,7 @@ module Pod
@header_dir.root.should == temporary_directory + 'Sandbox/Headers/Public' @header_dir.root.should == temporary_directory + 'Sandbox/Headers/Public'
end end
it "can add namespaced headers to its header path using symlinks and return the relative path" do it 'can add namespaced headers to its header path using symlinks and return the relative path' do
FileUtils.mkdir_p(@sandbox.root + 'ExampleLib/') FileUtils.mkdir_p(@sandbox.root + 'ExampleLib/')
namespace_path = Pathname.new('ExampleLib') namespace_path = Pathname.new('ExampleLib')
relative_header_paths = [ relative_header_paths = [
...@@ -51,8 +51,8 @@ module Pod ...@@ -51,8 +51,8 @@ module Pod
@header_dir.add_search_path('iOS Search Path', :ios) @header_dir.add_search_path('iOS Search Path', :ios)
@header_dir.add_search_path('OS X Search Path', :osx) @header_dir.add_search_path('OS X Search Path', :osx)
@header_dir.search_paths(:ios).sort.should == [ @header_dir.search_paths(:ios).sort.should == [
"${PODS_ROOT}/Headers/Public", '${PODS_ROOT}/Headers/Public',
"${PODS_ROOT}/Headers/Public/iOS Search Path", '${PODS_ROOT}/Headers/Public/iOS Search Path',
] ]
end end
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