Commit 45704437 authored by Kyle Fuller's avatar Kyle Fuller

[Rubocop] Enable Style/StringLiterals

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