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

[Rubocop] Update

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