Commit 79d2b1f6 authored by Fabio Pelosin's avatar Fabio Pelosin

[Rubocop] Update

parent 9109185a
# This configuration was generated by `rubocop --auto-gen-config`
# on 2014-08-14 12:21:44 +0200 using RuboCop version 0.24.1.
# on 2014-08-20 23:30:36 +0200 using RuboCop version 0.25.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
......@@ -9,7 +9,8 @@
Lint/AmbiguousOperator:
Enabled: false
# Offense count: 4
# Offense count: 1
# Cop supports --auto-correct.
Lint/BlockAlignment:
Enabled: false
......@@ -18,7 +19,7 @@ Lint/BlockAlignment:
Lint/DefEndAlignment:
Enabled: false
# Offense count: 3
# Offense count: 2
# Cop supports --auto-correct.
Lint/DeprecatedClassMethods:
Enabled: false
......@@ -28,31 +29,16 @@ Lint/DeprecatedClassMethods:
Lint/EndAlignment:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Lint/RescueException:
Enabled: false
# Offense count: 2
Lint/SpaceBeforeFirstArg:
Enabled: false
# Offense count: 5
# Cop supports --auto-correct.
Lint/StringConversionInInterpolation:
Enabled: false
# Offense count: 6
# Cop supports --auto-correct.
Lint/UnusedBlockArgument:
Enabled: false
# Offense count: 6
# Offense count: 1
# Cop supports --auto-correct.
Lint/UnusedMethodArgument:
Enabled: false
# Offense count: 4
# Offense count: 3
Lint/UselessAccessModifier:
Enabled: false
......@@ -60,32 +46,51 @@ Lint/UselessAccessModifier:
Lint/UselessAssignment:
Enabled: false
# Offense count: 7
# Offense count: 1
Metrics/BlockNesting:
Max: 4
# Offense count: 11
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 326
# Offense count: 12
Metrics/CyclomaticComplexity:
Max: 9
# Offense count: 956
# Configuration parameters: AllowURI.
Metrics/LineLength:
Max: 1060
# Offense count: 104
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 39
# Offense count: 12
Metrics/PerceivedComplexity:
Max: 10
# Offense count: 2
# Cop supports --auto-correct.
Style/Alias:
Enabled: false
# Offense count: 1
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/AlignParameters:
Enabled: false
# Offense count: 4
# Cop supports --auto-correct.
Style/AndOr:
Enabled: false
# Offense count: 1
Style/BlockNesting:
Max: 4
# Offense count: 6
# Cop supports --auto-correct.
Style/Blocks:
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/BarePercentLiterals:
Enabled: false
# Offense count: 49
# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/BracesAroundHashParameters:
......@@ -96,69 +101,36 @@ Style/BracesAroundHashParameters:
Style/ClassAndModuleChildren:
Enabled: false
# Offense count: 12
# Configuration parameters: CountComments.
Style/ClassLength:
Max: 328
# Offense count: 1
# Cop supports --auto-correct.
Style/ClassMethods:
Enabled: false
# Offense count: 5
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: PreferredMethods.
Style/CollectionMethods:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/ColonMethodCall:
Enabled: false
# Offense count: 7
# Configuration parameters: Keywords.
Style/CommentAnnotation:
Enabled: false
# Offense count: 3
# Cop supports --auto-correct.
Style/CommentIndentation:
Enabled: false
# Offense count: 12
Style/CyclomaticComplexity:
Max: 9
# Offense count: 1
# Cop supports --auto-correct.
Style/DeprecatedHashMethods:
Style/CommentIndentation:
Enabled: false
# Offense count: 1
Style/DoubleNegation:
Enabled: false
# Offense count: 24
# Offense count: 5
# Cop supports --auto-correct.
Style/EmptyLines:
Enabled: false
# Offense count: 1
Style/EmptyLinesAroundAccessModifier:
Enabled: false
# Offense count: 164
# Offense count: 17
# Cop supports --auto-correct.
Style/EmptyLinesAroundBody:
Enabled: false
# Offense count: 3
# Cop supports --auto-correct.
Style/EmptyLiteral:
Enabled: false
# Offense count: 1
# Configuration parameters: Exclude.
Style/FileName:
......@@ -174,44 +146,23 @@ Style/For:
Style/GlobalVars:
Enabled: false
# Offense count: 17
# Offense count: 5
# Cop supports --auto-correct.
Style/IndentArray:
Enabled: false
# Offense count: 20
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/IndentHash:
Enabled: false
# Offense count: 3
# Offense count: 1
# Cop supports --auto-correct.
Style/IndentationConsistency:
Enabled: false
# Offense count: 24
# Offense count: 6
# Cop supports --auto-correct.
Style/IndentationWidth:
Enabled: false
# Offense count: 3
# Cop supports --auto-correct.
Style/LeadingCommentSpace:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/LineEndConcatenation:
Enabled: false
# Offense count: 952
# Configuration parameters: AllowURI.
Style/LineLength:
Max: 1060
# Offense count: 18
# Cop supports --auto-correct.
Style/MethodCallParentheses:
Enabled: false
......@@ -221,11 +172,6 @@ Style/MethodCallParentheses:
Style/MethodDefParentheses:
Enabled: false
# Offense count: 104
# Configuration parameters: CountComments.
Style/MethodLength:
Max: 39
# Offense count: 1
Style/MultilineIfThen:
Enabled: false
......@@ -234,56 +180,29 @@ Style/MultilineIfThen:
Style/MultilineTernaryOperator:
Enabled: false
# Offense count: 3
# Cop supports --auto-correct.
Style/NegatedIf:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/NegatedWhile:
Enabled: false
# Offense count: 10
# Cop supports --auto-correct.
Style/NilComparison:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: IncludeSemanticChanges.
Style/NonNilCheck:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/Not:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowSafeAssignment.
Style/ParenthesesAroundCondition:
Enabled: false
# Offense count: 49
# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/PerlBackrefs:
Enabled: false
# Offense count: 9
# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: AllowMultipleReturnValues.
Style/RedundantReturn:
Enabled: false
# Offense count: 3
# Offense count: 1
# Cop supports --auto-correct.
Style/RedundantSelf:
Enabled: false
......@@ -297,104 +216,84 @@ Style/RegexpLiteral:
Style/SelfAssignment:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowIfMethodIsEmpty.
Style/SingleLineMethods:
Enabled: false
# Offense count: 9
# Offense count: 6
# Cop supports --auto-correct.
Style/SingleSpaceBeforeFirstArg:
Enabled: false
# Offense count: 14
# Offense count: 3
# Cop supports --auto-correct.
Style/SpaceAfterComma:
Enabled: false
# Offense count: 2
# Offense count: 1
# Cop supports --auto-correct.
Style/SpaceAfterControlKeyword:
Enabled: false
# Offense count: 15
# Cop supports --auto-correct.
Style/SpaceAroundOperators:
Enabled: false
# Offense count: 13
# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/SpaceBeforeBlockBraces:
Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
Style/SpaceBeforeComma:
Enabled: false
# Offense count: 35
# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
Style/SpaceInsideBlockBraces:
Enabled: false
# Offense count: 25
# Offense count: 4
# Cop supports --auto-correct.
Style/SpaceInsideBrackets:
Enabled: false
# Offense count: 89
# Offense count: 34
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
Style/SpaceInsideHashLiteralBraces:
Enabled: false
# Offense count: 40
# Offense count: 1
# Cop supports --auto-correct.
Style/SpaceInsideParens:
Enabled: false
# Offense count: 1580
# Offense count: 160
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/StringLiterals:
Enabled: false
# Offense count: 30
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/TrailingBlankLines:
Enabled: false
# Offense count: 86
# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
Style/TrailingComma:
Enabled: false
# Offense count: 32
# Offense count: 22
# Cop supports --auto-correct.
Style/TrailingWhitespace:
Enabled: false
# Offense count: 5
# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, Whitelist.
Style/TrivialAccessors:
Enabled: false
# Offense count: 10
# Cop supports --auto-correct.
Style/UnneededPercentQ:
Enabled: false
# Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/VariableName:
Enabled: false
# Offense count: 19
# Offense count: 1
# Cop supports --auto-correct.
Style/WordArray:
MinSize: 4
MinSize: 2
......@@ -28,14 +28,14 @@ GIT
GIT
remote: https://github.com/CocoaPods/cocoapods-try.git
revision: f91e069f1f1b22cef5bbd788835f1803e6dce24e
revision: 59a225cd4dd1868da4be7c4cc870cae427f04bf9
branch: master
specs:
cocoapods-try (0.3.0)
GIT
remote: https://github.com/CocoaPods/cocoapods-trunk.git
revision: ed920119fa850d66ee8fbe1873ae9ee0d4e46905
revision: 62bca8ec7073fc59d4137818bd78e0bbc8b1718f
branch: master
specs:
cocoapods-trunk (0.1.4)
......@@ -45,7 +45,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/cocoapods-plugins.git
revision: b989190a02875d16482d2e440a34a54b8559996c
revision: f1364dd91ea334e46b2f37455aef46147d14575a
branch: master
specs:
cocoapods-plugins (0.2.0)
......@@ -53,14 +53,14 @@ GIT
GIT
remote: https://github.com/CocoaPods/cocoapods-downloader.git
revision: 025395e3fd53d23b74b9f55ac0a5750fa92f82e3
revision: a8710a42b1ce379fb2afe66ce9f98a08b58fb482
branch: master
specs:
cocoapods-downloader (0.6.1)
GIT
remote: https://github.com/CocoaPods/Core.git
revision: d696bf6a34eb837d8e89fc1fc9170cff1a1256e4
revision: f557903817f29000819d4b1b754e6dd667587c30
branch: master
specs:
cocoapods-core (0.33.1)
......
......@@ -2,7 +2,7 @@
if RUBY_VERSION > '1.8.7' && Encoding.default_external != Encoding::UTF_8
puts "\e[33mWARNING: CocoaPods requires your terminal to be using UTF-8 encoding."
if ENV["TRAVIS"]
if ENV['TRAVIS']
puts <<-DOC
Consider adding the following settings to .travis.yml
......@@ -19,12 +19,12 @@ end
if $PROGRAM_NAME == __FILE__ && !ENV['COCOAPODS_NO_BUNDLER']
ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
require "rubygems"
require "bundler/setup"
require 'rubygems'
require 'bundler/setup'
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
elsif ENV['COCOAPODS_NO_BUNDLER']
require "rubygems"
gem "cocoapods"
require 'rubygems'
gem 'cocoapods'
end
STDOUT.sync = true if ENV['CP_STDOUT_SYNC'] == 'TRUE'
......
......@@ -105,9 +105,7 @@ PROFILE_ERB_TEMPLATE = <<-EOS
(deny default)
EOS
class Profile
def pod_bin
File.expand_path('../pod', __FILE__)
end
......@@ -159,14 +157,12 @@ class Profile
def generate
ERB.new(PROFILE_ERB_TEMPLATE, 0, '>').result(binding)
end
end
# Ensure the `pod` bin doesn’t think it needs to use Bundler.
ENV['COCOAPODS_NO_BUNDLER'] = '1'
profile = Profile.new
#puts profile.generate
# puts profile.generate
command = ['/usr/bin/sandbox-exec', '-p', profile.generate, profile.pod_bin, *ARGV]
exec(*command)
......@@ -66,7 +66,6 @@ module Pod
autoload :LibraryRepresentation, 'cocoapods/hooks/library_representation'
autoload :PodRepresentation, 'cocoapods/hooks/pod_representation'
end
end
if ENV['COCOA_PODS_ENV'] == 'development'
......
......@@ -7,7 +7,6 @@ module Pod
end
class Command < CLAide::Command
require 'cocoapods/command/help'
require 'cocoapods/command/inter_process_communication'
require 'cocoapods/command/lib'
......@@ -44,14 +43,14 @@ module Pod
end
def self.run(argv)
help! "You cannot run CocoaPods as root." if Process.uid == 0
help! 'You cannot run CocoaPods as root.' if Process.uid == 0
super(argv)
UI.print_warnings
end
def self.report_error(exception)
if exception.is_a?(Interrupt)
puts "[!] Cancelled".red
puts '[!] Cancelled'.red
Config.instance.verbose? ? raise : exit(1)
else
if ENV['COCOA_PODS_ENV'] != 'development'
......@@ -76,9 +75,9 @@ module Pod
def initialize(argv)
super
config.silent = argv.flag?('silent', config.silent)
config.verbose = self.verbose? unless self.verbose.nil?
config.verbose = self.verbose? unless verbose.nil?
unless self.ansi_output?
String.send(:define_method, :colorize) { |string , _| string }
String.send(:define_method, :colorize) { |string, _| string }
end
end
......@@ -113,4 +112,3 @@ module Pod
end
end
end
......@@ -3,7 +3,7 @@ module Pod
class Help < Command
self.summary = 'Show help for the given command.'
self.arguments = [
CLAide::Argument.new('COMMAND', false)
CLAide::Argument.new('COMMAND', false),
]
def initialize(argv)
......@@ -17,9 +17,7 @@ module Pod
private
def help_command
@help_command
end
attr_reader :help_command
end
end
end
......@@ -4,7 +4,6 @@ require 'active_support/core_ext/string/strip'
module Pod
class Command
class Init < Command
self.summary = 'Generate a Podfile for the current directory.'
self.description = <<-DESC
Creates a Podfile for the current directory if none currently exists. If
......@@ -18,11 +17,11 @@ module Pod
`~/.cocoapods/templates` folder.
DESC
self.arguments = [
CLAide::Argument.new('XCODEPROJ', :false)
CLAide::Argument.new('XCODEPROJ', :false),
]
def initialize(argv)
@podfile_path = Pathname.pwd + "Podfile"
@podfile_path = Pathname.pwd + 'Podfile'
@project_path = argv.shift_argument
@project_paths = Pathname.pwd.children.select { |pn| pn.extname == '.xcodeproj' }
super
......@@ -30,13 +29,13 @@ module Pod
def validate!
super
raise Informative, "Existing Podfile found in directory" unless config.podfile_path_in_dir(Pathname.pwd).nil?
raise Informative, 'Existing Podfile found in directory' unless config.podfile_path_in_dir(Pathname.pwd).nil?
if @project_path
help! "Xcode project at #{@project_path} does not exist" unless File.exist? @project_path
project_path = @project_path
else
raise Informative, "No xcode project found, please specify one" unless @project_paths.length > 0
raise Informative, "Multiple xcode projects found, please specify one" unless @project_paths.length == 1
raise Informative, 'No xcode project found, please specify one' unless @project_paths.length > 0
raise Informative, 'Multiple xcode projects found, please specify one' unless @project_paths.length == 1
project_path = @project_paths.first
end
@xcode_project = Xcodeproj::Project.open(project_path)
......@@ -82,12 +81,11 @@ module Pod
target_module << "\nend\n"
end
def template_contents(path)
if path.exist?
path.read.chomp.lines.map{ |line| " #{line}" }.join("\n")
path.read.chomp.lines.map { |line| " #{line}" }.join("\n")
else
String.new
''
end
end
end
......
module Pod
class Command
class IPC < Command
self.abstract_command = true
self.summary = 'Inter-process communication'
......@@ -12,11 +11,10 @@ module Pod
#-----------------------------------------------------------------------#
class Spec < IPC
self.summary = 'Converts a podspec to JSON.'
self.description = 'Converts a podspec to JSON and prints it to STDOUT.'
self.arguments = [
CLAide::Argument.new('PATH', true)
CLAide::Argument.new('PATH', true),
]
def initialize(argv)
......@@ -26,24 +24,22 @@ module Pod
def validate!
super
help! "A specification path is required." unless @path
help! 'A specification path is required.' unless @path
end
def run
spec = Specification.from_file(@path)
output_pipe.puts spec.to_json
end
end
#-----------------------------------------------------------------------#
class Podfile < IPC
self.summary = 'Converts a Podfile to YAML.'
self.description = 'Converts a Podfile to YAML and prints it to STDOUT.'
self.arguments = [
CLAide::Argument.new('PATH', true)
CLAide::Argument.new('PATH', true),
]
def initialize(argv)
......@@ -53,20 +49,18 @@ module Pod
def validate!
super
help! "A Podfile path is required." unless @path
help! 'A Podfile path is required.' unless @path
end
def run
podfile = Pod::Podfile.from_file(@path)
output_pipe.puts podfile.to_yaml
end
end
#-----------------------------------------------------------------------#
class List < IPC
self.summary = 'Lists the specifications known to CocoaPods.'
self.description = <<-DESC
Prints to STDOUT a YAML dictionary where the keys are the name of the
......@@ -99,13 +93,11 @@ module Pod
end
output_pipe.puts result.to_yaml
end
end
#-----------------------------------------------------------------------#
class UpdateSearchIndex < IPC
self.summary = 'Updates the search index.'
self.description = <<-DESC
Updates the search index and prints its path to standard output.
......@@ -123,13 +115,11 @@ module Pod
SourcesManager.updated_search_index
output_pipe.puts(SourcesManager.search_index_path)
end
end
#-----------------------------------------------------------------------#
class Repl < IPC
END_OF_OUTPUT_SIGNAL = "\n\r"
self.summary = 'The repl listens to commands on standard input.'
......@@ -172,11 +162,9 @@ module Pod
signal_end_of_output
end
end
end
#-----------------------------------------------------------------------#
end
end
end
......@@ -6,8 +6,8 @@ module Pod
def self.options
[[
"--update", "Run `pod repo update` before listing",
"--stats", "Show additional stats (like GitHub watchers and forks)"
'--update', 'Run `pod repo update` before listing',
'--stats', 'Show additional stats (like GitHub watchers and forks)'
]].concat(super)
end
......@@ -31,7 +31,7 @@ module Pod
def update_if_necessary!
if @update && config.verbose?
UI.section("\nUpdating Spec Repositories\n".yellow) do
Repo.new(ARGV.new(["update"])).run
Repo.new(ARGV.new(['update'])).run
end
end
end
......@@ -44,9 +44,9 @@ module Pod
def run
update_if_necessary!
days = [1,2,3,5,8]
days = [1, 2, 3, 5, 8]
dates, groups = {}, {}
days.each {|d| dates[d] = Time.now - 60 * 60 * 24 * d}
days.each { |d| dates[d] = Time.now - 60 * 60 * 24 * d }
sets = SourcesManager.all_sets
statistics_provider = Config.instance.spec_statistics_provider
creation_dates = statistics_provider.creation_dates(sets)
......@@ -64,8 +64,8 @@ module Pod
days.reverse.each do |d|
sets = groups[d]
next unless sets
UI.section("\nPods added in the last #{"day".pluralize(d)}".yellow) do
sorted = sets.sort_by {|s| creation_dates[s.name]}
UI.section("\nPods added in the last #{'day'.pluralize(d)}".yellow) do
sorted = sets.sort_by { |s| creation_dates[s.name] }
mode = @stats ? :stats : :name
sorted.each { |set| UI.pod(set, mode, statistics_provider) }
end
......
......@@ -9,7 +9,7 @@ module Pod
DESC
def self.options
[["--no-repo-update", "Skip running `pod repo update` before install"]].concat(super)
[['--no-repo-update', 'Skip running `pod repo update` before install']].concat(super)
end
def initialize(argv)
......@@ -23,11 +23,10 @@ module Pod
# @todo fix.
#
def run
if updates.empty?
UI.puts "No updates are available.".yellow
UI.puts 'No updates are available.'.yellow
else
UI.section "The following updates are available:" do
UI.section 'The following updates are available:' do
updates.each do |(name, from_version, to_version)|
UI.puts "- #{name} #{from_version} -> #{to_version}"
end
......@@ -46,7 +45,6 @@ module Pod
end
end
end
end
private
......@@ -97,9 +95,6 @@ module Pod
config.lockfile
end
end
end
end
end
module Pod
class Command
# Provides support the common behaviour of the `install` and `update`
# commands.
#
......@@ -8,9 +7,9 @@ module Pod
module Options
def options
[
["--no-clean", "Leave SCM dirs like `.git` and `.svn` intact after downloading"],
["--no-integrate", "Skip integration of the Pods libraries in the Xcode project(s)"],
["--no-repo-update", "Skip running `pod repo update` before install"],
['--no-clean', 'Leave SCM dirs like `.git` and `.svn` intact after downloading'],
['--no-integrate', 'Skip integration of the Pods libraries in the Xcode project(s)'],
['--no-repo-update', 'Skip running `pod repo update` before install'],
].concat(super)
end
end
......@@ -105,19 +104,17 @@ module Pod
missing_pods = @pods.select { |pod| !config.lockfile.pod_names.include?(pod) }
if missing_pods.length > 0
raise Informative, (missing_pods.length > 1 \
? "Pods %s are not installed and cannot be updated" \
: "Pod %s is not installed and cannot be updated"
? 'Pods %s are not installed and cannot be updated' \
: 'Pod %s is not installed and cannot be updated'
) % missing_pods.map { |p| "`#{p}`" }.join(', ')
end
run_install_with_update(:pods => @pods)
else
UI.puts "Update all pods".yellow unless @pods
UI.puts 'Update all pods'.yellow unless @pods
run_install_with_update(true)
end
end
end
end
end
......@@ -3,7 +3,6 @@ module Pod
class Push < Command
self.summary = 'Temporary alias for the `pod repo push` command'
def initialize(argv)
@push_command = Repo::Push.new(argv)
super
......
......@@ -21,12 +21,12 @@ module Pod
self.arguments = [
CLAide::Argument.new('NAME', true),
CLAide::Argument.new('URL', true),
CLAide::Argument.new('BRANCH', false)
CLAide::Argument.new('BRANCH', false),
]
def self.options
[
["--shallow", "Create a shallow clone (fast clone, but no push capabilities)"],
['--shallow', 'Create a shallow clone (fast clone, but no push capabilities)'],
].concat(super)
end
......@@ -39,7 +39,7 @@ module Pod
def validate!
super
unless @name && @url
help! "Adding a repo needs a `NAME` and a `URL`."
help! 'Adding a repo needs a `NAME` and a `URL`.'
end
end
......@@ -69,7 +69,7 @@ module Pod
DESC
self.arguments = [
CLAide::Argument.new('NAME', false)
CLAide::Argument.new('NAME', false),
]
def initialize(argv)
......@@ -94,11 +94,11 @@ module Pod
DESC
self.arguments = [
CLAide::Argument.new(%w(NAME DIRECTORY), false)
CLAide::Argument.new(%w(NAME DIRECTORY), false),
]
def self.options
[["--only-errors", "Lint presents only the errors"]].concat(super)
[['--only-errors', 'Lint presents only the errors']].concat(super)
end
def initialize(argv)
......@@ -114,16 +114,16 @@ module Pod
#
def run
if @name
dirs = File.exists?(@name) ? [ Pathname.new(@name) ] : [ dir ]
dirs = File.exist?(@name) ? [Pathname.new(@name)] : [dir]
else
dirs = config.repos_dir.children.select {|c| c.directory?}
dirs = config.repos_dir.children.select { |c| c.directory? }
end
dirs.each do |dir|
SourcesManager.check_version_information(dir)
UI.puts "\nLinting spec repo `#{dir.realpath.basename}`\n".yellow
validator = Source::HealthReporter.new(dir)
validator.pre_check do |name, version|
validator.pre_check do |_name, _version|
UI.print '.'
end
report = validator.analyze
......@@ -144,7 +144,7 @@ module Pod
UI.puts "Analyzed #{report.analyzed_paths.count} podspecs files.\n\n"
if report.pods_by_error.count.zero?
UI.puts "All the specs passed validation.".green << "\n\n"
UI.puts 'All the specs passed validation.'.green << "\n\n"
else
raise Informative, "#{report.pods_by_error.count} podspecs failed validation."
end
......@@ -162,7 +162,7 @@ module Pod
DESC
self.arguments = [
CLAide::Argument.new('NAME', true)
CLAide::Argument.new('NAME', true),
]
def initialize(argv)
......@@ -175,7 +175,7 @@ module Pod
help! 'Deleting a repo needs a `NAME`.' unless @name
help! "repo #{@name} does not exist" unless File.directory?(dir)
help! "You do not have permission to delete the #{@name} repository." \
"Perhaps try prefixing this command with sudo." unless File.writable?(dir)
'Perhaps try prefixing this command with sudo.' unless File.writable?(dir)
end
def run
......@@ -194,4 +194,3 @@ module Pod
end
end
end
......@@ -16,12 +16,12 @@ module Pod
self.arguments = [
CLAide::Argument.new('REPO', true),
CLAide::Argument.new('NAME.podspec', false)
CLAide::Argument.new('NAME.podspec', false),
]
def self.options
[ ["--allow-warnings", "Allows pushing even if there are warnings"],
["--local-only", "Does not perform the step of pushing REPO to its remote"] ].concat(super)
[['--allow-warnings', 'Allows pushing even if there are warnings'],
['--local-only', 'Does not perform the step of pushing REPO to its remote']].concat(super)
end
def initialize(argv)
......@@ -34,7 +34,7 @@ module Pod
def validate!
super
help! "A spec-repo name is required." unless @repo
help! 'A spec-repo name is required.' unless @repo
end
def run
......@@ -69,15 +69,14 @@ module Pod
end
if is_master_repo
raise Informative, "To push to the CocoaPods master repo use " \
raise Informative, 'To push to the CocoaPods master repo use ' \
"the `pod trunk push` command.\n\nIf you are using a fork of " \
"the master repo for private purposes we recommend to migrate " \
"to a clean private repo. To disable this check remove the " \
"remote pointing to the CocoaPods master repo."
'the master repo for private purposes we recommend to migrate ' \
'to a clean private repo. To disable this check remove the ' \
'remote pointing to the CocoaPods master repo.'
end
end
# Performs a full lint against the podspecs.
#
def validate_podspec_files
......@@ -87,7 +86,7 @@ module Pod
validator.only_errors = @allow_warnings
begin
validator.validate
rescue Exception
rescue
raise Informative, "The `#{podspec}` specification does not validate."
end
raise Informative, "The `#{podspec}` specification does not validate." unless validator.validated?
......@@ -143,7 +142,7 @@ module Pod
FileUtils.cp(spec_file, output_path)
Dir.chdir(repo_dir) do
# only commit if modified
if git!("status --porcelain 2>&1").include?(spec.name)
if git!('status --porcelain 2>&1').include?(spec.name)
UI.puts " - #{message}"
git!("add #{spec.name}")
git!("commit --no-verify -m '#{message}'")
......@@ -187,7 +186,7 @@ module Pod
# @return [Array<Pathname>] The path of the specifications to push.
#
def podspec_files
files = Pathname.glob(@podspec || "*.podspec")
files = Pathname.glob(@podspec || '*.podspec')
raise Informative, "Couldn't find any .podspec file in current directory" if files.empty?
files
end
......@@ -199,7 +198,6 @@ module Pod
end
#---------------------------------------------------------------------#
end
end
end
......
......@@ -10,16 +10,16 @@ module Pod
DESC
self.arguments = [
CLAide::Argument.new('QUERY', true)
CLAide::Argument.new('QUERY', true),
]
def self.options
[
["--full", "Search by name, summary, and description"],
["--stats", "Show additional stats (like GitHub watchers and forks)"],
["--ios", "Restricts the search to Pods supported on iOS"],
["--osx", "Restricts the search to Pods supported on OS X"],
["--web", "Searches on cocoapods.org"]
['--full', 'Search by name, summary, and description'],
['--stats', 'Show additional stats (like GitHub watchers and forks)'],
['--ios', 'Restricts the search to Pods supported on iOS'],
['--osx', 'Restricts the search to Pods supported on OS X'],
['--web', 'Searches on cocoapods.org'],
].concat(super.reject { |option, _| option == '--silent' })
end
......@@ -36,13 +36,13 @@ module Pod
def validate!
super
help! "A search query is required." unless @query
help! 'A search query is required.' unless @query
unless @web
begin
/#{@query.join(' ').strip}/
rescue RegexpError
help! "A valid regular expression is required."
help! 'A valid regular expression is required.'
end
end
end
......@@ -62,9 +62,9 @@ module Pod
query_parameter = [
('on:osx' if @supported_on_osx),
('on:ios' if @supported_on_ios),
@query
@query,
].compact.flatten.join(' ')
url = "http://cocoapods.org/?q=#{CGI.escape(query_parameter).gsub("+", "%20")}"
url = "http://cocoapods.org/?q=#{CGI.escape(query_parameter).gsub('+', '%20')}"
UI.puts("Opening #{url}")
open!(url)
end
......@@ -72,10 +72,10 @@ module Pod
def local_search
sets = SourcesManager.search_by_name(@query.join(' ').strip, @full_text_search)
if @supported_on_ios
sets.reject!{ |set| !set.specification.available_platforms.map(&:name).include?(:ios) }
sets.reject! { |set| !set.specification.available_platforms.map(&:name).include?(:ios) }
end
if @supported_on_osx
sets.reject!{ |set| !set.specification.available_platforms.map(&:name).include?(:osx) }
sets.reject! { |set| !set.specification.available_platforms.map(&:name).include?(:osx) }
end
statistics_provider = Config.instance.spec_statistics_provider
......@@ -91,7 +91,6 @@ module Pod
end
end
end
end
end
end
......@@ -16,8 +16,8 @@ module Pod
def self.options
[
["--no-shallow", "Clone full history so push will work"],
["--push", "Use this option to enable push access once granted"],
['--no-shallow', 'Clone full history so push will work'],
['--push', 'Use this option to enable push access once granted'],
].concat(super)
end
......@@ -31,7 +31,7 @@ module Pod
end
def run
UI.section "Setting up CocoaPods master repo" do
UI.section 'Setting up CocoaPods master repo' do
if master_repo_dir.exist?
set_master_repo_url
set_master_repo_branch
......@@ -43,7 +43,7 @@ module Pod
end
end
access_type = push? ? "push" : "read-only"
access_type = push? ? 'push' : 'read-only'
UI.puts "Setup completed (#{access_type} access)".green
end
......@@ -103,7 +103,7 @@ module Pod
#
def set_master_repo_branch
Dir.chdir(master_repo_dir) do
git("checkout master")
git('checkout master')
end
end
......
......@@ -3,7 +3,6 @@ require 'cocoapods-downloader'
module Pod
module Downloader
class Base
override_api do
def execute_command(executable, command, raise_on_failure = false)
......
module Pod
# Module which provides support for running executables.
#
# In a class it can be used as:
......@@ -12,7 +11,6 @@ module Pod
# output of the command.
#
module Executable
# Creates the methods for the executable with the given name.
#
# @param [Symbol] name
......@@ -21,12 +19,11 @@ module Pod
# @return [void]
#
def executable(name)
define_method(name) do |command|
Executable.execute_command(name, command, false)
end
define_method(name.to_s + "!") do |command|
define_method(name.to_s + '!') do |command|
Executable.execute_command(name, command, true)
end
end
......@@ -51,7 +48,6 @@ module Pod
# @todo Find a way to display the live output of the commands.
#
def self.execute_command(executable, command, raise_on_failure)
bin = `which #{executable}`.strip
raise Informative, "Unable to locate the executable `#{executable}`" if bin.empty?
......@@ -66,7 +62,7 @@ module Pod
stdout, stderr = Indenter.new, Indenter.new
end
options = {:stdout => stdout, :stderr => stderr, :status => true}
options = { :stdout => stdout, :stderr => stderr, :status => true }
status = Open4.spawn(full_command, options)
output = stdout.join("\n") + stderr.join("\n")
unless status.success?
......@@ -85,7 +81,6 @@ module Pod
# the UI indentation lever.
#
class Indenter < ::Array
# @return [Fixnum] The indentation level of the UI.
#
attr_accessor :indent
......
......@@ -4,12 +4,10 @@ require 'cocoapods/external_sources/path_source'
require 'cocoapods/external_sources/podspec_source'
module Pod
# Provides support for initializing the correct concrete class of an external
# source.
#
module ExternalSources
# @return [AbstractExternalSource] an initialized instance of the concrete
# external source class associated with the option specified in the
# hash.
......@@ -34,8 +32,8 @@ module Pod
elsif params.key?(:path)
PathSource
elsif params.key?(:local)
UI.warn "The `:local` option of the Podfile has been " \
"renamed to `:path` and it is deprecated."
UI.warn 'The `:local` option of the Podfile has been ' \
'renamed to `:path` and it is deprecated.'
PathSource
elsif Downloader.strategy_from_options(params)
DownloaderSource
......
module Pod
module ExternalSources
# Abstract class that defines the common behaviour of external sources.
#
class AbstractExternalSource
# @return [String] the name of the Pod described by this external source.
#
attr_reader :name
......@@ -48,14 +46,14 @@ module Pod
#
# @return [void]
#
def fetch(sandbox)
raise "Abstract method"
def fetch(_sandbox)
raise 'Abstract method'
end
# @return [String] a string representation of the source suitable for UI.
#
def description
raise "Abstract method"
raise 'Abstract method'
end
protected
......@@ -98,7 +96,7 @@ module Pod
#
def pre_download(sandbox)
title = "Pre-downloading: `#{name}` #{description}"
UI.titled_section(title, { :verbose_prefix => "-> " }) do
UI.titled_section(title, :verbose_prefix => '-> ') do
target = sandbox.root + name
target.rmtree if target.exist?
downloader = Downloader.for_target(target, params)
......@@ -137,4 +135,3 @@ module Pod
end
end
end
module Pod
module ExternalSources
# Provides support for fetching a specification file from a source handled
# by the downloader. Supports all the options of the downloader
#
......@@ -8,7 +7,6 @@ module Pod
# name matching the one of the dependency.
#
class DownloaderSource < AbstractExternalSource
# @see AbstractExternalSource#fetch
#
def fetch(sandbox)
......
module Pod
module ExternalSources
# Provides support for fetching a specification file from a path local to
# the machine running the installation.
#
# Works with the {LocalPod::LocalSourcedPod} class.
#
class PathSource < AbstractExternalSource
# @see AbstractExternalSource#fetch
#
def fetch(sandbox)
title = "Fetching podspec for `#{name}` #{description}"
UI.titled_section(title, { :verbose_prefix => "-> " }) do
UI.titled_section(title, :verbose_prefix => '-> ') do
podspec = podspec_path
unless podspec.exist?
raise Informative, "No podspec found for `#{name}` in " \
......@@ -55,4 +53,3 @@ module Pod
end
end
end
module Pod
module ExternalSources
# Provides support for fetching a specification file from an URL. Can be
# http, file, etc.
#
class PodspecSource < AbstractExternalSource
# @see AbstractExternalSource#fetch
#
def fetch(sandbox)
title = "Fetching podspec for `#{name}` #{description}"
UI.titled_section(title, { :verbose_prefix => "-> " }) do
UI.titled_section(title, :verbose_prefix => '-> ') do
is_json = podspec_uri.split('.').last == 'json'
require 'open-uri'
open(podspec_uri) { |io| store_podspec(sandbox, io.read, is_json) }
......
......@@ -3,4 +3,3 @@ module Pod
#
VERSION = '0.33.1' unless defined? Pod::VERSION
end
module Pod
module Generator
class Acknowledgements
# @return [Array<Class>] The classes of the acknowledgements generator
# subclasses.
#
......@@ -29,25 +27,25 @@ module Pod
# @return [String] The title of the acknowledgements file.
#
def header_title
"Acknowledgements"
'Acknowledgements'
end
# @return [String] A text to present before listing the acknowledgements.
#
def header_text
"This application makes use of the following third party libraries:"
'This application makes use of the following third party libraries:'
end
# @return [String] The title of the foot notes.
#
def footnote_title
""
''
end
# @return [String] the foot notes.
#
def footnote_text
"Generated by CocoaPods - http://cocoapods.org"
'Generated by CocoaPods - http://cocoapods.org'
end
#-----------------------------------------------------------------------#
......@@ -60,7 +58,7 @@ module Pod
# acknowledgements should be generated.
#
def specs
file_accessors.map{ |accessor| accessor.spec.root }.uniq
file_accessors.map { |accessor| accessor.spec.root }.uniq
end
# Returns the text of the license for the given spec.
......@@ -101,7 +99,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
module Generator
class Markdown < Acknowledgements
def self.path_from_basepath(path)
Pathname.new(path.dirname + "#{path.basename.to_s}.markdown")
Pathname.new(path.dirname + "#{path.basename}.markdown")
end
def save_as(path)
file = File.new(path, "w")
file = File.new(path, 'w')
file.write(licenses)
file.close
end
def title_from_string(string, level)
if !string.empty?
"#" * level << " #{string}"
unless string.empty?
'#' * level << " #{string}"
end
end
......@@ -29,7 +27,7 @@ module Pod
licenses_string = "#{title_from_string(header_title, 1)}\n#{header_text}\n"
specs.each do |spec|
if (license = string_for_spec(spec))
license = license.force_encoding("UTF-8") if license.respond_to?(:force_encoding)
license = license.force_encoding('UTF-8') if license.respond_to?(:force_encoding)
licenses_string += license
end
end
......
module Pod
module Generator
class Plist < Acknowledgements
def self.path_from_basepath(path)
Pathname.new(path.dirname + "#{path.basename.to_s}.plist")
Pathname.new(path.dirname + "#{path.basename}.plist")
end
def save_as(path)
......@@ -15,12 +14,12 @@ module Pod
{
:Title => plist_title,
:StringsTable => plist_title,
:PreferenceSpecifiers => licenses
:PreferenceSpecifiers => licenses,
}
end
def plist_title
"Acknowledgements"
'Acknowledgements'
end
def licenses
......@@ -36,26 +35,26 @@ module Pod
def hash_for_spec(spec)
if (license = license_text(spec))
{
:Type => "PSGroupSpecifier",
:Type => 'PSGroupSpecifier',
:Title => spec.name,
:FooterText => license
:FooterText => license,
}
end
end
def header_hash
{
:Type => "PSGroupSpecifier",
:Type => 'PSGroupSpecifier',
:Title => header_title,
:FooterText => header_text
:FooterText => header_text,
}
end
def footnote_hash
{
:Type => "PSGroupSpecifier",
:Type => 'PSGroupSpecifier',
:Title => footnote_title,
:FooterText => footnote_text
:FooterText => footnote_text,
}
end
end
......
......@@ -10,11 +10,11 @@ module Pod
def save_as(pathname)
pathname.open('w') do |source|
source.puts "#import <Foundation/Foundation.h>"
source.puts '#import <Foundation/Foundation.h>'
source.puts "@interface #{class_name} : NSObject"
source.puts "@end"
source.puts '@end'
source.puts "@implementation #{class_name}"
source.puts "@end"
source.puts '@end'
end
end
end
......
......@@ -2,7 +2,6 @@ require 'active_support/core_ext/string/strip'
module Pod
module Generator
# Generates a header which allows to inspect at compile time the installed
# pods and the installed specifications of a pod.
#
......@@ -24,7 +23,6 @@ module Pod
# #endif
#
class TargetEnvironmentHeader
# @return [Hash{String => LocalPod}] the specifications installed for
# the target by build configuration name.
#
......@@ -104,7 +102,7 @@ module Pod
# The name of the spec.
#
def safe_spec_name(spec_name)
spec_name.gsub(/[^\w]/,'_')
spec_name.gsub(/[^\w]/, '_')
end
# @return [String]
......@@ -136,13 +134,13 @@ module Pod
def indent(string, indent_count)
indent = ' ' * (indent_count * 2)
lines = string.lines.map { |line|
lines = string.lines.map do |line|
if line == "\n"
line
else
"#{indent}#{line}"
end
}
end
lines.join
end
......@@ -169,7 +167,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
module Generator
# Generates Xcode configuration files. A configuration file is generated
# for each Pod and for each Pod target definition. The aggregates the
# configurations of the Pods and define target specific settings.
#
module XCConfig
autoload :AggregateXCConfig, 'cocoapods/generator/xcconfig/aggregate_xcconfig'
autoload :PublicPodXCConfig, 'cocoapods/generator/xcconfig/public_pod_xcconfig'
autoload :PrivatePodXCConfig, 'cocoapods/generator/xcconfig/private_pod_xcconfig'
autoload :XCConfigHelper, 'cocoapods/generator/xcconfig/xcconfig_helper'
end
end
end
module Pod
module Generator
module XCConfig
# Generates the xcconfigs for the aggregate targets.
#
class AggregateXCConfig
# @return [Target] the target represented by this xcconfig.
#
attr_reader :target
......@@ -50,13 +48,13 @@ module Pod
#
def generate
header_search_path_flags = target.sandbox.public_headers.search_paths
@xcconfig = Xcodeproj::Config.new({
@xcconfig = Xcodeproj::Config.new(
'OTHER_LDFLAGS' => XCConfigHelper.default_ld_flags(target),
'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(target.sandbox.public_headers.search_paths),
'PODS_ROOT' => target.relative_pods_root,
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(header_search_path_flags, '-isystem')
})
)
target.pod_targets.each do |pod_target|
next unless pod_target.include_in_build_config?(@configuration_name)
......@@ -74,9 +72,7 @@ module Pod
# Add pod static lib to list of libraries that are to be linked with
# the user’s project.
@xcconfig.merge!({
'OTHER_LDFLAGS' => %Q(-l "#{pod_target.name}")
})
@xcconfig.merge!('OTHER_LDFLAGS' => %(-l "#{pod_target.name}"))
end
# TODO Need to decide how we are going to ensure settings like these
......@@ -88,8 +84,7 @@ module Pod
@xcconfig
end
#-----------------------------------------------------------------------#
#---------------------------------------------------------------------#
end
end
end
......
module Pod
module Generator
module XCConfig
# Generates the private xcconfigs for the pod targets.
#
# The private xcconfig file for a Pod target merges the configuration
......@@ -9,7 +8,6 @@ module Pod
# configuration values required by CocoaPods.
#
class PrivatePodXCConfig
# @return [Target] the target represented by this xcconfig.
#
attr_reader :target
......@@ -81,7 +79,7 @@ module Pod
#
def add_xcconfig_namespaced_keys(source_config, destination_config, prefix)
result = destination_config.dup
source_config.each do |key, value|
source_config.each do |key, _value|
prefixed_key = prefix + conditional_less_key(key)
current_value = destination_config[key]
if current_value
......@@ -110,7 +108,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
......
module Pod
module Generator
module XCConfig
# Generates the public xcconfigs for the pod targets.
#
# The public xcconfig file for a Pod is completely namespaced to prevent
......@@ -10,7 +9,6 @@ module Pod
# libraries, frameworks, weak frameworks and xcconfig overrides.
#
class PublicPodXCConfig
# @return [Target] the target represented by this xcconfig.
#
attr_reader :target
......@@ -55,7 +53,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
......
module Pod
module Generator
module XCConfig
# Stores the shared logic of the classes of the XCConfig module.
#
module XCConfigHelper
# Converts an array of strings to a single string where the each string
# is surrounded by double quotes and separated by a space. Used to
# represent strings in a xcconfig file.
......@@ -19,7 +17,7 @@ module Pod
#
def self.quote(strings, prefix = nil)
prefix = "#{prefix} " if prefix
strings.sort.map { |s| %W|#{prefix}"#{s}"| }.join(" ")
strings.sort.map { |s| %W( #{prefix}"#{s}" ) }.join(' ')
end
# @return [String] the default linker flags. `-ObjC` is always included
......@@ -28,7 +26,7 @@ module Pod
#
def self.default_ld_flags(target)
ld_flags = '-ObjC'
if target.target_definition.podfile.set_arc_compatibility_flag? and
if target.target_definition.podfile.set_arc_compatibility_flag? &&
target.spec_consumers.any? { |consumer| consumer.requires_arc? }
ld_flags << ' -fobjc-arc'
end
......@@ -62,11 +60,11 @@ module Pod
# The xcconfig to edit.
#
def self.add_framework_build_settings(framework_path, xcconfig, sandbox_root)
name = File.basename(framework_path, ".framework")
name = File.basename(framework_path, '.framework')
dirname = '$(PODS_ROOT)/' + framework_path.dirname.relative_path_from(sandbox_root).to_s
build_settings = {
'OTHER_LDFLAGS' => "-framework #{name}",
'FRAMEWORK_SEARCH_PATHS' => quote([dirname])
'FRAMEWORK_SEARCH_PATHS' => quote([dirname]),
}
xcconfig.merge!(build_settings)
end
......@@ -81,11 +79,11 @@ module Pod
# The xcconfig to edit.
#
def self.add_library_build_settings(library_path, xcconfig, sandbox_root)
name = File.basename(library_path, ".a").sub(/\Alib/, '')
name = File.basename(library_path, '.a').sub(/\Alib/, '')
dirname = '$(PODS_ROOT)/' + library_path.dirname.relative_path_from(sandbox_root).to_s
build_settings = {
'OTHER_LDFLAGS' => "-l#{name}",
'LIBRARY_SEARCH_PATHS' => quote([dirname])
'LIBRARY_SEARCH_PATHS' => quote([dirname]),
}
xcconfig.merge!(build_settings)
end
......@@ -101,7 +99,7 @@ module Pod
# @return [void]
#
def self.add_developers_frameworks_if_needed(xcconfig, platform)
matched_frameworks = xcconfig.frameworks & ['XCTest', 'SenTestingKit']
matched_frameworks = xcconfig.frameworks & %w(XCTest SenTestingKit)
unless matched_frameworks.empty?
search_paths = xcconfig.attributes['FRAMEWORK_SEARCH_PATHS'] ||= ''
search_paths_to_add = []
......
module Pod
class Podfile
def config
UI.warn "Podfile#config is deprecated. The config is accessible from " \
"the parameter passed to the hooks"
UI.warn 'Podfile#config is deprecated. The config is accessible from ' \
'the parameter passed to the hooks'
Config.instance
end
end
class Podfile::TargetDefinition
def copy_resources_script_name
UI.warn "TargetDefinition#copy_resources_script_name is deprecated. " \
"The value is accessible directly from the representation of the " \
"library using the #copy_resources_script_path method."
UI.warn 'TargetDefinition#copy_resources_script_name is deprecated. ' \
'The value is accessible directly from the representation of the ' \
'library using the #copy_resources_script_path method.'
Config.instance.sandbox.root + "#{label}-resources.sh"
end
end
module Hooks
# The installer representation to pass to the hooks.
#
class InstallerRepresentation
public
# @!group Public Hooks API
......@@ -79,15 +76,16 @@ module Pod
end
#-----------------------------------------------------------------------#
public
# @!group Compatibility
#
# The following aliases provides compatibility with CP < 0.17
alias :target_installers :libraries
alias :specs_by_target :specs_by_lib
alias :local_pods_by_target :pods_by_lib
alias_method :target_installers, :libraries
alias_method :specs_by_target, :specs_by_lib
alias_method :local_pods_by_target, :pods_by_lib
#-----------------------------------------------------------------------#
......@@ -126,9 +124,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
module Hooks
class LibraryRepresentation
# Stores the information of the target installer
#-----------------------------------------------------------------------#
......@@ -27,11 +26,11 @@ module Pod
# @return [Pathname] The path of the prefix_header
#
def prefix_header_path
UI.warn "LibraryRepresentation#prefix_header_path is deprecated. " \
"Use the specification `prefix_header_contents` attribute."
UI.warn 'LibraryRepresentation#prefix_header_path is deprecated. ' \
'Use the specification `prefix_header_contents` attribute.'
library.prefix_header_path
end
alias :prefix_header_filename :prefix_header_path
alias_method :prefix_header_filename, :prefix_header_path
# @return [Pathname] The path of the script used to copy the resources.
#
......@@ -83,13 +82,10 @@ module Pod
def initialize(sandbox, library)
@sandbox = sandbox
@library = library
raise "[BUG]" unless library.is_a?(AggregateTarget)
raise '[BUG]' unless library.is_a?(AggregateTarget)
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
class Specification
def config
UI.warn "[#{name}] Specification#config is deprecated. The config is accessible from " \
"the parameter passed to the hooks"
'the parameter passed to the hooks'
Config.instance
end
end
module Hooks
# Stores the information of the Installer for the hooks
#
class PodRepresentation
# @return [String]
#
attr_accessor :name
......@@ -68,7 +65,6 @@ module Pod
attr_reader :file_accessors
#-----------------------------------------------------------------------#
end
end
end
module Pod
# Provides support for the hook system of CocoaPods. The system is designed
# especially for plugins. Interested clients can register to notifications by
# name.
......@@ -16,7 +15,6 @@ module Pod
#
module HooksManager
class << self
# @return [Hash{Symbol => Proc}] The list of the blocks that are
# registered for each notification name.
#
......@@ -34,8 +32,8 @@ module Pod
raise ArgumentError, 'Missing name' unless name
raise ArgumentError, 'Missing block' unless block
@registrations ||= Hash.new
@registrations[name] ||= Array.new
@registrations ||= {}
@registrations[name] ||= []
@registrations[name] << block
end
......
require 'active_support/core_ext/string/inflections'
module Pod
# The Installer is responsible of taking a Podfile and transform it in the
# Pods libraries. It also integrates the user project so the Pods
# libraries can be used out of the box.
......@@ -29,7 +28,6 @@ module Pod
# source control.
#
class Installer
autoload :Analyzer, 'cocoapods/installer/analyzer'
autoload :FileReferencesInstaller, 'cocoapods/installer/file_references_installer'
autoload :PodSourceInstaller, 'cocoapods/installer/pod_source_installer'
......@@ -95,7 +93,7 @@ module Pod
end
def resolve_dependencies
UI.section "Analyzing dependencies" do
UI.section 'Analyzing dependencies' do
analyze
validate_build_configurations
prepare_for_legacy_compatibility
......@@ -104,7 +102,7 @@ module Pod
end
def download_dependencies
UI.section "Downloading dependencies" do
UI.section 'Downloading dependencies' do
create_file_accessors
install_pod_sources
run_pre_install_hooks
......@@ -113,7 +111,7 @@ module Pod
end
def generate_pods_project
UI.section "Generating Pods project" do
UI.section 'Generating Pods project' do
prepare_pods_project
install_file_references
install_libraries
......@@ -219,7 +217,7 @@ module Pod
end
unless sandbox_state.deleted.empty?
title_options = { :verbose_prefix => "-> ".red }
title_options = { :verbose_prefix => '-> '.red }
sandbox_state.deleted.each do |pod_name|
UI.titled_section("Removing #{pod_name}".red, title_options) do
sandbox.clean_pod(pod_name)
......@@ -253,7 +251,7 @@ module Pod
def install_pod_sources
@installed_specs = []
pods_to_install = sandbox_state.added | sandbox_state.changed
title_options = { :verbose_prefix => "-> ".green }
title_options = { :verbose_prefix => '-> '.green }
root_specs.sort_by(&:name).each do |spec|
if pods_to_install.include?(spec.name)
if sandbox_state.changed.include?(spec.name) && sandbox.manifest
......@@ -346,7 +344,7 @@ module Pod
# @todo Clean and modify the project if it exists.
#
def prepare_pods_project
UI.message "- Creating Pods project" do
UI.message '- Creating Pods project' do
@pods_project = Pod::Project.new(sandbox.project_path)
analysis_result.all_user_build_configurations.each do |name, type|
......@@ -378,7 +376,6 @@ module Pod
end
end
# Installs the file references in the Pods project. This is done once per
# Pod as the same file reference might be shared by multiple aggregate
# targets.
......@@ -396,7 +393,7 @@ module Pod
# @return [void]
#
def install_libraries
UI.message"- Installing libraries" do
UI.message'- Installing libraries' do
pod_targets.sort_by(&:name).each do |pod_target|
next if pod_target.target_definition.empty?
target_installer = PodTargetInstaller.new(sandbox, pod_target)
......@@ -448,7 +445,7 @@ module Pod
UI.message "- Writing Xcode project file to #{UI.path sandbox.project_path}" do
pods_project.pods.remove_from_project if pods_project.pods.empty?
pods_project.development_pods.remove_from_project if pods_project.development_pods.empty?
pods_project.sort({:groups_position => :below})
pods_project.sort(:groups_position => :below)
pods_project.recreate_user_schemes(false)
pods_project.save
end
......@@ -504,9 +501,9 @@ module Pod
# @return [void]
#
def run_pre_install_hooks
UI.message "- Running pre install hooks" do
UI.message '- Running pre install hooks' do
executed = run_podfile_pre_install_hook
UI.message "- Podfile" if executed
UI.message '- Podfile' if executed
end
end
......@@ -519,8 +516,8 @@ module Pod
def run_podfile_pre_install_hook
podfile.pre_install!(installer_rep)
rescue => e
raise Informative, "An error occurred while processing the pre-install " \
"hook of the Podfile." \
raise Informative, 'An error occurred while processing the pre-install ' \
'hook of the Podfile.' \
"\n\n#{e.message}\n\n#{e.backtrace * "\n"}"
end
......@@ -532,9 +529,9 @@ module Pod
# @return [void]
#
def run_podfile_post_install_hooks
UI.message "- Running post install hooks" do
UI.message '- Running post install hooks' do
executed = run_podfile_post_install_hook
UI.message "- Podfile" if executed
UI.message '- Podfile' if executed
end
end
......@@ -547,8 +544,8 @@ module Pod
def run_podfile_post_install_hook
podfile.post_install!(installer_rep)
rescue => e
raise Informative, "An error occurred while processing the post-install " \
"hook of the Podfile." \
raise Informative, 'An error occurred while processing the post-install ' \
'hook of the Podfile.' \
"\n\n#{e.message}\n\n#{e.backtrace * "\n"}"
end
......@@ -635,6 +632,5 @@ module Pod
end
#-------------------------------------------------------------------------#
end
end
module Pod
class Installer
# Analyzes the Podfile, the Lockfile, and the sandbox manifest to generate
# the information relative to a CocoaPods installation.
#
class Analyzer
include Config::Mixin
autoload :SandboxAnalyzer, 'cocoapods/installer/analyzer/sandbox_analyzer'
......@@ -111,7 +109,7 @@ module Pod
:none
elsif update == true
:all
elsif update[:pods] != nil
elsif !update[:pods].nil?
:selected
end
end
......@@ -149,7 +147,7 @@ module Pod
def generate_podfile_state
if lockfile
pods_state = nil
UI.section "Finding Podfile changes" do
UI.section 'Finding Podfile changes' do
pods_by_state = lockfile.detect_changes_with_podfile(podfile)
pods_by_state.dup.each do |state, full_names|
pods_by_state[state] = full_names.map { |fn| Specification.root_name(fn) }
......@@ -290,7 +288,7 @@ module Pod
end
unless deps_to_fetch.empty?
UI.section "Fetching external sources" do
UI.section 'Fetching external sources' do
deps_to_fetch.uniq.sort.each do |dependency|
source = ExternalSources.from_dependency(dependency, podfile.defined_in_file)
source.fetch(sandbox)
......@@ -343,7 +341,7 @@ module Pod
#
def generate_sandbox_state
sandbox_state = nil
UI.section "Comparing resolved specification to the sandbox manifest" do
UI.section 'Comparing resolved specification to the sandbox manifest' do
sandbox_analyzer = SandboxAnalyzer.new(sandbox, result.specifications, update_mode?, lockfile)
sandbox_state = sandbox_analyzer.analyze
sandbox_state.print
......@@ -381,7 +379,7 @@ module Pod
path = "#{path}.xcodeproj" unless File.extname(path) == '.xcodeproj'
path = Pathname.new(path)
unless path.exist?
raise Informative, "Unable to find the Xcode project " \
raise Informative, 'Unable to find the Xcode project ' \
"`#{path}` for the target `#{target_definition.label}`."
end
......@@ -390,7 +388,7 @@ module Pod
if xcodeprojs.size == 1
path = xcodeprojs.first
else
raise Informative, "Could not automatically select an Xcode project. " \
raise Informative, 'Could not automatically select an Xcode project. ' \
"Specify one in your Podfile like so:\n\n" \
" xcodeproj 'path/to/Project.xcodeproj'\n"
end
......@@ -417,12 +415,12 @@ module Pod
targets = native_targets(user_project).select { |t| link_with.include?(t.name) }
raise Informative, "Unable to find the targets named `#{link_with.to_sentence}` to link with target definition `#{target_definition.name}`" if targets.empty?
elsif target_definition.link_with_first_target?
targets = [ native_targets(user_project).first ].compact
raise Informative, "Unable to find a target" if targets.empty?
targets = [native_targets(user_project).first].compact
raise Informative, 'Unable to find a target' if targets.empty?
else
target = native_targets(user_project).find { |t| t.name == target_definition.name.to_s }
targets = [ target ].compact
raise Informative, "Unable to find a target named `#{target_definition.name.to_s}`" if targets.empty?
targets = [target].compact
raise Informative, "Unable to find a target named `#{target_definition.name}`" if targets.empty?
end
targets
end
......@@ -442,7 +440,7 @@ module Pod
#
def compute_user_build_configurations(target_definition, user_targets)
if user_targets
user_targets.map { |t| t.build_configurations.map(&:name) }.flatten.inject({}) do |hash, name|
user_targets.map { |t| t.build_configurations.map(&:name) }.flatten.reduce({}) do |hash, name|
hash[name] = name == 'Debug' ? :debug : :release
hash
end.merge(target_definition.build_configurations || {})
......@@ -466,7 +464,7 @@ module Pod
user_targets.each do |target|
name ||= target.platform_name
raise Informative, "Targets with different platforms" unless name == target.platform_name
raise Informative, 'Targets with different platforms' unless name == target.platform_name
if !deployment_target || deployment_target > Version.new(target.deployment_target)
deployment_target = Version.new(target.deployment_target)
end
......@@ -484,7 +482,7 @@ module Pod
# @todo Is assigning the platform to the target definition the best way
# to go?
#
def compute_archs_for_target_definition(target_definition, user_targets)
def compute_archs_for_target_definition(_target_definition, user_targets)
archs = []
user_targets.each do |target|
target_archs = target.common_resolved_build_setting('ARCHS')
......@@ -515,7 +513,7 @@ module Pod
@archs_by_target_def[target_definition] = archs
else
unless target_definition.platform
raise Informative, "It is necessary to specify the platform in the Podfile if not integrating."
raise Informative, 'It is necessary to specify the platform in the Podfile if not integrating.'
end
end
end
......@@ -524,7 +522,6 @@ module Pod
#-----------------------------------------------------------------------#
class AnalysisResult
# @return [SpecsState] the states of the Podfile specs.
#
attr_accessor :podfile_state
......@@ -555,7 +552,7 @@ module Pod
# its type (`:debug` or `:release`).
#
def all_user_build_configurations
targets.inject({}) do |result, target|
targets.reduce({}) do |result, target|
result.merge(target.user_build_configurations)
end
end
......@@ -572,7 +569,6 @@ module Pod
# subspecs are added instead of the name of the Pods.
#
class SpecsState
# @param [Hash{Symbol=>String}] pods_by_state
# The **root** name of the pods grouped by their state
# (`:added`, `:removed`, `:changed` or `:unchanged`).
......@@ -612,10 +608,10 @@ module Pod
# @return [void]
#
def print
added .sort.each { |pod| UI.message("A".green + " #{pod}", '', 2) }
deleted .sort.each { |pod| UI.message("R".red + " #{pod}", '', 2) }
changed .sort.each { |pod| UI.message("M".yellow + " #{pod}", '', 2) }
unchanged.sort.each { |pod| UI.message("-" + " #{pod}", '', 2) }
added .sort.each { |pod| UI.message('A'.green + " #{pod}", '', 2) }
deleted .sort.each { |pod| UI.message('R'.red + " #{pod}", '', 2) }
changed .sort.each { |pod| UI.message('M'.yellow + " #{pod}", '', 2) }
unchanged.sort.each { |pod| UI.message('-' + " #{pod}", '', 2) }
end
# Adds the name of a Pod to the give state.
......@@ -631,10 +627,9 @@ module Pod
# @return [void]
#
def add_name(name, state)
raise "[Bug] Attempt to add subspec to the pods state" if name.include?('/')
self.send(state) << name
raise '[Bug] Attempt to add subspec to the pods state' if name.include?('/')
send(state) << name
end
end
end
end
......
module Pod
class Installer
class Analyzer
# Analyze the sandbox to detect which Pods should be removed, and which
# ones should be reinstalled.
#
......@@ -28,7 +27,6 @@ module Pod
# - If none of the above conditions match.
#
class SandboxAnalyzer
# @return [Sandbox] The sandbox to analyze.
#
attr_reader :sandbox
......@@ -98,7 +96,7 @@ module Pod
return :added if pod_added?(pod)
return :deleted if pod_deleted?(pod)
return :changed if pod_changed?(pod)
return :unchanged
:unchanged
end
# Returns whether the Pod with the given name should be installed.
......@@ -112,8 +110,8 @@ module Pod
#
def pod_added?(pod)
return true if resolved_pods.include?(pod) && !sandbox_pods.include?(pod)
return true if !folder_exist?(pod)
return false
return true unless folder_exist?(pod)
false
end
# Returns whether the Pod with the given name should be removed from
......@@ -126,7 +124,7 @@ module Pod
#
def pod_deleted?(pod)
return true if !resolved_pods.include?(pod) && sandbox_pods.include?(pod)
return false
false
end
# Returns whether the Pod with the given name should be considered
......@@ -154,7 +152,7 @@ module Pod
if update_mode
return true if sandbox.head_pod?(pod)
end
return false
false
end
#---------------------------------------------------------------------#
......@@ -254,7 +252,6 @@ module Pod
end
#---------------------------------------------------------------------#
end
end
end
......
module Pod
class Installer
# Controller class responsible of installing the file references of the
# specifications in the Pods project.
#
class FileReferencesInstaller
# @return [Sandbox] The sandbox of the installation.
#
attr_reader :sandbox
......@@ -68,7 +66,7 @@ module Pod
# @return [void]
#
def add_source_files_references
UI.message "- Adding source files to Pods project" do
UI.message '- Adding source files to Pods project' do
add_file_accessors_paths_to_pods_group(:source_files)
end
end
......@@ -78,7 +76,7 @@ module Pod
# @return [void]
#
def add_frameworks_bundles
UI.message "- Adding frameworks to Pods project" do
UI.message '- Adding frameworks to Pods project' do
add_file_accessors_paths_to_pods_group(:vendored_frameworks, :frameworks)
end
end
......@@ -88,7 +86,7 @@ module Pod
# @return [void]
#
def add_vendored_libraries
UI.message "- Adding libraries to Pods project" do
UI.message '- Adding libraries to Pods project' do
add_file_accessors_paths_to_pods_group(:vendored_libraries, :frameworks)
end
end
......@@ -101,7 +99,7 @@ module Pod
# @return [void]
#
def add_resources
UI.message "- Adding resources to Pods project" do
UI.message '- Adding resources to Pods project' do
add_file_accessors_paths_to_pods_group(:resources, :resources)
add_file_accessors_paths_to_pods_group(:resource_bundle_files, :resources)
end
......@@ -112,7 +110,7 @@ module Pod
# @return [void]
#
def link_headers
UI.message "- Linking headers" do
UI.message '- Linking headers' do
libraries.each do |library|
library.file_accessors.each do |file_accessor|
headers_sandbox = Pathname.new(file_accessor.spec.root.name)
......@@ -202,7 +200,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
class Installer
# Context object designed to be used with the HooksManager which describes
# the context of the installer.
#
class HooksContext
# @return [String] The path to the sandbox root (`Pods` directory).
#
attr_accessor :sandbox_root
......@@ -40,7 +38,6 @@ module Pod
# Pure data class which describes and umbrella target.
#
class UmbrellaTargetDescription
# @return [String] The path of the user project
# integrated by this target.
#
......
......@@ -2,14 +2,12 @@ require 'active_support/core_ext/string/strip'
module Pod
class Installer
# Controller class responsible of installing the activated specifications
# of a single Pod.
#
# @note This class needs to consider all the activated specs of a Pod.
#
class PodSourceInstaller
# @return [Sandbox]
#
attr_reader :sandbox
......@@ -62,7 +60,7 @@ module Pod
# @return [void]
#
def clean!
clean_installation if !local?
clean_installation unless local?
end
# @return [Hash]
......@@ -89,9 +87,9 @@ module Pod
@specific_source = downloader.checkout_options
rescue RuntimeError => e
if e.message == 'Abstract method'
raise Informative, "The pod '" + root_spec.name + "' does not " +
"support the :head option, as it uses a " + downloader.name +
" source. Remove that option to use this pod."
raise Informative, "The pod '" + root_spec.name + "' does not " \
'support the :head option, as it uses a ' + downloader.name +
' source. Remove that option to use this pod.'
else
raise
end
......@@ -121,7 +119,7 @@ module Pod
#
def run_prepare_command
return unless root_spec.prepare_command
UI.section(" > Running prepare command", '', 1) do
UI.section(' > Running prepare command', '', 1) do
Dir.chdir(root) do
ENV.delete('CDPATH')
prepare_command = root_spec.prepare_command.strip_heredoc.chomp
......@@ -237,7 +235,7 @@ module Pod
def clean_paths
cached_used = used_files
glob_options = File::FNM_DOTMATCH | File::FNM_CASEFOLD
files = Pathname.glob(root + "**/*", glob_options).map(&:to_s)
files = Pathname.glob(root + '**/*', glob_options).map(&:to_s)
files.reject! do |candidate|
candidate = candidate.downcase
......@@ -265,11 +263,10 @@ module Pod
file_accessors.map(&:source_files),
]
files.flatten.compact.map{ |path| path.to_s }.uniq
files.flatten.compact.map { |path| path.to_s }.uniq
end
#-----------------------------------------------------------------------#
end
end
end
......@@ -6,13 +6,11 @@ require 'active_support/core_ext/array/conversions'
module Pod
class Installer
# The {UserProjectIntegrator} integrates the libraries generated by
# TargetDefinitions of the {Podfile} with their correspondent user
# projects.
#
class UserProjectIntegrator
autoload :TargetIntegrator, 'cocoapods/installer/user_project_integrator/target_integrator'
# @return [Podfile] the podfile that should be integrated with the user
......@@ -129,8 +127,8 @@ module Pod
# @return [void]
#
def warn_about_empty_podfile
if podfile.target_definitions.values.all?{ |td| td.empty? }
UI.warn "[!] The Podfile does not contain any dependencies."
if podfile.target_definitions.values.all? { |td| td.empty? }
UI.warn '[!] The Podfile does not contain any dependencies.'
end
end
......@@ -175,7 +173,7 @@ module Pod
project = user_project_paths.first.basename('.xcodeproj')
installation_root + "#{project}.xcworkspace"
else
raise Informative, "Could not automatically select an Xcode " \
raise Informative, 'Could not automatically select an Xcode ' \
"workspace. Specify one in your Podfile like so:\n\n" \
" workspace 'path/to/Workspace.xcworkspace'\n"
end
......@@ -213,18 +211,17 @@ module Pod
#
def print_override_warning(aggregate_target, user_target, config, key)
actions = [
"Use the `$(inherited)` flag, or",
"Remove the build settings from the target."
'Use the `$(inherited)` flag, or',
'Remove the build settings from the target.',
]
message = "The `#{user_target.name} [#{config.name}]` " \
"target overrides the `#{key}` build setting defined in " \
"`#{aggregate_target.xcconfig_relative_path(config.name)}'. " \
"This can lead to problems with the CocoaPods installation"
'This can lead to problems with the CocoaPods installation'
UI.warn(message, actions)
end
#-----------------------------------------------------------------------#
end
end
end
......@@ -3,12 +3,10 @@ require 'active_support/core_ext/string/inflections'
module Pod
class Installer
class UserProjectIntegrator
# This class is responsible for integrating the library generated by a
# {TargetDefinition} with its destination project.
#
class TargetIntegrator
autoload :XCConfigIntegrator, 'cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator'
# @return [Target] the target that should be integrated.
......@@ -45,7 +43,6 @@ module Pod
"#<#{self.class} for target `#{target.label}'>"
end
private
# @!group Integration steps
......@@ -76,12 +73,12 @@ module Pod
# @return [void]
#
def add_copy_resources_script_phase
phase_name = "Copy Pods Resources"
phase_name = 'Copy Pods Resources'
native_targets_to_integrate.each do |native_target|
phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first ||
native_target.new_shell_script_build_phase(phase_name)
path = target.copy_resources_script_relative_path
phase.shell_script = %{"#{path}"\n}
phase.shell_script = %( "#{path}"\n )
phase.show_env_vars_in_log = '0'
end
end
......
......@@ -71,7 +71,6 @@ module Pod
config.base_configuration_reference = file_ref
end
private
# @!group Private helpers
......@@ -94,13 +93,13 @@ module Pod
#
def self.print_override_warning(pod_bundle, target, config, key)
actions = [
"Use the `$(inherited)` flag, or",
"Remove the build settings from the target."
'Use the `$(inherited)` flag, or',
'Remove the build settings from the target.',
]
message = "The `#{target.name} [#{config.name}]` " \
"target overrides the `#{key}` build setting defined in " \
"`#{pod_bundle.xcconfig_relative_path(config.name)}'. " \
"This can lead to problems with the CocoaPods installation"
'This can lead to problems with the CocoaPods installation'
UI.warn(message, actions)
end
end
......
......@@ -3,7 +3,6 @@ require 'open-uri'
# Allow OpenURI to follow http to https redirects.
#
module OpenURI
# Whether {#open} should follow a redirect.
#
# Inspiration from: https://gist.github.com/1271420
......@@ -17,7 +16,7 @@ module OpenURI
# (RFC 2109 4.3.1, RFC 2965 3.3, RFC 2616 15.1.3)
# However this is ad hoc. It should be extensible/configurable.
#
def OpenURI.redirectable?(uri1, uri2)
def self.redirectable?(uri1, uri2)
uri1.scheme.downcase == uri2.scheme.downcase ||
(/\A(?:http|ftp)\z/i =~ uri1.scheme && /\A(?:https?|ftp)\z/i =~ uri2.scheme)
end
......
require 'xcodeproj'
module Pod
# The Pods project.
#
# Model class which provides helpers for working with the Pods project
# through the installation process.
#
class Project < Xcodeproj::Project
# @param [Pathname, String] path @see path
# @param [Bool] skip_initialization
# Wether the project should be initialized from scratch.
......@@ -34,7 +32,6 @@ module Pod
#
attr_reader :development_pods
public
# @!group Pod Groups
......@@ -58,7 +55,7 @@ module Pod
# @return [PBXGroup] The new group.
#
def add_pod_group(pod_name, path, development = false, absolute = false)
raise "[BUG]" if pod_group(pod_name)
raise '[BUG]' if pod_group(pod_name)
parent_group = development ? development_pods : pods
source_tree = absolute ? :absolute : :group
......@@ -236,6 +233,5 @@ module Pod
attr_reader :refs_by_absolute_path
#-------------------------------------------------------------------------#
end
end
module Pod
# The resolver is responsible of generating a list of specifications grouped
# by target for a given Podfile.
#
......@@ -15,7 +14,6 @@ module Pod
#
#
class Resolver
# @return [Sandbox] the Sandbox used by the resolver to find external
# dependencies.
#
......
require 'fileutils'
module Pod
# The sandbox provides support for the directory that CocoaPods uses for an
# installation. In this directory the Pods projects, the support files and
# the sources of the Pods are stored.
......@@ -46,7 +45,6 @@ module Pod
# See #833
#
class Sandbox
autoload :FileAccessor, 'cocoapods/sandbox/file_accessor'
autoload :HeadersStore, 'cocoapods/sandbox/headers_store'
autoload :PathList, 'cocoapods/sandbox/path_list'
......@@ -64,7 +62,7 @@ module Pod
def initialize(root)
FileUtils.mkdir_p(root)
@root = Pathname.new(root).realpath
@public_headers = HeadersStore.new(self, "Headers")
@public_headers = HeadersStore.new(self, 'Headers')
@predownloaded_pods = []
@head_pods = []
@checkout_sources = {}
......@@ -120,13 +118,13 @@ module Pod
# @return [Pathname] the path of the manifest.
#
def manifest_path
root + "Manifest.lock"
root + 'Manifest.lock'
end
# @return [Pathname] the path of the Pods project.
#
def project_path
root + "Pods.xcodeproj"
root + 'Pods.xcodeproj'
end
# Returns the path for the directory where to store the support files of
......@@ -137,7 +135,7 @@ module Pod
#
# @return [Pathname] the path of the support files.
#
def library_support_files_dir(name)
def library_support_files_dir(_name)
# root + "Target Support Files/#{name}"
root
end
......@@ -202,9 +200,9 @@ module Pod
# @todo Migrate old installations and store the for all the pods.
# Two folders should be created `External Sources` and `Podspecs`.
#
def specifications_dir(external_source = false)
def specifications_dir(_external_source = false)
# root + "Specifications"
root + "Local Podspecs"
root + 'Local Podspecs'
end
# Returns the path of the specification for the Pod with the
......@@ -395,7 +393,5 @@ module Pod
end
#-------------------------------------------------------------------------#
end
end
module Pod
class Sandbox
# Resolves the file patterns of a specification against its root directory,
# taking into account any exclude pattern and the default extensions to use
# for directories.
......@@ -8,7 +7,6 @@ module Pod
# @note The FileAccessor always returns absolute paths.
#
class FileAccessor
HEADER_EXTENSIONS = Xcodeproj::Constants::HEADER_FILES_EXTENSIONS
# @return [Sandbox::PathList] the directory where the source of the Pod
......@@ -33,7 +31,7 @@ module Pod
@spec_consumer = spec_consumer
unless @spec_consumer
raise Informative, "Attempt to initialize File Accessor without a specification consumer."
raise Informative, 'Attempt to initialize File Accessor without a specification consumer.'
end
end
......@@ -151,7 +149,7 @@ module Pod
# @return [Pathname] The path of the auto-detected README file.
#
def readme
path_list.glob(%w[ readme{*,.*} ]).first
path_list.glob(%w( readme{*,.*} )).first
end
# @return [Pathname] The path of the license file as indicated in the
......@@ -161,7 +159,7 @@ module Pod
if spec_consumer.spec.root.license[:file]
path_list.root + spec_consumer.spec.root.license[:file]
else
path_list.glob(%w[ licen{c,s}e{*,.*} ]).first
path_list.glob(%w( licen{c,s}e{*,.*} )).first
end
end
......@@ -229,9 +227,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
class Sandbox
# Provides support for managing a header directory. It also keeps track of
# the header search paths.
#
class HeadersStore
# @return [Pathname] the absolute path of this header directory.
#
def root
......@@ -91,7 +89,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
class Sandbox
# The PathList class is designed to perform multiple glob matches against
# a given directory. Basically, it generates a list of all the children
# paths and matches the globs patterns against them, resulting in just one
......@@ -11,7 +10,6 @@ module Pod
# {#read_file_system}
#
class PathList
# @return [Pathname] The root of the list whose files and directories
# are used to perform the matching operations.
#
......@@ -46,15 +44,15 @@ module Pod
unless root.exist?
raise Informative, "Attempt to read non existent folder `#{root}`."
end
root_length = root.to_s.length+1
root_length = root.to_s.length + 1
escaped_root = escape_path_for_glob(root)
paths = Dir.glob(escaped_root + "**/*", File::FNM_DOTMATCH)
paths = Dir.glob(escaped_root + '**/*', File::FNM_DOTMATCH)
absolute_dirs = paths.select { |path| File.directory?(path) }
relative_dirs = absolute_dirs.map { |p| p[root_length..-1] }
absolute_paths = paths.reject { |p| p == "#{root}/." || p == "#{root}/.." }
relative_paths = absolute_paths.map { |p| p[root_length..-1] }
@files = relative_paths - relative_dirs
@dirs = relative_dirs.map { |d| d.gsub(/\/\.\.?$/,'') }.reject { |d| d == '.' || d == '..' } .uniq
@dirs = relative_dirs.map { |d| d.gsub(/\/\.\.?$/, '') }.reject { |d| d == '.' || d == '..' } .uniq
end
#-----------------------------------------------------------------------#
......@@ -67,7 +65,7 @@ module Pod
# paths.
#
def glob(patterns, options = {})
relative_glob(patterns, options).map {|p| root + p }
relative_glob(patterns, options).map { |p| root + p }
end
# @return [Array<Pathname>] The list of relative paths that are case
......@@ -164,9 +162,9 @@ module Pod
end
if values_by_set.empty?
[ pattern ]
[pattern]
else
patterns = [ pattern ]
patterns = [pattern]
values_by_set.each do |set, values|
patterns = patterns.map do |old_pattern|
values.map do |value|
......@@ -192,13 +190,12 @@ module Pod
result = path.to_s
characters_to_escape = ['[', ']', '{', '}', '?', '*']
characters_to_escape.each do |character|
result.gsub!(character, "\\#{character}" )
result.gsub!(character, "\\#{character}")
end
Pathname.new(result)
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
# Manages all the sources known to the running CocoaPods Instance.
#
class SourcesManager
class << self
include Config::Mixin
# @return [Source::Aggregate] the aggregate of all the sources known to
......@@ -78,7 +75,7 @@ module Pod
sets = aggregate.search_by_name(query, false)
end
if sets.empty?
extra = ", author, summary, or description" if full_text_search
extra = ', author, summary, or description' if full_text_search
raise Informative, "Unable to find a pod with name#{extra}" \
"matching `#{query}`"
end
......@@ -155,13 +152,13 @@ module Pod
UI.section "Updating spec repo `#{source.name}`" do
Dir.chdir(source.data_provider.repo) do
begin
output = git!("pull --ff-only")
output = git!('pull --ff-only')
UI.puts output if show_output && !config.verbose?
rescue Informative => e
UI.warn "CocoaPods was not able to update the " \
UI.warn 'CocoaPods was not able to update the ' \
"`#{source.name}` repo. If this is an unexpected issue " \
"and persists you can inspect it running " \
"`pod repo update --verbose`"
'and persists you can inspect it running ' \
'`pod repo update --verbose`'
end
end
check_version_information(source.data_provider.repo)
......@@ -196,10 +193,10 @@ module Pod
versions = version_information(dir)
unless repo_compatible?(dir)
min, max = versions['min'], versions['max']
version_msg = ( min == max ) ? min : "#{min} - #{max}"
version_msg = ( min == max) ? min : "#{min} - #{max}"
raise Informative, "The `#{dir.basename}` repo requires " \
"CocoaPods #{version_msg} (currently using #{Pod::VERSION})\n".red +
"Update CocoaPods, or checkout the appropriate tag in the repo."
'Update CocoaPods, or checkout the appropriate tag in the repo.'
end
needs_sudo = path_writable?(__FILE__)
......@@ -330,4 +327,3 @@ module Pod
end
end
end
module Pod
# Model class which describes a Pods target.
#
# The Target class stores and provides the information necessary for
......@@ -7,7 +6,6 @@ module Pod
# This class is used to represent both the targets and their libraries.
#
class Target
# @return [PBXNativeTarget] the target definition of the Podfile that
# generated this target.
#
......@@ -101,7 +99,7 @@ module Pod
# the information about the installed pods.
#
def target_environment_header_path
support_files_root + "#{target_definition.label.to_s}-environment.h"
support_files_root + "#{target_definition.label}-environment.h"
end
# @return [Pathname] the absolute path of the prefix header file.
......@@ -123,6 +121,5 @@ module Pod
end
#-------------------------------------------------------------------------#
end
end
module Pod
# Stores the information relative to the target used to cluster the targets
# of the single Pods. The client targets will then depend on this one.
#
class AggregateTarget < Target
# @param [TargetDefinition] target_definition @see target_definition
# @param [Sandbox] sandbox @see sandbox
#
......@@ -53,7 +51,7 @@ module Pod
user_target_uuids.map do |uuid|
native_target = project.objects_by_uuid[uuid]
unless native_target
raise Informative, "[Bug] Unable to find the target with " \
raise Informative, '[Bug] Unable to find the target with ' \
"the `#{uuid}` UUID for the `#{self}` integration library"
end
native_target
......@@ -69,7 +67,6 @@ module Pod
#
attr_reader :xcconfigs
# @return [Array<PodTarget>] The dependencies for this target.
#
attr_accessor :pod_targets
......
module Pod
# Stores the information relative to the target used to compile a single Pod.
# A pod can have one or more activated spec/subspecs.
#
class PodTarget < Target
# @return [Specification] the spec for the target.
#
attr_reader :specs
......@@ -21,14 +19,14 @@ module Pod
@specs = specs
@target_definition = target_definition
@sandbox = sandbox
@build_headers = Sandbox::HeadersStore.new(sandbox, "BuildHeaders")
@build_headers = Sandbox::HeadersStore.new(sandbox, 'BuildHeaders')
@file_accessors = []
end
# @return [String] the label for the target.
#
def label
"#{target_definition.label.to_s}-#{root_spec.name}"
"#{target_definition.label}-#{root_spec.name}"
end
# @return [Array<Sandbox::FileAccessor>] the file accessors for the
......@@ -82,8 +80,8 @@ module Pod
else
raise Informative, "The subspecs of `#{pod_name}` are linked to " \
"different build configurations for the `#{target_definition}` " \
"target. CocoaPods does not support subspecs across different " \
"build configurations."
'target. CocoaPods does not support subspecs across different ' \
'build configurations.'
end
end
......
require 'cocoapods/user_interface/error_report'
module Pod
# Provides support for UI output. It provides support for nested sections of
# information and for a verbose mode.
#
module UserInterface
require 'colored'
@title_colors = %w|yellow green|
@title_colors = %w( yellow green )
@title_level = 0
@indentation_level = 2
@treat_titles_as_messages = false
@warnings = []
class << self
include Config::Mixin
attr_accessor :indentation_level
......@@ -78,7 +75,7 @@ module Pod
# A title opposed to a section is always visible
#
def title(title, verbose_prefix = '', relative_indentation = 2)
if(@treat_titles_as_messages)
if @treat_titles_as_messages
message(title, verbose_prefix)
else
title = verbose_prefix + title if config.verbose?
......@@ -122,7 +119,7 @@ module Pod
#
def info(message)
indentation = config.verbose? ? self.indentation_level : 0
indented = wrap_string(message, " " * indentation)
indented = wrap_string(message, ' ' * indentation)
puts(indented)
self.indentation_level += 2
......@@ -170,7 +167,7 @@ module Pod
colored_title = title.green
end
title(colored_title, "", 1) do
title(colored_title, '', 1) do
puts_indented pod.summary
puts_indented "pod '#{pod.name}', '~> #{pod.version}'"
labeled('Homepage', pod.homepage)
......@@ -210,7 +207,7 @@ module Pod
# wrapping it to the terminal width if necessary.
#
def puts_indented(message = '')
indented = wrap_string(message, " " * self.indentation_level)
indented = wrap_string(message, ' ' * self.indentation_level)
puts(indented)
end
......@@ -225,7 +222,7 @@ module Pod
next if warning[:verbose_only] && !config.verbose?
STDERR.puts("\n[!] #{warning[:message]}".yellow)
warning[:actions].each do |action|
indented = wrap_string(action, " - ")
indented = wrap_string(action, ' - ')
puts(indented)
end
end
......@@ -302,9 +299,7 @@ module Pod
# Redirects cocoapods-core UI.
#
module CoreUI
class << self
def puts(message)
UI.puts message
end
......@@ -316,14 +311,12 @@ module Pod
end
end
#---------------------------------------------------------------------------#
#---------------------------------------------------------------------------#
module Xcodeproj
# Redirects xcodeproj UI.
#
module UserInterface
def self.puts(message)
::Pod::UI.puts message
end
......@@ -331,7 +324,5 @@ module Xcodeproj
def self.warn(message)
::Pod::UI.warn message
end
end
end
......@@ -8,7 +8,7 @@ module Pod
module ErrorReport
class << self
def report(exception)
return <<-EOS
<<-EOS
#{'――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed}
......@@ -75,7 +75,7 @@ EOS
def error_from_podfile(error)
if error.message =~ /Podfile:(\d*)/
"\nIt appears to have originated from your Podfile at line #{$1}.\n"
"\nIt appears to have originated from your Podfile at line #{Regexp.last_match[1]}.\n"
end
end
......@@ -90,12 +90,12 @@ EOS
end
def host_information
product, version, build =`sw_vers`.strip.split("\n").map { |line| line.split(":").last.strip }
product, version, build = `sw_vers`.strip.split("\n").map { |line| line.split(':').last.strip }
"#{product} #{version} (#{build})"
end
def xcode_information
version, build = `xcodebuild -version`.strip.split("\n").map { |line| line.split(" ").last }
version, build = `xcodebuild -version`.strip.split("\n").map { |line| line.split(' ').last }
"#{version} (#{build})"
end
......
module Pod
# Validates a Specification.
#
# Extends the Linter from the Core to add additional which require the
......@@ -10,7 +9,6 @@ module Pod
# it without integration and building the project with xcodebuild.
#
class Validator
include Config::Mixin
# @return [Specification::Linter] the linter instance from CocoaPods
......@@ -70,7 +68,7 @@ module Pod
perform_linting
perform_extensive_analysis(a_spec) if a_spec && !quick
UI.puts " -> ".send(result_color) << (a_spec ? a_spec.to_s : file.basename.to_s)
UI.puts ' -> '.send(result_color) << (a_spec ? a_spec.to_s : file.basename.to_s)
print_results
validated?
end
......@@ -82,25 +80,25 @@ module Pod
def print_results
results.each do |result|
if result.platforms == [:ios]
platform_message = "[iOS] "
platform_message = '[iOS] '
elsif result.platforms == [:osx]
platform_message = "[OSX] "
platform_message = '[OSX] '
end
subspecs_message = ""
subspecs_message = ''
if result.is_a?(Result)
subspecs = result.subspecs.uniq
if subspecs.count > 2
subspecs_message = "[" + subspecs[0..2].join(', ') + ", and more...] "
subspecs_message = '[' + subspecs[0..2].join(', ') + ', and more...] '
elsif subspecs.count > 0
subspecs_message = "[" + subspecs.join(',') + "] "
subspecs_message = '[' + subspecs.join(',') + '] '
end
end
case result.type
when :error then type = "ERROR"
when :warning then type = "WARN"
when :note then type = "NOTE"
when :error then type = 'ERROR'
when :warning then type = 'WARN'
when :note then type = 'NOTE'
else raise "#{result.type}" end
UI.puts " - #{type.ljust(5)} | #{platform_message}#{subspecs_message}#{result.message}"
end
......@@ -109,7 +107,7 @@ module Pod
#-------------------------------------------------------------------------#
# @!group Configuration
#  @!group Configuration
# @return [Bool] whether the validation should skip the checks that
# requires the download of the library.
......@@ -127,7 +125,9 @@ module Pod
# @note Uses the `:path` option of the Podfile.
#
attr_writer :local
def local?; @local; end
def local?
@local
end
# @return [Bool] Whether the validator should fail only on errors or also
# on warnings.
......@@ -177,7 +177,7 @@ module Pod
# @return [Pathname] the temporary directory used by the linter.
#
def validation_dir
Pathname.new(File.join(Pathname.new('/tmp').realpath,'CocoaPods/Lint'))
Pathname.new(File.join(Pathname.new('/tmp').realpath, 'CocoaPods/Lint'))
end
#-------------------------------------------------------------------------#
......@@ -229,7 +229,7 @@ module Pod
# Performs validation of a URL
#
def validate_url(url)
resp = Pod::HTTP::validate_url(url)
resp = Pod::HTTP.validate_url(url)
if !resp
warning "There was a problem validating the URL #{url}."
......@@ -352,8 +352,8 @@ module Pod
end
if consumer.spec.root?
unless file_accessor.license || spec.license && ( spec.license[:type] == 'Public Domain' || spec.license[:text] )
warning "Unable to find a license file"
unless file_accessor.license || spec.license && ( spec.license[:type] == 'Public Domain' || spec.license[:text])
warning 'Unable to find a license file'
end
end
end
......@@ -389,14 +389,12 @@ module Pod
# Specialized Result to support subspecs aggregation
#
class Result < Specification::Linter::Result
def initialize(type, message)
super(type, message)
@subspecs = []
end
attr_reader :subspecs
end
#-------------------------------------------------------------------------#
......@@ -417,7 +415,7 @@ module Pod
local = local?
podfile = Pod::Podfile.new do
platform(platform_name, deployment_target)
if (local)
if local
pod name, :path => podspec.dirname.to_s
else
pod name, :podspec => podspec.to_s
......@@ -445,8 +443,8 @@ module Pod
l.include?('note: ') && (l !~ /expanded from macro/)
end
selected_lines.map do |l|
new = l.gsub(/\/tmp\/CocoaPods\/Lint\/Pods\//,'')
new.gsub!(/^ */,' ')
new = l.gsub(/\/tmp\/CocoaPods\/Lint\/Pods\//, '')
new.gsub!(/^ */, ' ')
end
end
......@@ -459,6 +457,5 @@ module Pod
end
#-------------------------------------------------------------------------#
end
end
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe "Command::Help" do
describe 'Command::Help' do
extend SpecHelper::Command
it "invokes the right command with --help flag" do
it 'invokes the right command with --help flag' do
command = command('help', 'repo', 'push')
command.send(:help_command).should.be.instance_of Pod::Command::Repo::Push
lambda { command.run }.should.raise CLAide::Help
end
it "raises help! if no other command is passed" do
it 'raises help! if no other command is passed' do
lambda { command('help').run }.should.raise CLAide::Help
end
it "shows the right usage" do
it 'shows the right usage' do
args = [CLAide::Argument.new('COMMAND', false)]
Pod::Command::Help.arguments.should.equal args
end
......
......@@ -3,19 +3,18 @@ require File.expand_path('../../../spec_helper', __FILE__)
require 'xcodeproj'
module Pod
describe Command::Init do
it "complains if project does not exist" do
it 'complains if project does not exist' do
lambda { run_command('init') }.should.raise Informative
lambda { run_command('init', 'foo.xcodeproj') }.should.raise CLAide::Help
end
it "complains if wrong parameters" do
it 'complains if wrong parameters' do
lambda { run_command('too', 'many') }.should.raise CLAide::Help
end
it "complains if more than one project exists and none is specified" do
it 'complains if more than one project exists and none is specified' do
Dir.chdir(temporary_directory) do
Xcodeproj::Project.new(temporary_directory + 'test2.xcodeproj').save
Xcodeproj::Project.new(temporary_directory + 'test1.xcodeproj').save
......@@ -23,7 +22,7 @@ module Pod
end
end
it "complains if a Podfile already exists" do
it 'complains if a Podfile already exists' do
Dir.chdir(temporary_directory) do
(Pathname.pwd + 'Podfile').open('w') { |f| f << "pod 'AFNetworking'" }
Xcodeproj::Project.new(temporary_directory + 'test1.xcodeproj').save
......@@ -31,7 +30,7 @@ module Pod
end
end
it "creates a Podfile for a project in current directory" do
it 'creates a Podfile for a project in current directory' do
Dir.chdir(temporary_directory) do
Xcodeproj::Project.new(temporary_directory + 'test1.xcodeproj').save
run_command('init')
......@@ -39,7 +38,7 @@ module Pod
end
end
it "creates a Podfile for a specified project" do
it 'creates a Podfile for a specified project' do
Dir.chdir(temporary_directory) do
Xcodeproj::Project.new(temporary_directory + 'test1.xcodeproj').save
Xcodeproj::Project.new(temporary_directory + 'test2.xcodeproj').save
......@@ -49,23 +48,23 @@ module Pod
end
end
it "creates a Podfile with targets from the project" do
it 'creates a Podfile with targets from the project' do
Dir.chdir(temporary_directory) do
project = Xcodeproj::Project.new(temporary_directory + 'test.xcodeproj')
target1 = project.new_target(:application, "AppA", :ios)
target2 = project.new_target(:application, "AppB", :ios)
target1 = project.new_target(:application, 'AppA', :ios)
target2 = project.new_target(:application, 'AppB', :ios)
project.save
run_command('init')
config.podfile.nil?.should == false
config.podfile.target_definitions.length.should == project.targets.length + 1
config.podfile.target_definitions["AppA"].nil?.should == false
config.podfile.target_definitions["AppB"].nil?.should == false
config.podfile.target_definitions['AppA'].nil?.should == false
config.podfile.target_definitions['AppB'].nil?.should == false
end
end
it "includes default pods in a Podfile" do
it 'includes default pods in a Podfile' do
Dir.chdir(temporary_directory) do
tmp_templates_dir = Pathname.pwd + 'templates_dir'
tmp_templates_dir.mkpath
......@@ -79,12 +78,12 @@ module Pod
run_command('init')
dependencies = config.podfile.target_definitions["AppA"].dependencies
dependencies.map(&:name).should == ["AFNetworking"]
dependencies = config.podfile.target_definitions['AppA'].dependencies
dependencies.map(&:name).should == ['AFNetworking']
end
end
it "includes default test pods in test targets in a Podfile" do
it 'includes default test pods in test targets in a Podfile' do
Dir.chdir(temporary_directory) do
tmp_templates_dir = Pathname.pwd + 'templates_dir'
tmp_templates_dir.mkpath
......@@ -93,17 +92,17 @@ module Pod
open(config.default_test_podfile_path, 'w') { |f| f << "pod 'Kiwi'" }
project = Xcodeproj::Project.new(temporary_directory + 'test.xcodeproj')
project.new_target(:application, "AppTests", :ios)
project.new_target(:application, 'AppTests', :ios)
project.save
run_command('init')
dependencies = config.podfile.target_definitions["AppTests"].dependencies
dependencies.map(&:name).should == ["Kiwi"]
dependencies = config.podfile.target_definitions['AppTests'].dependencies
dependencies.map(&:name).should == ['Kiwi']
end
end
it "does not include default test pods if there are no test targets" do
it 'does not include default test pods if there are no test targets' do
Dir.chdir(temporary_directory) do
tmp_templates_dir = Pathname.pwd + 'templates_dir'
tmp_templates_dir.mkpath
......@@ -112,7 +111,7 @@ module Pod
open(config.default_test_podfile_path, 'w') { |f| f << "pod 'Kiwi'" }
project = Xcodeproj::Project.new(temporary_directory + 'test.xcodeproj')
project.new_target(:application, "App", :ios)
project.new_target(:application, 'App', :ios)
project.save
run_command('init')
......@@ -122,7 +121,7 @@ module Pod
end
end
it "saves xcode project file in Podfile if one was supplied" do
it 'saves xcode project file in Podfile if one was supplied' do
Dir.chdir(temporary_directory) do
Xcodeproj::Project.new(temporary_directory + 'test1.xcodeproj').save
Xcodeproj::Project.new(temporary_directory + 'Project.xcodeproj').save
......@@ -141,7 +140,7 @@ module Pod
run_command('init')
target_definition = config.podfile.target_definitions.values.first
target_definition.user_project_path.should == nil
target_definition.user_project_path.should.nil?
end
end
end
......
......@@ -13,7 +13,7 @@ module Pod
describe Command::IPC::Spec do
it "converts a podspec to JSON and prints it to STDOUT" do
it 'converts a podspec to JSON and prints it to STDOUT' do
out = run_command('ipc', 'spec', fixture('banana-lib/BananaLib.podspec'))
out.should.match /"name":"BananaLib"/
out.should.match /"version":"1.0"/
......@@ -26,7 +26,7 @@ module Pod
describe Command::IPC::Podfile do
it "converts a Podfile to yaml and prints it to STDOUT" do
it 'converts a Podfile to yaml and prints it to STDOUT' do
out = run_command('ipc', 'podfile', fixture('Podfile'))
out.should.include('---')
out.should.match /target_definitions:/
......@@ -40,7 +40,7 @@ module Pod
describe Command::IPC::List do
it "prints a list of podspecs in the yaml format and prints it to STDOUT" do
it 'prints a list of podspecs in the yaml format and prints it to STDOUT' do
spec = fixture_spec('banana-lib/BananaLib.podspec')
set = Specification.new('BananaLib')
set.stubs(:specification).returns(spec)
......@@ -58,7 +58,7 @@ module Pod
describe Command::IPC::UpdateSearchIndex do
it "updates the search index and prints its path to STDOUT" do
it 'updates the search index and prints its path to STDOUT' do
SourcesManager.expects(:updated_search_index)
out = run_command('ipc', 'update-search-index')
out.should.include(SourcesManager.search_index_path.to_s)
......@@ -70,7 +70,7 @@ module Pod
describe Command::IPC::Repl do
it "prints the version of CocoaPods as its first message" do
it 'prints the version of CocoaPods as its first message' do
command = Command::IPC::Repl.new(CLAide::ARGV.new([]))
command.stubs(:listen)
command.run
......@@ -79,7 +79,7 @@ module Pod
out.should.match /version: '#{Pod::VERSION}'/
end
it "converts forwards the commands to the other ipc subcommands prints the result to STDOUT" do
it 'converts forwards the commands to the other ipc subcommands prints the result to STDOUT' do
command = Command::IPC::Repl.new(CLAide::ARGV.new([]))
command.execute_repl_command("podfile #{fixture('Podfile')}")
......
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Command::Lib::Create do
before do
@sut = Command::Lib::Create
end
it "complains if wrong parameters" do
it 'complains if wrong parameters' do
lambda { run_command('lib', 'create') }.should.raise CLAide::Help
end
it "complains if pod name contains spaces" do
it 'complains if pod name contains spaces' do
lambda { run_command('lib', 'create', 'Pod Name With Spaces') }.should.raise CLAide::Help
end
it "complains if pod name begins with a period" do
it 'complains if pod name begins with a period' do
lambda { run_command('lib', 'create', '.HiddenPod') }.should.raise CLAide::Help
end
it "should create a new dir for the newly created pod" do
it 'should create a new dir for the newly created pod' do
@sut.any_instance.stubs(:configure_template)
url = @sut::TEMPLATE_REPO
@sut.any_instance.expects(:git!).with("clone '#{url}' TestPod").once
run_command('lib', 'create', 'TestPod')
end
it "configures the template after cloning it passing the name of the Pod as the argument" do
it 'configures the template after cloning it passing the name of the Pod as the argument' do
@sut.any_instance.stubs(:clone_template)
dir = SpecHelper.temporary_directory + 'TestPod'
dir.mkpath
File.stubs(:exists?).with("configure").returns(true)
@sut.any_instance.expects(:system).with("./configure TestPod").once
File.stubs(:exists?).with('configure').returns(true)
@sut.any_instance.expects(:system).with('./configure TestPod').once
run_command('lib', 'create', 'TestPod')
end
it "should show link to new pod guide after creation" do
it 'should show link to new pod guide after creation' do
@sut.any_instance.stubs(:clone_template)
@sut.any_instance.stubs(:configure_template)
output = run_command('lib', 'create', 'TestPod')
......@@ -47,13 +46,13 @@ module Pod
@sut.any_instance.stubs(:configure_template)
end
it "should use the given template URL" do
it 'should use the given template URL' do
template_url = 'https://github.com/custom/template.git'
@sut.any_instance.expects(:git!).with("clone '#{template_url}' TestPod").once
sut = run_command('lib', 'create', 'TestPod', template_url)
end
it "should use the default URL if no template URL is given" do
it 'should use the default URL if no template URL is given' do
template_url = 'https://github.com/CocoaPods/pod-template.git'
@sut.any_instance.expects(:git!).with("clone '#{template_url}' TestPod").once
run_command('lib', 'create', 'TestPod')
......@@ -61,52 +60,52 @@ module Pod
end
describe Command::Lib::Lint do
it "lints the current working directory" do
it 'lints the current working directory' do
Dir.chdir(fixture('integration/Reachability')) do
cmd = command('lib', 'lint', '--only-errors', '--quick')
cmd.run
UI.output.should.include "passed validation"
UI.output.should.include 'passed validation'
end
end
it "lints a single spec in the current working directory" do
it 'lints a single spec in the current working directory' do
Dir.chdir(fixture('integration/Reachability')) do
cmd = command('lib', 'lint', 'Reachability.podspec', '--quick', '--only-errors')
cmd.run
UI.output.should.include "passed validation"
UI.output.should.include 'passed validation'
end
end
it "fails to lint a broken spec file and cleans up" do
it 'fails to lint a broken spec file and cleans up' do
Dir.chdir(temporary_directory) do
open(temporary_directory + 'Broken.podspec', 'w') { |f|
open(temporary_directory + 'Broken.podspec', 'w') do |f|
f << 'Pod::Spec.new do |spec|'
f << "spec.name = 'Broken'"
f << 'end'
}
end
Validator.any_instance.expects(:no_clean=).with(false)
Validator.any_instance.stubs(:perform_extensive_analysis)
should.raise Pod::Informative do
run_command('lib', 'lint', 'Broken.podspec')
end
UI.output.should.include "Missing required attribute"
UI.output.should.include 'Missing required attribute'
end
end
it "fails to lint a broken spec file and leaves lint directory" do
it 'fails to lint a broken spec file and leaves lint directory' do
Dir.chdir(temporary_directory) do
open(temporary_directory + 'Broken.podspec', 'w') { |f|
open(temporary_directory + 'Broken.podspec', 'w') do |f|
f << 'Pod::Spec.new do |spec|'
f << "spec.name = 'Broken'"
f << 'end'
}
end
Validator.any_instance.expects(:no_clean=).with(true)
Validator.any_instance.stubs(:perform_extensive_analysis)
should.raise Pod::Informative do
run_command('lib', 'lint', 'Broken.podspec', '--no-clean')
end
UI.output.should.include "Missing required attribute"
UI.output.should.include "Pods project available at"
UI.output.should.include 'Missing required attribute'
UI.output.should.include 'Pods project available at'
end
end
end
......
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe "Command::List" do
describe 'Command::List' do
extend SpecHelper::TemporaryRepos
before do
......@@ -9,15 +9,15 @@ module Pod
config.repos_dir = SpecHelper.tmp_repos_path
end
it "presents the known pods" do
it 'presents the known pods' do
out = run_command('list')
[ /BananaLib/,
[/BananaLib/,
/JSONKit/,
/\d+ pods were found/
/\d+ pods were found/,
].each { |regex| out.should =~ regex }
end
it "returns the new pods" do
it 'returns the new pods' do
sets = SourcesManager.all_sets
jsonkit_set = sets.find { |s| s.name == 'JSONKit' }
dates = {
......@@ -29,14 +29,14 @@ module Pod
out.should.not.include('JSONKit')
end
it "presents the known pods with versions" do
it 'presents the known pods with versions' do
sets = SourcesManager.all_sets
jsonkit_set = sets.find { |s| s.name == 'JSONKit' }
out = run_command('list')
[ /BananaLib 1.0/,
[/BananaLib 1.0/,
/JSONKit #{jsonkit_set.versions.first}/,
/\d+ pods were found/
/\d+ pods were found/,
].each { |regex| out.should =~ regex }
end
end
......
......@@ -4,14 +4,14 @@ module Pod
describe Command::Outdated do
extend SpecHelper::TemporaryRepos
it "tells the user that no Podfile was found in the current working dir" do
it 'tells the user that no Podfile was found in the current working dir' do
exception = lambda { run_command('outdated', '--no-repo-update') }.should.raise Informative
exception.message.should.include "No `Podfile' found in the current working directory."
end
it "tells the user that no Lockfile was found in the current working dir" do
it 'tells the user that no Lockfile was found in the current working dir' do
file = temporary_directory + 'Podfile'
File.open(file, 'w') {|f| f.write('platform :ios') }
File.open(file, 'w') { |f| f.write('platform :ios') }
Dir.chdir(temporary_directory) do
exception = lambda { run_command('outdated', '--no-repo-update') }.should.raise Informative
exception.message.should.include "No `Podfile.lock' found in the current working directory"
......@@ -45,4 +45,3 @@ module Pod
end
end
end
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Command::Project do
it "tells the user that no Podfile or podspec was found in the current working dir" do
it 'tells the user that no Podfile or podspec was found in the current working dir' do
Command::Install.new(CLAide::ARGV.new(['--no-repo-update']))
config.skip_repo_update.should.be.true
end
......@@ -15,7 +14,7 @@ module Pod
describe Command::Install do
it "tells the user that no Podfile or podspec was found in the current working dir" do
it 'tells the user that no Podfile or podspec was found in the current working dir' do
exception = lambda { run_command('install', '--no-repo-update') }.should.raise Informative
exception.message.should.include "No `Podfile' found in the current working directory."
end
......@@ -27,12 +26,12 @@ module Pod
describe Command::Update do
extend SpecHelper::TemporaryRepos
it "tells the user that no Podfile was found in the current working dir" do
exception = lambda { run_command('update','--no-repo-update') }.should.raise Informative
it 'tells the user that no Podfile was found in the current working dir' do
exception = lambda { run_command('update', '--no-repo-update') }.should.raise Informative
exception.message.should.include "No `Podfile' found in the current working directory."
end
it "tells the user that no Lockfile was found in the current working dir" do
it 'tells the user that no Lockfile was found in the current working dir' do
file = temporary_directory + 'Podfile'
File.open(file, 'w') do |f|
f.puts('platform :ios')
......@@ -44,7 +43,7 @@ module Pod
end
end
describe "tells the user that the Pods cannot be updated unless they are installed" do
describe 'tells the user that the Pods cannot be updated unless they are installed' do
extend SpecHelper::TemporaryRepos
before do
......@@ -62,22 +61,22 @@ module Pod
Specification.new do |s|
s.name = 'BananaLib'
s.version = '1.0'
end
end,
]
Lockfile.generate(podfile, specs).write_to_disk(temporary_directory + 'Podfile.lock')
end
it "for a single missing Pod" do
it 'for a single missing Pod' do
Dir.chdir(temporary_directory) do
exception = lambda { run_command('update', 'Reachability', '--no-repo-update') }.should.raise Informative
exception.message.should.include "Pod `Reachability` is not installed and cannot be updated"
exception.message.should.include 'Pod `Reachability` is not installed and cannot be updated'
end
end
it "for multiple missing Pods" do
it 'for multiple missing Pods' do
Dir.chdir(temporary_directory) do
exception = lambda { run_command('update', 'Reachability', 'BananaLib2', '--no-repo-update') }.should.raise Informative
exception.message.should.include "Pods `Reachability`, `BananaLib2` are not installed and cannot be updated"
exception.message.should.include 'Pods `Reachability`, `BananaLib2` are not installed and cannot be updated'
end
end
end
......@@ -85,6 +84,4 @@ module Pod
end
#---------------------------------------------------------------------------#
end
......@@ -29,7 +29,7 @@ module Pod
repo_make('test_repo')
Dir.chdir(temporary_directory) do
spec = "Spec.new do |s|; s.name = 'Broken'; s.version = '1.0' end"
File.open('Broken.podspec', 'w') {|f| f.write(spec) }
File.open('Broken.podspec', 'w') { |f| f.write(spec) }
cmd = command('repo', 'push', 'test_repo')
Validator.any_instance.stubs(:validated?).returns(false)
......@@ -60,12 +60,12 @@ module Pod
spec_clean = (fixture('spec-repos') + 'test_repo/BananaLib/1.0/BananaLib.podspec').read
File.open(temporary_directory + 'JSONKit.podspec', 'w') {|f| f.write(spec_fix) }
File.open(temporary_directory + 'PushTest.podspec', 'w') {|f| f.write(spec_add) }
File.open(temporary_directory + 'BananaLib.podspec', 'w') {|f| f.write(spec_clean) }
File.open(temporary_directory + 'JSONKit.podspec', 'w') { |f| f.write(spec_fix) }
File.open(temporary_directory + 'PushTest.podspec', 'w') { |f| f.write(spec_add) }
File.open(temporary_directory + 'BananaLib.podspec', 'w') { |f| f.write(spec_clean) }
end
it "refuses to push if the repo is not clean" do
it 'refuses to push if the repo is not clean' do
Dir.chdir(test_repo_path) do
`git remote set-url origin https://github.com/CocoaPods/Specs.git`
end
......@@ -74,7 +74,7 @@ module Pod
e.message.should.match(/use the `pod trunk push` command/)
end
it "refuses to push if the repo is not clean" do
it 'refuses to push if the repo is not clean' do
Dir.chdir(test_repo_path) do
`touch DIRTY_FILE`
end
......@@ -85,7 +85,7 @@ module Pod
(@upstream + 'PushTest/1.4/PushTest.podspec').should.not.exist?
end
it "successfully pushes a spec" do
it 'successfully pushes a spec' do
cmd = command('repo', 'push', 'master')
Dir.chdir(@upstream) { `git checkout -b tmp_for_push -q` }
cmd.expects(:validate_podspec_files).returns(true)
......
......@@ -11,7 +11,7 @@ module Pod
config.repos_dir = SpecHelper.tmp_repos_path
end
it "updates a repository" do
it 'updates a repository' do
upstream = SpecHelper.temporary_directory + 'upstream'
FileUtils.cp_r(test_repo_path, upstream)
Dir.chdir(test_repo_path) do
......@@ -23,11 +23,11 @@ module Pod
lambda { command('repo', 'update').run }.should.not.raise
end
it "updates a spec-repo" do
it 'updates a spec-repo' do
repo1 = repo_make('repo1')
repo2 = repo_clone('repo1', 'repo2')
repo_make_readme_change(repo1, 'Updated')
Dir.chdir(repo1) {`git commit -a -m "Update"`}
Dir.chdir(repo1) { `git commit -a -m "Update"` }
run_command('repo', 'update', 'repo2')
(repo2 + 'README').read.should.include 'Updated'
end
......@@ -44,7 +44,7 @@ module Pod
::REST.stubs(:head => stub(:success? => true))
end
it "lints a repository" do
it 'lints a repository' do
repo = fixture('spec-repos/test_repo').to_s
lambda { run_command('repo', 'lint', repo) }.should.not.raise
end
......@@ -59,25 +59,25 @@ module Pod
config.repos_dir = SpecHelper.tmp_repos_path
end
it "adds a spec-repo" do
it 'adds a spec-repo' do
run_command('repo', 'add', 'private', test_repo_path)
Dir.chdir(config.repos_dir + 'private') do
`git config --get remote.origin.url`.chomp.should == test_repo_path.to_s
end
end
it "adds a spec-repo with a specified branch" do
it 'adds a spec-repo with a specified branch' do
repo1 = repo_make('repo1')
Dir.chdir(repo1) do
`git checkout -b my-branch >/dev/null 2>&1`
`git checkout master >/dev/null 2>&1`
end
repo2 = command( 'repo' ,'add', 'repo2', repo1.to_s, 'my-branch')
repo2 = command('repo', 'add', 'repo2', repo1.to_s, 'my-branch')
repo2.run
Dir.chdir(repo2.dir) { `git symbolic-ref HEAD` }.should.include? 'my-branch'
end
it "adds a spec-repo by creating a shallow clone" do
it 'adds a spec-repo by creating a shallow clone' do
Dir.chdir(test_repo_path) do
`echo 'touch' > touch && git add touch && git commit -m 'updated'`
end
......@@ -98,7 +98,7 @@ module Pod
config.repos_dir = SpecHelper.tmp_repos_path
end
it "complains when a repository name is missing" do
it 'complains when a repository name is missing' do
lambda { run_command('repo', 'remove') }.should.raise CLAide::Help
end
......@@ -106,7 +106,7 @@ module Pod
lambda { run_command('repo', 'remove', 'nonexistant') }.should.raise CLAide::Help
end
it "complains if we do not have permission" do
it 'complains if we do not have permission' do
File.stubs(:writable?).returns(false)
upstream = SpecHelper.temporary_directory + 'upstream'
FileUtils.cp_r(test_repo_path, upstream)
......@@ -114,7 +114,7 @@ module Pod
FileUtils.rm_rf(upstream)
end
it "removes a spec-repo" do
it 'removes a spec-repo' do
upstream = SpecHelper.temporary_directory + 'upstream'
FileUtils.cp_r(test_repo_path, upstream)
lambda { run_command('repo', 'remove', upstream) }.should.not.raise
......
......@@ -11,28 +11,28 @@ module Pod
SourcesManager.updated_search_index = nil
end
it "runs with correct parameters" do
it 'runs with correct parameters' do
lambda { run_command('search', 'JSON') }.should.not.raise
lambda { run_command('search', 'JSON', '--full') }.should.not.raise
end
it "complains for wrong parameters" do
it 'complains for wrong parameters' do
lambda { run_command('search') }.should.raise CLAide::Help
lambda { run_command('search', 'too', '--wrong') }.should.raise CLAide::Help
lambda { run_command('search', '--wrong') }.should.raise CLAide::Help
end
it "searches for a pod with name matching the given query ignoring case" do
it 'searches for a pod with name matching the given query ignoring case' do
output = run_command('search', 'json')
output.should.include? 'JSONKit'
end
it "searches for a pod with name, summary, or description matching the given query ignoring case" do
it 'searches for a pod with name, summary, or description matching the given query ignoring case' do
output = run_command('search', 'Engelhart', '--full')
output.should.include? 'JSONKit'
end
it "restricts the search to Pods supported on iOS" do
it 'restricts the search to Pods supported on iOS' do
output = run_command('search', 'BananaLib', '--ios')
output.should.include? 'BananaLib'
Specification.any_instance.stubs(:available_platforms).returns([Platform.osx])
......@@ -40,50 +40,50 @@ module Pod
output.should.not.include? 'BananaLib'
end
it "restricts the search to Pods supported on iOS" do
it 'restricts the search to Pods supported on iOS' do
output = run_command('search', 'BananaLib', '--osx')
output.should.not.include? 'BananaLib'
end
it "outputs with the silent parameter" do
it 'outputs with the silent parameter' do
output = run_command('search', 'BananaLib', '--silent')
output.should.include? 'BananaLib'
end
it "shows a friendly message when locally searching with invalid regex" do
it 'shows a friendly message when locally searching with invalid regex' do
lambda { run_command('search', '+') }.should.raise CLAide::Help
end
describe "option --web" do
describe 'option --web' do
extend SpecHelper::TemporaryRepos
it "searches with invalid regex" do
it 'searches with invalid regex' do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=NSAttributedString%2BCCLFormat')
run_command('search', '--web', 'NSAttributedString+CCLFormat')
end
it "should url encode search queries" do
it 'should url encode search queries' do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=NSAttributedString%2BCCLFormat')
run_command('search', '--web', 'NSAttributedString+CCLFormat')
end
it "searches the web via the open! command" do
it 'searches the web via the open! command' do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=bananalib')
run_command('search', '--web', 'bananalib')
end
it "includes option --osx correctly" do
it 'includes option --osx correctly' do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=on%3Aosx%20bananalib')
run_command('search', '--web', '--osx', 'bananalib')
end
it "includes option --ios correctly" do
it 'includes option --ios correctly' do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=on%3Aios%20bananalib')
run_command('search', '--web', '--ios', 'bananalib')
end
it "does not matter in which order the ios/osx options are set" do
it 'does not matter in which order the ios/osx options are set' do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=on%3Aosx%20on%3Aios%20bananalib')
run_command('search', '--web', '--ios', '--osx', 'bananalib')
......
......@@ -10,12 +10,12 @@ module Pod
config.repos_dir = SpecHelper.tmp_repos_path
end
it "returns the read only URL of the `master` spec-repo" do
it 'returns the read only URL of the `master` spec-repo' do
cmd = Command::Setup.new(argv)
cmd.url.should == 'https://github.com/CocoaPods/Specs.git'
end
it "returns the push URL of the `master` spec-repo" do
it 'returns the push URL of the `master` spec-repo' do
config.silent = true
cmd = Command::Setup.new(argv('--push'))
cmd.url.should == 'git@github.com:CocoaPods/Specs.git'
......@@ -27,19 +27,19 @@ module Pod
config.repos_dir = SpecHelper.temporary_directory
end
it "runs with correct parameters" do
it 'runs with correct parameters' do
lambda { run_command('setup') }.should.not.raise
end
it "creates the local spec-repos directory and creates a clone of the `master` repo" do
it 'creates the local spec-repos directory and creates a clone of the `master` repo' do
output = run_command('setup')
output.should.include "Setup completed"
output.should.not.include "push"
output.should.include 'Setup completed'
output.should.not.include 'push'
url = Dir.chdir(config.repos_dir + 'master') { `git config --get remote.origin.url`.chomp }
url.should == test_repo_path.to_s
end
it "creates a shallow clone of the `master` repo by default" do
it 'creates a shallow clone of the `master` repo by default' do
Dir.chdir(test_repo_path) do
`echo 'touch' > touch && git add touch && git commit -m 'updated'`
end
......@@ -51,7 +51,7 @@ module Pod
end
end
it "creates a full clone of the `master` repo if requested" do
it 'creates a full clone of the `master` repo if requested' do
Dir.chdir(test_repo_path) do
`echo 'touch' > touch && git add touch && git commit -m 'updated'`
end
......@@ -61,7 +61,7 @@ module Pod
end
end
it "creates a full clone of the `master` repo when push access is requested" do
it 'creates a full clone of the `master` repo when push access is requested' do
Dir.chdir(test_repo_path) do
`echo 'touch' > touch && git add touch && git commit -m 'updated'`
end
......@@ -73,9 +73,9 @@ module Pod
end
end
it "preserves push access for the `master` repo" do
it 'preserves push access for the `master` repo' do
output = run_command('setup')
output.should.not.include "push"
output.should.not.include 'push'
Dir.chdir(config.repos_dir + 'master') { `git remote set-url origin git@github.com:CocoaPods/Specs.git` }
command('setup').url.should == 'git@github.com:CocoaPods/Specs.git'
end
......@@ -87,7 +87,7 @@ module Pod
Command::Setup.any_instance.stubs(:old_master_repo_dir).returns(SpecHelper.temporary_directory + 'cocoapods/master')
end
it "migrates repos from the old directory structure to the new one" do
it 'migrates repos from the old directory structure to the new one' do
source = SpecHelper.temporary_directory + 'cocoapods/master'
target = config.repos_dir + 'master'
......
This diff is collapsed.
......@@ -4,12 +4,12 @@ module Pod
describe Command do
extend SpecHelper::Command
it "displays the current version number with the --version flag" do
it 'displays the current version number with the --version flag' do
Pod::Command.version.should == VERSION
end
it "reports the location of the AFNetworking spec" do
lambda { Pod::Command.run(['spec', 'which', 'AFNetworking']) }.should.not.raise
it 'reports the location of the AFNetworking spec' do
lambda { Pod::Command.run(%w(spec which AFNetworking)) }.should.not.raise
UI.output.should.include 'spec/fixtures/spec-repos/master/Specs/AFNetworking'
end
......
......@@ -9,7 +9,7 @@ module Pod
@set = SourcesManager.search(Dependency.new('CocoaLumberjack'))
end
it "presents the name, version, description, homepage and source of a specification set" do
it 'presents the name, version, description, homepage and source of a specification set' do
UI.pod(@set)
output = UI.output
output.should.include? 'CocoaLumberjack'
......@@ -21,26 +21,26 @@ module Pod
output.should.include? 'https://github.com/CocoaLumberjack/CocoaLumberjack.git'
end
it "Presents information about deprecation if the pod is deprecated" do
it 'Presents information about deprecation if the pod is deprecated' do
specification = @set.specification
specification.deprecated = true
@set.expects(:specification).returns(specification)
UI.pod(@set)
output = UI.output
output.should.include? "[DEPRECATED]"
output.should.include? '[DEPRECATED]'
end
it "Presents information about the deprecation in favor of another pod" do
it 'Presents information about the deprecation in favor of another pod' do
specification = @set.specification
specification.deprecated_in_favor_of = "NewMoreAwesomePod"
specification.deprecated_in_favor_of = 'NewMoreAwesomePod'
@set.expects(:specification).returns(specification)
UI.pod(@set)
output = UI.output
output.should.include? "[DEPRECATED in favor of NewMoreAwesomePod]"
output.should.include? '[DEPRECATED in favor of NewMoreAwesomePod]'
end
it "presents the stats of a specification set" do
it 'presents the stats of a specification set' do
Specification::Set::Presenter.any_instance.expects(:github_last_activity).returns('more than a year ago')
Specification::Set::Presenter.any_instance.expects(:github_watchers).returns('318')
Specification::Set::Presenter.any_instance.expects(:github_forks).returns('42')
......@@ -54,14 +54,14 @@ module Pod
output.should.include? 'Pushed: more than a year ago'
end
it "should print at least one subspec" do
it 'should print at least one subspec' do
@set = SourcesManager.search(Dependency.new('RestKit'))
UI.pod(@set)
output = UI.output
output.should.include? "RestKit/Network"
output.should.include? 'RestKit/Network'
end
it "presents only name and version of a specification set in :name_and_version mode" do
it 'presents only name and version of a specification set in :name_and_version mode' do
@set = SourcesManager.search_by_name('RestKit').first
UI.pod(@set, :name_and_version)
output = UI.output
......
......@@ -37,29 +37,28 @@
#-----------------------------------------------------------------------------#
# @return [Pathname] The root of the repo.
#
ROOT = Pathname.new(File.expand_path("../../", __FILE__)) unless defined? ROOT
ROOT = Pathname.new(File.expand_path('../../', __FILE__)) unless defined? ROOT
$:.unshift((ROOT + 'spec').to_s)
require 'rubygems'
require 'bundler/setup'
require 'pretty_bacon'
require 'colored'
require "clintegracon"
require "integration/xcodeproj_project_yaml"
require 'clintegracon'
require 'integration/xcodeproj_project_yaml'
CLIntegracon.configure do |c|
c.spec_path = ROOT + "spec/cocoapods-integration-specs"
c.temp_path = ROOT + "tmp"
c.spec_path = ROOT + 'spec/cocoapods-integration-specs'
c.temp_path = ROOT + 'tmp'
# Transform produced project files to YAMLs
c.transform_produced "**/*.xcodeproj" do |path|
c.transform_produced '**/*.xcodeproj' do |path|
# Creates a YAML representation of the Xcodeproj files
# which should be used as a reference for comparison.
xcodeproj = Xcodeproj::Project.open(path)
File.open("#{path}.yaml", "w") do |file|
File.open("#{path}.yaml", 'w') do |file|
file.write xcodeproj.to_yaml
end
end
......@@ -67,156 +66,155 @@ CLIntegracon.configure do |c|
# Register special handling for YAML files
paths = [%r{Podfile\.lock}, %r{Manifest\.lock$}, %r{xcodeproj\.yaml$}]
c.has_special_handling_for *paths do |path|
if RUBY_VERSION < "1.9"
if RUBY_VERSION < '1.9'
nil # CP is not sorting array derived from hashes whose order is
# undefined in 1.8.7
else
# Remove CocoaPods version
yaml = File.open(path) { |f| YAML.load(f) }
yaml.delete("COCOAPODS")
yaml.delete('COCOAPODS')
yaml.to_s
end
end
# So we don't need to compare them directly
c.ignores %r{\.xcodeproj/}
c.ignores "Podfile"
c.ignores 'Podfile'
# Ignore certain OSX files
c.ignores ".DS_Store"
c.ignores '.DS_Store'
# Ignore xcuserdata
c.ignores %r{/xcuserdata/}
# TODO The output from the caches changes on Travis
c.ignores "execution_output.txt"
c.ignores 'execution_output.txt'
# Needed for some test cases
c.ignores "Reachability.podspec"
c.ignores "PodTest-hg-source/**"
c.ignores 'Reachability.podspec'
c.ignores 'PodTest-hg-source/**'
c.hook_into :bacon
end
describe_cli "pod" do
describe_cli 'pod' do
subject do |s|
s.executable = "ruby #{ROOT + "bin/pod"}"
s.executable = "ruby #{ROOT + 'bin/pod'}"
s.environment_vars = {
"CP_AGGRESSIVE_CACHE" => "TRUE",
"XCODEPROJ_DISABLE_XCPROJ" => "TRUE",
'CP_AGGRESSIVE_CACHE' => 'TRUE',
'XCODEPROJ_DISABLE_XCPROJ' => 'TRUE',
}
s.default_args = [
"--verbose",
"--no-ansi"
'--verbose',
'--no-ansi',
]
s.replace_path ROOT.to_s, "ROOT"
s.replace_user_path "Library/Caches/CocoaPods", "CACHES_DIR"
s.replace_path ROOT.to_s, 'ROOT'
s.replace_user_path 'Library/Caches/CocoaPods', 'CACHES_DIR'
end
describe "Pod install" do
describe 'Pod install' do
# Test installation with no integration
# Test subspecs inheritance
describe "Integrates a project with CocoaPods" do
behaves_like cli_spec "install_new",
"install --no-repo-update"
describe 'Integrates a project with CocoaPods' do
behaves_like cli_spec 'install_new',
'install --no-repo-update'
end
describe "Adds a Pod to an existing installation" do
behaves_like cli_spec "install_add_pod",
"install --no-repo-update"
describe 'Adds a Pod to an existing installation' do
behaves_like cli_spec 'install_add_pod',
'install --no-repo-update'
end
describe "Removes a Pod from an existing installation" do
behaves_like cli_spec "install_remove_pod",
"install --no-repo-update"
describe 'Removes a Pod from an existing installation' do
behaves_like cli_spec 'install_remove_pod',
'install --no-repo-update'
end
describe "Creates an installation with multiple target definitions" do
behaves_like cli_spec "install_multiple_targets",
"install --no-repo-update"
describe 'Creates an installation with multiple target definitions' do
behaves_like cli_spec 'install_multiple_targets',
'install --no-repo-update'
end
describe "Installs a Pod with different subspecs activated across different targets" do
behaves_like cli_spec "install_subspecs",
"install --no-repo-update"
describe 'Installs a Pod with different subspecs activated across different targets' do
behaves_like cli_spec 'install_subspecs',
'install --no-repo-update'
end
describe "Installs a Pod with subspecs and does not duplicate the prefix header" do
behaves_like cli_spec "install_subspecs_no_duplicate_prefix",
"install --no-repo-update"
describe 'Installs a Pod with subspecs and does not duplicate the prefix header' do
behaves_like cli_spec 'install_subspecs_no_duplicate_prefix',
'install --no-repo-update'
end
describe "Installs a Pod with a local source" do
behaves_like cli_spec "install_local_source",
"install --no-repo-update"
describe 'Installs a Pod with a local source' do
behaves_like cli_spec 'install_local_source',
'install --no-repo-update'
end
describe "Installs a Pod with an external source" do
behaves_like cli_spec "install_external_source",
"install --no-repo-update"
describe 'Installs a Pod with an external source' do
behaves_like cli_spec 'install_external_source',
'install --no-repo-update'
end
describe "Installs a Pod given the podspec" do
behaves_like cli_spec "install_podspec",
"install --no-repo-update"
describe 'Installs a Pod given the podspec' do
behaves_like cli_spec 'install_podspec',
'install --no-repo-update'
end
describe "Performs an installation using a custom workspace" do
behaves_like cli_spec "install_custom_workspace",
"install --no-repo-update"
describe 'Performs an installation using a custom workspace' do
behaves_like cli_spec 'install_custom_workspace',
'install --no-repo-update'
end
describe "Integrates a target with custom build settings" do
behaves_like cli_spec "install_custom_build_configuration",
"install --no-repo-update"
describe 'Integrates a target with custom build settings' do
behaves_like cli_spec 'install_custom_build_configuration',
'install --no-repo-update'
end
# @todo add tests for all the hooks API
#
describe "Runs the Podfile callbacks" do
behaves_like cli_spec "install_podfile_callbacks",
"install --no-repo-update"
describe 'Runs the Podfile callbacks' do
behaves_like cli_spec 'install_podfile_callbacks',
'install --no-repo-update'
end
end
#--------------------------------------#
describe "Pod update" do
describe 'Pod update' do
describe "Updates an existing installation" do
behaves_like cli_spec "update_all",
"update --no-repo-update"
describe 'Updates an existing installation' do
behaves_like cli_spec 'update_all',
'update --no-repo-update'
end
describe "Updates a selected Pod in an existing installation" do
behaves_like cli_spec "update_selected",
"update Reachability --no-repo-update"
describe 'Updates a selected Pod in an existing installation' do
behaves_like cli_spec 'update_selected',
'update Reachability --no-repo-update'
end
end
#--------------------------------------#
describe "Pod lint" do
describe 'Pod lint' do
describe "Lints a Pod" do
behaves_like cli_spec "spec_lint",
"spec lint --quick"
describe 'Lints a Pod' do
behaves_like cli_spec 'spec_lint',
'spec lint --quick'
end
end
#--------------------------------------#
describe "Pod init" do
describe 'Pod init' do
describe "Initializes a Podfile with a single platform" do
behaves_like cli_spec "init_single_platform",
"init"
describe 'Initializes a Podfile with a single platform' do
behaves_like cli_spec 'init_single_platform',
'init'
end
end
......
require "xcodeproj"
require "yaml"
require 'xcodeproj'
require 'yaml'
class Xcodeproj::Project
def to_yaml
pretty_print_output = pretty_print
sections = []
sorted_keys = ["File References", "Targets", "Build Configurations"]
sorted_keys = ['File References', 'Targets', 'Build Configurations']
sorted_keys.each do |key|
yaml = { key => pretty_print_output[key] }.to_yaml
sections << yaml
end
(sections * "\n\n").gsub!("---", '')
(sections * "\n\n").gsub!('---', '')
end
end
......@@ -26,7 +26,7 @@ require 'bacon'
require 'mocha-on-bacon'
require 'pretty_bacon'
require 'pathname'
require "active_support/core_ext/string/strip"
require 'active_support/core_ext/string/strip'
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
$:.unshift((ROOT + 'lib').to_s)
......@@ -34,7 +34,7 @@ $:.unshift((ROOT + 'spec').to_s)
require 'cocoapods'
require 'claide'
#require 'awesome_print'
# require 'awesome_print'
require 'spec_helper/command' # Allows to run Pod commands and returns their output.
require 'spec_helper/fixture' # Provides access to the fixtures and unpacks them if needed.
......@@ -52,7 +52,7 @@ require 'spec_helper/github' # Stubs Github API to return always the va
#
module Pod
class Specification
alias :original_source :source
alias_method :original_source, :source
def source
fixture = SpecHelper.fixture("integration/#{name}")
result = super
......@@ -117,7 +117,7 @@ module SpecHelper
end
def temporary_sandbox
Pod::Sandbox.new(temporary_directory + "Pods")
Pod::Sandbox.new(temporary_directory + 'Pods')
end
def fixture_spec(name)
......@@ -135,4 +135,3 @@ end
#-----------------------------------------------------------------------------#
SpecHelper::Fixture.fixture('banana-lib') # ensure it exists
......@@ -31,4 +31,3 @@ module Bacon
end
end
end
......@@ -88,4 +88,3 @@ module SpecHelper
end
end
end
module Pod
# Disable the wrapping so the output is deterministic in the tests.
#
UI.disable_wrap = true
......@@ -20,7 +19,7 @@ module Pod
@output << "#{message}\n"
end
def warn(message = '', actions = [])
def warn(message = '', _actions = [])
@warnings << "#{message}\n"
end
......
......@@ -2,21 +2,21 @@ require File.expand_path('../../spec_helper', __FILE__)
module Pod
describe Command do
it "returns the proper command class" do
Command.parse(%w{ help }).should.be.instance_of Command::Help
Command.parse(%w{ install }).should.be.instance_of Command::Install
Command.parse(%w{ list }).should.be.instance_of Command::List
Command.parse(%w{ outdated }).should.be.instance_of Command::Outdated
Command.parse(%w{ repo }).should.be.instance_of Command::Repo
Command.parse(%w{ repo add }).should.be.instance_of Command::Repo::Add
Command.parse(%w{ repo lint }).should.be.instance_of Command::Repo::Lint
Command.parse(%w{ repo update }).should.be.instance_of Command::Repo::Update
Command.parse(%w{ repo remove }).should.be.instance_of Command::Repo::Remove
Command.parse(%w{ search }).should.be.instance_of Command::Search
Command.parse(%w{ setup }).should.be.instance_of Command::Setup
Command.parse(%w{ spec create }).should.be.instance_of Command::Spec::Create
Command.parse(%w{ spec lint }).should.be.instance_of Command::Spec::Lint
Command.parse(%w{ init }).should.be.instance_of Command::Init
it 'returns the proper command class' do
Command.parse(%w( help )).should.be.instance_of Command::Help
Command.parse(%w( install )).should.be.instance_of Command::Install
Command.parse(%w( list )).should.be.instance_of Command::List
Command.parse(%w( outdated )).should.be.instance_of Command::Outdated
Command.parse(%w( repo )).should.be.instance_of Command::Repo
Command.parse(%w( repo add )).should.be.instance_of Command::Repo::Add
Command.parse(%w( repo lint )).should.be.instance_of Command::Repo::Lint
Command.parse(%w( repo update )).should.be.instance_of Command::Repo::Update
Command.parse(%w( repo remove )).should.be.instance_of Command::Repo::Remove
Command.parse(%w( search )).should.be.instance_of Command::Search
Command.parse(%w( setup )).should.be.instance_of Command::Setup
Command.parse(%w( spec create )).should.be.instance_of Command::Spec::Create
Command.parse(%w( spec lint )).should.be.instance_of Command::Spec::Lint
Command.parse(%w( init )).should.be.instance_of Command::Init
end
end
end
This diff is collapsed.
......@@ -3,8 +3,10 @@ require File.expand_path('../../spec_helper', __FILE__)
module Pod
describe Executable do
it 'shows the actual command on failure' do
e = lambda { Executable.execute_command('false',
'', true) }.should.raise Informative
e = lambda do
Executable.execute_command('false',
'', true)
end.should.raise Informative
e.message.should.match(/false/)
end
end
......
......@@ -4,26 +4,26 @@ module Pod
describe ExternalSources::AbstractExternalSource do
before do
dependency = Dependency.new("Reachability", :git => fixture('integration/Reachability'))
dependency = Dependency.new('Reachability', :git => fixture('integration/Reachability'))
@subject = ExternalSources.from_dependency(dependency, nil)
end
#--------------------------------------#
describe "In general" do
describe 'In general' do
it "compares to another" do
dependency_1 = Dependency.new("Reachability", :git => 'url')
dependency_2 = Dependency.new("Another_name", :git => 'url')
dependency_3 = Dependency.new("Reachability", :git => 'another_url')
it 'compares to another' do
dependency_1 = Dependency.new('Reachability', :git => 'url')
dependency_2 = Dependency.new('Another_name', :git => 'url')
dependency_3 = Dependency.new('Reachability', :git => 'another_url')
dependency_1.should.be == dependency_1
dependency_1.should.not.be == dependency_2
dependency_1.should.not.be == dependency_3
end
it "fetches the specification from the remote stores it in the sandbox" do
config.sandbox.specification('Reachability').should == nil
it 'fetches the specification from the remote stores it in the sandbox' do
config.sandbox.specification('Reachability').should.nil?
@subject.fetch(config.sandbox)
config.sandbox.specification('Reachability').name.should == 'Reachability'
end
......@@ -32,19 +32,19 @@ module Pod
#--------------------------------------#
describe "Subclasses helpers" do
describe 'Subclasses helpers' do
it "pre-downloads the Pod and stores the relevant information in the sandbox" do
it 'pre-downloads the Pod and stores the relevant information in the sandbox' do
sandbox = config.sandbox
@subject.send(:pre_download, sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
sandbox.predownloaded_pods.should == ["Reachability"]
sandbox.predownloaded_pods.should == ['Reachability']
sandbox.checkout_sources.should == {
"Reachability" => {
'Reachability' => {
:git => fixture('integration/Reachability'),
:commit => "4ec575e4b074dcc87c44018cce656672a979b34a"
}
:commit => '4ec575e4b074dcc87c44018cce656672a979b34a',
},
}
end
end
......
......@@ -5,24 +5,24 @@ module Pod
before do
params = {
:git => fixture('integration/Reachability'),
:branch => 'master'
:branch => 'master',
}
dep = Dependency.new("Reachability", params)
dep = Dependency.new('Reachability', params)
@subject = ExternalSources.from_dependency(dep, nil)
end
it "creates a copy of the podspec" do
it 'creates a copy of the podspec' do
@subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
end
it "marks the Pod as pre-downloaded" do
it 'marks the Pod as pre-downloaded' do
@subject.fetch(config.sandbox)
config.sandbox.predownloaded_pods.should == ["Reachability"]
config.sandbox.predownloaded_pods.should == ['Reachability']
end
it "returns the description" do
it 'returns the description' do
expected = /from `.*Reachability`, branch `master`/
@subject.description.should.match(expected)
end
......
......@@ -6,28 +6,28 @@ module Pod
@subject = ExternalSources
end
describe "from_dependency" do
it "supports a podspec source" do
dep = Dependency.new("Reachability", :podspec => nil)
describe 'from_dependency' do
it 'supports a podspec source' do
dep = Dependency.new('Reachability', :podspec => nil)
klass = @subject.from_dependency(dep, nil).class
klass.should == @subject::PodspecSource
end
it "supports a path source" do
dep = Dependency.new("Reachability", :path => nil)
it 'supports a path source' do
dep = Dependency.new('Reachability', :path => nil)
klass = @subject.from_dependency(dep, nil).class
klass.should == @subject::PathSource
end
it "supports a path source specified with the legacy :local key" do
dep = Dependency.new("Reachability", :local => nil)
it 'supports a path source specified with the legacy :local key' do
dep = Dependency.new('Reachability', :local => nil)
klass = @subject.from_dependency(dep, nil).class
klass.should == @subject::PathSource
end
it "supports all the strategies implemented by the downloader" do
it 'supports all the strategies implemented by the downloader' do
[:git, :svn, :hg, :bzr, :http].each do |strategy|
dep = Dependency.new("Reachability", strategy => nil)
dep = Dependency.new('Reachability', strategy => nil)
klass = @subject.from_dependency(dep, nil).class
klass.should == @subject::DownloaderSource
end
......
......@@ -3,14 +3,14 @@ require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Generator::CopyResourcesScript do
it "returns the copy resources script" do
it 'returns the copy resources script' do
resources = ['path/to/resource.png']
generator = Pod::Generator::CopyResourcesScript.new(resources, Platform.new(:ios, '6.0'))
generator.send(:script).should.include 'path/to/resource.png'
generator.send(:script).should.include 'storyboard'
end
it "instructs ibtool to use the --reference-external-strings-file if set to do so" do
it 'instructs ibtool to use the --reference-external-strings-file if set to do so' do
resources = ['path/to/resource.png']
generator_1 = Pod::Generator::CopyResourcesScript.new(resources, Platform.new(:ios, '4.0'))
generator_2 = Pod::Generator::CopyResourcesScript.new(resources, Platform.new(:ios, '6.0'))
......
......@@ -2,8 +2,7 @@ require File.expand_path('../../../spec_helper', __FILE__)
describe Pod::Generator::DummySource do
it "generates a dummy source file with the appropriate class for the class name identifier" do
it 'generates a dummy source file with the appropriate class for the class name identifier' do
generator = Pod::Generator::DummySource.new('SomeIdentification')
file = temporary_directory + 'PodsDummy.m'
generator.save_as(file)
......@@ -16,7 +15,7 @@ describe Pod::Generator::DummySource do
EOS
end
it "generates a dummy source file with the appropriate class, replacing non-alphanumeric characters with underscores" do
it 'generates a dummy source file with the appropriate class, replacing non-alphanumeric characters with underscores' do
generator = Pod::Generator::DummySource.new('This!has_non-alphanumeric+characters in it.0123456789')
file = temporary_directory + 'PodsDummy.m'
generator.save_as(file)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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