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

[Rubocop] Update

parent 9109185a
# This configuration was generated by `rubocop --auto-gen-config`
# on 2014-08-14 12:21:44 +0200 using RuboCop version 0.24.1.
# on 2014-08-20 23:30:36 +0200 using RuboCop version 0.25.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
......@@ -9,7 +9,8 @@
Lint/AmbiguousOperator:
Enabled: false
# Offense count: 4
# Offense count: 1
# Cop supports --auto-correct.
Lint/BlockAlignment:
Enabled: false
......@@ -18,7 +19,7 @@ Lint/BlockAlignment:
Lint/DefEndAlignment:
Enabled: false
# Offense count: 3
# Offense count: 2
# Cop supports --auto-correct.
Lint/DeprecatedClassMethods:
Enabled: false
......@@ -28,31 +29,16 @@ Lint/DeprecatedClassMethods:
Lint/EndAlignment:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Lint/RescueException:
Enabled: false
# Offense count: 2
Lint/SpaceBeforeFirstArg:
Enabled: false
# Offense count: 5
# Cop supports --auto-correct.
Lint/StringConversionInInterpolation:
Enabled: false
# Offense count: 6
# Cop supports --auto-correct.
Lint/UnusedBlockArgument:
Enabled: false
# Offense count: 6
# Offense count: 1
# Cop supports --auto-correct.
Lint/UnusedMethodArgument:
Enabled: false
# Offense count: 4
# Offense count: 3
Lint/UselessAccessModifier:
Enabled: false
......@@ -60,32 +46,51 @@ Lint/UselessAccessModifier:
Lint/UselessAssignment:
Enabled: false
# Offense count: 7
# Offense count: 1
Metrics/BlockNesting:
Max: 4
# Offense count: 11
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 326
# Offense count: 12
Metrics/CyclomaticComplexity:
Max: 9
# Offense count: 956
# Configuration parameters: AllowURI.
Metrics/LineLength:
Max: 1060
# Offense count: 104
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 39
# Offense count: 12
Metrics/PerceivedComplexity:
Max: 10
# Offense count: 2
# Cop supports --auto-correct.
Style/Alias:
Enabled: false
# Offense count: 1
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/AlignParameters:
Enabled: false
# Offense count: 4
# Cop supports --auto-correct.
Style/AndOr:
Enabled: false
# Offense count: 1
Style/BlockNesting:
Max: 4
# Offense count: 6
# Cop supports --auto-correct.
Style/Blocks:
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/BarePercentLiterals:
Enabled: false
# Offense count: 49
# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/BracesAroundHashParameters:
......@@ -96,69 +101,36 @@ Style/BracesAroundHashParameters:
Style/ClassAndModuleChildren:
Enabled: false
# Offense count: 12
# Configuration parameters: CountComments.
Style/ClassLength:
Max: 328
# Offense count: 1
# Cop supports --auto-correct.
Style/ClassMethods:
Enabled: false
# Offense count: 5
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: PreferredMethods.
Style/CollectionMethods:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/ColonMethodCall:
Enabled: false
# Offense count: 7
# Configuration parameters: Keywords.
Style/CommentAnnotation:
Enabled: false
# Offense count: 3
# Cop supports --auto-correct.
Style/CommentIndentation:
Enabled: false
# Offense count: 12
Style/CyclomaticComplexity:
Max: 9
# Offense count: 1
# Cop supports --auto-correct.
Style/DeprecatedHashMethods:
Style/CommentIndentation:
Enabled: false
# Offense count: 1
Style/DoubleNegation:
Enabled: false
# Offense count: 24
# Offense count: 5
# Cop supports --auto-correct.
Style/EmptyLines:
Enabled: false
# Offense count: 1
Style/EmptyLinesAroundAccessModifier:
Enabled: false
# Offense count: 164
# Offense count: 17
# Cop supports --auto-correct.
Style/EmptyLinesAroundBody:
Enabled: false
# Offense count: 3
# Cop supports --auto-correct.
Style/EmptyLiteral:
Enabled: false
# Offense count: 1
# Configuration parameters: Exclude.
Style/FileName:
......@@ -174,44 +146,23 @@ Style/For:
Style/GlobalVars:
Enabled: false
# Offense count: 17
# Offense count: 5
# Cop supports --auto-correct.
Style/IndentArray:
Enabled: false
# Offense count: 20
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/IndentHash:
Enabled: false
# Offense count: 3
# Offense count: 1
# Cop supports --auto-correct.
Style/IndentationConsistency:
Enabled: false
# Offense count: 24
# Offense count: 6
# Cop supports --auto-correct.
Style/IndentationWidth:
Enabled: false
# Offense count: 3
# Cop supports --auto-correct.
Style/LeadingCommentSpace:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/LineEndConcatenation:
Enabled: false
# Offense count: 952
# Configuration parameters: AllowURI.
Style/LineLength:
Max: 1060
# Offense count: 18
# Cop supports --auto-correct.
Style/MethodCallParentheses:
Enabled: false
......@@ -221,11 +172,6 @@ Style/MethodCallParentheses:
Style/MethodDefParentheses:
Enabled: false
# Offense count: 104
# Configuration parameters: CountComments.
Style/MethodLength:
Max: 39
# Offense count: 1
Style/MultilineIfThen:
Enabled: false
......@@ -234,56 +180,29 @@ Style/MultilineIfThen:
Style/MultilineTernaryOperator:
Enabled: false
# Offense count: 3
# Cop supports --auto-correct.
Style/NegatedIf:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/NegatedWhile:
Enabled: false
# Offense count: 10
# Cop supports --auto-correct.
Style/NilComparison:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: IncludeSemanticChanges.
Style/NonNilCheck:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/Not:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowSafeAssignment.
Style/ParenthesesAroundCondition:
Enabled: false
# Offense count: 49
# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/PerlBackrefs:
Enabled: false
# Offense count: 9
# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: AllowMultipleReturnValues.
Style/RedundantReturn:
Enabled: false
# Offense count: 3
# Offense count: 1
# Cop supports --auto-correct.
Style/RedundantSelf:
Enabled: false
......@@ -297,104 +216,84 @@ Style/RegexpLiteral:
Style/SelfAssignment:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowIfMethodIsEmpty.
Style/SingleLineMethods:
Enabled: false
# Offense count: 9
# Offense count: 6
# Cop supports --auto-correct.
Style/SingleSpaceBeforeFirstArg:
Enabled: false
# Offense count: 14
# Offense count: 3
# Cop supports --auto-correct.
Style/SpaceAfterComma:
Enabled: false
# Offense count: 2
# Offense count: 1
# Cop supports --auto-correct.
Style/SpaceAfterControlKeyword:
Enabled: false
# Offense count: 15
# Cop supports --auto-correct.
Style/SpaceAroundOperators:
Enabled: false
# Offense count: 13
# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/SpaceBeforeBlockBraces:
Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
Style/SpaceBeforeComma:
Enabled: false
# Offense count: 35
# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
Style/SpaceInsideBlockBraces:
Enabled: false
# Offense count: 25
# Offense count: 4
# Cop supports --auto-correct.
Style/SpaceInsideBrackets:
Enabled: false
# Offense count: 89
# Offense count: 34
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
Style/SpaceInsideHashLiteralBraces:
Enabled: false
# Offense count: 40
# Offense count: 1
# Cop supports --auto-correct.
Style/SpaceInsideParens:
Enabled: false
# Offense count: 1580
# Offense count: 160
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/StringLiterals:
Enabled: false
# Offense count: 30
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/TrailingBlankLines:
Enabled: false
# Offense count: 86
# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
Style/TrailingComma:
Enabled: false
# Offense count: 32
# Offense count: 22
# Cop supports --auto-correct.
Style/TrailingWhitespace:
Enabled: false
# Offense count: 5
# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, Whitelist.
Style/TrivialAccessors:
Enabled: false
# Offense count: 10
# Cop supports --auto-correct.
Style/UnneededPercentQ:
Enabled: false
# Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/VariableName:
Enabled: false
# Offense count: 19
# Offense count: 1
# Cop supports --auto-correct.
Style/WordArray:
MinSize: 4
MinSize: 2
......@@ -28,14 +28,14 @@ GIT
GIT
remote: https://github.com/CocoaPods/cocoapods-try.git
revision: f91e069f1f1b22cef5bbd788835f1803e6dce24e
revision: 59a225cd4dd1868da4be7c4cc870cae427f04bf9
branch: master
specs:
cocoapods-try (0.3.0)
GIT
remote: https://github.com/CocoaPods/cocoapods-trunk.git
revision: ed920119fa850d66ee8fbe1873ae9ee0d4e46905
revision: 62bca8ec7073fc59d4137818bd78e0bbc8b1718f
branch: master
specs:
cocoapods-trunk (0.1.4)
......@@ -45,7 +45,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/cocoapods-plugins.git
revision: b989190a02875d16482d2e440a34a54b8559996c
revision: f1364dd91ea334e46b2f37455aef46147d14575a
branch: master
specs:
cocoapods-plugins (0.2.0)
......@@ -53,14 +53,14 @@ GIT
GIT
remote: https://github.com/CocoaPods/cocoapods-downloader.git
revision: 025395e3fd53d23b74b9f55ac0a5750fa92f82e3
revision: a8710a42b1ce379fb2afe66ce9f98a08b58fb482
branch: master
specs:
cocoapods-downloader (0.6.1)
GIT
remote: https://github.com/CocoaPods/Core.git
revision: d696bf6a34eb837d8e89fc1fc9170cff1a1256e4
revision: f557903817f29000819d4b1b754e6dd667587c30
branch: master
specs:
cocoapods-core (0.33.1)
......
......@@ -2,7 +2,7 @@
if RUBY_VERSION > '1.8.7' && Encoding.default_external != Encoding::UTF_8
puts "\e[33mWARNING: CocoaPods requires your terminal to be using UTF-8 encoding."
if ENV["TRAVIS"]
if ENV['TRAVIS']
puts <<-DOC
Consider adding the following settings to .travis.yml
......@@ -19,12 +19,12 @@ end
if $PROGRAM_NAME == __FILE__ && !ENV['COCOAPODS_NO_BUNDLER']
ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
require "rubygems"
require "bundler/setup"
require 'rubygems'
require 'bundler/setup'
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
elsif ENV['COCOAPODS_NO_BUNDLER']
require "rubygems"
gem "cocoapods"
require 'rubygems'
gem 'cocoapods'
end
STDOUT.sync = true if ENV['CP_STDOUT_SYNC'] == 'TRUE'
......
......@@ -105,9 +105,7 @@ PROFILE_ERB_TEMPLATE = <<-EOS
(deny default)
EOS
class Profile
def pod_bin
File.expand_path('../pod', __FILE__)
end
......@@ -159,14 +157,12 @@ class Profile
def generate
ERB.new(PROFILE_ERB_TEMPLATE, 0, '>').result(binding)
end
end
# Ensure the `pod` bin doesn’t think it needs to use Bundler.
ENV['COCOAPODS_NO_BUNDLER'] = '1'
profile = Profile.new
#puts profile.generate
# puts profile.generate
command = ['/usr/bin/sandbox-exec', '-p', profile.generate, profile.pod_bin, *ARGV]
exec(*command)
......@@ -66,7 +66,6 @@ module Pod
autoload :LibraryRepresentation, 'cocoapods/hooks/library_representation'
autoload :PodRepresentation, 'cocoapods/hooks/pod_representation'
end
end
if ENV['COCOA_PODS_ENV'] == 'development'
......
......@@ -7,7 +7,6 @@ module Pod
end
class Command < CLAide::Command
require 'cocoapods/command/help'
require 'cocoapods/command/inter_process_communication'
require 'cocoapods/command/lib'
......@@ -44,14 +43,14 @@ module Pod
end
def self.run(argv)
help! "You cannot run CocoaPods as root." if Process.uid == 0
help! 'You cannot run CocoaPods as root.' if Process.uid == 0
super(argv)
UI.print_warnings
end
def self.report_error(exception)
if exception.is_a?(Interrupt)
puts "[!] Cancelled".red
puts '[!] Cancelled'.red
Config.instance.verbose? ? raise : exit(1)
else
if ENV['COCOA_PODS_ENV'] != 'development'
......@@ -76,9 +75,9 @@ module Pod
def initialize(argv)
super
config.silent = argv.flag?('silent', config.silent)
config.verbose = self.verbose? unless self.verbose.nil?
config.verbose = self.verbose? unless verbose.nil?
unless self.ansi_output?
String.send(:define_method, :colorize) { |string , _| string }
String.send(:define_method, :colorize) { |string, _| string }
end
end
......@@ -113,4 +112,3 @@ module Pod
end
end
end
......@@ -3,7 +3,7 @@ module Pod
class Help < Command
self.summary = 'Show help for the given command.'
self.arguments = [
CLAide::Argument.new('COMMAND', false)
CLAide::Argument.new('COMMAND', false),
]
def initialize(argv)
......@@ -17,9 +17,7 @@ module Pod
private
def help_command
@help_command
end
attr_reader :help_command
end
end
end
......@@ -4,7 +4,6 @@ require 'active_support/core_ext/string/strip'
module Pod
class Command
class Init < Command
self.summary = 'Generate a Podfile for the current directory.'
self.description = <<-DESC
Creates a Podfile for the current directory if none currently exists. If
......@@ -18,11 +17,11 @@ module Pod
`~/.cocoapods/templates` folder.
DESC
self.arguments = [
CLAide::Argument.new('XCODEPROJ', :false)
CLAide::Argument.new('XCODEPROJ', :false),
]
def initialize(argv)
@podfile_path = Pathname.pwd + "Podfile"
@podfile_path = Pathname.pwd + 'Podfile'
@project_path = argv.shift_argument
@project_paths = Pathname.pwd.children.select { |pn| pn.extname == '.xcodeproj' }
super
......@@ -30,13 +29,13 @@ module Pod
def validate!
super
raise Informative, "Existing Podfile found in directory" unless config.podfile_path_in_dir(Pathname.pwd).nil?
raise Informative, 'Existing Podfile found in directory' unless config.podfile_path_in_dir(Pathname.pwd).nil?
if @project_path
help! "Xcode project at #{@project_path} does not exist" unless File.exist? @project_path
project_path = @project_path
else
raise Informative, "No xcode project found, please specify one" unless @project_paths.length > 0
raise Informative, "Multiple xcode projects found, please specify one" unless @project_paths.length == 1
raise Informative, 'No xcode project found, please specify one' unless @project_paths.length > 0
raise Informative, 'Multiple xcode projects found, please specify one' unless @project_paths.length == 1
project_path = @project_paths.first
end
@xcode_project = Xcodeproj::Project.open(project_path)
......@@ -82,12 +81,11 @@ module Pod
target_module << "\nend\n"
end
def template_contents(path)
if path.exist?
path.read.chomp.lines.map{ |line| " #{line}" }.join("\n")
path.read.chomp.lines.map { |line| " #{line}" }.join("\n")
else
String.new
''
end
end
end
......
module Pod
class Command
class IPC < Command
self.abstract_command = true
self.summary = 'Inter-process communication'
......@@ -12,11 +11,10 @@ module Pod
#-----------------------------------------------------------------------#
class Spec < IPC
self.summary = 'Converts a podspec to JSON.'
self.description = 'Converts a podspec to JSON and prints it to STDOUT.'
self.arguments = [
CLAide::Argument.new('PATH', true)
CLAide::Argument.new('PATH', true),
]
def initialize(argv)
......@@ -26,24 +24,22 @@ module Pod
def validate!
super
help! "A specification path is required." unless @path
help! 'A specification path is required.' unless @path
end
def run
spec = Specification.from_file(@path)
output_pipe.puts spec.to_json
end
end
#-----------------------------------------------------------------------#
class Podfile < IPC
self.summary = 'Converts a Podfile to YAML.'
self.description = 'Converts a Podfile to YAML and prints it to STDOUT.'
self.arguments = [
CLAide::Argument.new('PATH', true)
CLAide::Argument.new('PATH', true),
]
def initialize(argv)
......@@ -53,20 +49,18 @@ module Pod
def validate!
super
help! "A Podfile path is required." unless @path
help! 'A Podfile path is required.' unless @path
end
def run
podfile = Pod::Podfile.from_file(@path)
output_pipe.puts podfile.to_yaml
end
end
#-----------------------------------------------------------------------#
class List < IPC
self.summary = 'Lists the specifications known to CocoaPods.'
self.description = <<-DESC
Prints to STDOUT a YAML dictionary where the keys are the name of the
......@@ -99,13 +93,11 @@ module Pod
end
output_pipe.puts result.to_yaml
end
end
#-----------------------------------------------------------------------#
class UpdateSearchIndex < IPC
self.summary = 'Updates the search index.'
self.description = <<-DESC
Updates the search index and prints its path to standard output.
......@@ -123,13 +115,11 @@ module Pod
SourcesManager.updated_search_index
output_pipe.puts(SourcesManager.search_index_path)
end
end
#-----------------------------------------------------------------------#
class Repl < IPC
END_OF_OUTPUT_SIGNAL = "\n\r"
self.summary = 'The repl listens to commands on standard input.'
......@@ -172,11 +162,9 @@ module Pod
signal_end_of_output
end
end
end
#-----------------------------------------------------------------------#
end
end
end
......@@ -6,8 +6,8 @@ module Pod
def self.options
[[
"--update", "Run `pod repo update` before listing",
"--stats", "Show additional stats (like GitHub watchers and forks)"
'--update', 'Run `pod repo update` before listing',
'--stats', 'Show additional stats (like GitHub watchers and forks)'
]].concat(super)
end
......@@ -31,7 +31,7 @@ module Pod
def update_if_necessary!
if @update && config.verbose?
UI.section("\nUpdating Spec Repositories\n".yellow) do
Repo.new(ARGV.new(["update"])).run
Repo.new(ARGV.new(['update'])).run
end
end
end
......@@ -44,9 +44,9 @@ module Pod
def run
update_if_necessary!
days = [1,2,3,5,8]
days = [1, 2, 3, 5, 8]
dates, groups = {}, {}
days.each {|d| dates[d] = Time.now - 60 * 60 * 24 * d}
days.each { |d| dates[d] = Time.now - 60 * 60 * 24 * d }
sets = SourcesManager.all_sets
statistics_provider = Config.instance.spec_statistics_provider
creation_dates = statistics_provider.creation_dates(sets)
......@@ -64,8 +64,8 @@ module Pod
days.reverse.each do |d|
sets = groups[d]
next unless sets
UI.section("\nPods added in the last #{"day".pluralize(d)}".yellow) do
sorted = sets.sort_by {|s| creation_dates[s.name]}
UI.section("\nPods added in the last #{'day'.pluralize(d)}".yellow) do
sorted = sets.sort_by { |s| creation_dates[s.name] }
mode = @stats ? :stats : :name
sorted.each { |set| UI.pod(set, mode, statistics_provider) }
end
......
......@@ -9,7 +9,7 @@ module Pod
DESC
def self.options
[["--no-repo-update", "Skip running `pod repo update` before install"]].concat(super)
[['--no-repo-update', 'Skip running `pod repo update` before install']].concat(super)
end
def initialize(argv)
......@@ -23,11 +23,10 @@ module Pod
# @todo fix.
#
def run
if updates.empty?
UI.puts "No updates are available.".yellow
UI.puts 'No updates are available.'.yellow
else
UI.section "The following updates are available:" do
UI.section 'The following updates are available:' do
updates.each do |(name, from_version, to_version)|
UI.puts "- #{name} #{from_version} -> #{to_version}"
end
......@@ -46,7 +45,6 @@ module Pod
end
end
end
end
private
......@@ -97,9 +95,6 @@ module Pod
config.lockfile
end
end
end
end
end
module Pod
class Command
# Provides support the common behaviour of the `install` and `update`
# commands.
#
......@@ -8,9 +7,9 @@ module Pod
module Options
def options
[
["--no-clean", "Leave SCM dirs like `.git` and `.svn` intact after downloading"],
["--no-integrate", "Skip integration of the Pods libraries in the Xcode project(s)"],
["--no-repo-update", "Skip running `pod repo update` before install"],
['--no-clean', 'Leave SCM dirs like `.git` and `.svn` intact after downloading'],
['--no-integrate', 'Skip integration of the Pods libraries in the Xcode project(s)'],
['--no-repo-update', 'Skip running `pod repo update` before install'],
].concat(super)
end
end
......@@ -105,19 +104,17 @@ module Pod
missing_pods = @pods.select { |pod| !config.lockfile.pod_names.include?(pod) }
if missing_pods.length > 0
raise Informative, (missing_pods.length > 1 \
? "Pods %s are not installed and cannot be updated" \
: "Pod %s is not installed and cannot be updated"
? 'Pods %s are not installed and cannot be updated' \
: 'Pod %s is not installed and cannot be updated'
) % missing_pods.map { |p| "`#{p}`" }.join(', ')
end
run_install_with_update(:pods => @pods)
else
UI.puts "Update all pods".yellow unless @pods
UI.puts 'Update all pods'.yellow unless @pods
run_install_with_update(true)
end
end
end
end
end
......@@ -3,7 +3,6 @@ module Pod
class Push < Command
self.summary = 'Temporary alias for the `pod repo push` command'
def initialize(argv)
@push_command = Repo::Push.new(argv)
super
......
......@@ -21,12 +21,12 @@ module Pod
self.arguments = [
CLAide::Argument.new('NAME', true),
CLAide::Argument.new('URL', true),
CLAide::Argument.new('BRANCH', false)
CLAide::Argument.new('BRANCH', false),
]
def self.options
[
["--shallow", "Create a shallow clone (fast clone, but no push capabilities)"],
['--shallow', 'Create a shallow clone (fast clone, but no push capabilities)'],
].concat(super)
end
......@@ -39,7 +39,7 @@ module Pod
def validate!
super
unless @name && @url
help! "Adding a repo needs a `NAME` and a `URL`."
help! 'Adding a repo needs a `NAME` and a `URL`.'
end
end
......@@ -69,7 +69,7 @@ module Pod
DESC
self.arguments = [
CLAide::Argument.new('NAME', false)
CLAide::Argument.new('NAME', false),
]
def initialize(argv)
......@@ -94,11 +94,11 @@ module Pod
DESC
self.arguments = [
CLAide::Argument.new(%w(NAME DIRECTORY), false)
CLAide::Argument.new(%w(NAME DIRECTORY), false),
]
def self.options
[["--only-errors", "Lint presents only the errors"]].concat(super)
[['--only-errors', 'Lint presents only the errors']].concat(super)
end
def initialize(argv)
......@@ -114,16 +114,16 @@ module Pod
#
def run
if @name
dirs = File.exists?(@name) ? [ Pathname.new(@name) ] : [ dir ]
dirs = File.exist?(@name) ? [Pathname.new(@name)] : [dir]
else
dirs = config.repos_dir.children.select {|c| c.directory?}
dirs = config.repos_dir.children.select { |c| c.directory? }
end
dirs.each do |dir|
SourcesManager.check_version_information(dir)
UI.puts "\nLinting spec repo `#{dir.realpath.basename}`\n".yellow
validator = Source::HealthReporter.new(dir)
validator.pre_check do |name, version|
validator.pre_check do |_name, _version|
UI.print '.'
end
report = validator.analyze
......@@ -144,7 +144,7 @@ module Pod
UI.puts "Analyzed #{report.analyzed_paths.count} podspecs files.\n\n"
if report.pods_by_error.count.zero?
UI.puts "All the specs passed validation.".green << "\n\n"
UI.puts 'All the specs passed validation.'.green << "\n\n"
else
raise Informative, "#{report.pods_by_error.count} podspecs failed validation."
end
......@@ -162,7 +162,7 @@ module Pod
DESC
self.arguments = [
CLAide::Argument.new('NAME', true)
CLAide::Argument.new('NAME', true),
]
def initialize(argv)
......@@ -175,7 +175,7 @@ module Pod
help! 'Deleting a repo needs a `NAME`.' unless @name
help! "repo #{@name} does not exist" unless File.directory?(dir)
help! "You do not have permission to delete the #{@name} repository." \
"Perhaps try prefixing this command with sudo." unless File.writable?(dir)
'Perhaps try prefixing this command with sudo.' unless File.writable?(dir)
end
def run
......@@ -194,4 +194,3 @@ module Pod
end
end
end
......@@ -16,12 +16,12 @@ module Pod
self.arguments = [
CLAide::Argument.new('REPO', true),
CLAide::Argument.new('NAME.podspec', false)
CLAide::Argument.new('NAME.podspec', false),
]
def self.options
[ ["--allow-warnings", "Allows pushing even if there are warnings"],
["--local-only", "Does not perform the step of pushing REPO to its remote"] ].concat(super)
[['--allow-warnings', 'Allows pushing even if there are warnings'],
['--local-only', 'Does not perform the step of pushing REPO to its remote']].concat(super)
end
def initialize(argv)
......@@ -34,7 +34,7 @@ module Pod
def validate!
super
help! "A spec-repo name is required." unless @repo
help! 'A spec-repo name is required.' unless @repo
end
def run
......@@ -69,15 +69,14 @@ module Pod
end
if is_master_repo
raise Informative, "To push to the CocoaPods master repo use " \
raise Informative, 'To push to the CocoaPods master repo use ' \
"the `pod trunk push` command.\n\nIf you are using a fork of " \
"the master repo for private purposes we recommend to migrate " \
"to a clean private repo. To disable this check remove the " \
"remote pointing to the CocoaPods master repo."
'the master repo for private purposes we recommend to migrate ' \
'to a clean private repo. To disable this check remove the ' \
'remote pointing to the CocoaPods master repo.'
end
end
# Performs a full lint against the podspecs.
#
def validate_podspec_files
......@@ -87,7 +86,7 @@ module Pod
validator.only_errors = @allow_warnings
begin
validator.validate
rescue Exception
rescue
raise Informative, "The `#{podspec}` specification does not validate."
end
raise Informative, "The `#{podspec}` specification does not validate." unless validator.validated?
......@@ -143,7 +142,7 @@ module Pod
FileUtils.cp(spec_file, output_path)
Dir.chdir(repo_dir) do
# only commit if modified
if git!("status --porcelain 2>&1").include?(spec.name)
if git!('status --porcelain 2>&1').include?(spec.name)
UI.puts " - #{message}"
git!("add #{spec.name}")
git!("commit --no-verify -m '#{message}'")
......@@ -187,7 +186,7 @@ module Pod
# @return [Array<Pathname>] The path of the specifications to push.
#
def podspec_files
files = Pathname.glob(@podspec || "*.podspec")
files = Pathname.glob(@podspec || '*.podspec')
raise Informative, "Couldn't find any .podspec file in current directory" if files.empty?
files
end
......@@ -199,7 +198,6 @@ module Pod
end
#---------------------------------------------------------------------#
end
end
end
......
......@@ -10,16 +10,16 @@ module Pod
DESC
self.arguments = [
CLAide::Argument.new('QUERY', true)
CLAide::Argument.new('QUERY', true),
]
def self.options
[
["--full", "Search by name, summary, and description"],
["--stats", "Show additional stats (like GitHub watchers and forks)"],
["--ios", "Restricts the search to Pods supported on iOS"],
["--osx", "Restricts the search to Pods supported on OS X"],
["--web", "Searches on cocoapods.org"]
['--full', 'Search by name, summary, and description'],
['--stats', 'Show additional stats (like GitHub watchers and forks)'],
['--ios', 'Restricts the search to Pods supported on iOS'],
['--osx', 'Restricts the search to Pods supported on OS X'],
['--web', 'Searches on cocoapods.org'],
].concat(super.reject { |option, _| option == '--silent' })
end
......@@ -36,13 +36,13 @@ module Pod
def validate!
super
help! "A search query is required." unless @query
help! 'A search query is required.' unless @query
unless @web
begin
/#{@query.join(' ').strip}/
rescue RegexpError
help! "A valid regular expression is required."
help! 'A valid regular expression is required.'
end
end
end
......@@ -62,9 +62,9 @@ module Pod
query_parameter = [
('on:osx' if @supported_on_osx),
('on:ios' if @supported_on_ios),
@query
@query,
].compact.flatten.join(' ')
url = "http://cocoapods.org/?q=#{CGI.escape(query_parameter).gsub("+", "%20")}"
url = "http://cocoapods.org/?q=#{CGI.escape(query_parameter).gsub('+', '%20')}"
UI.puts("Opening #{url}")
open!(url)
end
......@@ -72,10 +72,10 @@ module Pod
def local_search
sets = SourcesManager.search_by_name(@query.join(' ').strip, @full_text_search)
if @supported_on_ios
sets.reject!{ |set| !set.specification.available_platforms.map(&:name).include?(:ios) }
sets.reject! { |set| !set.specification.available_platforms.map(&:name).include?(:ios) }
end
if @supported_on_osx
sets.reject!{ |set| !set.specification.available_platforms.map(&:name).include?(:osx) }
sets.reject! { |set| !set.specification.available_platforms.map(&:name).include?(:osx) }
end
statistics_provider = Config.instance.spec_statistics_provider
......@@ -91,7 +91,6 @@ module Pod
end
end
end
end
end
end
......@@ -16,8 +16,8 @@ module Pod
def self.options
[
["--no-shallow", "Clone full history so push will work"],
["--push", "Use this option to enable push access once granted"],
['--no-shallow', 'Clone full history so push will work'],
['--push', 'Use this option to enable push access once granted'],
].concat(super)
end
......@@ -31,7 +31,7 @@ module Pod
end
def run
UI.section "Setting up CocoaPods master repo" do
UI.section 'Setting up CocoaPods master repo' do
if master_repo_dir.exist?
set_master_repo_url
set_master_repo_branch
......@@ -43,7 +43,7 @@ module Pod
end
end
access_type = push? ? "push" : "read-only"
access_type = push? ? 'push' : 'read-only'
UI.puts "Setup completed (#{access_type} access)".green
end
......@@ -103,7 +103,7 @@ module Pod
#
def set_master_repo_branch
Dir.chdir(master_repo_dir) do
git("checkout master")
git('checkout master')
end
end
......
......@@ -3,7 +3,6 @@ require 'cocoapods-downloader'
module Pod
module Downloader
class Base
override_api do
def execute_command(executable, command, raise_on_failure = false)
......
module Pod
# Module which provides support for running executables.
#
# In a class it can be used as:
......@@ -12,7 +11,6 @@ module Pod
# output of the command.
#
module Executable
# Creates the methods for the executable with the given name.
#
# @param [Symbol] name
......@@ -21,12 +19,11 @@ module Pod
# @return [void]
#
def executable(name)
define_method(name) do |command|
Executable.execute_command(name, command, false)
end
define_method(name.to_s + "!") do |command|
define_method(name.to_s + '!') do |command|
Executable.execute_command(name, command, true)
end
end
......@@ -51,7 +48,6 @@ module Pod
# @todo Find a way to display the live output of the commands.
#
def self.execute_command(executable, command, raise_on_failure)
bin = `which #{executable}`.strip
raise Informative, "Unable to locate the executable `#{executable}`" if bin.empty?
......@@ -66,7 +62,7 @@ module Pod
stdout, stderr = Indenter.new, Indenter.new
end
options = {:stdout => stdout, :stderr => stderr, :status => true}
options = { :stdout => stdout, :stderr => stderr, :status => true }
status = Open4.spawn(full_command, options)
output = stdout.join("\n") + stderr.join("\n")
unless status.success?
......@@ -85,7 +81,6 @@ module Pod
# the UI indentation lever.
#
class Indenter < ::Array
# @return [Fixnum] The indentation level of the UI.
#
attr_accessor :indent
......
......@@ -4,12 +4,10 @@ require 'cocoapods/external_sources/path_source'
require 'cocoapods/external_sources/podspec_source'
module Pod
# Provides support for initializing the correct concrete class of an external
# source.
#
module ExternalSources
# @return [AbstractExternalSource] an initialized instance of the concrete
# external source class associated with the option specified in the
# hash.
......@@ -34,8 +32,8 @@ module Pod
elsif params.key?(:path)
PathSource
elsif params.key?(:local)
UI.warn "The `:local` option of the Podfile has been " \
"renamed to `:path` and it is deprecated."
UI.warn 'The `:local` option of the Podfile has been ' \
'renamed to `:path` and it is deprecated.'
PathSource
elsif Downloader.strategy_from_options(params)
DownloaderSource
......
module Pod
module ExternalSources
# Abstract class that defines the common behaviour of external sources.
#
class AbstractExternalSource
# @return [String] the name of the Pod described by this external source.
#
attr_reader :name
......@@ -48,14 +46,14 @@ module Pod
#
# @return [void]
#
def fetch(sandbox)
raise "Abstract method"
def fetch(_sandbox)
raise 'Abstract method'
end
# @return [String] a string representation of the source suitable for UI.
#
def description
raise "Abstract method"
raise 'Abstract method'
end
protected
......@@ -98,7 +96,7 @@ module Pod
#
def pre_download(sandbox)
title = "Pre-downloading: `#{name}` #{description}"
UI.titled_section(title, { :verbose_prefix => "-> " }) do
UI.titled_section(title, :verbose_prefix => '-> ') do
target = sandbox.root + name
target.rmtree if target.exist?
downloader = Downloader.for_target(target, params)
......@@ -137,4 +135,3 @@ module Pod
end
end
end
module Pod
module ExternalSources
# Provides support for fetching a specification file from a source handled
# by the downloader. Supports all the options of the downloader
#
......@@ -8,7 +7,6 @@ module Pod
# name matching the one of the dependency.
#
class DownloaderSource < AbstractExternalSource
# @see AbstractExternalSource#fetch
#
def fetch(sandbox)
......
module Pod
module ExternalSources
# Provides support for fetching a specification file from a path local to
# the machine running the installation.
#
# Works with the {LocalPod::LocalSourcedPod} class.
#
class PathSource < AbstractExternalSource
# @see AbstractExternalSource#fetch
#
def fetch(sandbox)
title = "Fetching podspec for `#{name}` #{description}"
UI.titled_section(title, { :verbose_prefix => "-> " }) do
UI.titled_section(title, :verbose_prefix => '-> ') do
podspec = podspec_path
unless podspec.exist?
raise Informative, "No podspec found for `#{name}` in " \
......@@ -55,4 +53,3 @@ module Pod
end
end
end
module Pod
module ExternalSources
# Provides support for fetching a specification file from an URL. Can be
# http, file, etc.
#
class PodspecSource < AbstractExternalSource
# @see AbstractExternalSource#fetch
#
def fetch(sandbox)
title = "Fetching podspec for `#{name}` #{description}"
UI.titled_section(title, { :verbose_prefix => "-> " }) do
UI.titled_section(title, :verbose_prefix => '-> ') do
is_json = podspec_uri.split('.').last == 'json'
require 'open-uri'
open(podspec_uri) { |io| store_podspec(sandbox, io.read, is_json) }
......
......@@ -3,4 +3,3 @@ module Pod
#
VERSION = '0.33.1' unless defined? Pod::VERSION
end
module Pod
module Generator
class Acknowledgements
# @return [Array<Class>] The classes of the acknowledgements generator
# subclasses.
#
......@@ -29,25 +27,25 @@ module Pod
# @return [String] The title of the acknowledgements file.
#
def header_title
"Acknowledgements"
'Acknowledgements'
end
# @return [String] A text to present before listing the acknowledgements.
#
def header_text
"This application makes use of the following third party libraries:"
'This application makes use of the following third party libraries:'
end
# @return [String] The title of the foot notes.
#
def footnote_title
""
''
end
# @return [String] the foot notes.
#
def footnote_text
"Generated by CocoaPods - http://cocoapods.org"
'Generated by CocoaPods - http://cocoapods.org'
end
#-----------------------------------------------------------------------#
......@@ -60,7 +58,7 @@ module Pod
# acknowledgements should be generated.
#
def specs
file_accessors.map{ |accessor| accessor.spec.root }.uniq
file_accessors.map { |accessor| accessor.spec.root }.uniq
end
# Returns the text of the license for the given spec.
......@@ -101,7 +99,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
module Generator
class Markdown < Acknowledgements
def self.path_from_basepath(path)
Pathname.new(path.dirname + "#{path.basename.to_s}.markdown")
Pathname.new(path.dirname + "#{path.basename}.markdown")
end
def save_as(path)
file = File.new(path, "w")
file = File.new(path, 'w')
file.write(licenses)
file.close
end
def title_from_string(string, level)
if !string.empty?
"#" * level << " #{string}"
unless string.empty?
'#' * level << " #{string}"
end
end
......@@ -29,7 +27,7 @@ module Pod
licenses_string = "#{title_from_string(header_title, 1)}\n#{header_text}\n"
specs.each do |spec|
if (license = string_for_spec(spec))
license = license.force_encoding("UTF-8") if license.respond_to?(:force_encoding)
license = license.force_encoding('UTF-8') if license.respond_to?(:force_encoding)
licenses_string += license
end
end
......
module Pod
module Generator
class Plist < Acknowledgements
def self.path_from_basepath(path)
Pathname.new(path.dirname + "#{path.basename.to_s}.plist")
Pathname.new(path.dirname + "#{path.basename}.plist")
end
def save_as(path)
......@@ -15,12 +14,12 @@ module Pod
{
:Title => plist_title,
:StringsTable => plist_title,
:PreferenceSpecifiers => licenses
:PreferenceSpecifiers => licenses,
}
end
def plist_title
"Acknowledgements"
'Acknowledgements'
end
def licenses
......@@ -36,26 +35,26 @@ module Pod
def hash_for_spec(spec)
if (license = license_text(spec))
{
:Type => "PSGroupSpecifier",
:Type => 'PSGroupSpecifier',
:Title => spec.name,
:FooterText => license
:FooterText => license,
}
end
end
def header_hash
{
:Type => "PSGroupSpecifier",
:Type => 'PSGroupSpecifier',
:Title => header_title,
:FooterText => header_text
:FooterText => header_text,
}
end
def footnote_hash
{
:Type => "PSGroupSpecifier",
:Type => 'PSGroupSpecifier',
:Title => footnote_title,
:FooterText => footnote_text
:FooterText => footnote_text,
}
end
end
......
......@@ -10,11 +10,11 @@ module Pod
def save_as(pathname)
pathname.open('w') do |source|
source.puts "#import <Foundation/Foundation.h>"
source.puts '#import <Foundation/Foundation.h>'
source.puts "@interface #{class_name} : NSObject"
source.puts "@end"
source.puts '@end'
source.puts "@implementation #{class_name}"
source.puts "@end"
source.puts '@end'
end
end
end
......
......@@ -2,7 +2,6 @@ require 'active_support/core_ext/string/strip'
module Pod
module Generator
# Generates a header which allows to inspect at compile time the installed
# pods and the installed specifications of a pod.
#
......@@ -24,7 +23,6 @@ module Pod
# #endif
#
class TargetEnvironmentHeader
# @return [Hash{String => LocalPod}] the specifications installed for
# the target by build configuration name.
#
......@@ -104,7 +102,7 @@ module Pod
# The name of the spec.
#
def safe_spec_name(spec_name)
spec_name.gsub(/[^\w]/,'_')
spec_name.gsub(/[^\w]/, '_')
end
# @return [String]
......@@ -136,13 +134,13 @@ module Pod
def indent(string, indent_count)
indent = ' ' * (indent_count * 2)
lines = string.lines.map { |line|
lines = string.lines.map do |line|
if line == "\n"
line
else
"#{indent}#{line}"
end
}
end
lines.join
end
......@@ -169,7 +167,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
module Generator
# Generates Xcode configuration files. A configuration file is generated
# for each Pod and for each Pod target definition. The aggregates the
# configurations of the Pods and define target specific settings.
#
module XCConfig
autoload :AggregateXCConfig, 'cocoapods/generator/xcconfig/aggregate_xcconfig'
autoload :PublicPodXCConfig, 'cocoapods/generator/xcconfig/public_pod_xcconfig'
autoload :PrivatePodXCConfig, 'cocoapods/generator/xcconfig/private_pod_xcconfig'
autoload :XCConfigHelper, 'cocoapods/generator/xcconfig/xcconfig_helper'
end
end
end
module Pod
module Generator
module XCConfig
# Generates the xcconfigs for the aggregate targets.
#
class AggregateXCConfig
# @return [Target] the target represented by this xcconfig.
#
attr_reader :target
......@@ -50,13 +48,13 @@ module Pod
#
def generate
header_search_path_flags = target.sandbox.public_headers.search_paths
@xcconfig = Xcodeproj::Config.new({
@xcconfig = Xcodeproj::Config.new(
'OTHER_LDFLAGS' => XCConfigHelper.default_ld_flags(target),
'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(target.sandbox.public_headers.search_paths),
'PODS_ROOT' => target.relative_pods_root,
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(header_search_path_flags, '-isystem')
})
)
target.pod_targets.each do |pod_target|
next unless pod_target.include_in_build_config?(@configuration_name)
......@@ -74,9 +72,7 @@ module Pod
# Add pod static lib to list of libraries that are to be linked with
# the user’s project.
@xcconfig.merge!({
'OTHER_LDFLAGS' => %Q(-l "#{pod_target.name}")
})
@xcconfig.merge!('OTHER_LDFLAGS' => %(-l "#{pod_target.name}"))
end
# TODO Need to decide how we are going to ensure settings like these
......@@ -88,8 +84,7 @@ module Pod
@xcconfig
end
#-----------------------------------------------------------------------#
#---------------------------------------------------------------------#
end
end
end
......
module Pod
module Generator
module XCConfig
# Generates the private xcconfigs for the pod targets.
#
# The private xcconfig file for a Pod target merges the configuration
......@@ -9,7 +8,6 @@ module Pod
# configuration values required by CocoaPods.
#
class PrivatePodXCConfig
# @return [Target] the target represented by this xcconfig.
#
attr_reader :target
......@@ -81,7 +79,7 @@ module Pod
#
def add_xcconfig_namespaced_keys(source_config, destination_config, prefix)
result = destination_config.dup
source_config.each do |key, value|
source_config.each do |key, _value|
prefixed_key = prefix + conditional_less_key(key)
current_value = destination_config[key]
if current_value
......@@ -110,7 +108,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
......
module Pod
module Generator
module XCConfig
# Generates the public xcconfigs for the pod targets.
#
# The public xcconfig file for a Pod is completely namespaced to prevent
......@@ -10,7 +9,6 @@ module Pod
# libraries, frameworks, weak frameworks and xcconfig overrides.
#
class PublicPodXCConfig
# @return [Target] the target represented by this xcconfig.
#
attr_reader :target
......@@ -55,7 +53,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
......
module Pod
module Generator
module XCConfig
# Stores the shared logic of the classes of the XCConfig module.
#
module XCConfigHelper
# Converts an array of strings to a single string where the each string
# is surrounded by double quotes and separated by a space. Used to
# represent strings in a xcconfig file.
......@@ -19,7 +17,7 @@ module Pod
#
def self.quote(strings, prefix = nil)
prefix = "#{prefix} " if prefix
strings.sort.map { |s| %W|#{prefix}"#{s}"| }.join(" ")
strings.sort.map { |s| %W( #{prefix}"#{s}" ) }.join(' ')
end
# @return [String] the default linker flags. `-ObjC` is always included
......@@ -28,7 +26,7 @@ module Pod
#
def self.default_ld_flags(target)
ld_flags = '-ObjC'
if target.target_definition.podfile.set_arc_compatibility_flag? and
if target.target_definition.podfile.set_arc_compatibility_flag? &&
target.spec_consumers.any? { |consumer| consumer.requires_arc? }
ld_flags << ' -fobjc-arc'
end
......@@ -62,11 +60,11 @@ module Pod
# The xcconfig to edit.
#
def self.add_framework_build_settings(framework_path, xcconfig, sandbox_root)
name = File.basename(framework_path, ".framework")
name = File.basename(framework_path, '.framework')
dirname = '$(PODS_ROOT)/' + framework_path.dirname.relative_path_from(sandbox_root).to_s
build_settings = {
'OTHER_LDFLAGS' => "-framework #{name}",
'FRAMEWORK_SEARCH_PATHS' => quote([dirname])
'FRAMEWORK_SEARCH_PATHS' => quote([dirname]),
}
xcconfig.merge!(build_settings)
end
......@@ -81,11 +79,11 @@ module Pod
# The xcconfig to edit.
#
def self.add_library_build_settings(library_path, xcconfig, sandbox_root)
name = File.basename(library_path, ".a").sub(/\Alib/, '')
name = File.basename(library_path, '.a').sub(/\Alib/, '')
dirname = '$(PODS_ROOT)/' + library_path.dirname.relative_path_from(sandbox_root).to_s
build_settings = {
'OTHER_LDFLAGS' => "-l#{name}",
'LIBRARY_SEARCH_PATHS' => quote([dirname])
'LIBRARY_SEARCH_PATHS' => quote([dirname]),
}
xcconfig.merge!(build_settings)
end
......@@ -101,7 +99,7 @@ module Pod
# @return [void]
#
def self.add_developers_frameworks_if_needed(xcconfig, platform)
matched_frameworks = xcconfig.frameworks & ['XCTest', 'SenTestingKit']
matched_frameworks = xcconfig.frameworks & %w(XCTest SenTestingKit)
unless matched_frameworks.empty?
search_paths = xcconfig.attributes['FRAMEWORK_SEARCH_PATHS'] ||= ''
search_paths_to_add = []
......
module Pod
class Podfile
def config
UI.warn "Podfile#config is deprecated. The config is accessible from " \
"the parameter passed to the hooks"
UI.warn 'Podfile#config is deprecated. The config is accessible from ' \
'the parameter passed to the hooks'
Config.instance
end
end
class Podfile::TargetDefinition
def copy_resources_script_name
UI.warn "TargetDefinition#copy_resources_script_name is deprecated. " \
"The value is accessible directly from the representation of the " \
"library using the #copy_resources_script_path method."
UI.warn 'TargetDefinition#copy_resources_script_name is deprecated. ' \
'The value is accessible directly from the representation of the ' \
'library using the #copy_resources_script_path method.'
Config.instance.sandbox.root + "#{label}-resources.sh"
end
end
module Hooks
# The installer representation to pass to the hooks.
#
class InstallerRepresentation
public
# @!group Public Hooks API
......@@ -79,15 +76,16 @@ module Pod
end
#-----------------------------------------------------------------------#
public
# @!group Compatibility
#
# The following aliases provides compatibility with CP < 0.17
alias :target_installers :libraries
alias :specs_by_target :specs_by_lib
alias :local_pods_by_target :pods_by_lib
alias_method :target_installers, :libraries
alias_method :specs_by_target, :specs_by_lib
alias_method :local_pods_by_target, :pods_by_lib
#-----------------------------------------------------------------------#
......@@ -126,9 +124,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
module Hooks
class LibraryRepresentation
# Stores the information of the target installer
#-----------------------------------------------------------------------#
......@@ -27,11 +26,11 @@ module Pod
# @return [Pathname] The path of the prefix_header
#
def prefix_header_path
UI.warn "LibraryRepresentation#prefix_header_path is deprecated. " \
"Use the specification `prefix_header_contents` attribute."
UI.warn 'LibraryRepresentation#prefix_header_path is deprecated. ' \
'Use the specification `prefix_header_contents` attribute.'
library.prefix_header_path
end
alias :prefix_header_filename :prefix_header_path
alias_method :prefix_header_filename, :prefix_header_path
# @return [Pathname] The path of the script used to copy the resources.
#
......@@ -83,13 +82,10 @@ module Pod
def initialize(sandbox, library)
@sandbox = sandbox
@library = library
raise "[BUG]" unless library.is_a?(AggregateTarget)
raise '[BUG]' unless library.is_a?(AggregateTarget)
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
class Specification
def config
UI.warn "[#{name}] Specification#config is deprecated. The config is accessible from " \
"the parameter passed to the hooks"
'the parameter passed to the hooks'
Config.instance
end
end
module Hooks
# Stores the information of the Installer for the hooks
#
class PodRepresentation
# @return [String]
#
attr_accessor :name
......@@ -68,7 +65,6 @@ module Pod
attr_reader :file_accessors
#-----------------------------------------------------------------------#
end
end
end
module Pod
# Provides support for the hook system of CocoaPods. The system is designed
# especially for plugins. Interested clients can register to notifications by
# name.
......@@ -16,7 +15,6 @@ module Pod
#
module HooksManager
class << self
# @return [Hash{Symbol => Proc}] The list of the blocks that are
# registered for each notification name.
#
......@@ -34,8 +32,8 @@ module Pod
raise ArgumentError, 'Missing name' unless name
raise ArgumentError, 'Missing block' unless block
@registrations ||= Hash.new
@registrations[name] ||= Array.new
@registrations ||= {}
@registrations[name] ||= []
@registrations[name] << block
end
......
require 'active_support/core_ext/string/inflections'
module Pod
# The Installer is responsible of taking a Podfile and transform it in the
# Pods libraries. It also integrates the user project so the Pods
# libraries can be used out of the box.
......@@ -29,7 +28,6 @@ module Pod
# source control.
#
class Installer
autoload :Analyzer, 'cocoapods/installer/analyzer'
autoload :FileReferencesInstaller, 'cocoapods/installer/file_references_installer'
autoload :PodSourceInstaller, 'cocoapods/installer/pod_source_installer'
......@@ -95,7 +93,7 @@ module Pod
end
def resolve_dependencies
UI.section "Analyzing dependencies" do
UI.section 'Analyzing dependencies' do
analyze
validate_build_configurations
prepare_for_legacy_compatibility
......@@ -104,7 +102,7 @@ module Pod
end
def download_dependencies
UI.section "Downloading dependencies" do
UI.section 'Downloading dependencies' do
create_file_accessors
install_pod_sources
run_pre_install_hooks
......@@ -113,7 +111,7 @@ module Pod
end
def generate_pods_project
UI.section "Generating Pods project" do
UI.section 'Generating Pods project' do
prepare_pods_project
install_file_references
install_libraries
......@@ -219,7 +217,7 @@ module Pod
end
unless sandbox_state.deleted.empty?
title_options = { :verbose_prefix => "-> ".red }
title_options = { :verbose_prefix => '-> '.red }
sandbox_state.deleted.each do |pod_name|
UI.titled_section("Removing #{pod_name}".red, title_options) do
sandbox.clean_pod(pod_name)
......@@ -253,7 +251,7 @@ module Pod
def install_pod_sources
@installed_specs = []
pods_to_install = sandbox_state.added | sandbox_state.changed
title_options = { :verbose_prefix => "-> ".green }
title_options = { :verbose_prefix => '-> '.green }
root_specs.sort_by(&:name).each do |spec|
if pods_to_install.include?(spec.name)
if sandbox_state.changed.include?(spec.name) && sandbox.manifest
......@@ -346,7 +344,7 @@ module Pod
# @todo Clean and modify the project if it exists.
#
def prepare_pods_project
UI.message "- Creating Pods project" do
UI.message '- Creating Pods project' do
@pods_project = Pod::Project.new(sandbox.project_path)
analysis_result.all_user_build_configurations.each do |name, type|
......@@ -378,7 +376,6 @@ module Pod
end
end
# Installs the file references in the Pods project. This is done once per
# Pod as the same file reference might be shared by multiple aggregate
# targets.
......@@ -396,7 +393,7 @@ module Pod
# @return [void]
#
def install_libraries
UI.message"- Installing libraries" do
UI.message'- Installing libraries' do
pod_targets.sort_by(&:name).each do |pod_target|
next if pod_target.target_definition.empty?
target_installer = PodTargetInstaller.new(sandbox, pod_target)
......@@ -448,7 +445,7 @@ module Pod
UI.message "- Writing Xcode project file to #{UI.path sandbox.project_path}" do
pods_project.pods.remove_from_project if pods_project.pods.empty?
pods_project.development_pods.remove_from_project if pods_project.development_pods.empty?
pods_project.sort({:groups_position => :below})
pods_project.sort(:groups_position => :below)
pods_project.recreate_user_schemes(false)
pods_project.save
end
......@@ -504,9 +501,9 @@ module Pod
# @return [void]
#
def run_pre_install_hooks
UI.message "- Running pre install hooks" do
UI.message '- Running pre install hooks' do
executed = run_podfile_pre_install_hook
UI.message "- Podfile" if executed
UI.message '- Podfile' if executed
end
end
......@@ -519,8 +516,8 @@ module Pod
def run_podfile_pre_install_hook
podfile.pre_install!(installer_rep)
rescue => e
raise Informative, "An error occurred while processing the pre-install " \
"hook of the Podfile." \
raise Informative, 'An error occurred while processing the pre-install ' \
'hook of the Podfile.' \
"\n\n#{e.message}\n\n#{e.backtrace * "\n"}"
end
......@@ -532,9 +529,9 @@ module Pod
# @return [void]
#
def run_podfile_post_install_hooks
UI.message "- Running post install hooks" do
UI.message '- Running post install hooks' do
executed = run_podfile_post_install_hook
UI.message "- Podfile" if executed
UI.message '- Podfile' if executed
end
end
......@@ -547,8 +544,8 @@ module Pod
def run_podfile_post_install_hook
podfile.post_install!(installer_rep)
rescue => e
raise Informative, "An error occurred while processing the post-install " \
"hook of the Podfile." \
raise Informative, 'An error occurred while processing the post-install ' \
'hook of the Podfile.' \
"\n\n#{e.message}\n\n#{e.backtrace * "\n"}"
end
......@@ -635,6 +632,5 @@ module Pod
end
#-------------------------------------------------------------------------#
end
end
module Pod
class Installer
# Analyzes the Podfile, the Lockfile, and the sandbox manifest to generate
# the information relative to a CocoaPods installation.
#
class Analyzer
include Config::Mixin
autoload :SandboxAnalyzer, 'cocoapods/installer/analyzer/sandbox_analyzer'
......@@ -111,7 +109,7 @@ module Pod
:none
elsif update == true
:all
elsif update[:pods] != nil
elsif !update[:pods].nil?
:selected
end
end
......@@ -149,7 +147,7 @@ module Pod
def generate_podfile_state
if lockfile
pods_state = nil
UI.section "Finding Podfile changes" do
UI.section 'Finding Podfile changes' do
pods_by_state = lockfile.detect_changes_with_podfile(podfile)
pods_by_state.dup.each do |state, full_names|
pods_by_state[state] = full_names.map { |fn| Specification.root_name(fn) }
......@@ -290,7 +288,7 @@ module Pod
end
unless deps_to_fetch.empty?
UI.section "Fetching external sources" do
UI.section 'Fetching external sources' do
deps_to_fetch.uniq.sort.each do |dependency|
source = ExternalSources.from_dependency(dependency, podfile.defined_in_file)
source.fetch(sandbox)
......@@ -343,7 +341,7 @@ module Pod
#
def generate_sandbox_state
sandbox_state = nil
UI.section "Comparing resolved specification to the sandbox manifest" do
UI.section 'Comparing resolved specification to the sandbox manifest' do
sandbox_analyzer = SandboxAnalyzer.new(sandbox, result.specifications, update_mode?, lockfile)
sandbox_state = sandbox_analyzer.analyze
sandbox_state.print
......@@ -381,7 +379,7 @@ module Pod
path = "#{path}.xcodeproj" unless File.extname(path) == '.xcodeproj'
path = Pathname.new(path)
unless path.exist?
raise Informative, "Unable to find the Xcode project " \
raise Informative, 'Unable to find the Xcode project ' \
"`#{path}` for the target `#{target_definition.label}`."
end
......@@ -390,7 +388,7 @@ module Pod
if xcodeprojs.size == 1
path = xcodeprojs.first
else
raise Informative, "Could not automatically select an Xcode project. " \
raise Informative, 'Could not automatically select an Xcode project. ' \
"Specify one in your Podfile like so:\n\n" \
" xcodeproj 'path/to/Project.xcodeproj'\n"
end
......@@ -417,12 +415,12 @@ module Pod
targets = native_targets(user_project).select { |t| link_with.include?(t.name) }
raise Informative, "Unable to find the targets named `#{link_with.to_sentence}` to link with target definition `#{target_definition.name}`" if targets.empty?
elsif target_definition.link_with_first_target?
targets = [ native_targets(user_project).first ].compact
raise Informative, "Unable to find a target" if targets.empty?
targets = [native_targets(user_project).first].compact
raise Informative, 'Unable to find a target' if targets.empty?
else
target = native_targets(user_project).find { |t| t.name == target_definition.name.to_s }
targets = [ target ].compact
raise Informative, "Unable to find a target named `#{target_definition.name.to_s}`" if targets.empty?
targets = [target].compact
raise Informative, "Unable to find a target named `#{target_definition.name}`" if targets.empty?
end
targets
end
......@@ -442,7 +440,7 @@ module Pod
#
def compute_user_build_configurations(target_definition, user_targets)
if user_targets
user_targets.map { |t| t.build_configurations.map(&:name) }.flatten.inject({}) do |hash, name|
user_targets.map { |t| t.build_configurations.map(&:name) }.flatten.reduce({}) do |hash, name|
hash[name] = name == 'Debug' ? :debug : :release
hash
end.merge(target_definition.build_configurations || {})
......@@ -466,7 +464,7 @@ module Pod
user_targets.each do |target|
name ||= target.platform_name
raise Informative, "Targets with different platforms" unless name == target.platform_name
raise Informative, 'Targets with different platforms' unless name == target.platform_name
if !deployment_target || deployment_target > Version.new(target.deployment_target)
deployment_target = Version.new(target.deployment_target)
end
......@@ -484,7 +482,7 @@ module Pod
# @todo Is assigning the platform to the target definition the best way
# to go?
#
def compute_archs_for_target_definition(target_definition, user_targets)
def compute_archs_for_target_definition(_target_definition, user_targets)
archs = []
user_targets.each do |target|
target_archs = target.common_resolved_build_setting('ARCHS')
......@@ -515,7 +513,7 @@ module Pod
@archs_by_target_def[target_definition] = archs
else
unless target_definition.platform
raise Informative, "It is necessary to specify the platform in the Podfile if not integrating."
raise Informative, 'It is necessary to specify the platform in the Podfile if not integrating.'
end
end
end
......@@ -524,7 +522,6 @@ module Pod
#-----------------------------------------------------------------------#
class AnalysisResult
# @return [SpecsState] the states of the Podfile specs.
#
attr_accessor :podfile_state
......@@ -555,7 +552,7 @@ module Pod
# its type (`:debug` or `:release`).
#
def all_user_build_configurations
targets.inject({}) do |result, target|
targets.reduce({}) do |result, target|
result.merge(target.user_build_configurations)
end
end
......@@ -572,7 +569,6 @@ module Pod
# subspecs are added instead of the name of the Pods.
#
class SpecsState
# @param [Hash{Symbol=>String}] pods_by_state
# The **root** name of the pods grouped by their state
# (`:added`, `:removed`, `:changed` or `:unchanged`).
......@@ -612,10 +608,10 @@ module Pod
# @return [void]
#
def print
added .sort.each { |pod| UI.message("A".green + " #{pod}", '', 2) }
deleted .sort.each { |pod| UI.message("R".red + " #{pod}", '', 2) }
changed .sort.each { |pod| UI.message("M".yellow + " #{pod}", '', 2) }
unchanged.sort.each { |pod| UI.message("-" + " #{pod}", '', 2) }
added .sort.each { |pod| UI.message('A'.green + " #{pod}", '', 2) }
deleted .sort.each { |pod| UI.message('R'.red + " #{pod}", '', 2) }
changed .sort.each { |pod| UI.message('M'.yellow + " #{pod}", '', 2) }
unchanged.sort.each { |pod| UI.message('-' + " #{pod}", '', 2) }
end
# Adds the name of a Pod to the give state.
......@@ -631,10 +627,9 @@ module Pod
# @return [void]
#
def add_name(name, state)
raise "[Bug] Attempt to add subspec to the pods state" if name.include?('/')
self.send(state) << name
raise '[Bug] Attempt to add subspec to the pods state' if name.include?('/')
send(state) << name
end
end
end
end
......
module Pod
class Installer
class Analyzer
# Analyze the sandbox to detect which Pods should be removed, and which
# ones should be reinstalled.
#
......@@ -28,7 +27,6 @@ module Pod
# - If none of the above conditions match.
#
class SandboxAnalyzer
# @return [Sandbox] The sandbox to analyze.
#
attr_reader :sandbox
......@@ -98,7 +96,7 @@ module Pod
return :added if pod_added?(pod)
return :deleted if pod_deleted?(pod)
return :changed if pod_changed?(pod)
return :unchanged
:unchanged
end
# Returns whether the Pod with the given name should be installed.
......@@ -112,8 +110,8 @@ module Pod
#
def pod_added?(pod)
return true if resolved_pods.include?(pod) && !sandbox_pods.include?(pod)
return true if !folder_exist?(pod)
return false
return true unless folder_exist?(pod)
false
end
# Returns whether the Pod with the given name should be removed from
......@@ -126,7 +124,7 @@ module Pod
#
def pod_deleted?(pod)
return true if !resolved_pods.include?(pod) && sandbox_pods.include?(pod)
return false
false
end
# Returns whether the Pod with the given name should be considered
......@@ -154,7 +152,7 @@ module Pod
if update_mode
return true if sandbox.head_pod?(pod)
end
return false
false
end
#---------------------------------------------------------------------#
......@@ -254,7 +252,6 @@ module Pod
end
#---------------------------------------------------------------------#
end
end
end
......
module Pod
class Installer
# Controller class responsible of installing the file references of the
# specifications in the Pods project.
#
class FileReferencesInstaller
# @return [Sandbox] The sandbox of the installation.
#
attr_reader :sandbox
......@@ -68,7 +66,7 @@ module Pod
# @return [void]
#
def add_source_files_references
UI.message "- Adding source files to Pods project" do
UI.message '- Adding source files to Pods project' do
add_file_accessors_paths_to_pods_group(:source_files)
end
end
......@@ -78,7 +76,7 @@ module Pod
# @return [void]
#
def add_frameworks_bundles
UI.message "- Adding frameworks to Pods project" do
UI.message '- Adding frameworks to Pods project' do
add_file_accessors_paths_to_pods_group(:vendored_frameworks, :frameworks)
end
end
......@@ -88,7 +86,7 @@ module Pod
# @return [void]
#
def add_vendored_libraries
UI.message "- Adding libraries to Pods project" do
UI.message '- Adding libraries to Pods project' do
add_file_accessors_paths_to_pods_group(:vendored_libraries, :frameworks)
end
end
......@@ -101,7 +99,7 @@ module Pod
# @return [void]
#
def add_resources
UI.message "- Adding resources to Pods project" do
UI.message '- Adding resources to Pods project' do
add_file_accessors_paths_to_pods_group(:resources, :resources)
add_file_accessors_paths_to_pods_group(:resource_bundle_files, :resources)
end
......@@ -112,7 +110,7 @@ module Pod
# @return [void]
#
def link_headers
UI.message "- Linking headers" do
UI.message '- Linking headers' do
libraries.each do |library|
library.file_accessors.each do |file_accessor|
headers_sandbox = Pathname.new(file_accessor.spec.root.name)
......@@ -202,7 +200,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
class Installer
# Context object designed to be used with the HooksManager which describes
# the context of the installer.
#
class HooksContext
# @return [String] The path to the sandbox root (`Pods` directory).
#
attr_accessor :sandbox_root
......@@ -40,7 +38,6 @@ module Pod
# Pure data class which describes and umbrella target.
#
class UmbrellaTargetDescription
# @return [String] The path of the user project
# integrated by this target.
#
......
......@@ -2,14 +2,12 @@ require 'active_support/core_ext/string/strip'
module Pod
class Installer
# Controller class responsible of installing the activated specifications
# of a single Pod.
#
# @note This class needs to consider all the activated specs of a Pod.
#
class PodSourceInstaller
# @return [Sandbox]
#
attr_reader :sandbox
......@@ -62,7 +60,7 @@ module Pod
# @return [void]
#
def clean!
clean_installation if !local?
clean_installation unless local?
end
# @return [Hash]
......@@ -89,9 +87,9 @@ module Pod
@specific_source = downloader.checkout_options
rescue RuntimeError => e
if e.message == 'Abstract method'
raise Informative, "The pod '" + root_spec.name + "' does not " +
"support the :head option, as it uses a " + downloader.name +
" source. Remove that option to use this pod."
raise Informative, "The pod '" + root_spec.name + "' does not " \
'support the :head option, as it uses a ' + downloader.name +
' source. Remove that option to use this pod.'
else
raise
end
......@@ -121,7 +119,7 @@ module Pod
#
def run_prepare_command
return unless root_spec.prepare_command
UI.section(" > Running prepare command", '', 1) do
UI.section(' > Running prepare command', '', 1) do
Dir.chdir(root) do
ENV.delete('CDPATH')
prepare_command = root_spec.prepare_command.strip_heredoc.chomp
......@@ -237,7 +235,7 @@ module Pod
def clean_paths
cached_used = used_files
glob_options = File::FNM_DOTMATCH | File::FNM_CASEFOLD
files = Pathname.glob(root + "**/*", glob_options).map(&:to_s)
files = Pathname.glob(root + '**/*', glob_options).map(&:to_s)
files.reject! do |candidate|
candidate = candidate.downcase
......@@ -265,11 +263,10 @@ module Pod
file_accessors.map(&:source_files),
]
files.flatten.compact.map{ |path| path.to_s }.uniq
files.flatten.compact.map { |path| path.to_s }.uniq
end
#-----------------------------------------------------------------------#
end
end
end
......@@ -6,13 +6,11 @@ require 'active_support/core_ext/array/conversions'
module Pod
class Installer
# The {UserProjectIntegrator} integrates the libraries generated by
# TargetDefinitions of the {Podfile} with their correspondent user
# projects.
#
class UserProjectIntegrator
autoload :TargetIntegrator, 'cocoapods/installer/user_project_integrator/target_integrator'
# @return [Podfile] the podfile that should be integrated with the user
......@@ -129,8 +127,8 @@ module Pod
# @return [void]
#
def warn_about_empty_podfile
if podfile.target_definitions.values.all?{ |td| td.empty? }
UI.warn "[!] The Podfile does not contain any dependencies."
if podfile.target_definitions.values.all? { |td| td.empty? }
UI.warn '[!] The Podfile does not contain any dependencies.'
end
end
......@@ -175,7 +173,7 @@ module Pod
project = user_project_paths.first.basename('.xcodeproj')
installation_root + "#{project}.xcworkspace"
else
raise Informative, "Could not automatically select an Xcode " \
raise Informative, 'Could not automatically select an Xcode ' \
"workspace. Specify one in your Podfile like so:\n\n" \
" workspace 'path/to/Workspace.xcworkspace'\n"
end
......@@ -213,18 +211,17 @@ module Pod
#
def print_override_warning(aggregate_target, user_target, config, key)
actions = [
"Use the `$(inherited)` flag, or",
"Remove the build settings from the target."
'Use the `$(inherited)` flag, or',
'Remove the build settings from the target.',
]
message = "The `#{user_target.name} [#{config.name}]` " \
"target overrides the `#{key}` build setting defined in " \
"`#{aggregate_target.xcconfig_relative_path(config.name)}'. " \
"This can lead to problems with the CocoaPods installation"
'This can lead to problems with the CocoaPods installation'
UI.warn(message, actions)
end
#-----------------------------------------------------------------------#
end
end
end
......@@ -3,12 +3,10 @@ require 'active_support/core_ext/string/inflections'
module Pod
class Installer
class UserProjectIntegrator
# This class is responsible for integrating the library generated by a
# {TargetDefinition} with its destination project.
#
class TargetIntegrator
autoload :XCConfigIntegrator, 'cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator'
# @return [Target] the target that should be integrated.
......@@ -45,7 +43,6 @@ module Pod
"#<#{self.class} for target `#{target.label}'>"
end
private
# @!group Integration steps
......@@ -76,12 +73,12 @@ module Pod
# @return [void]
#
def add_copy_resources_script_phase
phase_name = "Copy Pods Resources"
phase_name = 'Copy Pods Resources'
native_targets_to_integrate.each do |native_target|
phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first ||
native_target.new_shell_script_build_phase(phase_name)
path = target.copy_resources_script_relative_path
phase.shell_script = %{"#{path}"\n}
phase.shell_script = %( "#{path}"\n )
phase.show_env_vars_in_log = '0'
end
end
......
......@@ -71,7 +71,6 @@ module Pod
config.base_configuration_reference = file_ref
end
private
# @!group Private helpers
......@@ -94,13 +93,13 @@ module Pod
#
def self.print_override_warning(pod_bundle, target, config, key)
actions = [
"Use the `$(inherited)` flag, or",
"Remove the build settings from the target."
'Use the `$(inherited)` flag, or',
'Remove the build settings from the target.',
]
message = "The `#{target.name} [#{config.name}]` " \
"target overrides the `#{key}` build setting defined in " \
"`#{pod_bundle.xcconfig_relative_path(config.name)}'. " \
"This can lead to problems with the CocoaPods installation"
'This can lead to problems with the CocoaPods installation'
UI.warn(message, actions)
end
end
......
......@@ -3,7 +3,6 @@ require 'open-uri'
# Allow OpenURI to follow http to https redirects.
#
module OpenURI
# Whether {#open} should follow a redirect.
#
# Inspiration from: https://gist.github.com/1271420
......@@ -17,7 +16,7 @@ module OpenURI
# (RFC 2109 4.3.1, RFC 2965 3.3, RFC 2616 15.1.3)
# However this is ad hoc. It should be extensible/configurable.
#
def OpenURI.redirectable?(uri1, uri2)
def self.redirectable?(uri1, uri2)
uri1.scheme.downcase == uri2.scheme.downcase ||
(/\A(?:http|ftp)\z/i =~ uri1.scheme && /\A(?:https?|ftp)\z/i =~ uri2.scheme)
end
......
require 'xcodeproj'
module Pod
# The Pods project.
#
# Model class which provides helpers for working with the Pods project
# through the installation process.
#
class Project < Xcodeproj::Project
# @param [Pathname, String] path @see path
# @param [Bool] skip_initialization
# Wether the project should be initialized from scratch.
......@@ -34,7 +32,6 @@ module Pod
#
attr_reader :development_pods
public
# @!group Pod Groups
......@@ -58,7 +55,7 @@ module Pod
# @return [PBXGroup] The new group.
#
def add_pod_group(pod_name, path, development = false, absolute = false)
raise "[BUG]" if pod_group(pod_name)
raise '[BUG]' if pod_group(pod_name)
parent_group = development ? development_pods : pods
source_tree = absolute ? :absolute : :group
......@@ -236,6 +233,5 @@ module Pod
attr_reader :refs_by_absolute_path
#-------------------------------------------------------------------------#
end
end
module Pod
# The resolver is responsible of generating a list of specifications grouped
# by target for a given Podfile.
#
......@@ -15,7 +14,6 @@ module Pod
#
#
class Resolver
# @return [Sandbox] the Sandbox used by the resolver to find external
# dependencies.
#
......
require 'fileutils'
module Pod
# The sandbox provides support for the directory that CocoaPods uses for an
# installation. In this directory the Pods projects, the support files and
# the sources of the Pods are stored.
......@@ -46,7 +45,6 @@ module Pod
# See #833
#
class Sandbox
autoload :FileAccessor, 'cocoapods/sandbox/file_accessor'
autoload :HeadersStore, 'cocoapods/sandbox/headers_store'
autoload :PathList, 'cocoapods/sandbox/path_list'
......@@ -64,7 +62,7 @@ module Pod
def initialize(root)
FileUtils.mkdir_p(root)
@root = Pathname.new(root).realpath
@public_headers = HeadersStore.new(self, "Headers")
@public_headers = HeadersStore.new(self, 'Headers')
@predownloaded_pods = []
@head_pods = []
@checkout_sources = {}
......@@ -120,13 +118,13 @@ module Pod
# @return [Pathname] the path of the manifest.
#
def manifest_path
root + "Manifest.lock"
root + 'Manifest.lock'
end
# @return [Pathname] the path of the Pods project.
#
def project_path
root + "Pods.xcodeproj"
root + 'Pods.xcodeproj'
end
# Returns the path for the directory where to store the support files of
......@@ -137,7 +135,7 @@ module Pod
#
# @return [Pathname] the path of the support files.
#
def library_support_files_dir(name)
def library_support_files_dir(_name)
# root + "Target Support Files/#{name}"
root
end
......@@ -202,9 +200,9 @@ module Pod
# @todo Migrate old installations and store the for all the pods.
# Two folders should be created `External Sources` and `Podspecs`.
#
def specifications_dir(external_source = false)
def specifications_dir(_external_source = false)
# root + "Specifications"
root + "Local Podspecs"
root + 'Local Podspecs'
end
# Returns the path of the specification for the Pod with the
......@@ -395,7 +393,5 @@ module Pod
end
#-------------------------------------------------------------------------#
end
end
module Pod
class Sandbox
# Resolves the file patterns of a specification against its root directory,
# taking into account any exclude pattern and the default extensions to use
# for directories.
......@@ -8,7 +7,6 @@ module Pod
# @note The FileAccessor always returns absolute paths.
#
class FileAccessor
HEADER_EXTENSIONS = Xcodeproj::Constants::HEADER_FILES_EXTENSIONS
# @return [Sandbox::PathList] the directory where the source of the Pod
......@@ -33,7 +31,7 @@ module Pod
@spec_consumer = spec_consumer
unless @spec_consumer
raise Informative, "Attempt to initialize File Accessor without a specification consumer."
raise Informative, 'Attempt to initialize File Accessor without a specification consumer.'
end
end
......@@ -151,7 +149,7 @@ module Pod
# @return [Pathname] The path of the auto-detected README file.
#
def readme
path_list.glob(%w[ readme{*,.*} ]).first
path_list.glob(%w( readme{*,.*} )).first
end
# @return [Pathname] The path of the license file as indicated in the
......@@ -161,7 +159,7 @@ module Pod
if spec_consumer.spec.root.license[:file]
path_list.root + spec_consumer.spec.root.license[:file]
else
path_list.glob(%w[ licen{c,s}e{*,.*} ]).first
path_list.glob(%w( licen{c,s}e{*,.*} )).first
end
end
......@@ -229,9 +227,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
class Sandbox
# Provides support for managing a header directory. It also keeps track of
# the header search paths.
#
class HeadersStore
# @return [Pathname] the absolute path of this header directory.
#
def root
......@@ -91,7 +89,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
class Sandbox
# The PathList class is designed to perform multiple glob matches against
# a given directory. Basically, it generates a list of all the children
# paths and matches the globs patterns against them, resulting in just one
......@@ -11,7 +10,6 @@ module Pod
# {#read_file_system}
#
class PathList
# @return [Pathname] The root of the list whose files and directories
# are used to perform the matching operations.
#
......@@ -46,15 +44,15 @@ module Pod
unless root.exist?
raise Informative, "Attempt to read non existent folder `#{root}`."
end
root_length = root.to_s.length+1
root_length = root.to_s.length + 1
escaped_root = escape_path_for_glob(root)
paths = Dir.glob(escaped_root + "**/*", File::FNM_DOTMATCH)
paths = Dir.glob(escaped_root + '**/*', File::FNM_DOTMATCH)
absolute_dirs = paths.select { |path| File.directory?(path) }
relative_dirs = absolute_dirs.map { |p| p[root_length..-1] }
absolute_paths = paths.reject { |p| p == "#{root}/." || p == "#{root}/.." }
relative_paths = absolute_paths.map { |p| p[root_length..-1] }
@files = relative_paths - relative_dirs
@dirs = relative_dirs.map { |d| d.gsub(/\/\.\.?$/,'') }.reject { |d| d == '.' || d == '..' } .uniq
@dirs = relative_dirs.map { |d| d.gsub(/\/\.\.?$/, '') }.reject { |d| d == '.' || d == '..' } .uniq
end
#-----------------------------------------------------------------------#
......@@ -67,7 +65,7 @@ module Pod
# paths.
#
def glob(patterns, options = {})
relative_glob(patterns, options).map {|p| root + p }
relative_glob(patterns, options).map { |p| root + p }
end
# @return [Array<Pathname>] The list of relative paths that are case
......@@ -164,9 +162,9 @@ module Pod
end
if values_by_set.empty?
[ pattern ]
[pattern]
else
patterns = [ pattern ]
patterns = [pattern]
values_by_set.each do |set, values|
patterns = patterns.map do |old_pattern|
values.map do |value|
......@@ -192,13 +190,12 @@ module Pod
result = path.to_s
characters_to_escape = ['[', ']', '{', '}', '?', '*']
characters_to_escape.each do |character|
result.gsub!(character, "\\#{character}" )
result.gsub!(character, "\\#{character}")
end
Pathname.new(result)
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
# Manages all the sources known to the running CocoaPods Instance.
#
class SourcesManager
class << self
include Config::Mixin
# @return [Source::Aggregate] the aggregate of all the sources known to
......@@ -78,7 +75,7 @@ module Pod
sets = aggregate.search_by_name(query, false)
end
if sets.empty?
extra = ", author, summary, or description" if full_text_search
extra = ', author, summary, or description' if full_text_search
raise Informative, "Unable to find a pod with name#{extra}" \
"matching `#{query}`"
end
......@@ -155,13 +152,13 @@ module Pod
UI.section "Updating spec repo `#{source.name}`" do
Dir.chdir(source.data_provider.repo) do
begin
output = git!("pull --ff-only")
output = git!('pull --ff-only')
UI.puts output if show_output && !config.verbose?
rescue Informative => e
UI.warn "CocoaPods was not able to update the " \
UI.warn 'CocoaPods was not able to update the ' \
"`#{source.name}` repo. If this is an unexpected issue " \
"and persists you can inspect it running " \
"`pod repo update --verbose`"
'and persists you can inspect it running ' \
'`pod repo update --verbose`'
end
end
check_version_information(source.data_provider.repo)
......@@ -196,10 +193,10 @@ module Pod
versions = version_information(dir)
unless repo_compatible?(dir)
min, max = versions['min'], versions['max']
version_msg = ( min == max ) ? min : "#{min} - #{max}"
version_msg = ( min == max) ? min : "#{min} - #{max}"
raise Informative, "The `#{dir.basename}` repo requires " \
"CocoaPods #{version_msg} (currently using #{Pod::VERSION})\n".red +
"Update CocoaPods, or checkout the appropriate tag in the repo."
'Update CocoaPods, or checkout the appropriate tag in the repo.'
end
needs_sudo = path_writable?(__FILE__)
......@@ -330,4 +327,3 @@ module Pod
end
end
end
module Pod
# Model class which describes a Pods target.
#
# The Target class stores and provides the information necessary for
......@@ -7,7 +6,6 @@ module Pod
# This class is used to represent both the targets and their libraries.
#
class Target
# @return [PBXNativeTarget] the target definition of the Podfile that
# generated this target.
#
......@@ -101,7 +99,7 @@ module Pod
# the information about the installed pods.
#
def target_environment_header_path
support_files_root + "#{target_definition.label.to_s}-environment.h"
support_files_root + "#{target_definition.label}-environment.h"
end
# @return [Pathname] the absolute path of the prefix header file.
......@@ -123,6 +121,5 @@ module Pod
end
#-------------------------------------------------------------------------#
end
end
module Pod
# Stores the information relative to the target used to cluster the targets
# of the single Pods. The client targets will then depend on this one.
#
class AggregateTarget < Target
# @param [TargetDefinition] target_definition @see target_definition
# @param [Sandbox] sandbox @see sandbox
#
......@@ -53,7 +51,7 @@ module Pod
user_target_uuids.map do |uuid|
native_target = project.objects_by_uuid[uuid]
unless native_target
raise Informative, "[Bug] Unable to find the target with " \
raise Informative, '[Bug] Unable to find the target with ' \
"the `#{uuid}` UUID for the `#{self}` integration library"
end
native_target
......@@ -69,7 +67,6 @@ module Pod
#
attr_reader :xcconfigs
# @return [Array<PodTarget>] The dependencies for this target.
#
attr_accessor :pod_targets
......
module Pod
# Stores the information relative to the target used to compile a single Pod.
# A pod can have one or more activated spec/subspecs.
#
class PodTarget < Target
# @return [Specification] the spec for the target.
#
attr_reader :specs
......@@ -21,14 +19,14 @@ module Pod
@specs = specs
@target_definition = target_definition
@sandbox = sandbox
@build_headers = Sandbox::HeadersStore.new(sandbox, "BuildHeaders")
@build_headers = Sandbox::HeadersStore.new(sandbox, 'BuildHeaders')
@file_accessors = []
end
# @return [String] the label for the target.
#
def label
"#{target_definition.label.to_s}-#{root_spec.name}"
"#{target_definition.label}-#{root_spec.name}"
end
# @return [Array<Sandbox::FileAccessor>] the file accessors for the
......@@ -82,8 +80,8 @@ module Pod
else
raise Informative, "The subspecs of `#{pod_name}` are linked to " \
"different build configurations for the `#{target_definition}` " \
"target. CocoaPods does not support subspecs across different " \
"build configurations."
'target. CocoaPods does not support subspecs across different ' \
'build configurations.'
end
end
......
require 'cocoapods/user_interface/error_report'
module Pod
# Provides support for UI output. It provides support for nested sections of
# information and for a verbose mode.
#
module UserInterface
require 'colored'
@title_colors = %w|yellow green|
@title_colors = %w( yellow green )
@title_level = 0
@indentation_level = 2
@treat_titles_as_messages = false
@warnings = []
class << self
include Config::Mixin
attr_accessor :indentation_level
......@@ -78,7 +75,7 @@ module Pod
# A title opposed to a section is always visible
#
def title(title, verbose_prefix = '', relative_indentation = 2)
if(@treat_titles_as_messages)
if @treat_titles_as_messages
message(title, verbose_prefix)
else
title = verbose_prefix + title if config.verbose?
......@@ -122,7 +119,7 @@ module Pod
#
def info(message)
indentation = config.verbose? ? self.indentation_level : 0
indented = wrap_string(message, " " * indentation)
indented = wrap_string(message, ' ' * indentation)
puts(indented)
self.indentation_level += 2
......@@ -170,7 +167,7 @@ module Pod
colored_title = title.green
end
title(colored_title, "", 1) do
title(colored_title, '', 1) do
puts_indented pod.summary
puts_indented "pod '#{pod.name}', '~> #{pod.version}'"
labeled('Homepage', pod.homepage)
......@@ -210,7 +207,7 @@ module Pod
# wrapping it to the terminal width if necessary.
#
def puts_indented(message = '')
indented = wrap_string(message, " " * self.indentation_level)
indented = wrap_string(message, ' ' * self.indentation_level)
puts(indented)
end
......@@ -225,7 +222,7 @@ module Pod
next if warning[:verbose_only] && !config.verbose?
STDERR.puts("\n[!] #{warning[:message]}".yellow)
warning[:actions].each do |action|
indented = wrap_string(action, " - ")
indented = wrap_string(action, ' - ')
puts(indented)
end
end
......@@ -302,9 +299,7 @@ module Pod
# Redirects cocoapods-core UI.
#
module CoreUI
class << self
def puts(message)
UI.puts message
end
......@@ -316,14 +311,12 @@ module Pod
end
end
#---------------------------------------------------------------------------#
#---------------------------------------------------------------------------#
module Xcodeproj
# Redirects xcodeproj UI.
#
module UserInterface
def self.puts(message)
::Pod::UI.puts message
end
......@@ -331,7 +324,5 @@ module Xcodeproj
def self.warn(message)
::Pod::UI.warn message
end
end
end
......@@ -8,7 +8,7 @@ module Pod
module ErrorReport
class << self
def report(exception)
return <<-EOS
<<-EOS
#{'――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed}
......@@ -75,7 +75,7 @@ EOS
def error_from_podfile(error)
if error.message =~ /Podfile:(\d*)/
"\nIt appears to have originated from your Podfile at line #{$1}.\n"
"\nIt appears to have originated from your Podfile at line #{Regexp.last_match[1]}.\n"
end
end
......@@ -90,12 +90,12 @@ EOS
end
def host_information
product, version, build =`sw_vers`.strip.split("\n").map { |line| line.split(":").last.strip }
product, version, build = `sw_vers`.strip.split("\n").map { |line| line.split(':').last.strip }
"#{product} #{version} (#{build})"
end
def xcode_information
version, build = `xcodebuild -version`.strip.split("\n").map { |line| line.split(" ").last }
version, build = `xcodebuild -version`.strip.split("\n").map { |line| line.split(' ').last }
"#{version} (#{build})"
end
......
module Pod
# Validates a Specification.
#
# Extends the Linter from the Core to add additional which require the
......@@ -10,7 +9,6 @@ module Pod
# it without integration and building the project with xcodebuild.
#
class Validator
include Config::Mixin
# @return [Specification::Linter] the linter instance from CocoaPods
......@@ -70,7 +68,7 @@ module Pod
perform_linting
perform_extensive_analysis(a_spec) if a_spec && !quick
UI.puts " -> ".send(result_color) << (a_spec ? a_spec.to_s : file.basename.to_s)
UI.puts ' -> '.send(result_color) << (a_spec ? a_spec.to_s : file.basename.to_s)
print_results
validated?
end
......@@ -82,25 +80,25 @@ module Pod
def print_results
results.each do |result|
if result.platforms == [:ios]
platform_message = "[iOS] "
platform_message = '[iOS] '
elsif result.platforms == [:osx]
platform_message = "[OSX] "
platform_message = '[OSX] '
end
subspecs_message = ""
subspecs_message = ''
if result.is_a?(Result)
subspecs = result.subspecs.uniq
if subspecs.count > 2
subspecs_message = "[" + subspecs[0..2].join(', ') + ", and more...] "
subspecs_message = '[' + subspecs[0..2].join(', ') + ', and more...] '
elsif subspecs.count > 0
subspecs_message = "[" + subspecs.join(',') + "] "
subspecs_message = '[' + subspecs.join(',') + '] '
end
end
case result.type
when :error then type = "ERROR"
when :warning then type = "WARN"
when :note then type = "NOTE"
when :error then type = 'ERROR'
when :warning then type = 'WARN'
when :note then type = 'NOTE'
else raise "#{result.type}" end
UI.puts " - #{type.ljust(5)} | #{platform_message}#{subspecs_message}#{result.message}"
end
......@@ -109,7 +107,7 @@ module Pod
#-------------------------------------------------------------------------#
# @!group Configuration
#  @!group Configuration
# @return [Bool] whether the validation should skip the checks that
# requires the download of the library.
......@@ -127,7 +125,9 @@ module Pod
# @note Uses the `:path` option of the Podfile.
#
attr_writer :local
def local?; @local; end
def local?
@local
end
# @return [Bool] Whether the validator should fail only on errors or also
# on warnings.
......@@ -177,7 +177,7 @@ module Pod
# @return [Pathname] the temporary directory used by the linter.
#
def validation_dir
Pathname.new(File.join(Pathname.new('/tmp').realpath,'CocoaPods/Lint'))
Pathname.new(File.join(Pathname.new('/tmp').realpath, 'CocoaPods/Lint'))
end
#-------------------------------------------------------------------------#
......@@ -229,7 +229,7 @@ module Pod
# Performs validation of a URL
#
def validate_url(url)
resp = Pod::HTTP::validate_url(url)
resp = Pod::HTTP.validate_url(url)
if !resp
warning "There was a problem validating the URL #{url}."
......@@ -352,8 +352,8 @@ module Pod
end
if consumer.spec.root?
unless file_accessor.license || spec.license && ( spec.license[:type] == 'Public Domain' || spec.license[:text] )
warning "Unable to find a license file"
unless file_accessor.license || spec.license && ( spec.license[:type] == 'Public Domain' || spec.license[:text])
warning 'Unable to find a license file'
end
end
end
......@@ -389,14 +389,12 @@ module Pod
# Specialized Result to support subspecs aggregation
#
class Result < Specification::Linter::Result
def initialize(type, message)
super(type, message)
@subspecs = []
end
attr_reader :subspecs
end
#-------------------------------------------------------------------------#
......@@ -417,7 +415,7 @@ module Pod
local = local?
podfile = Pod::Podfile.new do
platform(platform_name, deployment_target)
if (local)
if local
pod name, :path => podspec.dirname.to_s
else
pod name, :podspec => podspec.to_s
......@@ -445,8 +443,8 @@ module Pod
l.include?('note: ') && (l !~ /expanded from macro/)
end
selected_lines.map do |l|
new = l.gsub(/\/tmp\/CocoaPods\/Lint\/Pods\//,'')
new.gsub!(/^ */,' ')
new = l.gsub(/\/tmp\/CocoaPods\/Lint\/Pods\//, '')
new.gsub!(/^ */, ' ')
end
end
......@@ -459,6 +457,5 @@ module Pod
end
#-------------------------------------------------------------------------#
end
end
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe "Command::Help" do
describe 'Command::Help' do
extend SpecHelper::Command
it "invokes the right command with --help flag" do
it 'invokes the right command with --help flag' do
command = command('help', 'repo', 'push')
command.send(:help_command).should.be.instance_of Pod::Command::Repo::Push
lambda { command.run }.should.raise CLAide::Help
end
it "raises help! if no other command is passed" do
it 'raises help! if no other command is passed' do
lambda { command('help').run }.should.raise CLAide::Help
end
it "shows the right usage" do
it 'shows the right usage' do
args = [CLAide::Argument.new('COMMAND', false)]
Pod::Command::Help.arguments.should.equal args
end
......
......@@ -3,19 +3,18 @@ require File.expand_path('../../../spec_helper', __FILE__)
require 'xcodeproj'
module Pod
describe Command::Init do
it "complains if project does not exist" do
it 'complains if project does not exist' do
lambda { run_command('init') }.should.raise Informative
lambda { run_command('init', 'foo.xcodeproj') }.should.raise CLAide::Help
end
it "complains if wrong parameters" do
it 'complains if wrong parameters' do
lambda { run_command('too', 'many') }.should.raise CLAide::Help
end
it "complains if more than one project exists and none is specified" do
it 'complains if more than one project exists and none is specified' do
Dir.chdir(temporary_directory) do
Xcodeproj::Project.new(temporary_directory + 'test2.xcodeproj').save
Xcodeproj::Project.new(temporary_directory + 'test1.xcodeproj').save
......@@ -23,7 +22,7 @@ module Pod
end
end
it "complains if a Podfile already exists" do
it 'complains if a Podfile already exists' do
Dir.chdir(temporary_directory) do
(Pathname.pwd + 'Podfile').open('w') { |f| f << "pod 'AFNetworking'" }
Xcodeproj::Project.new(temporary_directory + 'test1.xcodeproj').save
......@@ -31,7 +30,7 @@ module Pod
end
end
it "creates a Podfile for a project in current directory" do
it 'creates a Podfile for a project in current directory' do
Dir.chdir(temporary_directory) do
Xcodeproj::Project.new(temporary_directory + 'test1.xcodeproj').save
run_command('init')
......@@ -39,7 +38,7 @@ module Pod
end
end
it "creates a Podfile for a specified project" do
it 'creates a Podfile for a specified project' do
Dir.chdir(temporary_directory) do
Xcodeproj::Project.new(temporary_directory + 'test1.xcodeproj').save
Xcodeproj::Project.new(temporary_directory + 'test2.xcodeproj').save
......@@ -49,23 +48,23 @@ module Pod
end
end
it "creates a Podfile with targets from the project" do
it 'creates a Podfile with targets from the project' do
Dir.chdir(temporary_directory) do
project = Xcodeproj::Project.new(temporary_directory + 'test.xcodeproj')
target1 = project.new_target(:application, "AppA", :ios)
target2 = project.new_target(:application, "AppB", :ios)
target1 = project.new_target(:application, 'AppA', :ios)
target2 = project.new_target(:application, 'AppB', :ios)
project.save
run_command('init')
config.podfile.nil?.should == false
config.podfile.target_definitions.length.should == project.targets.length + 1
config.podfile.target_definitions["AppA"].nil?.should == false
config.podfile.target_definitions["AppB"].nil?.should == false
config.podfile.target_definitions['AppA'].nil?.should == false
config.podfile.target_definitions['AppB'].nil?.should == false
end
end
it "includes default pods in a Podfile" do
it 'includes default pods in a Podfile' do
Dir.chdir(temporary_directory) do
tmp_templates_dir = Pathname.pwd + 'templates_dir'
tmp_templates_dir.mkpath
......@@ -79,12 +78,12 @@ module Pod
run_command('init')
dependencies = config.podfile.target_definitions["AppA"].dependencies
dependencies.map(&:name).should == ["AFNetworking"]
dependencies = config.podfile.target_definitions['AppA'].dependencies
dependencies.map(&:name).should == ['AFNetworking']
end
end
it "includes default test pods in test targets in a Podfile" do
it 'includes default test pods in test targets in a Podfile' do
Dir.chdir(temporary_directory) do
tmp_templates_dir = Pathname.pwd + 'templates_dir'
tmp_templates_dir.mkpath
......@@ -93,17 +92,17 @@ module Pod
open(config.default_test_podfile_path, 'w') { |f| f << "pod 'Kiwi'" }
project = Xcodeproj::Project.new(temporary_directory + 'test.xcodeproj')
project.new_target(:application, "AppTests", :ios)
project.new_target(:application, 'AppTests', :ios)
project.save
run_command('init')
dependencies = config.podfile.target_definitions["AppTests"].dependencies
dependencies.map(&:name).should == ["Kiwi"]
dependencies = config.podfile.target_definitions['AppTests'].dependencies
dependencies.map(&:name).should == ['Kiwi']
end
end
it "does not include default test pods if there are no test targets" do
it 'does not include default test pods if there are no test targets' do
Dir.chdir(temporary_directory) do
tmp_templates_dir = Pathname.pwd + 'templates_dir'
tmp_templates_dir.mkpath
......@@ -112,7 +111,7 @@ module Pod
open(config.default_test_podfile_path, 'w') { |f| f << "pod 'Kiwi'" }
project = Xcodeproj::Project.new(temporary_directory + 'test.xcodeproj')
project.new_target(:application, "App", :ios)
project.new_target(:application, 'App', :ios)
project.save
run_command('init')
......@@ -122,7 +121,7 @@ module Pod
end
end
it "saves xcode project file in Podfile if one was supplied" do
it 'saves xcode project file in Podfile if one was supplied' do
Dir.chdir(temporary_directory) do
Xcodeproj::Project.new(temporary_directory + 'test1.xcodeproj').save
Xcodeproj::Project.new(temporary_directory + 'Project.xcodeproj').save
......@@ -141,7 +140,7 @@ module Pod
run_command('init')
target_definition = config.podfile.target_definitions.values.first
target_definition.user_project_path.should == nil
target_definition.user_project_path.should.nil?
end
end
end
......
......@@ -13,7 +13,7 @@ module Pod
describe Command::IPC::Spec do
it "converts a podspec to JSON and prints it to STDOUT" do
it 'converts a podspec to JSON and prints it to STDOUT' do
out = run_command('ipc', 'spec', fixture('banana-lib/BananaLib.podspec'))
out.should.match /"name":"BananaLib"/
out.should.match /"version":"1.0"/
......@@ -26,7 +26,7 @@ module Pod
describe Command::IPC::Podfile do
it "converts a Podfile to yaml and prints it to STDOUT" do
it 'converts a Podfile to yaml and prints it to STDOUT' do
out = run_command('ipc', 'podfile', fixture('Podfile'))
out.should.include('---')
out.should.match /target_definitions:/
......@@ -40,7 +40,7 @@ module Pod
describe Command::IPC::List do
it "prints a list of podspecs in the yaml format and prints it to STDOUT" do
it 'prints a list of podspecs in the yaml format and prints it to STDOUT' do
spec = fixture_spec('banana-lib/BananaLib.podspec')
set = Specification.new('BananaLib')
set.stubs(:specification).returns(spec)
......@@ -58,7 +58,7 @@ module Pod
describe Command::IPC::UpdateSearchIndex do
it "updates the search index and prints its path to STDOUT" do
it 'updates the search index and prints its path to STDOUT' do
SourcesManager.expects(:updated_search_index)
out = run_command('ipc', 'update-search-index')
out.should.include(SourcesManager.search_index_path.to_s)
......@@ -70,7 +70,7 @@ module Pod
describe Command::IPC::Repl do
it "prints the version of CocoaPods as its first message" do
it 'prints the version of CocoaPods as its first message' do
command = Command::IPC::Repl.new(CLAide::ARGV.new([]))
command.stubs(:listen)
command.run
......@@ -79,7 +79,7 @@ module Pod
out.should.match /version: '#{Pod::VERSION}'/
end
it "converts forwards the commands to the other ipc subcommands prints the result to STDOUT" do
it 'converts forwards the commands to the other ipc subcommands prints the result to STDOUT' do
command = Command::IPC::Repl.new(CLAide::ARGV.new([]))
command.execute_repl_command("podfile #{fixture('Podfile')}")
......
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Command::Lib::Create do
before do
@sut = Command::Lib::Create
end
it "complains if wrong parameters" do
it 'complains if wrong parameters' do
lambda { run_command('lib', 'create') }.should.raise CLAide::Help
end
it "complains if pod name contains spaces" do
it 'complains if pod name contains spaces' do
lambda { run_command('lib', 'create', 'Pod Name With Spaces') }.should.raise CLAide::Help
end
it "complains if pod name begins with a period" do
it 'complains if pod name begins with a period' do
lambda { run_command('lib', 'create', '.HiddenPod') }.should.raise CLAide::Help
end
it "should create a new dir for the newly created pod" do
it 'should create a new dir for the newly created pod' do
@sut.any_instance.stubs(:configure_template)
url = @sut::TEMPLATE_REPO
@sut.any_instance.expects(:git!).with("clone '#{url}' TestPod").once
run_command('lib', 'create', 'TestPod')
end
it "configures the template after cloning it passing the name of the Pod as the argument" do
it 'configures the template after cloning it passing the name of the Pod as the argument' do
@sut.any_instance.stubs(:clone_template)
dir = SpecHelper.temporary_directory + 'TestPod'
dir.mkpath
File.stubs(:exists?).with("configure").returns(true)
@sut.any_instance.expects(:system).with("./configure TestPod").once
File.stubs(:exists?).with('configure').returns(true)
@sut.any_instance.expects(:system).with('./configure TestPod').once
run_command('lib', 'create', 'TestPod')
end
it "should show link to new pod guide after creation" do
it 'should show link to new pod guide after creation' do
@sut.any_instance.stubs(:clone_template)
@sut.any_instance.stubs(:configure_template)
output = run_command('lib', 'create', 'TestPod')
......@@ -47,13 +46,13 @@ module Pod
@sut.any_instance.stubs(:configure_template)
end
it "should use the given template URL" do
it 'should use the given template URL' do
template_url = 'https://github.com/custom/template.git'
@sut.any_instance.expects(:git!).with("clone '#{template_url}' TestPod").once
sut = run_command('lib', 'create', 'TestPod', template_url)
end
it "should use the default URL if no template URL is given" do
it 'should use the default URL if no template URL is given' do
template_url = 'https://github.com/CocoaPods/pod-template.git'
@sut.any_instance.expects(:git!).with("clone '#{template_url}' TestPod").once
run_command('lib', 'create', 'TestPod')
......@@ -61,52 +60,52 @@ module Pod
end
describe Command::Lib::Lint do
it "lints the current working directory" do
it 'lints the current working directory' do
Dir.chdir(fixture('integration/Reachability')) do
cmd = command('lib', 'lint', '--only-errors', '--quick')
cmd.run
UI.output.should.include "passed validation"
UI.output.should.include 'passed validation'
end
end
it "lints a single spec in the current working directory" do
it 'lints a single spec in the current working directory' do
Dir.chdir(fixture('integration/Reachability')) do
cmd = command('lib', 'lint', 'Reachability.podspec', '--quick', '--only-errors')
cmd.run
UI.output.should.include "passed validation"
UI.output.should.include 'passed validation'
end
end
it "fails to lint a broken spec file and cleans up" do
it 'fails to lint a broken spec file and cleans up' do
Dir.chdir(temporary_directory) do
open(temporary_directory + 'Broken.podspec', 'w') { |f|
open(temporary_directory + 'Broken.podspec', 'w') do |f|
f << 'Pod::Spec.new do |spec|'
f << "spec.name = 'Broken'"
f << 'end'
}
end
Validator.any_instance.expects(:no_clean=).with(false)
Validator.any_instance.stubs(:perform_extensive_analysis)
should.raise Pod::Informative do
run_command('lib', 'lint', 'Broken.podspec')
end
UI.output.should.include "Missing required attribute"
UI.output.should.include 'Missing required attribute'
end
end
it "fails to lint a broken spec file and leaves lint directory" do
it 'fails to lint a broken spec file and leaves lint directory' do
Dir.chdir(temporary_directory) do
open(temporary_directory + 'Broken.podspec', 'w') { |f|
open(temporary_directory + 'Broken.podspec', 'w') do |f|
f << 'Pod::Spec.new do |spec|'
f << "spec.name = 'Broken'"
f << 'end'
}
end
Validator.any_instance.expects(:no_clean=).with(true)
Validator.any_instance.stubs(:perform_extensive_analysis)
should.raise Pod::Informative do
run_command('lib', 'lint', 'Broken.podspec', '--no-clean')
end
UI.output.should.include "Missing required attribute"
UI.output.should.include "Pods project available at"
UI.output.should.include 'Missing required attribute'
UI.output.should.include 'Pods project available at'
end
end
end
......
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe "Command::List" do
describe 'Command::List' do
extend SpecHelper::TemporaryRepos
before do
......@@ -9,15 +9,15 @@ module Pod
config.repos_dir = SpecHelper.tmp_repos_path
end
it "presents the known pods" do
it 'presents the known pods' do
out = run_command('list')
[ /BananaLib/,
[/BananaLib/,
/JSONKit/,
/\d+ pods were found/
/\d+ pods were found/,
].each { |regex| out.should =~ regex }
end
it "returns the new pods" do
it 'returns the new pods' do
sets = SourcesManager.all_sets
jsonkit_set = sets.find { |s| s.name == 'JSONKit' }
dates = {
......@@ -29,14 +29,14 @@ module Pod
out.should.not.include('JSONKit')
end
it "presents the known pods with versions" do
it 'presents the known pods with versions' do
sets = SourcesManager.all_sets
jsonkit_set = sets.find { |s| s.name == 'JSONKit' }
out = run_command('list')
[ /BananaLib 1.0/,
[/BananaLib 1.0/,
/JSONKit #{jsonkit_set.versions.first}/,
/\d+ pods were found/
/\d+ pods were found/,
].each { |regex| out.should =~ regex }
end
end
......
......@@ -4,14 +4,14 @@ module Pod
describe Command::Outdated do
extend SpecHelper::TemporaryRepos
it "tells the user that no Podfile was found in the current working dir" do
it 'tells the user that no Podfile was found in the current working dir' do
exception = lambda { run_command('outdated', '--no-repo-update') }.should.raise Informative
exception.message.should.include "No `Podfile' found in the current working directory."
end
it "tells the user that no Lockfile was found in the current working dir" do
it 'tells the user that no Lockfile was found in the current working dir' do
file = temporary_directory + 'Podfile'
File.open(file, 'w') {|f| f.write('platform :ios') }
File.open(file, 'w') { |f| f.write('platform :ios') }
Dir.chdir(temporary_directory) do
exception = lambda { run_command('outdated', '--no-repo-update') }.should.raise Informative
exception.message.should.include "No `Podfile.lock' found in the current working directory"
......@@ -45,4 +45,3 @@ module Pod
end
end
end
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Command::Project do
it "tells the user that no Podfile or podspec was found in the current working dir" do
it 'tells the user that no Podfile or podspec was found in the current working dir' do
Command::Install.new(CLAide::ARGV.new(['--no-repo-update']))
config.skip_repo_update.should.be.true
end
......@@ -15,7 +14,7 @@ module Pod
describe Command::Install do
it "tells the user that no Podfile or podspec was found in the current working dir" do
it 'tells the user that no Podfile or podspec was found in the current working dir' do
exception = lambda { run_command('install', '--no-repo-update') }.should.raise Informative
exception.message.should.include "No `Podfile' found in the current working directory."
end
......@@ -27,12 +26,12 @@ module Pod
describe Command::Update do
extend SpecHelper::TemporaryRepos
it "tells the user that no Podfile was found in the current working dir" do
exception = lambda { run_command('update','--no-repo-update') }.should.raise Informative
it 'tells the user that no Podfile was found in the current working dir' do
exception = lambda { run_command('update', '--no-repo-update') }.should.raise Informative
exception.message.should.include "No `Podfile' found in the current working directory."
end
it "tells the user that no Lockfile was found in the current working dir" do
it 'tells the user that no Lockfile was found in the current working dir' do
file = temporary_directory + 'Podfile'
File.open(file, 'w') do |f|
f.puts('platform :ios')
......@@ -44,7 +43,7 @@ module Pod
end
end
describe "tells the user that the Pods cannot be updated unless they are installed" do
describe 'tells the user that the Pods cannot be updated unless they are installed' do
extend SpecHelper::TemporaryRepos
before do
......@@ -62,22 +61,22 @@ module Pod
Specification.new do |s|
s.name = 'BananaLib'
s.version = '1.0'
end
end,
]
Lockfile.generate(podfile, specs).write_to_disk(temporary_directory + 'Podfile.lock')
end
it "for a single missing Pod" do
it 'for a single missing Pod' do
Dir.chdir(temporary_directory) do
exception = lambda { run_command('update', 'Reachability', '--no-repo-update') }.should.raise Informative
exception.message.should.include "Pod `Reachability` is not installed and cannot be updated"
exception.message.should.include 'Pod `Reachability` is not installed and cannot be updated'
end
end
it "for multiple missing Pods" do
it 'for multiple missing Pods' do
Dir.chdir(temporary_directory) do
exception = lambda { run_command('update', 'Reachability', 'BananaLib2', '--no-repo-update') }.should.raise Informative
exception.message.should.include "Pods `Reachability`, `BananaLib2` are not installed and cannot be updated"
exception.message.should.include 'Pods `Reachability`, `BananaLib2` are not installed and cannot be updated'
end
end
end
......@@ -85,6 +84,4 @@ module Pod
end
#---------------------------------------------------------------------------#
end
......@@ -29,7 +29,7 @@ module Pod
repo_make('test_repo')
Dir.chdir(temporary_directory) do
spec = "Spec.new do |s|; s.name = 'Broken'; s.version = '1.0' end"
File.open('Broken.podspec', 'w') {|f| f.write(spec) }
File.open('Broken.podspec', 'w') { |f| f.write(spec) }
cmd = command('repo', 'push', 'test_repo')
Validator.any_instance.stubs(:validated?).returns(false)
......@@ -60,12 +60,12 @@ module Pod
spec_clean = (fixture('spec-repos') + 'test_repo/BananaLib/1.0/BananaLib.podspec').read
File.open(temporary_directory + 'JSONKit.podspec', 'w') {|f| f.write(spec_fix) }
File.open(temporary_directory + 'PushTest.podspec', 'w') {|f| f.write(spec_add) }
File.open(temporary_directory + 'BananaLib.podspec', 'w') {|f| f.write(spec_clean) }
File.open(temporary_directory + 'JSONKit.podspec', 'w') { |f| f.write(spec_fix) }
File.open(temporary_directory + 'PushTest.podspec', 'w') { |f| f.write(spec_add) }
File.open(temporary_directory + 'BananaLib.podspec', 'w') { |f| f.write(spec_clean) }
end
it "refuses to push if the repo is not clean" do
it 'refuses to push if the repo is not clean' do
Dir.chdir(test_repo_path) do
`git remote set-url origin https://github.com/CocoaPods/Specs.git`
end
......@@ -74,7 +74,7 @@ module Pod
e.message.should.match(/use the `pod trunk push` command/)
end
it "refuses to push if the repo is not clean" do
it 'refuses to push if the repo is not clean' do
Dir.chdir(test_repo_path) do
`touch DIRTY_FILE`
end
......@@ -85,7 +85,7 @@ module Pod
(@upstream + 'PushTest/1.4/PushTest.podspec').should.not.exist?
end
it "successfully pushes a spec" do
it 'successfully pushes a spec' do
cmd = command('repo', 'push', 'master')
Dir.chdir(@upstream) { `git checkout -b tmp_for_push -q` }
cmd.expects(:validate_podspec_files).returns(true)
......
......@@ -11,7 +11,7 @@ module Pod
config.repos_dir = SpecHelper.tmp_repos_path
end
it "updates a repository" do
it 'updates a repository' do
upstream = SpecHelper.temporary_directory + 'upstream'
FileUtils.cp_r(test_repo_path, upstream)
Dir.chdir(test_repo_path) do
......@@ -23,11 +23,11 @@ module Pod
lambda { command('repo', 'update').run }.should.not.raise
end
it "updates a spec-repo" do
it 'updates a spec-repo' do
repo1 = repo_make('repo1')
repo2 = repo_clone('repo1', 'repo2')
repo_make_readme_change(repo1, 'Updated')
Dir.chdir(repo1) {`git commit -a -m "Update"`}
Dir.chdir(repo1) { `git commit -a -m "Update"` }
run_command('repo', 'update', 'repo2')
(repo2 + 'README').read.should.include 'Updated'
end
......@@ -44,7 +44,7 @@ module Pod
::REST.stubs(:head => stub(:success? => true))
end
it "lints a repository" do
it 'lints a repository' do
repo = fixture('spec-repos/test_repo').to_s
lambda { run_command('repo', 'lint', repo) }.should.not.raise
end
......@@ -59,25 +59,25 @@ module Pod
config.repos_dir = SpecHelper.tmp_repos_path
end
it "adds a spec-repo" do
it 'adds a spec-repo' do
run_command('repo', 'add', 'private', test_repo_path)
Dir.chdir(config.repos_dir + 'private') do
`git config --get remote.origin.url`.chomp.should == test_repo_path.to_s
end
end
it "adds a spec-repo with a specified branch" do
it 'adds a spec-repo with a specified branch' do
repo1 = repo_make('repo1')
Dir.chdir(repo1) do
`git checkout -b my-branch >/dev/null 2>&1`
`git checkout master >/dev/null 2>&1`
end
repo2 = command( 'repo' ,'add', 'repo2', repo1.to_s, 'my-branch')
repo2 = command('repo', 'add', 'repo2', repo1.to_s, 'my-branch')
repo2.run
Dir.chdir(repo2.dir) { `git symbolic-ref HEAD` }.should.include? 'my-branch'
end
it "adds a spec-repo by creating a shallow clone" do
it 'adds a spec-repo by creating a shallow clone' do
Dir.chdir(test_repo_path) do
`echo 'touch' > touch && git add touch && git commit -m 'updated'`
end
......@@ -98,7 +98,7 @@ module Pod
config.repos_dir = SpecHelper.tmp_repos_path
end
it "complains when a repository name is missing" do
it 'complains when a repository name is missing' do
lambda { run_command('repo', 'remove') }.should.raise CLAide::Help
end
......@@ -106,7 +106,7 @@ module Pod
lambda { run_command('repo', 'remove', 'nonexistant') }.should.raise CLAide::Help
end
it "complains if we do not have permission" do
it 'complains if we do not have permission' do
File.stubs(:writable?).returns(false)
upstream = SpecHelper.temporary_directory + 'upstream'
FileUtils.cp_r(test_repo_path, upstream)
......@@ -114,7 +114,7 @@ module Pod
FileUtils.rm_rf(upstream)
end
it "removes a spec-repo" do
it 'removes a spec-repo' do
upstream = SpecHelper.temporary_directory + 'upstream'
FileUtils.cp_r(test_repo_path, upstream)
lambda { run_command('repo', 'remove', upstream) }.should.not.raise
......
......@@ -11,28 +11,28 @@ module Pod
SourcesManager.updated_search_index = nil
end
it "runs with correct parameters" do
it 'runs with correct parameters' do
lambda { run_command('search', 'JSON') }.should.not.raise
lambda { run_command('search', 'JSON', '--full') }.should.not.raise
end
it "complains for wrong parameters" do
it 'complains for wrong parameters' do
lambda { run_command('search') }.should.raise CLAide::Help
lambda { run_command('search', 'too', '--wrong') }.should.raise CLAide::Help
lambda { run_command('search', '--wrong') }.should.raise CLAide::Help
end
it "searches for a pod with name matching the given query ignoring case" do
it 'searches for a pod with name matching the given query ignoring case' do
output = run_command('search', 'json')
output.should.include? 'JSONKit'
end
it "searches for a pod with name, summary, or description matching the given query ignoring case" do
it 'searches for a pod with name, summary, or description matching the given query ignoring case' do
output = run_command('search', 'Engelhart', '--full')
output.should.include? 'JSONKit'
end
it "restricts the search to Pods supported on iOS" do
it 'restricts the search to Pods supported on iOS' do
output = run_command('search', 'BananaLib', '--ios')
output.should.include? 'BananaLib'
Specification.any_instance.stubs(:available_platforms).returns([Platform.osx])
......@@ -40,50 +40,50 @@ module Pod
output.should.not.include? 'BananaLib'
end
it "restricts the search to Pods supported on iOS" do
it 'restricts the search to Pods supported on iOS' do
output = run_command('search', 'BananaLib', '--osx')
output.should.not.include? 'BananaLib'
end
it "outputs with the silent parameter" do
it 'outputs with the silent parameter' do
output = run_command('search', 'BananaLib', '--silent')
output.should.include? 'BananaLib'
end
it "shows a friendly message when locally searching with invalid regex" do
it 'shows a friendly message when locally searching with invalid regex' do
lambda { run_command('search', '+') }.should.raise CLAide::Help
end
describe "option --web" do
describe 'option --web' do
extend SpecHelper::TemporaryRepos
it "searches with invalid regex" do
it 'searches with invalid regex' do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=NSAttributedString%2BCCLFormat')
run_command('search', '--web', 'NSAttributedString+CCLFormat')
end
it "should url encode search queries" do
it 'should url encode search queries' do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=NSAttributedString%2BCCLFormat')
run_command('search', '--web', 'NSAttributedString+CCLFormat')
end
it "searches the web via the open! command" do
it 'searches the web via the open! command' do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=bananalib')
run_command('search', '--web', 'bananalib')
end
it "includes option --osx correctly" do
it 'includes option --osx correctly' do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=on%3Aosx%20bananalib')
run_command('search', '--web', '--osx', 'bananalib')
end
it "includes option --ios correctly" do
it 'includes option --ios correctly' do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=on%3Aios%20bananalib')
run_command('search', '--web', '--ios', 'bananalib')
end
it "does not matter in which order the ios/osx options are set" do
it 'does not matter in which order the ios/osx options are set' do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=on%3Aosx%20on%3Aios%20bananalib')
run_command('search', '--web', '--ios', '--osx', 'bananalib')
......
......@@ -10,12 +10,12 @@ module Pod
config.repos_dir = SpecHelper.tmp_repos_path
end
it "returns the read only URL of the `master` spec-repo" do
it 'returns the read only URL of the `master` spec-repo' do
cmd = Command::Setup.new(argv)
cmd.url.should == 'https://github.com/CocoaPods/Specs.git'
end
it "returns the push URL of the `master` spec-repo" do
it 'returns the push URL of the `master` spec-repo' do
config.silent = true
cmd = Command::Setup.new(argv('--push'))
cmd.url.should == 'git@github.com:CocoaPods/Specs.git'
......@@ -27,19 +27,19 @@ module Pod
config.repos_dir = SpecHelper.temporary_directory
end
it "runs with correct parameters" do
it 'runs with correct parameters' do
lambda { run_command('setup') }.should.not.raise
end
it "creates the local spec-repos directory and creates a clone of the `master` repo" do
it 'creates the local spec-repos directory and creates a clone of the `master` repo' do
output = run_command('setup')
output.should.include "Setup completed"
output.should.not.include "push"
output.should.include 'Setup completed'
output.should.not.include 'push'
url = Dir.chdir(config.repos_dir + 'master') { `git config --get remote.origin.url`.chomp }
url.should == test_repo_path.to_s
end
it "creates a shallow clone of the `master` repo by default" do
it 'creates a shallow clone of the `master` repo by default' do
Dir.chdir(test_repo_path) do
`echo 'touch' > touch && git add touch && git commit -m 'updated'`
end
......@@ -51,7 +51,7 @@ module Pod
end
end
it "creates a full clone of the `master` repo if requested" do
it 'creates a full clone of the `master` repo if requested' do
Dir.chdir(test_repo_path) do
`echo 'touch' > touch && git add touch && git commit -m 'updated'`
end
......@@ -61,7 +61,7 @@ module Pod
end
end
it "creates a full clone of the `master` repo when push access is requested" do
it 'creates a full clone of the `master` repo when push access is requested' do
Dir.chdir(test_repo_path) do
`echo 'touch' > touch && git add touch && git commit -m 'updated'`
end
......@@ -73,9 +73,9 @@ module Pod
end
end
it "preserves push access for the `master` repo" do
it 'preserves push access for the `master` repo' do
output = run_command('setup')
output.should.not.include "push"
output.should.not.include 'push'
Dir.chdir(config.repos_dir + 'master') { `git remote set-url origin git@github.com:CocoaPods/Specs.git` }
command('setup').url.should == 'git@github.com:CocoaPods/Specs.git'
end
......@@ -87,7 +87,7 @@ module Pod
Command::Setup.any_instance.stubs(:old_master_repo_dir).returns(SpecHelper.temporary_directory + 'cocoapods/master')
end
it "migrates repos from the old directory structure to the new one" do
it 'migrates repos from the old directory structure to the new one' do
source = SpecHelper.temporary_directory + 'cocoapods/master'
target = config.repos_dir + 'master'
......
......@@ -3,9 +3,9 @@ require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Command::Spec do
describe "In general" do
describe 'In general' do
it "complains for wrong parameters" do
it 'complains for wrong parameters' do
lambda { run_command('spec') }.should.raise CLAide::Help
lambda { run_command('spec', 'create') }.should.raise CLAide::Help
lambda { run_command('spec', '--create') }.should.raise CLAide::Help
......@@ -21,59 +21,59 @@ module Pod
#-------------------------------------------------------------------------#
describe "create subcommand" do
describe 'create subcommand' do
extend SpecHelper::TemporaryRepos
it "creates a new podspec stub file" do
it 'creates a new podspec stub file' do
run_command('spec', 'create', 'Bananas')
path = temporary_directory + 'Bananas.podspec'
spec = Specification.from_file(path)
spec.name.should == 'Bananas'
spec.license.should == { :type => "MIT (example)" }
spec.license.should == { :type => 'MIT (example)' }
spec.version.should == Version.new('0.0.1')
spec.summary.should == 'A short description of Bananas.'
spec.homepage.should == 'http://EXAMPLE/Bananas'
spec.authors.should == { `git config --get user.name`.strip => `git config --get user.email`.strip}
spec.authors.should == { `git config --get user.name`.strip => `git config --get user.email`.strip }
spec.source.should == { :git => 'http://EXAMPLE/Bananas.git', :tag => '0.0.1' }
spec.consumer(:ios).source_files.should == ['Classes', 'Classes/**/*.{h,m}']
spec.consumer(:ios).public_header_files.should == []
end
it "correctly creates a podspec from github" do
it 'correctly creates a podspec from github' do
repo = {
'name' => 'libPusher',
'owner' => { 'login' => 'lukeredpath' },
'html_url' => 'https://github.com/lukeredpath/libPusher',
'description' => 'An Objective-C interface to Pusher (pusherapp.com)',
'clone_url' => 'https://github.com/lukeredpath/libPusher.git'
'clone_url' => 'https://github.com/lukeredpath/libPusher.git',
}
GitHub.expects(:repo).with('lukeredpath/libPusher').returns(repo)
GitHub.expects(:tags).with('https://github.com/lukeredpath/libPusher').returns([{"name"=>"v1.4"}])
GitHub.expects(:user).with('lukeredpath').returns({ "name" => "Luke Redpath", "email" => "luke@lukeredpath.co.uk" })
GitHub.expects(:tags).with('https://github.com/lukeredpath/libPusher').returns([{ 'name' => 'v1.4' }])
GitHub.expects(:user).with('lukeredpath').returns('name' => 'Luke Redpath', 'email' => 'luke@lukeredpath.co.uk')
run_command('spec', 'create', 'https://github.com/lukeredpath/libPusher.git')
path = temporary_directory + 'libPusher.podspec'
spec = Specification.from_file(path)
spec.name.should == 'libPusher'
spec.license.should == { :type => "MIT (example)" }
spec.license.should == { :type => 'MIT (example)' }
spec.version.should == Version.new('1.4')
spec.summary.should == 'An Objective-C interface to Pusher (pusherapp.com)'
spec.homepage.should == 'https://github.com/lukeredpath/libPusher'
spec.authors.should == {"Luke Redpath"=>"luke@lukeredpath.co.uk"}
spec.authors.should == { 'Luke Redpath' => 'luke@lukeredpath.co.uk' }
spec.source.should == { :git => 'https://github.com/lukeredpath/libPusher.git', :tag => 'v1.4' }
end
it "accepts a name when creating a podspec form github" do
it 'accepts a name when creating a podspec form github' do
repo = {
'name' => 'libPusher',
'owner' => { 'login' => 'lukeredpath' },
'html_url' => 'https://github.com/lukeredpath/libPusher',
'description' => 'An Objective-C interface to Pusher (pusherapp.com)',
'clone_url' => 'https://github.com/lukeredpath/libPusher.git'
'clone_url' => 'https://github.com/lukeredpath/libPusher.git',
}
GitHub.expects(:repo).with('lukeredpath/libPusher').returns(repo)
GitHub.expects(:tags).with('https://github.com/lukeredpath/libPusher').returns([{"name"=>"v1.4"}])
GitHub.expects(:user).with('lukeredpath').returns({ "name" => "Luke Redpath", "email" => "luke@lukeredpath.co.uk" })
GitHub.expects(:tags).with('https://github.com/lukeredpath/libPusher').returns([{ 'name' => 'v1.4' }])
GitHub.expects(:user).with('lukeredpath').returns('name' => 'Luke Redpath', 'email' => 'luke@lukeredpath.co.uk')
run_command('spec', 'create', 'other_name', 'https://github.com/lukeredpath/libPusher.git')
path = temporary_directory + 'other_name.podspec'
spec = Specification.from_file(path)
......@@ -81,18 +81,18 @@ module Pod
spec.homepage.should == 'https://github.com/lukeredpath/libPusher'
end
it "correctly suggests the head commit if a suitable tag is not available on github" do
it 'correctly suggests the head commit if a suitable tag is not available on github' do
repo = {
'name' => 'libPusher',
'owner' => { 'login' => 'lukeredpath' },
'html_url' => 'https://github.com/lukeredpath/libPusher',
'description' => 'An Objective-C interface to Pusher (pusherapp.com)',
'clone_url' => 'https://github.com/lukeredpath/libPusher.git'
'clone_url' => 'https://github.com/lukeredpath/libPusher.git',
}
GitHub.expects(:repo).with('lukeredpath/libPusher').returns(repo)
GitHub.expects(:tags).with('https://github.com/lukeredpath/libPusher').returns([{"name"=>"experiment"}])
GitHub.expects(:branches).with('https://github.com/lukeredpath/libPusher').returns([{"name"=>"master", "commit" => {'sha' => '5f482b0693ac2ac1ad85d1aabc27ec7547cc0bc7'}}])
GitHub.expects(:user).with('lukeredpath').returns({ "name" => "Luke Redpath", "email" => "luke@lukeredpath.co.uk" })
GitHub.expects(:tags).with('https://github.com/lukeredpath/libPusher').returns([{ 'name' => 'experiment' }])
GitHub.expects(:branches).with('https://github.com/lukeredpath/libPusher').returns([{ 'name' => 'master', 'commit' => { 'sha' => '5f482b0693ac2ac1ad85d1aabc27ec7547cc0bc7' } }])
GitHub.expects(:user).with('lukeredpath').returns('name' => 'Luke Redpath', 'email' => 'luke@lukeredpath.co.uk')
run_command('spec', 'create', 'https://github.com/lukeredpath/libPusher.git')
path = temporary_directory + 'libPusher.podspec'
spec = Specification.from_file(path)
......@@ -106,12 +106,12 @@ module Pod
'owner' => { 'login' => 'lukeredpath' },
'html_url' => 'https://github.com/lukeredpath/libPusher',
'description' => 'An Objective-C interface to Pusher (pusherapp.com)',
'clone_url' => 'https://github.com/lukeredpath/libPusher.git'
'clone_url' => 'https://github.com/lukeredpath/libPusher.git',
}
GitHub.expects(:repo).with('lukeredpath/libPusher').returns(repo)
GitHub.expects(:tags).with('https://github.com/lukeredpath/libPusher').returns([{"name"=>"experiment"}])
GitHub.expects(:branches).with('https://github.com/lukeredpath/libPusher').returns([{"name"=>"master", "commit" => {'sha' => '5f482b0693ac2ac1ad85d1aabc27ec7547cc0bc7'}}])
GitHub.expects(:user).with('lukeredpath').returns({ "name" => "Luke Redpath", "email" => "luke@lukeredpath.co.uk" })
GitHub.expects(:tags).with('https://github.com/lukeredpath/libPusher').returns([{ 'name' => 'experiment' }])
GitHub.expects(:branches).with('https://github.com/lukeredpath/libPusher').returns([{ 'name' => 'master', 'commit' => { 'sha' => '5f482b0693ac2ac1ad85d1aabc27ec7547cc0bc7' } }])
GitHub.expects(:user).with('lukeredpath').returns('name' => 'Luke Redpath', 'email' => 'luke@lukeredpath.co.uk')
output = run_command('spec', 'create', 'https://github.com/lukeredpath/libPusher.git')
output.should.include 'MARKDOWN TEMPLATE'
output.should.include 'Please add semantic version tags'
......@@ -120,7 +120,7 @@ module Pod
#-------------------------------------------------------------------------#
describe "lint subcommand" do
describe 'lint subcommand' do
extend SpecHelper::TemporaryRepos
it "complains if it can't find any spec to lint" do
......@@ -135,16 +135,16 @@ module Pod
end
end
it "lints the current working directory" do
it 'lints the current working directory' do
Dir.chdir(fixture('spec-repos') + 'master/Specs/JSONKit/1.4/') do
cmd = command('spec', 'lint', '--quick', '--only-errors')
cmd.run
UI.output.should.include "passed validation"
UI.output.should.include 'passed validation'
end
end
# @todo VCR is required in CocoaPods only for this test.
xit "lints a remote podspec" do
xit 'lints a remote podspec' do
Dir.chdir(fixture('spec-repos') + 'master/Specs/JSONKit/1.4/') do
cmd = command('spec', 'lint', '--quick', '--only-errors', '--silent', 'https://github.com/CocoaPods/Specs/raw/master/A2DynamicDelegate/2.0.1/A2DynamicDelegate.podspec')
# VCR.use_cassette('linter', :record => :new_episodes) { }
......@@ -156,20 +156,20 @@ module Pod
text = (fixture('spec-repos') + 'master/Specs/JSONKit/1.4/JSONKit.podspec.json').read
text.gsub!(/.*license.*/, '"license": { "file": "LICENSE" },')
file = temporary_directory + 'JSONKit.podspec.json'
File.open(file, 'w') {|f| f.write(text) }
File.open(file, 'w') { |f| f.write(text) }
@spec_path = file.to_s
end
it "lints a given podspec" do
it 'lints a given podspec' do
cmd = command('spec', 'lint', '--quick', @spec_path)
lambda { cmd.run }.should.raise Informative
UI.output.should.include "Missing license type"
UI.output.should.include 'Missing license type'
end
it "respects the -only--errors option" do
it 'respects the -only--errors option' do
cmd = command('spec', 'lint', '--quick', '--only-errors', @spec_path)
lambda { cmd.run }.should.not.raise
UI.output.should.include "Missing license type"
UI.output.should.include 'Missing license type'
end
end
......@@ -183,19 +183,19 @@ module Pod
end
def it_should_check_for_ambiguity(command)
it "complains provided spec name is ambigious" do
it 'complains provided spec name is ambigious' do
e = lambda { command('spec', command, 'AF').run }.should.raise Informative
e.message.should.match /More than one/
end
end
describe Command::Spec::Which do
it_should_check_for_existence("which")
it_should_check_for_ambiguity("which")
it_should_check_for_existence('which')
it_should_check_for_ambiguity('which')
it "prints the path of a given podspec" do
it 'prints the path of a given podspec' do
lambda { command('spec', 'which', 'AFNetworking').run }.should.not.raise
text = "AFNetworking.podspec"
text = 'AFNetworking.podspec'
UI.output.should.include text.gsub(/\n/, '')
end
end
......@@ -203,15 +203,15 @@ module Pod
#-------------------------------------------------------------------------#
describe Command::Spec::Cat do
it_should_check_for_existence("cat")
it_should_check_for_ambiguity("cat")
it_should_check_for_existence('cat')
it_should_check_for_ambiguity('cat')
it "cats the given podspec" do
it 'cats the given podspec' do
lambda { command('spec', 'cat', 'AFNetworking').run }.should.not.raise
UI.output.should.include fixture('spec-repos/master/Specs/AFNetworking/2.3.1/AFNetworking.podspec.json').read
end
it "cats the first podspec from all podspecs" do
it 'cats the first podspec from all podspecs' do
UI.next_input = "1\n"
run_command('spec', 'cat', '--show-all', 'AFNetworking')
UI.output.should.include fixture('spec-repos/master/Specs/AFNetworking/2.3.1/AFNetworking.podspec.json').read
......@@ -229,23 +229,23 @@ module Pod
ENV['PATH'] = @path_saved
end
it_should_check_for_existence("edit")
it_should_check_for_ambiguity("edit")
it_should_check_for_existence('edit')
it_should_check_for_ambiguity('edit')
it "would execute the editor specified in ENV with the given podspec" do
it 'would execute the editor specified in ENV with the given podspec' do
ENV['EDITOR'] = 'podspeceditor'
lambda { command('spec', 'edit', 'AFNetworking').run }.should.raise SystemExit
UI.output.should.include '/bin/sh -i -c podspeceditor "$@" --'
UI.output.should.include 'fixtures/spec-repos/master/Specs/AFNetworking'
end
it "will raise if no editor is found" do
it 'will raise if no editor is found' do
ENV['PATH'] = ''
ENV['EDITOR'] = nil
lambda { command('spec', 'edit', 'AFNetworking').run }.should.raise Informative
end
it "would execute an editor with the first podspec from all podspecs" do
it 'would execute an editor with the first podspec from all podspecs' do
ENV['EDITOR'] = 'podspeceditor'
UI.next_input = "1\n"
lambda { command('spec', 'edit', '--show-all', 'AFNetworking').run }.should.raise SystemExit
......@@ -262,7 +262,7 @@ module Pod
#-------------------------------------------------------------------------#
describe "Private helpers" do
describe 'Private helpers' do
before do
# TODO Use class methods
......@@ -270,29 +270,29 @@ module Pod
end
describe "#get_path_of_spec" do
describe '#get_path_of_spec' do
it "returns the path of the specification with the given name" do
it 'returns the path of the specification with the given name' do
path = @sut.send(:get_path_of_spec, 'AFNetworking')
path.should == fixture('spec-repos') + 'master/Specs/AFNetworking/2.3.1/AFNetworking.podspec.json'
end
end
describe "#choose_from_array" do
describe '#choose_from_array' do
it "should return a valid index for the given array" do
it 'should return a valid index for the given array' do
UI.next_input = "1\n"
index = @sut.send(:choose_from_array, ['item1', 'item2', 'item3'], 'A message')
index = @sut.send(:choose_from_array, %w(item1 item2 item3), 'A message')
UI.output.should.include "1: item1\n2: item2\n3: item3\nA message\n"
index.should == 0
end
it "should raise when the index is out of bounds" do
it 'should raise when the index is out of bounds' do
UI.next_input = "4\n"
lambda { @sut.send(:choose_from_array, ['item1', 'item2', 'item3'], 'A message') }.should.raise Pod::Informative
lambda { @sut.send(:choose_from_array, %w(item1 item2 item3), 'A message') }.should.raise Pod::Informative
UI.next_input = "0\n"
lambda { @sut.send(:choose_from_array, ['item1', 'item2', 'item3'], 'A message') }.should.raise Pod::Informative
lambda { @sut.send(:choose_from_array, %w(item1 item2 item3), 'A message') }.should.raise Pod::Informative
end
end
......@@ -303,4 +303,3 @@ module Pod
end
end
......@@ -4,12 +4,12 @@ module Pod
describe Command do
extend SpecHelper::Command
it "displays the current version number with the --version flag" do
it 'displays the current version number with the --version flag' do
Pod::Command.version.should == VERSION
end
it "reports the location of the AFNetworking spec" do
lambda { Pod::Command.run(['spec', 'which', 'AFNetworking']) }.should.not.raise
it 'reports the location of the AFNetworking spec' do
lambda { Pod::Command.run(%w(spec which AFNetworking)) }.should.not.raise
UI.output.should.include 'spec/fixtures/spec-repos/master/Specs/AFNetworking'
end
......
......@@ -9,7 +9,7 @@ module Pod
@set = SourcesManager.search(Dependency.new('CocoaLumberjack'))
end
it "presents the name, version, description, homepage and source of a specification set" do
it 'presents the name, version, description, homepage and source of a specification set' do
UI.pod(@set)
output = UI.output
output.should.include? 'CocoaLumberjack'
......@@ -21,26 +21,26 @@ module Pod
output.should.include? 'https://github.com/CocoaLumberjack/CocoaLumberjack.git'
end
it "Presents information about deprecation if the pod is deprecated" do
it 'Presents information about deprecation if the pod is deprecated' do
specification = @set.specification
specification.deprecated = true
@set.expects(:specification).returns(specification)
UI.pod(@set)
output = UI.output
output.should.include? "[DEPRECATED]"
output.should.include? '[DEPRECATED]'
end
it "Presents information about the deprecation in favor of another pod" do
it 'Presents information about the deprecation in favor of another pod' do
specification = @set.specification
specification.deprecated_in_favor_of = "NewMoreAwesomePod"
specification.deprecated_in_favor_of = 'NewMoreAwesomePod'
@set.expects(:specification).returns(specification)
UI.pod(@set)
output = UI.output
output.should.include? "[DEPRECATED in favor of NewMoreAwesomePod]"
output.should.include? '[DEPRECATED in favor of NewMoreAwesomePod]'
end
it "presents the stats of a specification set" do
it 'presents the stats of a specification set' do
Specification::Set::Presenter.any_instance.expects(:github_last_activity).returns('more than a year ago')
Specification::Set::Presenter.any_instance.expects(:github_watchers).returns('318')
Specification::Set::Presenter.any_instance.expects(:github_forks).returns('42')
......@@ -54,14 +54,14 @@ module Pod
output.should.include? 'Pushed: more than a year ago'
end
it "should print at least one subspec" do
it 'should print at least one subspec' do
@set = SourcesManager.search(Dependency.new('RestKit'))
UI.pod(@set)
output = UI.output
output.should.include? "RestKit/Network"
output.should.include? 'RestKit/Network'
end
it "presents only name and version of a specification set in :name_and_version mode" do
it 'presents only name and version of a specification set in :name_and_version mode' do
@set = SourcesManager.search_by_name('RestKit').first
UI.pod(@set, :name_and_version)
output = UI.output
......
......@@ -37,29 +37,28 @@
#-----------------------------------------------------------------------------#
# @return [Pathname] The root of the repo.
#
ROOT = Pathname.new(File.expand_path("../../", __FILE__)) unless defined? ROOT
ROOT = Pathname.new(File.expand_path('../../', __FILE__)) unless defined? ROOT
$:.unshift((ROOT + 'spec').to_s)
require 'rubygems'
require 'bundler/setup'
require 'pretty_bacon'
require 'colored'
require "clintegracon"
require "integration/xcodeproj_project_yaml"
require 'clintegracon'
require 'integration/xcodeproj_project_yaml'
CLIntegracon.configure do |c|
c.spec_path = ROOT + "spec/cocoapods-integration-specs"
c.temp_path = ROOT + "tmp"
c.spec_path = ROOT + 'spec/cocoapods-integration-specs'
c.temp_path = ROOT + 'tmp'
# Transform produced project files to YAMLs
c.transform_produced "**/*.xcodeproj" do |path|
c.transform_produced '**/*.xcodeproj' do |path|
# Creates a YAML representation of the Xcodeproj files
# which should be used as a reference for comparison.
xcodeproj = Xcodeproj::Project.open(path)
File.open("#{path}.yaml", "w") do |file|
File.open("#{path}.yaml", 'w') do |file|
file.write xcodeproj.to_yaml
end
end
......@@ -67,156 +66,155 @@ CLIntegracon.configure do |c|
# Register special handling for YAML files
paths = [%r{Podfile\.lock}, %r{Manifest\.lock$}, %r{xcodeproj\.yaml$}]
c.has_special_handling_for *paths do |path|
if RUBY_VERSION < "1.9"
if RUBY_VERSION < '1.9'
nil # CP is not sorting array derived from hashes whose order is
# undefined in 1.8.7
else
# Remove CocoaPods version
yaml = File.open(path) { |f| YAML.load(f) }
yaml.delete("COCOAPODS")
yaml.delete('COCOAPODS')
yaml.to_s
end
end
# So we don't need to compare them directly
c.ignores %r{\.xcodeproj/}
c.ignores "Podfile"
c.ignores 'Podfile'
# Ignore certain OSX files
c.ignores ".DS_Store"
c.ignores '.DS_Store'
# Ignore xcuserdata
c.ignores %r{/xcuserdata/}
# TODO The output from the caches changes on Travis
c.ignores "execution_output.txt"
c.ignores 'execution_output.txt'
# Needed for some test cases
c.ignores "Reachability.podspec"
c.ignores "PodTest-hg-source/**"
c.ignores 'Reachability.podspec'
c.ignores 'PodTest-hg-source/**'
c.hook_into :bacon
end
describe_cli "pod" do
describe_cli 'pod' do
subject do |s|
s.executable = "ruby #{ROOT + "bin/pod"}"
s.executable = "ruby #{ROOT + 'bin/pod'}"
s.environment_vars = {
"CP_AGGRESSIVE_CACHE" => "TRUE",
"XCODEPROJ_DISABLE_XCPROJ" => "TRUE",
'CP_AGGRESSIVE_CACHE' => 'TRUE',
'XCODEPROJ_DISABLE_XCPROJ' => 'TRUE',
}
s.default_args = [
"--verbose",
"--no-ansi"
'--verbose',
'--no-ansi',
]
s.replace_path ROOT.to_s, "ROOT"
s.replace_user_path "Library/Caches/CocoaPods", "CACHES_DIR"
s.replace_path ROOT.to_s, 'ROOT'
s.replace_user_path 'Library/Caches/CocoaPods', 'CACHES_DIR'
end
describe "Pod install" do
describe 'Pod install' do
# Test installation with no integration
# Test subspecs inheritance
describe "Integrates a project with CocoaPods" do
behaves_like cli_spec "install_new",
"install --no-repo-update"
describe 'Integrates a project with CocoaPods' do
behaves_like cli_spec 'install_new',
'install --no-repo-update'
end
describe "Adds a Pod to an existing installation" do
behaves_like cli_spec "install_add_pod",
"install --no-repo-update"
describe 'Adds a Pod to an existing installation' do
behaves_like cli_spec 'install_add_pod',
'install --no-repo-update'
end
describe "Removes a Pod from an existing installation" do
behaves_like cli_spec "install_remove_pod",
"install --no-repo-update"
describe 'Removes a Pod from an existing installation' do
behaves_like cli_spec 'install_remove_pod',
'install --no-repo-update'
end
describe "Creates an installation with multiple target definitions" do
behaves_like cli_spec "install_multiple_targets",
"install --no-repo-update"
describe 'Creates an installation with multiple target definitions' do
behaves_like cli_spec 'install_multiple_targets',
'install --no-repo-update'
end
describe "Installs a Pod with different subspecs activated across different targets" do
behaves_like cli_spec "install_subspecs",
"install --no-repo-update"
describe 'Installs a Pod with different subspecs activated across different targets' do
behaves_like cli_spec 'install_subspecs',
'install --no-repo-update'
end
describe "Installs a Pod with subspecs and does not duplicate the prefix header" do
behaves_like cli_spec "install_subspecs_no_duplicate_prefix",
"install --no-repo-update"
describe 'Installs a Pod with subspecs and does not duplicate the prefix header' do
behaves_like cli_spec 'install_subspecs_no_duplicate_prefix',
'install --no-repo-update'
end
describe "Installs a Pod with a local source" do
behaves_like cli_spec "install_local_source",
"install --no-repo-update"
describe 'Installs a Pod with a local source' do
behaves_like cli_spec 'install_local_source',
'install --no-repo-update'
end
describe "Installs a Pod with an external source" do
behaves_like cli_spec "install_external_source",
"install --no-repo-update"
describe 'Installs a Pod with an external source' do
behaves_like cli_spec 'install_external_source',
'install --no-repo-update'
end
describe "Installs a Pod given the podspec" do
behaves_like cli_spec "install_podspec",
"install --no-repo-update"
describe 'Installs a Pod given the podspec' do
behaves_like cli_spec 'install_podspec',
'install --no-repo-update'
end
describe "Performs an installation using a custom workspace" do
behaves_like cli_spec "install_custom_workspace",
"install --no-repo-update"
describe 'Performs an installation using a custom workspace' do
behaves_like cli_spec 'install_custom_workspace',
'install --no-repo-update'
end
describe "Integrates a target with custom build settings" do
behaves_like cli_spec "install_custom_build_configuration",
"install --no-repo-update"
describe 'Integrates a target with custom build settings' do
behaves_like cli_spec 'install_custom_build_configuration',
'install --no-repo-update'
end
# @todo add tests for all the hooks API
#
describe "Runs the Podfile callbacks" do
behaves_like cli_spec "install_podfile_callbacks",
"install --no-repo-update"
describe 'Runs the Podfile callbacks' do
behaves_like cli_spec 'install_podfile_callbacks',
'install --no-repo-update'
end
end
#--------------------------------------#
describe "Pod update" do
describe 'Pod update' do
describe "Updates an existing installation" do
behaves_like cli_spec "update_all",
"update --no-repo-update"
describe 'Updates an existing installation' do
behaves_like cli_spec 'update_all',
'update --no-repo-update'
end
describe "Updates a selected Pod in an existing installation" do
behaves_like cli_spec "update_selected",
"update Reachability --no-repo-update"
describe 'Updates a selected Pod in an existing installation' do
behaves_like cli_spec 'update_selected',
'update Reachability --no-repo-update'
end
end
#--------------------------------------#
describe "Pod lint" do
describe 'Pod lint' do
describe "Lints a Pod" do
behaves_like cli_spec "spec_lint",
"spec lint --quick"
describe 'Lints a Pod' do
behaves_like cli_spec 'spec_lint',
'spec lint --quick'
end
end
#--------------------------------------#
describe "Pod init" do
describe 'Pod init' do
describe "Initializes a Podfile with a single platform" do
behaves_like cli_spec "init_single_platform",
"init"
describe 'Initializes a Podfile with a single platform' do
behaves_like cli_spec 'init_single_platform',
'init'
end
end
......
require "xcodeproj"
require "yaml"
require 'xcodeproj'
require 'yaml'
class Xcodeproj::Project
def to_yaml
pretty_print_output = pretty_print
sections = []
sorted_keys = ["File References", "Targets", "Build Configurations"]
sorted_keys = ['File References', 'Targets', 'Build Configurations']
sorted_keys.each do |key|
yaml = { key => pretty_print_output[key] }.to_yaml
sections << yaml
end
(sections * "\n\n").gsub!("---", '')
(sections * "\n\n").gsub!('---', '')
end
end
......@@ -26,7 +26,7 @@ require 'bacon'
require 'mocha-on-bacon'
require 'pretty_bacon'
require 'pathname'
require "active_support/core_ext/string/strip"
require 'active_support/core_ext/string/strip'
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
$:.unshift((ROOT + 'lib').to_s)
......@@ -34,7 +34,7 @@ $:.unshift((ROOT + 'spec').to_s)
require 'cocoapods'
require 'claide'
#require 'awesome_print'
# require 'awesome_print'
require 'spec_helper/command' # Allows to run Pod commands and returns their output.
require 'spec_helper/fixture' # Provides access to the fixtures and unpacks them if needed.
......@@ -52,7 +52,7 @@ require 'spec_helper/github' # Stubs Github API to return always the va
#
module Pod
class Specification
alias :original_source :source
alias_method :original_source, :source
def source
fixture = SpecHelper.fixture("integration/#{name}")
result = super
......@@ -117,7 +117,7 @@ module SpecHelper
end
def temporary_sandbox
Pod::Sandbox.new(temporary_directory + "Pods")
Pod::Sandbox.new(temporary_directory + 'Pods')
end
def fixture_spec(name)
......@@ -135,4 +135,3 @@ end
#-----------------------------------------------------------------------------#
SpecHelper::Fixture.fixture('banana-lib') # ensure it exists
......@@ -31,4 +31,3 @@ module Bacon
end
end
end
......@@ -88,4 +88,3 @@ module SpecHelper
end
end
end
module Pod
# Disable the wrapping so the output is deterministic in the tests.
#
UI.disable_wrap = true
......@@ -20,7 +19,7 @@ module Pod
@output << "#{message}\n"
end
def warn(message = '', actions = [])
def warn(message = '', _actions = [])
@warnings << "#{message}\n"
end
......
......@@ -2,21 +2,21 @@ require File.expand_path('../../spec_helper', __FILE__)
module Pod
describe Command do
it "returns the proper command class" do
Command.parse(%w{ help }).should.be.instance_of Command::Help
Command.parse(%w{ install }).should.be.instance_of Command::Install
Command.parse(%w{ list }).should.be.instance_of Command::List
Command.parse(%w{ outdated }).should.be.instance_of Command::Outdated
Command.parse(%w{ repo }).should.be.instance_of Command::Repo
Command.parse(%w{ repo add }).should.be.instance_of Command::Repo::Add
Command.parse(%w{ repo lint }).should.be.instance_of Command::Repo::Lint
Command.parse(%w{ repo update }).should.be.instance_of Command::Repo::Update
Command.parse(%w{ repo remove }).should.be.instance_of Command::Repo::Remove
Command.parse(%w{ search }).should.be.instance_of Command::Search
Command.parse(%w{ setup }).should.be.instance_of Command::Setup
Command.parse(%w{ spec create }).should.be.instance_of Command::Spec::Create
Command.parse(%w{ spec lint }).should.be.instance_of Command::Spec::Lint
Command.parse(%w{ init }).should.be.instance_of Command::Init
it 'returns the proper command class' do
Command.parse(%w( help )).should.be.instance_of Command::Help
Command.parse(%w( install )).should.be.instance_of Command::Install
Command.parse(%w( list )).should.be.instance_of Command::List
Command.parse(%w( outdated )).should.be.instance_of Command::Outdated
Command.parse(%w( repo )).should.be.instance_of Command::Repo
Command.parse(%w( repo add )).should.be.instance_of Command::Repo::Add
Command.parse(%w( repo lint )).should.be.instance_of Command::Repo::Lint
Command.parse(%w( repo update )).should.be.instance_of Command::Repo::Update
Command.parse(%w( repo remove )).should.be.instance_of Command::Repo::Remove
Command.parse(%w( search )).should.be.instance_of Command::Search
Command.parse(%w( setup )).should.be.instance_of Command::Setup
Command.parse(%w( spec create )).should.be.instance_of Command::Spec::Create
Command.parse(%w( spec lint )).should.be.instance_of Command::Spec::Lint
Command.parse(%w( init )).should.be.instance_of Command::Init
end
end
end
require File.expand_path('../../spec_helper', __FILE__)
module Pod
describe Config do
before do
@sut = Config.new(false)
......@@ -9,56 +8,56 @@ module Pod
#-------------------------------------------------------------------------#
describe "In general" do
describe 'In general' do
it "returns the singleton config instance" do
it 'returns the singleton config instance' do
@sut.should.be.instance_of Config
end
it "returns the path to the home dir" do
@sut.home_dir.should == Pathname.new("~/.cocoapods").expand_path
it 'returns the path to the home dir' do
@sut.home_dir.should == Pathname.new('~/.cocoapods').expand_path
end
it "returns the path to the spec-repos dir" do
@sut.repos_dir.should == Pathname.new("~/.cocoapods/repos").expand_path
it 'returns the path to the spec-repos dir' do
@sut.repos_dir.should == Pathname.new('~/.cocoapods/repos').expand_path
end
it "returns the path to the templates dir" do
@sut.templates_dir.should == Pathname.new("~/.cocoapods/templates").expand_path
it 'returns the path to the templates dir' do
@sut.templates_dir.should == Pathname.new('~/.cocoapods/templates').expand_path
end
it "returns the path of the default podfiles" do
@sut.default_podfile_path.should == Pathname.new("~/.cocoapods/templates/Podfile.default").expand_path
@sut.default_test_podfile_path.should == Pathname.new("~/.cocoapods/templates/Podfile.test").expand_path
it 'returns the path of the default podfiles' do
@sut.default_podfile_path.should == Pathname.new('~/.cocoapods/templates/Podfile.default').expand_path
@sut.default_test_podfile_path.should == Pathname.new('~/.cocoapods/templates/Podfile.test').expand_path
end
it "allows to specify the home dir with an environment variable" do
it 'allows to specify the home dir with an environment variable' do
ENV['CP_HOME_DIR'] = '~/custom_home_dir'
@sut.home_dir.should == Pathname.new("~/custom_home_dir").expand_path
@sut.home_dir.should == Pathname.new('~/custom_home_dir').expand_path
ENV.delete('CP_HOME_DIR')
end
it "allows to specify the repos dir with an environment variable" do
it 'allows to specify the repos dir with an environment variable' do
ENV['CP_REPOS_DIR'] = '~/custom_repos_dir'
@sut.repos_dir.should == Pathname.new("~/custom_repos_dir").expand_path
@sut.repos_dir.should == Pathname.new('~/custom_repos_dir').expand_path
ENV.delete('CP_REPOS_DIR')
end
end
#-------------------------------------------------------------------------#
describe "Paths" do
describe 'Paths' do
it "returns the working directory as the installation root if a Podfile can be found" do
it 'returns the working directory as the installation root if a Podfile can be found' do
Dir.chdir(temporary_directory) do
File.open("Podfile", "w") {}
File.open('Podfile', 'w') {}
@sut.installation_root.should == temporary_directory
end
end
it "returns the parent directory which contains the Podfile if it can be found" do
it 'returns the parent directory which contains the Podfile if it can be found' do
Dir.chdir(temporary_directory) do
File.open("Podfile", "w") {}
File.open('Podfile', 'w') {}
sub_dir = temporary_directory + 'sub_dir'
sub_dir.mkpath
Dir.chdir(sub_dir) do
......@@ -67,7 +66,7 @@ module Pod
end
end
it "it returns the working directory as the installation root if no Podfile can be found" do
it 'it returns the working directory as the installation root if no Podfile can be found' do
Dir.chdir(temporary_directory) do
@sut.installation_root.should == temporary_directory
end
......@@ -77,55 +76,55 @@ module Pod
@sut.installation_root = temporary_directory
end
it "returns the path to the project root" do
it 'returns the path to the project root' do
@sut.installation_root.should == temporary_directory
end
it "returns the path to the project Podfile if it exists" do
it 'returns the path to the project Podfile if it exists' do
(temporary_directory + 'Podfile').open('w') { |f| f << '# Yo' }
@sut.podfile_path.should == temporary_directory + 'Podfile'
end
it "can detect yaml Podfiles" do
it 'can detect yaml Podfiles' do
(temporary_directory + 'CocoaPods.podfile.yaml').open('w') { |f| f << '# Yo' }
@sut.podfile_path.should == temporary_directory + 'CocoaPods.podfile.yaml'
end
it "can detect files named `CocoaPods.podfile`" do
it 'can detect files named `CocoaPods.podfile`' do
(temporary_directory + 'CocoaPods.podfile').open('w') { |f| f << '# Yo' }
@sut.podfile_path.should == temporary_directory + 'CocoaPods.podfile'
end
it "returns the path to the Pods directory that holds the dependencies" do
it 'returns the path to the Pods directory that holds the dependencies' do
@sut.sandbox_root.should == temporary_directory + 'Pods'
end
it "returns the Podfile path" do
it 'returns the Podfile path' do
Dir.chdir(temporary_directory) do
File.open("Podfile", "w") {}
@sut.podfile_path.should == temporary_directory + "Podfile"
File.open('Podfile', 'w') {}
@sut.podfile_path.should == temporary_directory + 'Podfile'
end
end
it "returns nils if the Podfile if no paths exists" do
it 'returns nils if the Podfile if no paths exists' do
Dir.chdir(temporary_directory) do
@sut.podfile_path.should == nil
@sut.podfile_path.should.nil?
end
end
it "returns the Lockfile path" do
it 'returns the Lockfile path' do
Dir.chdir(temporary_directory) do
File.open("Podfile", "w") {}
File.open("Podfile.lock", "w") {}
@sut.lockfile_path.should == temporary_directory + "Podfile.lock"
File.open('Podfile', 'w') {}
File.open('Podfile.lock', 'w') {}
@sut.lockfile_path.should == temporary_directory + 'Podfile.lock'
end
end
it "returns the statistics cache file" do
it 'returns the statistics cache file' do
@sut.statistics_cache_file.to_s.should.end_with?('statistics.yml')
end
it "returns the search index file" do
it 'returns the search index file' do
@sut.search_index_file.to_s.should.end_with?('search_index.yaml')
end
......@@ -133,30 +132,30 @@ module Pod
#-------------------------------------------------------------------------#
describe "Default settings" do
describe 'Default settings' do
it "prints out normal information" do
it 'prints out normal information' do
@sut.should.not.be.silent
end
it "does not print verbose information" do
it 'does not print verbose information' do
@sut.should.not.be.verbose
end
it "cleans SCM dirs in dependency checkouts" do
it 'cleans SCM dirs in dependency checkouts' do
@sut.should.clean
end
it "returns the cache root" do
it 'returns the cache root' do
@sut.cache_root.should == Pathname.new(File.join(ENV['HOME'], 'Library/Caches/CocoaPods'))
end
end
#-------------------------------------------------------------------------#
describe "Dependency Injection" do
describe 'Dependency Injection' do
it "returns the specification statistics provider" do
it 'returns the specification statistics provider' do
stats_provider = @sut.spec_statistics_provider
stats_provider.cache_file.should == @sut.cache_root + 'statistics.yml'
end
......@@ -165,13 +164,13 @@ module Pod
#-------------------------------------------------------------------------#
describe "Private helpers" do
describe 'Private helpers' do
it "returns the path of the user settings file" do
@sut.send(:user_settings_file).should == Pathname.new("~/.cocoapods/config.yaml").expand_path
it 'returns the path of the user settings file' do
@sut.send(:user_settings_file).should == Pathname.new('~/.cocoapods/config.yaml').expand_path
end
it "can be configured with a hash" do
it 'can be configured with a hash' do
hash = { :verbose => true }
@sut.send(:configure_with, hash)
@sut.should.be.verbose
......@@ -179,32 +178,32 @@ module Pod
#----------------------------------------#
describe "#podfile_path_in_dir" do
describe '#podfile_path_in_dir' do
it "detects the CocoaPods.podfile.yaml file" do
expected = temporary_directory + "CocoaPods.podfile.yaml"
File.open(expected, "w") {}
it 'detects the CocoaPods.podfile.yaml file' do
expected = temporary_directory + 'CocoaPods.podfile.yaml'
File.open(expected, 'w') {}
path = @sut.send(:podfile_path_in_dir, temporary_directory)
path.should == expected
end
it "detects the CocoaPods.podfile file" do
expected = temporary_directory + "CocoaPods.podfile"
File.open(expected, "w") {}
it 'detects the CocoaPods.podfile file' do
expected = temporary_directory + 'CocoaPods.podfile'
File.open(expected, 'w') {}
path = @sut.send(:podfile_path_in_dir, temporary_directory)
path.should == expected
end
it "detects the Podfile file" do
expected = temporary_directory + "Podfile"
File.open(expected, "w") {}
it 'detects the Podfile file' do
expected = temporary_directory + 'Podfile'
File.open(expected, 'w') {}
path = @sut.send(:podfile_path_in_dir, temporary_directory)
path.should == expected
end
it "returns nils if the Podfile is not available" do
it 'returns nils if the Podfile is not available' do
path = @sut.send(:podfile_path_in_dir, temporary_directory)
path.should == nil
path.should.nil?
end
end
......
......@@ -3,8 +3,10 @@ require File.expand_path('../../spec_helper', __FILE__)
module Pod
describe Executable do
it 'shows the actual command on failure' do
e = lambda { Executable.execute_command('false',
'', true) }.should.raise Informative
e = lambda do
Executable.execute_command('false',
'', true)
end.should.raise Informative
e.message.should.match(/false/)
end
end
......
......@@ -4,26 +4,26 @@ module Pod
describe ExternalSources::AbstractExternalSource do
before do
dependency = Dependency.new("Reachability", :git => fixture('integration/Reachability'))
dependency = Dependency.new('Reachability', :git => fixture('integration/Reachability'))
@subject = ExternalSources.from_dependency(dependency, nil)
end
#--------------------------------------#
describe "In general" do
describe 'In general' do
it "compares to another" do
dependency_1 = Dependency.new("Reachability", :git => 'url')
dependency_2 = Dependency.new("Another_name", :git => 'url')
dependency_3 = Dependency.new("Reachability", :git => 'another_url')
it 'compares to another' do
dependency_1 = Dependency.new('Reachability', :git => 'url')
dependency_2 = Dependency.new('Another_name', :git => 'url')
dependency_3 = Dependency.new('Reachability', :git => 'another_url')
dependency_1.should.be == dependency_1
dependency_1.should.not.be == dependency_2
dependency_1.should.not.be == dependency_3
end
it "fetches the specification from the remote stores it in the sandbox" do
config.sandbox.specification('Reachability').should == nil
it 'fetches the specification from the remote stores it in the sandbox' do
config.sandbox.specification('Reachability').should.nil?
@subject.fetch(config.sandbox)
config.sandbox.specification('Reachability').name.should == 'Reachability'
end
......@@ -32,19 +32,19 @@ module Pod
#--------------------------------------#
describe "Subclasses helpers" do
describe 'Subclasses helpers' do
it "pre-downloads the Pod and stores the relevant information in the sandbox" do
it 'pre-downloads the Pod and stores the relevant information in the sandbox' do
sandbox = config.sandbox
@subject.send(:pre_download, sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
sandbox.predownloaded_pods.should == ["Reachability"]
sandbox.predownloaded_pods.should == ['Reachability']
sandbox.checkout_sources.should == {
"Reachability" => {
'Reachability' => {
:git => fixture('integration/Reachability'),
:commit => "4ec575e4b074dcc87c44018cce656672a979b34a"
}
:commit => '4ec575e4b074dcc87c44018cce656672a979b34a',
},
}
end
end
......
......@@ -5,24 +5,24 @@ module Pod
before do
params = {
:git => fixture('integration/Reachability'),
:branch => 'master'
:branch => 'master',
}
dep = Dependency.new("Reachability", params)
dep = Dependency.new('Reachability', params)
@subject = ExternalSources.from_dependency(dep, nil)
end
it "creates a copy of the podspec" do
it 'creates a copy of the podspec' do
@subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
end
it "marks the Pod as pre-downloaded" do
it 'marks the Pod as pre-downloaded' do
@subject.fetch(config.sandbox)
config.sandbox.predownloaded_pods.should == ["Reachability"]
config.sandbox.predownloaded_pods.should == ['Reachability']
end
it "returns the description" do
it 'returns the description' do
expected = /from `.*Reachability`, branch `master`/
@subject.description.should.match(expected)
end
......
......@@ -6,28 +6,28 @@ module Pod
@subject = ExternalSources
end
describe "from_dependency" do
it "supports a podspec source" do
dep = Dependency.new("Reachability", :podspec => nil)
describe 'from_dependency' do
it 'supports a podspec source' do
dep = Dependency.new('Reachability', :podspec => nil)
klass = @subject.from_dependency(dep, nil).class
klass.should == @subject::PodspecSource
end
it "supports a path source" do
dep = Dependency.new("Reachability", :path => nil)
it 'supports a path source' do
dep = Dependency.new('Reachability', :path => nil)
klass = @subject.from_dependency(dep, nil).class
klass.should == @subject::PathSource
end
it "supports a path source specified with the legacy :local key" do
dep = Dependency.new("Reachability", :local => nil)
it 'supports a path source specified with the legacy :local key' do
dep = Dependency.new('Reachability', :local => nil)
klass = @subject.from_dependency(dep, nil).class
klass.should == @subject::PathSource
end
it "supports all the strategies implemented by the downloader" do
it 'supports all the strategies implemented by the downloader' do
[:git, :svn, :hg, :bzr, :http].each do |strategy|
dep = Dependency.new("Reachability", strategy => nil)
dep = Dependency.new('Reachability', strategy => nil)
klass = @subject.from_dependency(dep, nil).class
klass.should == @subject::DownloaderSource
end
......
require File.expand_path("../../../../spec_helper", __FILE__)
require File.expand_path('../../../../spec_helper', __FILE__)
describe Pod::Generator::Markdown do
before do
@file_accessor = fixture_file_accessor('banana-lib/BananaLib.podspec')
@spec = @file_accessor.spec
@generator = Pod::Generator::Markdown.new([@file_accessor])
@spec.stubs(:name).returns("POD_NAME")
@generator.stubs(:license_text).returns("LICENSE_TEXT")
@spec.stubs(:name).returns('POD_NAME')
@generator.stubs(:license_text).returns('LICENSE_TEXT')
end
it "returns a correctly formatted title string" do
@generator.title_from_string("A Title", 2).should.equal "## A Title"
it 'returns a correctly formatted title string' do
@generator.title_from_string('A Title', 2).should.equal '## A Title'
end
it "returns a correctly formatted license string for each pod" do
it 'returns a correctly formatted license string for each pod' do
@generator.string_for_spec(@spec).should.equal "\n## POD_NAME\n\nLICENSE_TEXT\n"
end
it "returns a correctly formatted markdown string for the target" do
@generator.stubs(:header_title).returns("HEADER_TITLE")
@generator.stubs(:header_text).returns("HEADER_TEXT")
@generator.stubs(:footnote_title).returns("") # Test that extra \n isn't added for empty strings
@generator.stubs(:footnote_text).returns("FOOTNOTE_TEXT")
it 'returns a correctly formatted markdown string for the target' do
@generator.stubs(:header_title).returns('HEADER_TITLE')
@generator.stubs(:header_text).returns('HEADER_TEXT')
@generator.stubs(:footnote_title).returns('') # Test that extra \n isn't added for empty strings
@generator.stubs(:footnote_text).returns('FOOTNOTE_TEXT')
@generator.licenses.should.equal "# HEADER_TITLE\nHEADER_TEXT\n\n## POD_NAME\n\nLICENSE_TEXT\nFOOTNOTE_TEXT\n"
end
it "writes a markdown file to disk" do
basepath = config.sandbox.root + "Pods-acknowledgements"
it 'writes a markdown file to disk' do
basepath = config.sandbox.root + 'Pods-acknowledgements'
given_path = @generator.class.path_from_basepath(basepath)
expected_path = config.sandbox.root + "Pods-acknowledgements.markdown"
expected_path = config.sandbox.root + 'Pods-acknowledgements.markdown'
mockFile = mock
mockFile.expects(:write).with(equals(@generator.licenses))
mockFile.expects(:close)
File.expects(:new).with(equals(expected_path), equals("w")).returns(mockFile)
File.expects(:new).with(equals(expected_path), equals('w')).returns(mockFile)
@generator.save_as(given_path)
end
end
require File.expand_path("../../../../spec_helper", __FILE__)
require File.expand_path('../../../../spec_helper', __FILE__)
require 'xcodeproj'
......@@ -7,43 +7,43 @@ describe Pod::Generator::Plist do
@file_accessor = fixture_file_accessor('banana-lib/BananaLib.podspec')
@spec = @file_accessor.spec
@generator = Pod::Generator::Plist.new([@file_accessor])
@spec.stubs(:name).returns("POD_NAME")
@generator.stubs(:license_text).returns("LICENSE_TEXT")
@spec.stubs(:name).returns('POD_NAME')
@generator.stubs(:license_text).returns('LICENSE_TEXT')
end
it "returns the correct number of licenses (including header and footnote)" do
it 'returns the correct number of licenses (including header and footnote)' do
@generator.licenses.count.should == 3
end
it "returns a string for the plist title" do
it 'returns a string for the plist title' do
@generator.plist_title.should.be.kind_of(String)
end
it "returns a correctly formed license hash for each pod" do
it 'returns a correctly formed license hash for each pod' do
@generator.hash_for_spec(@spec).should == {
:Type => "PSGroupSpecifier",
:Title => "POD_NAME",
:FooterText => "LICENSE_TEXT"
:Type => 'PSGroupSpecifier',
:Title => 'POD_NAME',
:FooterText => 'LICENSE_TEXT',
}
end
it "returns nil for a pod with no license text" do
it 'returns nil for a pod with no license text' do
@generator.expects(:license_text).returns(nil)
@generator.hash_for_spec(@spec).should.be.nil
end
it "returns a plist containg the licenses" do
it 'returns a plist containg the licenses' do
@generator.plist.should == {
:Title => "Acknowledgements",
:StringsTable => "Acknowledgements",
:PreferenceSpecifiers => @generator.licenses
:Title => 'Acknowledgements',
:StringsTable => 'Acknowledgements',
:PreferenceSpecifiers => @generator.licenses,
}
end
it "writes a plist to disk at the given path" do
basepath = config.sandbox.root + "Pods-acknowledgements"
it 'writes a plist to disk at the given path' do
basepath = config.sandbox.root + 'Pods-acknowledgements'
given_path = @generator.class.path_from_basepath(basepath)
expected_path = config.sandbox.root + "Pods-acknowledgements.plist"
expected_path = config.sandbox.root + 'Pods-acknowledgements.plist'
Xcodeproj.expects(:write_plist).with(equals(@generator.plist), equals(expected_path))
@generator.save_as(given_path)
end
......
require File.expand_path("../../../spec_helper", __FILE__)
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Generator::Acknowledgements do
......@@ -8,14 +8,14 @@ module Pod
@generator = Pod::Generator::Acknowledgements.new([@file_accessor])
end
describe "In general" do
describe 'In general' do
it "returns the classes of the concrete generators generators" do
it 'returns the classes of the concrete generators generators' do
generators = Pod::Generator::Acknowledgements.generators
generators.map { |g| g.name.split('::').last }.should == ['Plist', 'Markdown']
generators.map { |g| g.name.split('::').last }.should == %w(Plist Markdown)
end
it "returns a string for each header and footnote text method" do
it 'returns a string for each header and footnote text method' do
@generator.header_title.should.be.kind_of(String)
@generator.header_text.should.be.kind_of(String)
@generator.footnote_title.should.be.kind_of(String)
......@@ -26,28 +26,28 @@ module Pod
#-----------------------------------------------------------------------#
describe "Private methods" do
describe 'Private methods' do
it "returns the root specifications" do
it 'returns the root specifications' do
generator = Pod::Generator::Acknowledgements.new([@file_accessor, @file_accessor])
generator.send(:specs).should == [@file_accessor.spec]
end
it "returns the license" do
it 'returns the license' do
text_from_spec = @generator.send(:license_text, @spec)
text_from_spec.should == "Permission is hereby granted ..."
text_from_spec.should == 'Permission is hereby granted ...'
end
it "returns the license from the file" do
@spec.stubs(:license).returns({ :type => 'MIT', :file => 'README'})
it 'returns the license from the file' do
@spec.stubs(:license).returns(:type => 'MIT', :file => 'README')
text_from_spec = @generator.send(:license_text, @spec)
text_from_spec.should == "post v1.0\n"
end
it "warns the user if the file specified in the license doesn't exists" do
@spec.stubs(:license).returns({ :type => 'MIT', :file => 'MISSING'})
@spec.stubs(:license).returns(:type => 'MIT', :file => 'MISSING')
text_from_spec = @generator.send(:license_text, @spec)
UI.warnings.should.include "Unable to read the license file"
UI.warnings.should.include 'Unable to read the license file'
end
end
......
......@@ -3,14 +3,14 @@ require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Generator::CopyResourcesScript do
it "returns the copy resources script" do
it 'returns the copy resources script' do
resources = ['path/to/resource.png']
generator = Pod::Generator::CopyResourcesScript.new(resources, Platform.new(:ios, '6.0'))
generator.send(:script).should.include 'path/to/resource.png'
generator.send(:script).should.include 'storyboard'
end
it "instructs ibtool to use the --reference-external-strings-file if set to do so" do
it 'instructs ibtool to use the --reference-external-strings-file if set to do so' do
resources = ['path/to/resource.png']
generator_1 = Pod::Generator::CopyResourcesScript.new(resources, Platform.new(:ios, '4.0'))
generator_2 = Pod::Generator::CopyResourcesScript.new(resources, Platform.new(:ios, '6.0'))
......
......@@ -2,8 +2,7 @@ require File.expand_path('../../../spec_helper', __FILE__)
describe Pod::Generator::DummySource do
it "generates a dummy source file with the appropriate class for the class name identifier" do
it 'generates a dummy source file with the appropriate class for the class name identifier' do
generator = Pod::Generator::DummySource.new('SomeIdentification')
file = temporary_directory + 'PodsDummy.m'
generator.save_as(file)
......@@ -16,7 +15,7 @@ describe Pod::Generator::DummySource do
EOS
end
it "generates a dummy source file with the appropriate class, replacing non-alphanumeric characters with underscores" do
it 'generates a dummy source file with the appropriate class, replacing non-alphanumeric characters with underscores' do
generator = Pod::Generator::DummySource.new('This!has_non-alphanumeric+characters in it.0123456789')
file = temporary_directory + 'PodsDummy.m'
generator.save_as(file)
......
......@@ -68,8 +68,8 @@ module Pod
EOS
end
it "includes the imports" do
@gen.imports << "header.h"
it 'includes the imports' do
@gen.imports << 'header.h'
@gen.generate.should == <<-EOS.strip_heredoc
#ifdef __OBJC__
#import <UIKit/UIKit.h>
......@@ -80,17 +80,17 @@ module Pod
EOS
end
it "imports UIKit in iOS platforms" do
it 'imports UIKit in iOS platforms' do
@gen.stubs(:platform).returns(Pod::Platform.ios)
@gen.generate.should.include?('#import <UIKit/UIKit.h>')
end
it "imports Cocoa for OS X platforms" do
it 'imports Cocoa for OS X platforms' do
@gen.stubs(:platform).returns(Pod::Platform.osx)
@gen.generate.should.include?('#import <Cocoa/Cocoa.h>')
end
it "writes the prefix header file to the disk" do
it 'writes the prefix header file to the disk' do
path = temporary_directory + 'Test.pch'
@gen.save_as(path)
path.read.should == <<-EOS.strip_heredoc
......
......@@ -4,10 +4,10 @@ describe Pod::Generator::TargetEnvironmentHeader do
before do
spec = fixture_spec('banana-lib/BananaLib.podspec')
@gen = Pod::Generator::TargetEnvironmentHeader.new({'Debug' => [spec]})
@gen = Pod::Generator::TargetEnvironmentHeader.new('Debug' => [spec])
end
it "generates a header files which include macro definitions for installed Pods" do
it 'generates a header files which include macro definitions for installed Pods' do
file = temporary_directory + 'Pods-environment.h'
@gen.save_as(file)
file.read.should == <<-EOS.strip_heredoc
......@@ -28,17 +28,17 @@ describe Pod::Generator::TargetEnvironmentHeader do
EOS
end
it "handles specifications with special characters" do
it 'handles specifications with special characters' do
name = @gen.send(:safe_spec_name, 'AppleCoreAudioUtilityClasses@thehtb')
name.should == 'AppleCoreAudioUtilityClasses_thehtb'
end
it "includes conditional statements for specifications not present in all build configurations" do
it 'includes conditional statements for specifications not present in all build configurations' do
spec = fixture_spec('banana-lib/BananaLib.podspec')
debug_spec = stub(:name => 'DebugPod', :version => Pod::Version.new('1.2.3'))
specs_by_configuration = {
'Debug' => [spec, debug_spec],
'Release' => [spec]
'Release' => [spec],
}
@gen = Pod::Generator::TargetEnvironmentHeader.new(specs_by_configuration)
@gen.generate.should == <<-EOS.strip_heredoc
......@@ -69,15 +69,14 @@ describe Pod::Generator::TargetEnvironmentHeader do
EOS
end
it "normalizes the name of the build configuration" do
it 'normalizes the name of the build configuration' do
spec = fixture_spec('banana-lib/BananaLib.podspec')
specs_by_configuration = {
'Debug' => [],
'build configuration copy' => [spec]
'build configuration copy' => [spec],
}
@gen = Pod::Generator::TargetEnvironmentHeader.new(specs_by_configuration)
@gen.generate.should.include 'BUILD_CONFIGURATION_COPY'
end
end
......@@ -9,7 +9,7 @@ module Pod
@spec = fixture_spec('banana-lib/BananaLib.podspec')
@consumer = @spec.consumer(:ios)
target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.whitelist_pod_for_configuration("BananaLib", "Release")
target_definition.whitelist_pod_for_configuration('BananaLib', 'Release')
@target = AggregateTarget.new(target_definition, config.sandbox)
@target.client_root = config.sandbox.root.dirname
@target.stubs(:platform).returns(:ios)
......@@ -17,10 +17,10 @@ module Pod
@pod_target.stubs(:platform).returns(:ios)
@pod_target.stubs(:spec_consumers).returns([@consumer])
@target.pod_targets = [@pod_target]
@generator = AggregateXCConfig.new(@target, "Release")
@generator = AggregateXCConfig.new(@target, 'Release')
end
it "returns the path of the pods root relative to the user project" do
it 'returns the path of the pods root relative to the user project' do
@generator.target.relative_pods_root.should == '${SRCROOT}/Pods'
end
......@@ -32,27 +32,27 @@ module Pod
@xcconfig = @generator.generate
end
it "generates the xcconfig" do
it 'generates the xcconfig' do
@xcconfig.class.should == Xcodeproj::Config
end
it "configures the project to load all members that implement Objective-c classes or categories from the static library" do
it 'configures the project to load all members that implement Objective-c classes or categories from the static library' do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include '-ObjC'
end
it 'does not add the -fobjc-arc to OTHER_LDFLAGS by default as Xcode 4.3.2 does not support it' do
@consumer.stubs(:requires_arc?).returns(true)
@xcconfig.to_hash['OTHER_LDFLAGS'].should.not.include("-fobjc-arc")
@xcconfig.to_hash['OTHER_LDFLAGS'].should.not.include('-fobjc-arc')
end
it 'adds the -fobjc-arc to OTHER_LDFLAGS if any pods require arc and the podfile explicitly requires it' do
@podfile.stubs(:set_arc_compatibility_flag?).returns(true)
@consumer.stubs(:requires_arc?).returns(true)
@xcconfig = @generator.generate
@xcconfig.to_hash['OTHER_LDFLAGS'].split(" ").should.include("-fobjc-arc")
@xcconfig.to_hash['OTHER_LDFLAGS'].split(' ').should.include('-fobjc-arc')
end
it "sets the PODS_ROOT build variable" do
it 'sets the PODS_ROOT build variable' do
@xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}/Pods'
end
......@@ -74,12 +74,12 @@ module Pod
@xcconfig.to_hash['GCC_PREPROCESSOR_DEFINITIONS'].should.include '$(inherited)'
end
it "links the pod targets with the aggregate integration library target" do
it 'links the pod targets with the aggregate integration library target' do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include '-l "Pods-BananaLib"'
end
it "does not links the pod targets with the aggregate integration library target for non-whitelisted configuration" do
@generator = AggregateXCConfig.new(@target, "Debug")
it 'does not links the pod targets with the aggregate integration library target for non-whitelisted configuration' do
@generator = AggregateXCConfig.new(@target, 'Debug')
@xcconfig = @generator.generate
@xcconfig.to_hash['OTHER_LDFLAGS'].should.not.include '-lPods-BananaLib'
end
......@@ -91,7 +91,7 @@ module Pod
@generator.save_as(@path)
end
it "saves the xcconfig" do
it 'saves the xcconfig' do
generated = Xcodeproj::Config.new(@path)
generated.class.should == Xcodeproj::Config
end
......
......@@ -5,42 +5,42 @@ module Pod
module XCConfig
describe PrivatePodXCConfig do
describe "in general" do
describe 'in general' do
before do
@spec = fixture_spec('banana-lib/BananaLib.podspec')
@consumer = @spec.consumer(:ios)
target_definition = Podfile::TargetDefinition.new('Pods', nil)
@pod_target = PodTarget.new([@spec], target_definition, config.sandbox)
@pod_target.stubs(:platform).returns(:ios)
public_xcconfig = Xcodeproj::Config.new({"OTHER_LDFLAGS"=>"-framework SystemConfiguration"})
public_xcconfig = Xcodeproj::Config.new('OTHER_LDFLAGS' => '-framework SystemConfiguration')
@generator = PrivatePodXCConfig.new(@pod_target, public_xcconfig)
@podfile = Podfile.new
@pod_target.target_definition.stubs(:podfile).returns(@podfile)
@xcconfig = @generator.generate
end
it "generates the xcconfig" do
it 'generates the xcconfig' do
@xcconfig.class.should == Xcodeproj::Config
end
it "configures the project to load all members that implement Objective-c classes or categories from the static library" do
it 'configures the project to load all members that implement Objective-c classes or categories from the static library' do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include '-ObjC'
end
it 'does not add the -fobjc-arc to OTHER_LDFLAGS by default as Xcode 4.3.2 does not support it' do
@consumer.stubs(:requires_arc?).returns(true)
@xcconfig.to_hash['OTHER_LDFLAGS'].should.not.include("-fobjc-arc")
@xcconfig.to_hash['OTHER_LDFLAGS'].should.not.include('-fobjc-arc')
end
it 'adds the -fobjc-arc to OTHER_LDFLAGS if any pods require arc and the podfile explicitly requires it' do
@podfile.stubs(:set_arc_compatibility_flag?).returns(true)
@consumer.stubs(:requires_arc?).returns(true)
@xcconfig = @generator.generate
@xcconfig.to_hash['OTHER_LDFLAGS'].split(" ").should.include("-fobjc-arc")
@xcconfig.to_hash['OTHER_LDFLAGS'].split(' ').should.include('-fobjc-arc')
end
it "sets the PODS_ROOT build variable" do
@xcconfig.to_hash['PODS_ROOT'].should.not == nil
it 'sets the PODS_ROOT build variable' do
@xcconfig.to_hash['PODS_ROOT'].should.not.nil?
end
it 'adds the library build headers and public headers search paths to the xcconfig, with quotes' do
......@@ -63,7 +63,7 @@ module Pod
@xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}'
end
it "saves the xcconfig" do
it 'saves the xcconfig' do
path = temporary_directory + 'sample.xcconfig'
@generator.save_as(path)
generated = Xcodeproj::Config.new(path)
......@@ -74,33 +74,33 @@ module Pod
#-------------------------------------------------------------------------#
describe "Private Helpers" do
describe 'Private Helpers' do
before do
@sut = PrivatePodXCConfig.new(stub(), stub())
@sut = PrivatePodXCConfig.new(stub, stub)
end
#----------------------------------------#
describe "#add_xcconfig_namespaced_keys" do
describe '#add_xcconfig_namespaced_keys' do
it "appends to the values of the keys of the destination the value of the keys of the source" do
it 'appends to the values of the keys of the destination the value of the keys of the source' do
source_config = { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/MyPod' }
destination_config = { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/BuildHeaders' }
result = @sut.send(:add_xcconfig_namespaced_keys, source_config, destination_config, 'PREFIX_')
result.should == { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/BuildHeaders ${PREFIX_HEADER_SEARCH_PATHS}' }
end
it "uses the key of the destination xcconfig if not present in the source" do
source_config = { }
it 'uses the key of the destination xcconfig if not present in the source' do
source_config = {}
destination_config = { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/BuildHeaders' }
result = @sut.send(:add_xcconfig_namespaced_keys, source_config, destination_config, 'PREFIX_')
result.should == { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/BuildHeaders' }
end
it "preserves any value of the source not present in the destination" do
it 'preserves any value of the source not present in the destination' do
source_config = { 'EXCLUDED_SOURCE_FILE_NAMES' => 'ZBarReaderViewImpl_Simulator.m' }
destination_config = { }
destination_config = {}
result = @sut.send(:add_xcconfig_namespaced_keys, source_config, destination_config, 'PREFIX_')
result.should == { 'EXCLUDED_SOURCE_FILE_NAMES' => '${PREFIX_EXCLUDED_SOURCE_FILE_NAMES}' }
end
......@@ -109,14 +109,14 @@ module Pod
#----------------------------------------#
describe "#conditional_less_key" do
describe '#conditional_less_key' do
it "returns the key without the xcconfig conditional syntax if present" do
it 'returns the key without the xcconfig conditional syntax if present' do
result = @sut.send(:conditional_less_key, 'EXCLUDED_SOURCE_FILE_NAMES[sdk=iphoneos*][arch=*]')
result.should == 'EXCLUDED_SOURCE_FILE_NAMES'
end
it "returns the key as it is if no conditional syntax is present" do
it 'returns the key as it is if no conditional syntax is present' do
result = @sut.send(:conditional_less_key, 'EXCLUDED_SOURCE_FILE_NAMES')
result.should == 'EXCLUDED_SOURCE_FILE_NAMES'
end
......
......@@ -27,27 +27,27 @@ module Pod
@xcconfig = @generator.generate
end
it "generates the xcconfig" do
it 'generates the xcconfig' do
@xcconfig.class.should == Xcodeproj::Config
end
it "includes the xcconfig of the specifications" do
@xcconfig.to_hash["OTHER_LDFLAGS"].should.include('-no_compact_unwind')
it 'includes the xcconfig of the specifications' do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include('-no_compact_unwind')
end
it "includes the libraries for the specifications" do
@xcconfig.to_hash["OTHER_LDFLAGS"].should.include(%q(-l "xml2"))
it 'includes the libraries for the specifications' do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include('-l "xml2"')
end
it "includes the frameworks of the specifications" do
@xcconfig.to_hash["OTHER_LDFLAGS"].should.include(%q(-framework "QuartzCore"))
it 'includes the frameworks of the specifications' do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include('-framework "QuartzCore"')
end
it "includes the weak-frameworks of the specifications" do
@xcconfig.to_hash["OTHER_LDFLAGS"].should.include(%q(-weak_framework "iAd"))
it 'includes the weak-frameworks of the specifications' do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include('-weak_framework "iAd"')
end
it "includes the developer frameworks search paths when SenTestingKit is detected" do
it 'includes the developer frameworks search paths when SenTestingKit is detected' do
@spec.xcconfig = { 'OTHER_LDFLAGS' => '-no_compact_unwind' }
@spec.frameworks = ['SenTestingKit']
xcconfig = @generator.generate
......@@ -60,20 +60,20 @@ module Pod
@spec.frameworks = ['SenTestingKit']
xcconfig = @generator.generate
framework_search_paths = xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].split(' ')
framework_search_paths.select { |path| path == '"$(SDKROOT)/Developer/Library/Frameworks"'}.count.should == 1
framework_search_paths.select { |path| path == '"$(DEVELOPER_LIBRARY_DIR)/Frameworks"'}.count.should == 1
framework_search_paths.select { |path| path == '"$(SDKROOT)/Developer/Library/Frameworks"' }.count.should == 1
framework_search_paths.select { |path| path == '"$(DEVELOPER_LIBRARY_DIR)/Frameworks"' }.count.should == 1
end
it "includes the build settings of the frameworks bundles of the spec" do
it 'includes the build settings of the frameworks bundles of the spec' do
config.sandbox.stubs(:root).returns(fixture(''))
xcconfig = @generator.generate
xcconfig.to_hash["FRAMEWORK_SEARCH_PATHS"].should.include?('"$(PODS_ROOT)/banana-lib"')
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.include?('"$(PODS_ROOT)/banana-lib"')
end
it "includes the build settings of the libraries shipped with the spec" do
it 'includes the build settings of the libraries shipped with the spec' do
config.sandbox.stubs(:root).returns(fixture(''))
xcconfig = @generator.generate
xcconfig.to_hash["LIBRARY_SEARCH_PATHS"].should.include?('"$(PODS_ROOT)/banana-lib"')
xcconfig.to_hash['LIBRARY_SEARCH_PATHS'].should.include?('"$(PODS_ROOT)/banana-lib"')
end
#-----------------------------------------------------------------------#
......@@ -83,14 +83,14 @@ module Pod
@generator.save_as(@path)
end
it "saves the xcconfig" do
it 'saves the xcconfig' do
generated = Xcodeproj::Config.new(@path)
generated.class.should == Xcodeproj::Config
end
it "writes the xcconfig with a prefix computed from the target definition and root spec" do
it 'writes the xcconfig with a prefix computed from the target definition and root spec' do
generated = Xcodeproj::Config.new(@path)
generated.to_hash.each { |k, v| k.should.start_with(@pod_target.xcconfig_prefix) }
generated.to_hash.each { |k, _v| k.should.start_with(@pod_target.xcconfig_prefix) }
end
end
......
......@@ -11,20 +11,20 @@ module Pod
#---------------------------------------------------------------------#
describe "::default_ld_flags" do
it "returns the default linker flags" do
podfile = stub( :set_arc_compatibility_flag? => false )
target_definition = stub( :podfile => podfile )
target = stub( :target_definition => target_definition )
describe '::default_ld_flags' do
it 'returns the default linker flags' do
podfile = stub(:set_arc_compatibility_flag? => false)
target_definition = stub(:podfile => podfile)
target = stub(:target_definition => target_definition)
result = @sut.default_ld_flags(target)
result.should == '-ObjC'
end
it "includes the ARC compatibility flag if required by the Podfile" do
podfile = stub( :set_arc_compatibility_flag? => true )
target_definition = stub( :podfile => podfile )
spec_consumer = stub( :requires_arc? => true )
target = stub( :target_definition => target_definition, :spec_consumers => [spec_consumer] )
it 'includes the ARC compatibility flag if required by the Podfile' do
podfile = stub(:set_arc_compatibility_flag? => true)
target_definition = stub(:podfile => podfile)
spec_consumer = stub(:requires_arc? => true)
target = stub(:target_definition => target_definition, :spec_consumers => [spec_consumer])
result = @sut.default_ld_flags(target)
result.should == '-ObjC -fobjc-arc'
end
......@@ -32,96 +32,96 @@ module Pod
#---------------------------------------------------------------------#
describe "::quote" do
it "quotes strings" do
result = @sut.quote(['string1', 'string2'])
describe '::quote' do
it 'quotes strings' do
result = @sut.quote(%w(string1 string2))
result.should == '"string1" "string2"'
end
it "inserts an optional string and then the normal quoted string" do
result = @sut.quote(['string1', 'string2'], '-isystem')
it 'inserts an optional string and then the normal quoted string' do
result = @sut.quote(%w(string1 string2), '-isystem')
result.should == '-isystem "string1" -isystem "string2"'
end
end
#---------------------------------------------------------------------#
describe "::add_spec_build_settings_to_xcconfig" do
it "adds the build settings of the consumer" do
describe '::add_spec_build_settings_to_xcconfig' do
it 'adds the build settings of the consumer' do
xcconfig = Xcodeproj::Config.new
consumer = stub({
consumer = stub(
:xcconfig => { 'OTHER_LDFLAGS' => '-framework SenTestingKit' },
:libraries => [],
:frameworks => [],
:weak_frameworks => [],
:platform_name => :ios
})
)
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == %q(-framework "SenTestingKit")
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-framework "SenTestingKit"'
end
it "adds the libraries of the xcconfig" do
it 'adds the libraries of the xcconfig' do
xcconfig = Xcodeproj::Config.new
consumer = stub({
consumer = stub(
:xcconfig => {},
:libraries => ['xml2'],
:frameworks => [],
:weak_frameworks => [],
:platform_name => :ios
})
)
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == %q(-l "xml2")
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-l "xml2"'
end
it "adds the frameworks of the xcconfig" do
it 'adds the frameworks of the xcconfig' do
xcconfig = Xcodeproj::Config.new
consumer = stub({
consumer = stub(
:xcconfig => {},
:libraries => [],
:frameworks => ['CoreAnimation'],
:weak_frameworks => [],
:platform_name => :ios
})
)
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == %q(-framework "CoreAnimation")
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-framework "CoreAnimation"'
end
it "adds the weak frameworks of the xcconfig" do
it 'adds the weak frameworks of the xcconfig' do
xcconfig = Xcodeproj::Config.new
consumer = stub({
consumer = stub(
:xcconfig => {},
:libraries => [],
:frameworks => [],
:weak_frameworks => ['iAd'],
:platform_name => :ios
})
)
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == %q(-weak_framework "iAd")
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-weak_framework "iAd"'
end
it "adds the ios developer frameworks search paths if needed" do
it 'adds the ios developer frameworks search paths if needed' do
xcconfig = Xcodeproj::Config.new
consumer = stub({
consumer = stub(
:xcconfig => {},
:libraries => [],
:frameworks => ['SenTestingKit'],
:weak_frameworks => [],
:platform_name => :ios
})
)
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.include('SDKROOT')
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.not.include('DEVELOPER_LIBRARY_DIR')
end
it "adds the osx developer frameworks search paths if needed" do
it 'adds the osx developer frameworks search paths if needed' do
xcconfig = Xcodeproj::Config.new
consumer = stub({
consumer = stub(
:xcconfig => {},
:libraries => [],
:frameworks => ['SenTestingKit'],
:weak_frameworks => [],
:platform_name => :osx
})
)
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.include('DEVELOPER_LIBRARY_DIR')
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.not.include('SDKROOT')
......@@ -130,27 +130,27 @@ module Pod
#---------------------------------------------------------------------#
describe "::add_framework_build_settings" do
it "adds the build settings of a framework to the given xcconfig" do
describe '::add_framework_build_settings' do
it 'adds the build settings of a framework to the given xcconfig' do
framework_path = config.sandbox.root + 'Parse/Parse.framework'
xcconfig = Xcodeproj::Config.new
@sut.add_framework_build_settings(framework_path, xcconfig, config.sandbox.root)
hash_config = xcconfig.to_hash
hash_config['OTHER_LDFLAGS'].should == %q(-framework "Parse")
hash_config['OTHER_LDFLAGS'].should == '-framework "Parse"'
hash_config['FRAMEWORK_SEARCH_PATHS'].should == '"$(PODS_ROOT)/Parse"'
end
it "doesn't ovverides exiting linker flags" do
framework_path = config.sandbox.root + 'Parse/Parse.framework'
xcconfig = Xcodeproj::Config.new( { 'OTHER_LDFLAGS' => '-framework CoreAnimation' } )
xcconfig = Xcodeproj::Config.new('OTHER_LDFLAGS' => '-framework CoreAnimation')
@sut.add_framework_build_settings(framework_path, xcconfig, config.sandbox.root)
hash_config = xcconfig.to_hash
hash_config['OTHER_LDFLAGS'].should == %q(-framework "CoreAnimation" -framework "Parse")
hash_config['OTHER_LDFLAGS'].should == '-framework "CoreAnimation" -framework "Parse"'
end
it "doesn't ovverides exiting frameworks search paths" do
framework_path = config.sandbox.root + 'Parse/Parse.framework'
xcconfig = Xcodeproj::Config.new( { 'FRAMEWORK_SEARCH_PATHS' => '"path/to/frameworks"' } )
xcconfig = Xcodeproj::Config.new('FRAMEWORK_SEARCH_PATHS' => '"path/to/frameworks"')
@sut.add_framework_build_settings(framework_path, xcconfig, config.sandbox.root)
hash_config = xcconfig.to_hash
hash_config['FRAMEWORK_SEARCH_PATHS'].should == '"path/to/frameworks" "$(PODS_ROOT)/Parse"'
......@@ -159,22 +159,22 @@ module Pod
#---------------------------------------------------------------------#
describe "::add_library_build_settings" do
it "adds the build settings of a framework to the given xcconfig" do
describe '::add_library_build_settings' do
it 'adds the build settings of a framework to the given xcconfig' do
path = config.sandbox.root + 'MapBox/Proj4/libProj4.a'
xcconfig = Xcodeproj::Config.new
@sut.add_library_build_settings(path, xcconfig, config.sandbox.root)
hash_config = xcconfig.to_hash
hash_config['OTHER_LDFLAGS'].should == %q(-l "Proj4")
hash_config['OTHER_LDFLAGS'].should == '-l "Proj4"'
hash_config['LIBRARY_SEARCH_PATHS'].should == '"$(PODS_ROOT)/MapBox/Proj4"'
end
end
#---------------------------------------------------------------------#
describe "::add_framework_build_settings" do
it "adds the developer frameworks search paths to the xcconfig if SenTestingKit has been detected" do
xcconfig = Xcodeproj::Config.new({'OTHER_LDFLAGS' => '-framework SenTestingKit'})
describe '::add_framework_build_settings' do
it 'adds the developer frameworks search paths to the xcconfig if SenTestingKit has been detected' do
xcconfig = Xcodeproj::Config.new('OTHER_LDFLAGS' => '-framework SenTestingKit')
@sut.add_developers_frameworks_if_needed(xcconfig, :ios)
frameworks_search_paths = xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS']
frameworks_search_paths.should.include?('$(inherited)')
......@@ -182,8 +182,8 @@ module Pod
frameworks_search_paths.should.not.include?('"$(DEVELOPER_LIBRARY_DIR)/Frameworks"')
end
it "adds the developer frameworks search paths to the xcconfig if XCTest has been detected" do
xcconfig = Xcodeproj::Config.new({'OTHER_LDFLAGS' => '-framework XCTest'})
it 'adds the developer frameworks search paths to the xcconfig if XCTest has been detected' do
xcconfig = Xcodeproj::Config.new('OTHER_LDFLAGS' => '-framework XCTest')
@sut.add_developers_frameworks_if_needed(xcconfig, :ios)
frameworks_search_paths = xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS']
frameworks_search_paths.should.include?('$(inherited)')
......@@ -194,13 +194,12 @@ module Pod
end
it "doesn't adds the developer frameworks relative to the SDK for OS X" do
xcconfig = Xcodeproj::Config.new({'OTHER_LDFLAGS' => '-framework XCTest'})
xcconfig = Xcodeproj::Config.new('OTHER_LDFLAGS' => '-framework XCTest')
@sut.add_developers_frameworks_if_needed(xcconfig, :ios)
frameworks_search_paths = xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS']
frameworks_search_paths.should.include?('"$(SDKROOT)/Developer/Library/Frameworks"')
xcconfig = Xcodeproj::Config.new({'OTHER_LDFLAGS' => '-framework XCTest'})
xcconfig = Xcodeproj::Config.new('OTHER_LDFLAGS' => '-framework XCTest')
@sut.add_developers_frameworks_if_needed(xcconfig, :osx)
frameworks_search_paths = xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS']
frameworks_search_paths.should.not.include?('"$(SDKROOT)/Developer/Library/Frameworks"')
......
......@@ -23,34 +23,34 @@ module Pod
#-------------------------------------------------------------------------#
describe "Public Hooks API" do
describe 'Public Hooks API' do
it "returns the sandbox root" do
it 'returns the sandbox root' do
@rep.sandbox_root.should == config.sandbox.root
end
it "returns the pods project" do
project = stub()
it 'returns the pods project' do
project = stub
safe_stub(@installer, :pods_project, project)
@rep.project.should == project
end
it "the hook representation of the pods" do
it 'the hook representation of the pods' do
@rep.pods.map(&:name).should == ['JSONKit']
end
it "the hook representation of the libraries" do
it 'the hook representation of the libraries' do
@rep.libraries.map(&:name).sort.should == ['Pods'].sort
end
it "returns the specs by library representation" do
it 'returns the specs by library representation' do
specs_by_lib = @rep.specs_by_lib
lib_rep = specs_by_lib.keys.first
lib_rep.name.should == 'Pods'
specs_by_lib.should == { lib_rep => @specs }
end
it "returns the pods representation by library representation" do
it 'returns the pods representation by library representation' do
pods_by_lib = @rep.pods_by_lib
target_definition = @installer.aggregate_targets.first.pod_targets.first.target_definition
pods_by_lib[target_definition].map(&:name).should == ['JSONKit']
......@@ -60,17 +60,17 @@ module Pod
#-------------------------------------------------------------------------#
describe "Unsafe Hooks API" do
describe 'Unsafe Hooks API' do
it "returns the sandbox" do
it 'returns the sandbox' do
@rep.sandbox.should == config.sandbox
end
it "returns the config" do
it 'returns the config' do
@rep.config.should == config
end
it "returns the installer" do
it 'returns the installer' do
@rep.installer.should == @installer
end
......
......@@ -13,36 +13,36 @@ module Pod
#-------------------------------------------------------------------------#
describe "Public Hooks API" do
describe 'Public Hooks API' do
it "returns the name" do
it 'returns the name' do
@rep.name.should == 'Pods-MyApp'
end
it "returns the dependencies" do
it 'returns the dependencies' do
@target_definition.store_pod('AFNetworking')
@rep.dependencies.should == [Dependency.new('AFNetworking')]
end
it "returns the sandbox dir" do
it 'returns the sandbox dir' do
@rep.sandbox_dir.should == temporary_directory + 'Pods'
end
it "returns the path of the prefix header" do
it 'returns the path of the prefix header' do
@rep.prefix_header_path.should == temporary_directory + 'Pods/Pods-MyApp-prefix.pch'
end
it "returns the path of the copy resources script" do
it 'returns the path of the copy resources script' do
@rep.copy_resources_script_path.should == temporary_directory + 'Pods/Pods-MyApp-resources.sh'
end
it "returns the pods project" do
project = stub()
it 'returns the pods project' do
project = stub
config.sandbox.project = project
@rep.project.should == project
end
it "returns the target definition" do
it 'returns the target definition' do
@rep.target_definition.should == @target_definition
end
......@@ -50,18 +50,18 @@ module Pod
#-------------------------------------------------------------------------#
describe "Unsafe Hooks API" do
describe 'Unsafe Hooks API' do
it "returns the sandbox" do
it 'returns the sandbox' do
@rep.sandbox.should == config.sandbox
end
it "returns the library" do
it 'returns the library' do
@rep.library.should == @lib
end
it "returns the native target" do
target = stub()
it 'returns the native target' do
target = stub
@lib.target = target
@rep.target.should == target
end
......
......@@ -12,38 +12,35 @@ module Pod
#-------------------------------------------------------------------------#
describe "Public Hooks API" do
describe 'Public Hooks API' do
it "returns the name" do
it 'returns the name' do
@rep.name.should == 'BananaLib'
end
it "returns the version" do
it 'returns the version' do
@rep.version.should == Version.new('1.0')
end
it "returns the root specification" do
it 'returns the root specification' do
@rep.root_spec.should == @spec
end
it "returns all the activated specifications" do
it 'returns all the activated specifications' do
@rep.specs.should == [@spec]
end
it "returns the directory where the pod is stored" do
it 'returns the directory where the pod is stored' do
@rep.root.should == @root
end
it "returns the source files" do
source_files = @rep.source_files.map{ |sf| sf.relative_path_from(@root).to_s }.sort
it 'returns the source files' do
source_files = @rep.source_files.map { |sf| sf.relative_path_from(@root).to_s }.sort
source_files.should == [
"Classes/Banana.h",
"Classes/Banana.m",
"Classes/BananaPrivate.h",
"Classes/BananaTrace.d"
'Classes/Banana.h',
'Classes/Banana.m',
'Classes/BananaPrivate.h',
'Classes/BananaTrace.d',
]
end
......
......@@ -7,19 +7,19 @@ module Pod
end
describe 'register' do
it "allows to register a block for a notification with a given name" do
it 'allows to register a block for a notification with a given name' do
@hooks_manager.register(:post_install) {}
@hooks_manager.registrations[:post_install].count.should == 1
@hooks_manager.registrations[:post_install].first.class.should == Proc
end
it "raises if no name is given" do
it 'raises if no name is given' do
should.raise ArgumentError do
@hooks_manager.register(nil) {}
end
end
it "raises if no block is given" do
it 'raises if no block is given' do
should.raise ArgumentError do
@hooks_manager.register(:post_install)
end
......@@ -27,21 +27,21 @@ module Pod
end
describe 'run' do
it "invokes the hooks" do
@hooks_manager.register(:post_install) do |options|
it 'invokes the hooks' do
@hooks_manager.register(:post_install) do |_options|
true.should.be.true
end
@hooks_manager.run(:post_install, Object.new)
end
it "handles the case that no listeners have registered" do
it 'handles the case that no listeners have registered' do
should.not.raise do
@hooks_manager.run(:post_install, Object.new)
end
end
it "handles the case that no listeners have registered for a name" do
@hooks_manager.register(:post_install) do |options|
it 'handles the case that no listeners have registered for a name' do
@hooks_manager.register(:post_install) do |_options|
true.should.be.true
end
should.not.raise do
......@@ -49,13 +49,13 @@ module Pod
end
end
it "raises if no name is given" do
it 'raises if no name is given' do
should.raise ArgumentError do
@hooks_manager.run(nil, Object.new) {}
end
end
it "raises if no context object is given" do
it 'raises if no context object is given' do
should.raise ArgumentError do
@hooks_manager.run(:post_install, nil)
end
......@@ -63,4 +63,3 @@ module Pod
end
end
end
......@@ -16,18 +16,18 @@ module Pod
#-------------------------------------------------------------------------#
describe "Analysis" do
describe 'Analysis' do
it "returns the sandbox state" do
it 'returns the sandbox state' do
@analyzer.stubs(:folder_exist?).returns(true)
@analyzer.stubs(:folder_empty?).returns(false)
@analyzer.stubs(:sandbox_checksum).returns(@spec.checksum)
state = @analyzer.analyze
state.class.should == Installer::Analyzer::SpecsState
state.unchanged.should == ["BananaLib"]
state.unchanged.should == ['BananaLib']
end
it "marks all the pods as added if no sandbox manifest is available" do
it 'marks all the pods as added if no sandbox manifest is available' do
@sandbox.stubs(:manifest)
@analyzer.analyze.added.should == ['BananaLib']
end
......@@ -36,7 +36,7 @@ module Pod
#-------------------------------------------------------------------------#
describe "Analysis" do
describe 'Analysis' do
before do
@analyzer.stubs(:folder_exist?).returns(true)
......@@ -44,11 +44,11 @@ module Pod
@analyzer.stubs(:sandbox_checksum).returns(@spec.checksum)
end
it "returns whether a Pod is unchanged" do
it 'returns whether a Pod is unchanged' do
@analyzer.send(:pod_state, 'BananaLib').should == :unchanged
end
it "considers a Pod as added if it is not recorded in the sandbox manifest" do
it 'considers a Pod as added if it is not recorded in the sandbox manifest' do
@analyzer.stubs(:sandbox_pods).returns([])
@analyzer.send(:pod_added?, 'BananaLib').should == true
end
......@@ -58,32 +58,32 @@ module Pod
@analyzer.send(:pod_added?, 'BananaLib').should == true
end
it "considers deleted a Pod without any resolved specification" do
it 'considers deleted a Pod without any resolved specification' do
@analyzer.stubs(:resolved_pods).returns([])
@analyzer.send(:pod_deleted?, 'BananaLib').should == true
end
it "considers changed a Pod whose versions do not match" do
it 'considers changed a Pod whose versions do not match' do
@analyzer.stubs(:sandbox_version).returns(Version.new(999))
@analyzer.send(:pod_changed?, 'BananaLib').should == true
end
it "considers changed a Pod whose checksums do not match" do
it 'considers changed a Pod whose checksums do not match' do
@analyzer.stubs(:sandbox_checksum).returns('SHA')
@analyzer.send(:pod_changed?, 'BananaLib').should == true
end
it "considers changed a Pod whose activated specifications do not match" do
it 'considers changed a Pod whose activated specifications do not match' do
@analyzer.stubs(:sandbox_spec_names).returns(['BananaLib', 'BananaLib/Subspec'])
@analyzer.send(:pod_changed?, 'BananaLib').should == true
end
it "considers changed a Pod whose folder is empty" do
it 'considers changed a Pod whose folder is empty' do
@analyzer.stubs(:folder_empty?).returns(true)
@analyzer.send(:pod_changed?, 'BananaLib').should == true
end
it "considers changed a Pod which has been pre-downloaded" do
it 'considers changed a Pod which has been pre-downloaded' do
@sandbox.stubs(:predownloaded?).returns(true)
@analyzer.send(:pod_changed?, 'BananaLib').should == true
end
......@@ -93,7 +93,7 @@ module Pod
@analyzer.send(:pod_changed?, 'BananaLib').should == true
end
it "considers changed a Pod whose specification is in head mode if in update mode" do
it 'considers changed a Pod whose specification is in head mode if in update mode' do
@sandbox.stubs(:head_pod?).returns(true)
@analyzer.stubs(:update_mode?).returns(true)
@analyzer.send(:pod_changed?, 'BananaLib').should == true
......@@ -110,13 +110,13 @@ module Pod
#-------------------------------------------------------------------------#
describe "Private helpers" do
describe 'Private helpers' do
it "returns the sandbox manifest" do
it 'returns the sandbox manifest' do
@analyzer.send(:sandbox_manifest).should == @manifest
end
it "returns the lockfile as the sandbox if one is not available" do
it 'returns the lockfile as the sandbox if one is not available' do
lockfile = Lockfile.new({})
@sandbox.stubs(:manifest)
@analyzer.stubs(:lockfile).returns(lockfile)
......@@ -125,29 +125,29 @@ module Pod
#--------------------------------------#
it "returns the root name of the resolved Pods" do
it 'returns the root name of the resolved Pods' do
subspec = Spec.new(@spec, 'Subspec')
@analyzer.stubs(:specs).returns([@spec, subspec])
@analyzer.send(:resolved_pods).should == ['BananaLib']
end
it "returns the root name of pods stored in the sandbox manifest" do
it 'returns the root name of pods stored in the sandbox manifest' do
@manifest.stubs(:pod_names).returns(['BananaLib', 'BananaLib/Subspec'])
@analyzer.send(:sandbox_pods).should == ['BananaLib']
end
it "returns the name of the resolved specifications sorted by name" do
it 'returns the name of the resolved specifications sorted by name' do
subspec = Spec.new(@spec, 'Subspec')
@analyzer.stubs(:specs).returns([subspec, @spec])
@analyzer.send(:resolved_spec_names, 'BananaLib').should == ['BananaLib', 'BananaLib/Subspec']
end
it "returns the name of the specifications stored in the sandbox manifest" do
it 'returns the name of the specifications stored in the sandbox manifest' do
@manifest.stubs(:pod_names).returns(['BananaLib', 'BananaLib/Subspec'])
@analyzer.send(:sandbox_spec_names, 'BananaLib').should == ['BananaLib', 'BananaLib/Subspec']
end
it "returns the root specification for the Pod with the given name" do
it 'returns the root specification for the Pod with the given name' do
subspec = Spec.new(@spec, 'Subspec')
@analyzer.stubs(:specs).returns([@spec, subspec])
@analyzer.send(:root_spec, 'BananaLib').should == @spec
......@@ -155,18 +155,18 @@ module Pod
#--------------------------------------#
it "returns the version for the Pod with the given name stored in the manifest" do
it 'returns the version for the Pod with the given name stored in the manifest' do
@analyzer.send(:sandbox_version, 'BananaLib').should == Version.new('1.0')
end
it "returns the checksum for the spec of the Pods with the given name stored in the manifest" do
it 'returns the checksum for the spec of the Pods with the given name stored in the manifest' do
@manifest.stubs(:checksum).returns(@spec.checksum)
@analyzer.send(:sandbox_checksum, 'BananaLib').should == @spec.checksum
end
#--------------------------------------#
it "returns whether the folder containing the Pod with the given name is empty" do
it 'returns whether the folder containing the Pod with the given name is empty' do
@analyzer.send(:folder_exist?, 'BananaLib').should.be.false
path = temporary_directory + 'Pods/BananaLib'
path.mkpath
......@@ -174,11 +174,11 @@ module Pod
end
it "returns whether the folder containing the Pod with the given name is empty" do
it 'returns whether the folder containing the Pod with the given name is empty' do
@analyzer.send(:folder_empty?, 'BananaLib').should.be.true
path = temporary_directory + 'Pods/BananaLib'
path.mkpath
File.open(path + "file", "w") {}
File.open(path + 'file', 'w') {}
@analyzer.send(:folder_empty?, 'BananaLib').should.be.false
end
......
......@@ -13,8 +13,8 @@ def create_analyzer
end
hash = {}
hash['PODS'] = ["JSONKit (1.4)", "NUI (0.2.0)", "SVPullToRefresh (0.4)"]
hash['DEPENDENCIES'] = ["JSONKit", "NUI", "SVPullToRefresh"]
hash['PODS'] = ['JSONKit (1.4)', 'NUI (0.2.0)', 'SVPullToRefresh (0.4)']
hash['DEPENDENCIES'] = %w(JSONKit NUI SVPullToRefresh)
hash['SPEC CHECKSUMS'] = {}
hash['COCOAPODS'] = Pod::VERSION
lockfile = Pod::Lockfile.new(hash)
......@@ -32,41 +32,41 @@ module Pod
@analyzer = create_analyzer
end
describe "Analysis" do
describe 'Analysis' do
it "returns whether an installation should be performed" do
it 'returns whether an installation should be performed' do
@analyzer.needs_install?.should.be.true
end
it "returns whether the Podfile has changes" do
it 'returns whether the Podfile has changes' do
analysis_result = @analyzer.analyze(false)
@analyzer.podfile_needs_install?(analysis_result).should.be.true
end
it "returns whether the sandbox is not in sync with the lockfile" do
it 'returns whether the sandbox is not in sync with the lockfile' do
analysis_result = @analyzer.analyze(false)
@analyzer.sandbox_needs_install?(analysis_result).should.be.true
end
#--------------------------------------#
it "computes the state of the Podfile respect to the Lockfile" do
it 'computes the state of the Podfile respect to the Lockfile' do
state = @analyzer.analyze.podfile_state
state.added.should == ["AFNetworking", "libextobjc"]
state.changed.should == ["JSONKit"]
state.unchanged.should == ["SVPullToRefresh"]
state.deleted.should == ["NUI"]
state.added.should == %w(AFNetworking libextobjc)
state.changed.should == ['JSONKit']
state.unchanged.should == ['SVPullToRefresh']
state.deleted.should == ['NUI']
end
#--------------------------------------#
it "updates the repositories by default" do
it 'updates the repositories by default' do
config.skip_repo_update = false
SourcesManager.expects(:update).once
@analyzer.analyze
end
it "does not updates the repositories if config indicates to skip them" do
it 'does not updates the repositories if config indicates to skip them' do
config.skip_repo_update = true
SourcesManager.expects(:update).never
@analyzer.analyze
......@@ -74,31 +74,31 @@ module Pod
#--------------------------------------#
it "generates the libraries which represent the target definitions" do
it 'generates the libraries which represent the target definitions' do
target = @analyzer.analyze.targets.first
target.pod_targets.map(&:name).sort.should == [
'Pods-JSONKit',
'Pods-AFNetworking',
'Pods-SVPullToRefresh',
'Pods-libextobjc'
'Pods-libextobjc',
].sort
target.support_files_root.should == config.sandbox.root
target.user_project_path.to_s.should.include 'SampleProject/SampleProject'
target.client_root.to_s.should.include 'SampleProject'
target.user_target_uuids.should == ["A346496C14F9BE9A0080D870"]
target.user_target_uuids.should == ['A346496C14F9BE9A0080D870']
user_proj = Xcodeproj::Project.open(target.user_project_path)
user_proj.objects_by_uuid[target.user_target_uuids.first].name.should == 'SampleProject'
target.user_build_configurations.should == {
"Debug" => :debug,
"Release" => :release,
"Test" => :release,
"App Store" => :release
'Debug' => :debug,
'Release' => :release,
'Test' => :release,
'App Store' => :release,
}
target.platform.to_s.should == 'iOS 6.0'
end
it "generates the integration library appropriately if the installation will not integrate" do
it 'generates the integration library appropriately if the installation will not integrate' do
config.integrate_targets = false
target = @analyzer.analyze.targets.first
......@@ -108,26 +108,26 @@ module Pod
target.platform.to_s.should == 'iOS 6.0'
end
it "returns all the configurations the user has in any of its projects and/or targets" do
it 'returns all the configurations the user has in any of its projects and/or targets' do
target_definition = @analyzer.podfile.target_definition_list.first
target_definition.stubs(:build_configurations).returns("AdHoc" => :test)
target_definition.stubs(:build_configurations).returns('AdHoc' => :test)
@analyzer.analyze.all_user_build_configurations.should == {
"Debug" => :debug,
"Release" => :release,
"AdHoc" => :test,
"Test" => :release,
"App Store" => :release
'Debug' => :debug,
'Release' => :release,
'AdHoc' => :test,
'Test' => :release,
'App Store' => :release,
}
end
#--------------------------------------#
it "locks the version of the dependencies which did not change in the Podfile" do
it 'locks the version of the dependencies which did not change in the Podfile' do
@analyzer.analyze
@analyzer.send(:locked_dependencies).map(&:to_s).should == ["SVPullToRefresh (= 0.4)"]
@analyzer.send(:locked_dependencies).map(&:to_s).should == ['SVPullToRefresh (= 0.4)']
end
it "does not lock the dependencies in update mode" do
it 'does not lock the dependencies in update mode' do
@analyzer.update = true
@analyzer.analyze
@analyzer.send(:locked_dependencies).map(&:to_s).should == []
......@@ -135,29 +135,29 @@ module Pod
#--------------------------------------#
it "fetches the dependencies with external sources" do
it 'fetches the dependencies with external sources' do
podfile_state = Installer::Analyzer::SpecsState.new
podfile_state.added << "BananaLib"
podfile_state.added << 'BananaLib'
@analyzer.stubs(:result).returns(stub(:podfile_state => podfile_state))
@podfile.stubs(:dependencies).returns([Dependency.new('BananaLib', :git => "example.com")])
@podfile.stubs(:dependencies).returns([Dependency.new('BananaLib', :git => 'example.com')])
ExternalSources::DownloaderSource.any_instance.expects(:fetch)
@analyzer.send(:fetch_external_sources)
end
xit "it fetches the specification from either the sandbox or from the remote be default" do
xit 'it fetches the specification from either the sandbox or from the remote be default' do
dependency = Dependency.new('Name', :git => 'www.example.com')
ExternalSources::DownloaderSource.any_instance.expects(:specification_from_external).returns(Specification.new).once
@resolver.send(:set_from_external_source, dependency)
end
xit "it fetches the specification from the remote if in update mode" do
xit 'it fetches the specification from the remote if in update mode' do
dependency = Dependency.new('Name', :git => 'www.example.com')
ExternalSources::DownloaderSource.any_instance.expects(:specification).returns(Specification.new).once
@resolver.update_external_specs = false
@resolver.send(:set_from_external_source, dependency)
end
xit "it fetches the specification only from the sandbox if pre-downloads are disabled" do
xit 'it fetches the specification only from the sandbox if pre-downloads are disabled' do
dependency = Dependency.new('Name', :git => 'www.example.com')
Sandbox.any_instance.expects(:specification).returns(Specification.new).once
@resolver.allow_pre_downloads = true
......@@ -166,49 +166,49 @@ module Pod
#--------------------------------------#
it "resolves the dependencies" do
it 'resolves the dependencies' do
@analyzer.analyze.specifications.map(&:to_s).should == [
"AFNetworking (1.0.1)",
"JSONKit (1.5pre)",
"SVPullToRefresh (0.4)",
"libextobjc/EXTKeyPathCoding (0.2.3)"
'AFNetworking (1.0.1)',
'JSONKit (1.5pre)',
'SVPullToRefresh (0.4)',
'libextobjc/EXTKeyPathCoding (0.2.3)',
]
end
xit "removes the specifications of the changed pods to prevent confusion in the resolution process" do
xit 'removes the specifications of the changed pods to prevent confusion in the resolution process' do
@analyzer.allow_pre_downloads = true
podspec = @analyzer.sandbox.root + 'Local Podspecs/JSONKit.podspec'
podspec.dirname.mkpath
File.open(podspec, "w") { |f| f.puts('test') }
File.open(podspec, 'w') { |f| f.puts('test') }
@analyzer.analyze
podspec.should.not.exist?
end
it "adds the specifications to the correspondent libraries" do
it 'adds the specifications to the correspondent libraries' do
@analyzer.analyze.targets.first.pod_targets.map(&:specs).flatten.map(&:to_s).should == [
"AFNetworking (1.0.1)",
"JSONKit (1.5pre)",
"SVPullToRefresh (0.4)",
"libextobjc/EXTKeyPathCoding (0.2.3)"
'AFNetworking (1.0.1)',
'JSONKit (1.5pre)',
'SVPullToRefresh (0.4)',
'libextobjc/EXTKeyPathCoding (0.2.3)',
]
end
#--------------------------------------#
it "computes the state of the Sandbox respect to the resolved dependencies" do
it 'computes the state of the Sandbox respect to the resolved dependencies' do
@analyzer.stubs(:lockfile).returns(nil)
state = @analyzer.analyze.sandbox_state
state.added.sort.should == ["AFNetworking", "JSONKit", "SVPullToRefresh", "libextobjc"]
state.added.sort.should == %w(AFNetworking JSONKit SVPullToRefresh libextobjc)
end
end
#-------------------------------------------------------------------------#
describe "Private helpers" do
describe 'Private helpers' do
describe "#compute_user_project_targets" do
it "uses the path specified in the target definition while computing the path of the user project" do
describe '#compute_user_project_targets' do
it 'uses the path specified in the target definition while computing the path of the user project' do
target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.user_project_path = 'SampleProject/SampleProject'
......@@ -216,7 +216,7 @@ module Pod
path.to_s.should.include 'SampleProject/SampleProject.xcodeproj'
end
it "raises if the user project of the target definition does not exists while computing the path of the user project" do
it 'raises if the user project of the target definition does not exists while computing the path of the user project' do
target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.user_project_path = 'Test'
......@@ -224,7 +224,7 @@ module Pod
e.message.should.match /Unable to find/
end
it "if not specified in the target definition if looks if there is only one project" do
it 'if not specified in the target definition if looks if there is only one project' do
target_definition = Podfile::TargetDefinition.new(:default, nil)
config.installation_root = config.installation_root + 'SampleProject'
......@@ -232,14 +232,14 @@ module Pod
path.to_s.should.include 'SampleProject/SampleProject.xcodeproj'
end
it "if not specified in the target definition if looks if there is only one project" do
it 'if not specified in the target definition if looks if there is only one project' do
target_definition = Podfile::TargetDefinition.new(:default, nil)
e = lambda { @analyzer.send(:compute_user_project_path, target_definition) }.should.raise Informative
e.message.should.match /Could not.*select.*project/
end
it "does not take aggregate targets into consideration" do
it 'does not take aggregate targets into consideration' do
aggregate_class = Xcodeproj::Project::Object::PBXAggregateTarget
sample_project_path = SpecHelper.create_sample_app_copy_from_fixture('SampleProject')
sample_project = Xcodeproj::Project.open(sample_project_path)
......@@ -252,9 +252,9 @@ module Pod
#--------------------------------------#
describe "#compute_user_project_targets" do
describe '#compute_user_project_targets' do
it "returns the targets specified in the target definition" do
it 'returns the targets specified in the target definition' do
target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.link_with = ['UserTarget']
user_project = Xcodeproj::Project.new('path')
......@@ -265,7 +265,7 @@ module Pod
targets.map(&:name).should == ['UserTarget']
end
it "raises if it is unable to find the targets specified by the target definition" do
it 'raises if it is unable to find the targets specified by the target definition' do
target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.link_with = ['UserTarget']
user_project = Xcodeproj::Project.new('path')
......@@ -274,7 +274,7 @@ module Pod
e.message.should.match /Unable to find the targets/
end
it "returns the target with the same name of the target definition" do
it 'returns the target with the same name of the target definition' do
target_definition = Podfile::TargetDefinition.new('UserTarget', nil)
user_project = Xcodeproj::Project.new('path')
user_project.new_target(:application, 'FirstTarget', :ios)
......@@ -284,14 +284,14 @@ module Pod
targets.map(&:name).should == ['UserTarget']
end
it "raises if the name of the target definition does not match any file" do
it 'raises if the name of the target definition does not match any file' do
target_definition = Podfile::TargetDefinition.new('UserTarget', nil)
user_project = Xcodeproj::Project.new('path')
e = lambda { @analyzer.send(:compute_user_project_targets, target_definition, user_project) }.should.raise Informative
e.message.should.match /Unable to find a target named/
end
it "returns the first target of the project if the target definition is named default" do
it 'returns the first target of the project if the target definition is named default' do
target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.link_with_first_target = true
user_project = Xcodeproj::Project.new('path')
......@@ -302,7 +302,7 @@ module Pod
targets.map(&:name).should == ['FirstTarget']
end
it "raises if the default target definition cannot be linked because there are no user targets" do
it 'raises if the default target definition cannot be linked because there are no user targets' do
target_definition = Podfile::TargetDefinition.new(:default, nil)
user_project = Xcodeproj::Project.new('path')
e = lambda { @analyzer.send(:compute_user_project_targets, target_definition, user_project) }.should.raise Informative
......@@ -313,9 +313,9 @@ module Pod
#--------------------------------------#
describe "#compute_user_build_configurations" do
describe '#compute_user_build_configurations' do
it "returns the user build configurations of the user targets" do
it 'returns the user build configurations of the user targets' do
user_project = Xcodeproj::Project.new('path')
target = user_project.new_target(:application, 'Target', :ios)
configuration = user_project.new(Xcodeproj::Project::Object::XCBuildConfiguration)
......@@ -329,11 +329,11 @@ module Pod
configurations.should == {
'Debug' => :debug,
'Release' => :release,
'AppStore' => :release
'AppStore' => :release,
}
end
it "returns the user build configurations specified in the target definition" do
it 'returns the user build configurations specified in the target definition' do
target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.build_configurations = { 'AppStore' => :release }
user_targets = []
......@@ -346,9 +346,9 @@ module Pod
#--------------------------------------#
describe "#compute_archs_for_target_definition" do
describe '#compute_archs_for_target_definition' do
it "handles a single ARCH defined in a single user target" do
it 'handles a single ARCH defined in a single user target' do
user_project = Xcodeproj::Project.new('path')
target = user_project.new_target(:application, 'Target', :ios)
target.build_configuration_list.set_setting('ARCHS', 'armv7')
......@@ -361,7 +361,7 @@ module Pod
archs.should == 'armv7'
end
it "handles a single ARCH defined in multiple user targets" do
it 'handles a single ARCH defined in multiple user targets' do
user_project = Xcodeproj::Project.new('path')
targeta = user_project.new_target(:application, 'Target', :ios)
targeta.build_configuration_list.set_setting('ARCHS', 'armv7')
......@@ -376,40 +376,40 @@ module Pod
archs.should == 'armv7'
end
it "handles an Array of ARCHs defined in a single user target" do
it 'handles an Array of ARCHs defined in a single user target' do
user_project = Xcodeproj::Project.new('path')
target = user_project.new_target(:application, 'Target', :ios)
target.build_configuration_list.set_setting('ARCHS', ['armv7', 'i386'])
target.build_configuration_list.set_setting('ARCHS', %w(armv7 i386))
target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.set_platform(:ios, '4.0')
user_targets = [target]
archs = @analyzer.send(:compute_archs_for_target_definition, target_definition, user_targets)
['armv7', 'i386'].each { |a| archs.should.include a }
%w(armv7 i386).each { |a| archs.should.include a }
end
it "handles an Array of ARCHs defined multiple user targets" do
it 'handles an Array of ARCHs defined multiple user targets' do
user_project = Xcodeproj::Project.new('path')
targeta = user_project.new_target(:application, 'Target', :ios)
targeta.build_configuration_list.set_setting('ARCHS', ['armv7', 'armv7s'])
targeta.build_configuration_list.set_setting('ARCHS', %w(armv7 armv7s))
targetb = user_project.new_target(:application, 'Target', :ios)
targetb.build_configuration_list.set_setting('ARCHS', ['armv7', 'i386'])
targetb.build_configuration_list.set_setting('ARCHS', %w(armv7 i386))
target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.set_platform(:ios, '4.0')
user_targets = [targeta, targetb]
archs = @analyzer.send(:compute_archs_for_target_definition, target_definition, user_targets)
['armv7', 'armv7s', 'i386'].each { |a| archs.should.include a }
%w(armv7 armv7s i386).each { |a| archs.should.include a }
end
end
#--------------------------------------#
describe "#compute_platform_for_target_definition" do
describe '#compute_platform_for_target_definition' do
it "returns the platform specified in the target definition" do
it 'returns the platform specified in the target definition' do
target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.set_platform(:ios, '4.0')
user_targets = []
......@@ -418,7 +418,7 @@ module Pod
configurations.should == Platform.new(:ios, '4.0')
end
it "infers the platform from the user targets" do
it 'infers the platform from the user targets' do
user_project = Xcodeproj::Project.new('path')
target = user_project.new_target(:application, 'Target', :ios)
target.build_configuration_list.set_setting('SDKROOT', 'iphoneos')
......@@ -431,7 +431,7 @@ module Pod
configurations.should == Platform.new(:ios, '4.0')
end
it "uses the lowest deployment target of the user targets if inferring the platform" do
it 'uses the lowest deployment target of the user targets if inferring the platform' do
user_project = Xcodeproj::Project.new('path')
target1 = user_project.new_target(:application, 'Target', :ios)
configuration1 = target1.build_configuration_list.build_configurations.first
......@@ -449,7 +449,7 @@ module Pod
configurations.should == Platform.new(:ios, '4.0')
end
it "raises if the user targets have a different platform" do
it 'raises if the user targets have a different platform' do
user_project = Xcodeproj::Project.new('path')
target1 = user_project.new_target(:application, 'Target', :ios)
target1.build_configuration_list.set_setting('SDKROOT', 'iphoneos')
......
......@@ -14,43 +14,43 @@ module Pod
#-------------------------------------------------------------------------#
describe "Installation" do
describe 'Installation' do
it "adds the files references of the source files the Pods project" do
it 'adds the files references of the source files the Pods project' do
@file_accessor.path_list.read_file_system
@file_accessor.path_list.expects(:read_file_system)
@installer.install!
end
it "adds the files references of the source files the Pods project" do
it 'adds the files references of the source files the Pods project' do
@installer.install!
file_ref = @installer.pods_project['Pods/BananaLib/Banana.m']
file_ref.should.be.not.nil
file_ref.path.should == "Classes/Banana.m"
file_ref.path.should == 'Classes/Banana.m'
end
it "adds the file references of the frameworks of the project" do
it 'adds the file references of the frameworks of the project' do
@installer.install!
file_ref = @installer.pods_project['Pods/BananaLib/Frameworks/Bananalib.framework']
file_ref.should.be.not.nil
file_ref.path.should == "Bananalib.framework"
file_ref.path.should == 'Bananalib.framework'
end
it "adds the file references of the libraries of the project" do
it 'adds the file references of the libraries of the project' do
@installer.install!
file_ref = @installer.pods_project['Pods/BananaLib/Frameworks/libBananalib.a']
file_ref.should.be.not.nil
file_ref.path.should == "libBananalib.a"
file_ref.path.should == 'libBananalib.a'
end
it "adds the files references of the resources the Pods project" do
it 'adds the files references of the resources the Pods project' do
@installer.install!
file_ref = @installer.pods_project['Pods/BananaLib/Resources/logo-sidebar.png']
file_ref.should.be.not.nil
file_ref.path.should == "Resources/logo-sidebar.png"
file_ref.path.should == 'Resources/logo-sidebar.png'
end
it "links the build headers" do
it 'links the build headers' do
@installer.install!
headers_root = @pod_target.build_headers.root
public_header = headers_root + 'BananaLib/Banana.h'
......@@ -59,7 +59,7 @@ module Pod
private_header.should.exist
end
it "links the public headers" do
it 'links the public headers' do
@installer.install!
headers_root = config.sandbox.public_headers.root
public_header = headers_root + 'BananaLib/Banana.h'
......@@ -72,10 +72,10 @@ module Pod
#-------------------------------------------------------------------------#
describe "Private Helpers" do
describe 'Private Helpers' do
describe "#file_accessors" do
it "returns the file accessors" do
describe '#file_accessors' do
it 'returns the file accessors' do
pod_target_1 = PodTarget.new([], nil, config.sandbox)
pod_target_1.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')]
pod_target_2 = PodTarget.new([], nil, config.sandbox)
......@@ -85,7 +85,7 @@ module Pod
roots.should == [fixture('banana-lib'), fixture('banana-lib')]
end
it "handles libraries empty libraries without file accessors" do
it 'handles libraries empty libraries without file accessors' do
pod_target_1 = PodTarget.new([], nil, config.sandbox)
pod_target_1.file_accessors = []
installer = Installer::FileReferencesInstaller.new(config.sandbox, [pod_target_1], @project)
......@@ -93,31 +93,31 @@ module Pod
end
end
describe "#header_mappings" do
it "returns the header mappings" do
describe '#header_mappings' do
it 'returns the header mappings' do
headers_sandbox = Pathname.new('BananaLib')
headers = [Pathname.new('BananaLib/Banana.h')]
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers)
mappings.should == {
headers_sandbox => [Pathname.new('BananaLib/Banana.h')]
headers_sandbox => [Pathname.new('BananaLib/Banana.h')],
}
end
it "takes into account the header dir specified in the spec" do
it 'takes into account the header dir specified in the spec' do
headers_sandbox = Pathname.new('BananaLib')
headers = [Pathname.new('BananaLib/Banana.h')]
@file_accessor.spec_consumer.stubs(:header_dir).returns('Sub_dir')
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers)
mappings.should == {
(headers_sandbox + 'Sub_dir') => [Pathname.new('BananaLib/Banana.h')]
(headers_sandbox + 'Sub_dir') => [Pathname.new('BananaLib/Banana.h')],
}
end
it "takes into account the header mappings dir specified in the spec" do
it 'takes into account the header mappings dir specified in the spec' do
headers_sandbox = Pathname.new('BananaLib')
header_1 = @file_accessor.root + 'BananaLib/sub_dir/dir_1/banana_1.h'
header_2 = @file_accessor.root + 'BananaLib/sub_dir/dir_2/banana_2.h'
headers = [ header_1, header_2 ]
headers = [header_1, header_2]
@file_accessor.spec_consumer.stubs(:header_mappings_dir).returns('BananaLib/sub_dir')
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers)
mappings.should == {
......@@ -133,5 +133,3 @@ module Pod
end
end
......@@ -3,7 +3,7 @@ require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Installer::HooksContext do
it "offers a convenience method to be generated" do
it 'offers a convenience method to be generated' do
sandbox = stub(:root => '/path')
spec = fixture_spec('banana-lib/BananaLib.podspec')
......
......@@ -12,10 +12,10 @@ module Pod
#-------------------------------------------------------------------------#
describe "Installation" do
describe 'Installation' do
describe "Download" do
it "downloads the source" do
describe 'Download' do
it 'downloads the source' do
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' }
@installer.install!
@installer.specific_source.should.be.nil
......@@ -23,35 +23,35 @@ module Pod
pod_folder.should.exist
end
it "downloads the head source even if a specific source is present specified source" do
it 'downloads the head source even if a specific source is present specified source' do
config.sandbox.store_head_pod('BananaLib')
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' }
@installer.install!
@installer.specific_source[:commit].should == "0b8b4084a43c38cfe308efa076fdeb3a64d9d2bc"
@installer.specific_source[:commit].should == '0b8b4084a43c38cfe308efa076fdeb3a64d9d2bc'
pod_folder = config.sandbox.root + 'BananaLib'
pod_folder.should.exist
end
it "returns the checkout options of the downloader if any" do
it 'returns the checkout options of the downloader if any' do
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :branch => 'topicbranch' }
@installer.install!
@installer.specific_source[:commit].should == "446b22414597f1bb4062a62c4eed7af9627a3f1b"
@installer.specific_source[:commit].should == '446b22414597f1bb4062a62c4eed7af9627a3f1b'
pod_folder = config.sandbox.root + 'BananaLib'
pod_folder.should.exist
end
it "stores the checkout options in the sandbox" do
it 'stores the checkout options in the sandbox' do
config.sandbox.store_head_pod('BananaLib')
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' }
@installer.install!
sources = @installer.sandbox.checkout_sources
sources.should == { "BananaLib" => {
sources.should == { 'BananaLib' => {
:git => SpecHelper.fixture('banana-lib'),
:commit=>"0b8b4084a43c38cfe308efa076fdeb3a64d9d2bc" }
:commit => '0b8b4084a43c38cfe308efa076fdeb3a64d9d2bc' },
}
end
it "cleans up directory when an error occurs during download" do
it 'cleans up directory when an error occurs during download' do
config.sandbox.store_head_pod('BananaLib')
pod_folder = config.sandbox.root + 'BananaLib'
partially_downloaded_file = pod_folder + 'partially_downloaded_file'
......@@ -61,17 +61,17 @@ module Pod
singleton_class.send(:define_method, :download_head) do
FileUtils.mkdir_p(pod_folder)
FileUtils.touch(partially_downloaded_file)
raise("some network error")
raise('some network error')
end
@installer.stubs(:downloader).returns(mock_downloader)
lambda {
lambda do
@installer.install!
}.should.raise(RuntimeError).message.should.equal('some network error')
end.should.raise(RuntimeError).message.should.equal('some network error')
partially_downloaded_file.should.not.exist
end
it "fails when using :head for Http source" do
it 'fails when using :head for Http source' do
config.sandbox.store_head_pod('BananaLib')
@spec.source = { :http => 'http://dl.google.com/googleadmobadssdk/googleadmobsearchadssdkios.zip' }
@spec.source_files = 'GoogleAdMobSearchAdsSDK/*.h'
......@@ -85,9 +85,9 @@ module Pod
#--------------------------------------#
describe "Prepare command" do
it "runs the prepare command if one has been declared in the spec" do
@spec.prepare_command = "echo test"
describe 'Prepare command' do
it 'runs the prepare command if one has been declared in the spec' do
@spec.prepare_command = 'echo test'
@installer.expects(:bash!).once
@installer.install!
end
......@@ -97,16 +97,16 @@ module Pod
@installer.install!
end
it "raises if the prepare command fails" do
@spec.prepare_command = "missing_command"
it 'raises if the prepare command fails' do
@spec.prepare_command = 'missing_command'
should.raise Informative do
@installer.install!
end.message.should.match /command not found/
end
it "unsets $CDPATH environment variable" do
ENV['CDPATH'] = "BogusPath"
@spec.prepare_command = "cd Classes;ls Banana.h"
it 'unsets $CDPATH environment variable' do
ENV['CDPATH'] = 'BogusPath'
@spec.prepare_command = 'cd Classes;ls Banana.h'
lambda { @installer.install! }.should.not.raise
end
......@@ -114,16 +114,16 @@ module Pod
#--------------------------------------#
describe "Cleaning" do
describe 'Cleaning' do
it "cleans the paths non used by the installation" do
it 'cleans the paths non used by the installation' do
@installer.install!
@installer.clean!
unused_file = config.sandbox.root + 'BananaLib/sub-dir/sub-dir-2/somefile.txt'
unused_file.should.not.exist
end
it "preserves important files like the LICENSE and the README" do
it 'preserves important files like the LICENSE and the README' do
@installer.install!
@installer.clean!
readme_file = config.sandbox.root + 'BananaLib/README'
......@@ -134,7 +134,7 @@ module Pod
#--------------------------------------#
describe "Options" do
describe 'Options' do
it "doesn't downloads the source if the pod was already downloaded" do
@installer.stubs(:predownloaded?).returns(true)
......@@ -163,38 +163,38 @@ module Pod
#-------------------------------------------------------------------------#
describe "Private Helpers" do
describe 'Private Helpers' do
it "returns the clean paths" do
it 'returns the clean paths' do
@installer.send(:download_source)
paths = @installer.send(:clean_paths)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')}
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '') }
paths_without_git = relative_paths.reject { |p| p.include? 'Pods/BananaLib/.git' }
paths_without_git.sort.should == [
"Pods/BananaLib/BananaLib.podspec",
"Pods/BananaLib/libPusher",
"Pods/BananaLib/sub-dir",
"Pods/BananaLib/sub-dir/sub-dir-2",
"Pods/BananaLib/sub-dir/sub-dir-2/somefile.txt"
'Pods/BananaLib/BananaLib.podspec',
'Pods/BananaLib/libPusher',
'Pods/BananaLib/sub-dir',
'Pods/BananaLib/sub-dir/sub-dir-2',
'Pods/BananaLib/sub-dir/sub-dir-2/somefile.txt',
]
end
it "returns the used files" do
it 'returns the used files' do
@installer.send(:download_source)
paths = @installer.send(:used_files)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')}
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '') }
relative_paths.sort.should == [
"Pods/BananaLib/Classes/Banana.h",
"Pods/BananaLib/Classes/Banana.m",
"Pods/BananaLib/Classes/BananaLib.pch",
"Pods/BananaLib/Classes/BananaPrivate.h",
"Pods/BananaLib/LICENSE",
"Pods/BananaLib/README",
"Pods/BananaLib/Resources/logo-sidebar.png"
'Pods/BananaLib/Classes/Banana.h',
'Pods/BananaLib/Classes/Banana.m',
'Pods/BananaLib/Classes/BananaLib.pch',
'Pods/BananaLib/Classes/BananaPrivate.h',
'Pods/BananaLib/LICENSE',
'Pods/BananaLib/README',
'Pods/BananaLib/Resources/logo-sidebar.png',
]
end
it "handles Pods with multiple file accessors" do
it 'handles Pods with multiple file accessors' do
spec = fixture_spec('banana-lib/BananaLib.podspec')
spec.source = { :git => SpecHelper.fixture('banana-lib') }
spec.source_files = []
......@@ -206,19 +206,19 @@ module Pod
@installer = Installer::PodSourceInstaller.new(config.sandbox, specs_by_platform)
@installer.send(:download_source)
paths = @installer.send(:used_files)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')}
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '') }
relative_paths.sort.should == [
"Pods/BananaLib/Classes/Banana.h",
"Pods/BananaLib/Classes/Banana.m",
"Pods/BananaLib/Classes/BananaLib.pch",
"Pods/BananaLib/Classes/BananaPrivate.h",
"Pods/BananaLib/LICENSE",
"Pods/BananaLib/README",
"Pods/BananaLib/Resources/logo-sidebar.png"
'Pods/BananaLib/Classes/Banana.h',
'Pods/BananaLib/Classes/Banana.m',
'Pods/BananaLib/Classes/BananaLib.pch',
'Pods/BananaLib/Classes/BananaPrivate.h',
'Pods/BananaLib/LICENSE',
'Pods/BananaLib/README',
'Pods/BananaLib/Resources/logo-sidebar.png',
]
end
it "compacts the used files as nil would be converted to the empty string" do
it 'compacts the used files as nil would be converted to the empty string' do
Sandbox::FileAccessor.any_instance.stubs(:source_files)
Sandbox::FileAccessor.any_instance.stubs(:vendored_libraries)
Sandbox::FileAccessor.any_instance.stubs(:resources).returns(nil)
......
......@@ -2,7 +2,7 @@ require File.expand_path('../../../../spec_helper', __FILE__)
module Pod
describe Installer::AggregateTargetInstaller do
describe "In General" do
describe 'In General' do
before do
@podfile = Podfile.new do
platform :ios
......@@ -39,19 +39,19 @@ module Pod
@spec.prefix_header_contents = '#import "BlocksKit.h"'
end
it "adds file references for the support files of the target" do
it 'adds file references for the support files of the target' do
@installer.install!
group = @project.support_files_group['Pods']
group.children.map(&:display_name).sort.should == [
"Pods-acknowledgements.markdown",
"Pods-acknowledgements.plist",
"Pods-dummy.m",
"Pods-environment.h",
"Pods-resources.sh",
"Pods.appstore.xcconfig",
"Pods.debug.xcconfig",
"Pods.release.xcconfig",
"Pods.test.xcconfig"
'Pods-acknowledgements.markdown',
'Pods-acknowledgements.plist',
'Pods-dummy.m',
'Pods-environment.h',
'Pods-resources.sh',
'Pods.appstore.xcconfig',
'Pods.debug.xcconfig',
'Pods.release.xcconfig',
'Pods.test.xcconfig',
]
end
......@@ -63,50 +63,50 @@ module Pod
@project.targets.first.name.should == @target_definition.label
end
it "adds the user build configurations to the target" do
it 'adds the user build configurations to the target' do
@installer.install!
target = @project.targets.first
target.build_settings('Test')["VALIDATE_PRODUCT"].should == nil
target.build_settings('AppStore')["VALIDATE_PRODUCT"].should == "YES"
target.build_settings('Test')['VALIDATE_PRODUCT'].should.nil?
target.build_settings('AppStore')['VALIDATE_PRODUCT'].should == 'YES'
end
it "sets VALIDATE_PRODUCT to YES for the Release configuration for iOS targets" do
it 'sets VALIDATE_PRODUCT to YES for the Release configuration for iOS targets' do
@installer.install!
target = @project.targets.first
target.build_settings('Release')["VALIDATE_PRODUCT"].should == "YES"
target.build_settings('Release')['VALIDATE_PRODUCT'].should == 'YES'
end
it "sets the platform and the deployment target for iOS targets" do
it 'sets the platform and the deployment target for iOS targets' do
@installer.install!
target = @project.targets.first
target.platform_name.should == :ios
target.deployment_target.should == "6.0"
target.build_settings('Debug')["IPHONEOS_DEPLOYMENT_TARGET"].should == "6.0"
target.build_settings('AppStore')["IPHONEOS_DEPLOYMENT_TARGET"].should == "6.0"
target.deployment_target.should == '6.0'
target.build_settings('Debug')['IPHONEOS_DEPLOYMENT_TARGET'].should == '6.0'
target.build_settings('AppStore')['IPHONEOS_DEPLOYMENT_TARGET'].should == '6.0'
end
it "sets the platform and the deployment target for OS X targets" do
it 'sets the platform and the deployment target for OS X targets' do
@target.stubs(:platform).returns(Platform.new(:osx, '10.8'))
@installer.install!
target = @project.targets.first
target.platform_name.should == :osx
target.deployment_target.should == "10.8"
target.build_settings('Debug')["MACOSX_DEPLOYMENT_TARGET"].should == "10.8"
target.build_settings('AppStore')["MACOSX_DEPLOYMENT_TARGET"].should == "10.8"
target.deployment_target.should == '10.8'
target.build_settings('Debug')['MACOSX_DEPLOYMENT_TARGET'].should == '10.8'
target.build_settings('AppStore')['MACOSX_DEPLOYMENT_TARGET'].should == '10.8'
end
it "adds the user's build configurations to the target" do
@installer.install!
@project.targets.first.build_configurations.map(&:name).sort.should == %w{ AppStore Debug Release Test }
@project.targets.first.build_configurations.map(&:name).sort.should == %w( AppStore Debug Release Test )
end
it "it creates different hash instances for the build settings of various build configurations" do
it 'it creates different hash instances for the build settings of various build configurations' do
@installer.install!
build_settings = @project.targets.first.build_configurations.map(&:build_settings)
build_settings.map(&:object_id).uniq.count.should == 4
end
it "does not enable the GCC_WARN_INHIBIT_ALL_WARNINGS flag by default" do
it 'does not enable the GCC_WARN_INHIBIT_ALL_WARNINGS flag by default' do
@installer.install!
@installer.library.target.build_configurations.each do |config|
config.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'].should.be.nil
......@@ -115,14 +115,14 @@ module Pod
#--------------------------------------#
it "creates the xcconfig file" do
it 'creates the xcconfig file' do
@installer.install!
file = config.sandbox.root + @target.xcconfig_path("Release")
file = config.sandbox.root + @target.xcconfig_path('Release')
xcconfig = Xcodeproj::Config.new(file)
xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}/Pods'
end
it "creates a header for the target which contains the information about the installed Pods" do
it 'creates a header for the target which contains the information about the installed Pods' do
@installer.install!
file = config.sandbox.root + 'Pods-environment.h'
contents = file.read
......@@ -132,27 +132,27 @@ module Pod
contents.should.include?('#define COCOAPODS_VERSION_PATCH_BananaLib 0')
end
it "creates a bridge support file" do
it 'creates a bridge support file' do
Podfile.any_instance.stubs(:generate_bridge_support? => true)
Generator::BridgeSupport.any_instance.expects(:save_as).once
@installer.install!
end
it "creates a create copy resources script" do
it 'creates a create copy resources script' do
@installer.install!
script = config.sandbox.root + 'Pods-resources.sh'
script.read.should.include?('logo-sidebar.png')
end
xit "adds the resources bundles to the copy resources script" do
xit 'adds the resources bundles to the copy resources script' do
end
xit "adds the bridge support file to the copy resources script, if one was created" do
xit 'adds the bridge support file to the copy resources script, if one was created' do
end
it "creates the acknowledgements files " do
it 'creates the acknowledgements files ' do
@installer.install!
markdown = config.sandbox.root + 'Pods-acknowledgements.markdown'
markdown.read.should.include?('Permission is hereby granted')
......@@ -160,7 +160,7 @@ module Pod
plist.read.should.include?('Permission is hereby granted')
end
it "creates a dummy source to ensure the creation of a single base library" do
it 'creates a dummy source to ensure the creation of a single base library' do
@installer.install!
build_files = @installer.library.target.source_build_phase.files
build_file = build_files.find { |bf| bf.file_ref.path.include?('Pods-dummy.m') }
......
......@@ -2,7 +2,7 @@ require File.expand_path('../../../../spec_helper', __FILE__)
module Pod
describe Installer::PodTargetInstaller do
describe "In General" do
describe 'In General' do
before do
@podfile = Podfile.new do
platform :ios
......@@ -30,15 +30,15 @@ module Pod
@spec.prefix_header_contents = '#import "BlocksKit.h"'
end
it "adds file references for the support files of the target" do
it 'adds file references for the support files of the target' do
@installer.install!
@project.support_files_group
group = @project['Pods/BananaLib/Support Files']
group.children.map(&:display_name).sort.should == [
"Pods-BananaLib-Private.xcconfig",
"Pods-BananaLib-dummy.m",
"Pods-BananaLib-prefix.pch",
"Pods-BananaLib.xcconfig",
'Pods-BananaLib-Private.xcconfig',
'Pods-BananaLib-dummy.m',
'Pods-BananaLib-prefix.pch',
'Pods-BananaLib.xcconfig',
]
end
......@@ -50,42 +50,42 @@ module Pod
@project.targets.first.name.should == 'Pods-BananaLib'
end
it "sets VALIDATE_PRODUCT to YES for the Release configuration for iOS targets" do
it 'sets VALIDATE_PRODUCT to YES for the Release configuration for iOS targets' do
@installer.install!
target = @project.targets.first
target.build_settings('Release')["VALIDATE_PRODUCT"].should == "YES"
target.build_settings('Release')['VALIDATE_PRODUCT'].should == 'YES'
end
it "sets the platform and the deployment target for iOS targets" do
it 'sets the platform and the deployment target for iOS targets' do
@installer.install!
target = @project.targets.first
target.platform_name.should == :ios
target.deployment_target.should == "6.0"
target.build_settings('Debug')["IPHONEOS_DEPLOYMENT_TARGET"].should == "6.0"
target.deployment_target.should == '6.0'
target.build_settings('Debug')['IPHONEOS_DEPLOYMENT_TARGET'].should == '6.0'
end
it "sets the platform and the deployment target for OS X targets" do
it 'sets the platform and the deployment target for OS X targets' do
@pod_target.stubs(:platform).returns(Platform.new(:osx, '10.8'))
@installer.install!
target = @project.targets.first
target.platform_name.should == :osx
target.deployment_target.should == "10.8"
target.build_settings('Debug')["MACOSX_DEPLOYMENT_TARGET"].should == "10.8"
target.deployment_target.should == '10.8'
target.build_settings('Debug')['MACOSX_DEPLOYMENT_TARGET'].should == '10.8'
end
it "adds the user's build configurations to the target" do
@pod_target.user_build_configurations.merge!({ 'AppStore' => :release, 'Test' => :debug })
@pod_target.user_build_configurations.merge!('AppStore' => :release, 'Test' => :debug)
@installer.install!
@project.targets.first.build_configurations.map(&:name).sort.should == %w{ AppStore Debug Release Test }
@project.targets.first.build_configurations.map(&:name).sort.should == %w( AppStore Debug Release Test )
end
it "it creates different hash instances for the build settings of various build configurations" do
it 'it creates different hash instances for the build settings of various build configurations' do
@installer.install!
build_settings = @project.targets.first.build_configurations.map(&:build_settings)
build_settings.map(&:object_id).uniq.count.should == 2
end
it "does not enable the GCC_WARN_INHIBIT_ALL_WARNINGS flag by default" do
it 'does not enable the GCC_WARN_INHIBIT_ALL_WARNINGS flag by default' do
@installer.install!
@installer.library.target.build_configurations.each do |config|
config.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'].should.be.nil
......@@ -97,15 +97,15 @@ module Pod
it 'adds the source files of each pod to the target of the Pod library' do
@installer.install!
names = @installer.library.target.source_build_phase.files.map { |bf| bf.file_ref.display_name }
names.should.include("Banana.m")
names.should.include('Banana.m')
end
#--------------------------------------#
it 'adds the resource bundle targets' do
@pod_target.file_accessors.first.stubs(:resource_bundles).returns({'banana_bundle' => []})
@pod_target.file_accessors.first.stubs(:resource_bundles).returns('banana_bundle' => [])
@installer.install!
@project.targets.map(&:name).should == ["Pods-BananaLib", "banana_bundle"]
@project.targets.map(&:name).should == ['Pods-BananaLib', 'banana_bundle']
end
xit 'adds the build configurations to the resources bundle targets' do
......@@ -114,7 +114,7 @@ module Pod
#--------------------------------------#
it "creates the xcconfig file" do
it 'creates the xcconfig file' do
@installer.install!
file = config.sandbox.root + @pod_target.xcconfig_private_path
xcconfig = Xcodeproj::Config.new(file)
......@@ -138,7 +138,7 @@ module Pod
generated.should == expected
end
it "creates a dummy source to ensure the compilation of libraries with only categories" do
it 'creates a dummy source to ensure the compilation of libraries with only categories' do
@installer.install!
build_files = @installer.library.target.source_build_phase.files
build_file = build_files.find { |bf| bf.file_ref.display_name == 'Pods-BananaLib-dummy.m' }
......@@ -148,26 +148,25 @@ module Pod
dummy.read.should.include?('@interface PodsDummy_Pods')
end
#--------------------------------------------------------------------------------#
describe "concerning compiler flags" do
describe 'concerning compiler flags' do
before do
@spec = Pod::Spec.new
end
it "flags should not be added to dtrace files" do
it 'flags should not be added to dtrace files' do
@installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
@installer.install!
dtrace_files = @installer.library.target.source_build_phase.files.reject {|sf|
dtrace_files = @installer.library.target.source_build_phase.files.reject do|sf|
!(File.extname(sf.file_ref.path) == '.d')
}
end
dtrace_files.each do |dt|
dt.settings.should.be.nil
end
end
it "adds -w per pod if target definition inhibits warnings for that pod" do
it 'adds -w per pod if target definition inhibits warnings for that pod' do
@installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
......@@ -179,7 +178,7 @@ module Pod
flags.should.not.include?('-w')
end
it "adds -Xanalyzer -analyzer-disable-checker per pod" do
it 'adds -Xanalyzer -analyzer-disable-checker per pod' do
@installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
......@@ -191,9 +190,9 @@ module Pod
flags.should.not.include?('-Xanalyzer -analyzer-disable-checker')
end
describe "concerning ARC before and after iOS 6.0 and OS X 10.8" do
describe 'concerning ARC before and after iOS 6.0 and OS X 10.8' do
it "does not do anything if ARC is *not* required" do
it 'does not do anything if ARC is *not* required' do
@spec.requires_arc = false
@spec.ios.deployment_target = '5'
@spec.osx.deployment_target = '10.6'
......@@ -203,7 +202,7 @@ module Pod
osx_flags.should.not.include '-DOS_OBJECT_USE_OBJC'
end
it "does *not* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and has a deployment target of >= iOS 6.0 or OS X 10.8" do
it 'does *not* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and has a deployment target of >= iOS 6.0 or OS X 10.8' do
@spec.requires_arc = false
@spec.ios.deployment_target = '6'
@spec.osx.deployment_target = '10.8'
......@@ -213,7 +212,7 @@ module Pod
osx_flags.should.not.include '-DOS_OBJECT_USE_OBJC'
end
it "*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required but has a deployment target < iOS 6.0 or OS X 10.8" do
it '*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required but has a deployment target < iOS 6.0 or OS X 10.8' do
@spec.requires_arc = true
@spec.ios.deployment_target = '5.1'
@spec.osx.deployment_target = '10.7.2'
......@@ -223,7 +222,7 @@ module Pod
osx_flags.should.include '-DOS_OBJECT_USE_OBJC'
end
it "*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and *no* deployment target is specified" do
it '*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and *no* deployment target is specified' do
@spec.requires_arc = true
ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx))
......
......@@ -29,14 +29,14 @@ module Pod
@installer = Installer::TargetInstaller.new(config.sandbox, @pod_target)
end
it "Adds the architectures to the custom build configurations of the user target" do
@pod_target.archs = "$(ARCHS_STANDARD_64_BIT)"
it 'Adds the architectures to the custom build configurations of the user target' do
@pod_target.archs = '$(ARCHS_STANDARD_64_BIT)'
@installer.send(:add_target)
@installer.send(:target).resolved_build_setting('ARCHS').should == {
"Release"=>"$(ARCHS_STANDARD_64_BIT)",
"Debug"=>"$(ARCHS_STANDARD_64_BIT)",
"AppStore"=>"$(ARCHS_STANDARD_64_BIT)",
"Test"=>"$(ARCHS_STANDARD_64_BIT)"
'Release' => '$(ARCHS_STANDARD_64_BIT)',
'Debug' => '$(ARCHS_STANDARD_64_BIT)',
'AppStore' => '$(ARCHS_STANDARD_64_BIT)',
'Test' => '$(ARCHS_STANDARD_64_BIT)',
}
end
......
......@@ -14,9 +14,9 @@ module Pod
@pod_bundle.user_project_path = project_path
@pod_bundle.client_root = project_path.dirname
@pod_bundle.user_target_uuids = [@target.uuid]
configuration = Xcodeproj::Config.new({
configuration = Xcodeproj::Config.new(
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1'
})
)
@pod_bundle.xcconfigs['Debug'] = configuration
@pod_bundle.xcconfigs['Test'] = configuration
@pod_bundle.xcconfigs['Release'] = configuration
......@@ -50,7 +50,5 @@ module Pod
config.base_configuration_reference.should.equal existing
end
end
end
......@@ -2,7 +2,7 @@ require File.expand_path('../../../../spec_helper', __FILE__)
module Pod
describe TargetIntegrator = Installer::UserProjectIntegrator::TargetIntegrator do
describe "In general" do
describe 'In general' do
# The project contains a `PBXReferenceProxy` in the build files of the
# frameworks build phase which implicitly checks for the robustness of
......@@ -19,9 +19,9 @@ module Pod
@pod_bundle.user_project_path = project_path
@pod_bundle.client_root = project_path.dirname
@pod_bundle.user_target_uuids = [@target.uuid]
configuration = Xcodeproj::Config.new({
configuration = Xcodeproj::Config.new(
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1'
})
)
@pod_bundle.xcconfigs['Debug'] = configuration
@pod_bundle.xcconfigs['Test'] = configuration
@pod_bundle.xcconfigs['Release'] = configuration
......@@ -43,28 +43,28 @@ module Pod
it 'adds references to the Pods static libraries to the Frameworks group' do
@target_integrator.integrate!
@target_integrator.send(:user_project)["Frameworks/libPods.a"].should.not == nil
@target_integrator.send(:user_project)['Frameworks/libPods.a'].should.not.nil?
end
it 'adds the libPods static library to the "Link binary with libraries" build phase of each target' do
@target_integrator.integrate!
target = @target_integrator.send(:native_targets).first
phase = target.frameworks_build_phase
ref = phase.files.find { |f| f.file_ref.path == 'libPods.a'}
ref = phase.files.find { |f| f.file_ref.path == 'libPods.a' }
ref.should.not.be.nil
end
it 'adds a Copy Pods Resources build phase to each target' do
@target_integrator.integrate!
target = @target_integrator.send(:native_targets).first
phase = target.shell_script_build_phases.find { |bp| bp.name == "Copy Pods Resources" }
phase = target.shell_script_build_phases.find { |bp| bp.name == 'Copy Pods Resources' }
phase.shell_script.strip.should == "\"${SRCROOT}/../Pods/Pods-resources.sh\""
end
it 'adds a Check Manifest.lock build phase to each target' do
@target_integrator.integrate!
target = @target_integrator.send(:native_targets).first
phase = target.shell_script_build_phases.find { |bp| bp.name == "Check Pods Manifest.lock" }
phase = target.shell_script_build_phases.find { |bp| bp.name == 'Check Pods Manifest.lock' }
phase.shell_script.should == <<-EOS.strip_heredoc
diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
if [[ $? != 0 ]] ; then
......@@ -80,7 +80,7 @@ module Pod
@target_integrator.integrate!
target = @target_integrator.send(:native_targets).first
target.build_phases.first
phase = target.build_phases.find { |bp| bp.name == "Check Pods Manifest.lock" }
phase = target.build_phases.find { |bp| bp.name == 'Check Pods Manifest.lock' }
target.build_phases.first.should.equal? phase
end
......@@ -95,7 +95,7 @@ module Pod
describe 'Private helpers' do
it 'returns the native targets associated with the Pod bundle' do
@target_integrator.send(:native_targets).map(&:name).should == %w[ SampleProject ]
@target_integrator.send(:native_targets).map(&:name).should == %w( SampleProject )
end
it 'returns the targets that need to be integrated' do
......@@ -110,7 +110,7 @@ module Pod
build_file.file_ref = @project.new(Xcodeproj::Project::PBXVariantGroup)
@target_integrator.stubs(:user_project).returns(@project)
@target.frameworks_build_phase.files << build_file
@target_integrator.send(:native_targets).map(&:name).should == %w[ SampleProject ]
@target_integrator.send(:native_targets).map(&:name).should == %w( SampleProject )
end
it 'is robust against build files with missing file references' do
......@@ -118,7 +118,7 @@ module Pod
build_file.file_ref = nil
@target_integrator.stubs(:user_project).returns(@project)
@target.frameworks_build_phase.files << build_file
@target_integrator.send(:native_targets).map(&:name).should == %w[ SampleProject ]
@target_integrator.send(:native_targets).map(&:name).should == %w( SampleProject )
end
end
end
......
......@@ -3,7 +3,7 @@ require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe UserProjectIntegrator = Installer::UserProjectIntegrator do
describe "In general" do
describe 'In general' do
before do
@sample_project_path = SpecHelper.create_sample_app_copy_from_fixture('SampleProject')
......@@ -28,12 +28,12 @@ module Pod
#-----------------------------------------------------------------------#
describe "In general" do
describe 'In general' do
before do
@integrator.stubs(:warn_about_xcconfig_overrides)
end
it "adds the Pods project to the workspace" do
it 'adds the Pods project to the workspace' do
UserProjectIntegrator::TargetIntegrator.any_instance.stubs(:integrate!)
@integrator.integrate!
workspace_path = @integrator.send(:workspace_path)
......@@ -44,12 +44,12 @@ module Pod
pods_project_ref.should.not.be.nil
end
it "integrates the user targets" do
it 'integrates the user targets' do
UserProjectIntegrator::TargetIntegrator.any_instance.expects(:integrate!)
@integrator.integrate!
end
it "warns if the podfile does not contain any dependency" do
it 'warns if the podfile does not contain any dependency' do
Podfile::TargetDefinition.any_instance.stubs(:empty?).returns(true)
@integrator.integrate!
UI.warnings.should.include?('The Podfile does not contain any dependencies')
......@@ -61,7 +61,7 @@ module Pod
user_target = stub(:name => 'SampleProject', :build_configurations => [target_config])
@library.stubs(:user_targets).returns([user_target])
@library.xcconfigs['Release'] = {'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1'}
@library.xcconfigs['Release'] = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1' }
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@library])
@integrator.unstub(:warn_about_xcconfig_overrides)
......@@ -76,7 +76,7 @@ module Pod
user_target = stub(:name => 'SampleProject', :build_configurations => [target_config])
@library.stubs(:user_targets).returns([user_target])
@library.xcconfigs['Release'] = {'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1'}
@library.xcconfigs['Release'] = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1' }
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@library])
@integrator.unstub(:warn_about_xcconfig_overrides)
......@@ -88,19 +88,19 @@ module Pod
#-----------------------------------------------------------------------#
describe "Workspace creation" do
describe 'Workspace creation' do
it "creates a new workspace if needed" do
it 'creates a new workspace if needed' do
@integrator.send(:create_workspace)
workspace_path = @integrator.send(:workspace_path)
saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
saved.file_references.map(&:path).should == [
"SampleProject/SampleProject.xcodeproj",
"Pods/Pods.xcodeproj"
'SampleProject/SampleProject.xcodeproj',
'Pods/Pods.xcodeproj',
]
end
it "updates an existing workspace if needed" do
it 'updates an existing workspace if needed' do
workspace_path = @integrator.send(:workspace_path)
ref = Xcodeproj::Workspace::FileReference.new('SampleProject/SampleProject.xcodeproj', 'group')
workspace = Xcodeproj::Workspace.new(ref)
......@@ -108,15 +108,15 @@ module Pod
@integrator.send(:create_workspace)
saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
saved.file_references.map(&:path).should == [
"SampleProject/SampleProject.xcodeproj",
"Pods/Pods.xcodeproj"
'SampleProject/SampleProject.xcodeproj',
'Pods/Pods.xcodeproj',
]
end
it "doesn't write the workspace if not needed" do
file_references = [
Xcodeproj::Workspace::FileReference.new('SampleProject/SampleProject.xcodeproj', 'group'),
Xcodeproj::Workspace::FileReference.new('Pods/Pods.xcodeproj', 'group')
Xcodeproj::Workspace::FileReference.new('Pods/Pods.xcodeproj', 'group'),
]
workspace = Xcodeproj::Workspace.new(file_references)
......@@ -126,7 +126,7 @@ module Pod
@integrator.send(:create_workspace)
end
it "only appends projects to the workspace and never deletes one" do
it 'only appends projects to the workspace and never deletes one' do
ref = Xcodeproj::Workspace::FileReference.new('user_added_project.xcodeproj', 'group')
workspace = Xcodeproj::Workspace.new(ref)
workspace_path = @integrator.send(:workspace_path)
......@@ -135,12 +135,12 @@ module Pod
saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
saved.file_references.map(&:path).should == [
'user_added_project.xcodeproj',
"SampleProject/SampleProject.xcodeproj",
"Pods/Pods.xcodeproj"
'SampleProject/SampleProject.xcodeproj',
'Pods/Pods.xcodeproj',
]
end
it "preserves the order of the projects in the workspace" do
it 'preserves the order of the projects in the workspace' do
file_references = [
Xcodeproj::Workspace::FileReference.new('Pods/Pods.xcodeproj', 'group'),
Xcodeproj::Workspace::FileReference.new('SampleProject/SampleProject.xcodeproj', 'group'),
......@@ -152,8 +152,8 @@ module Pod
@integrator.send(:create_workspace)
saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
saved.file_references.map(&:path).should == [
"Pods/Pods.xcodeproj",
"SampleProject/SampleProject.xcodeproj",
'Pods/Pods.xcodeproj',
'SampleProject/SampleProject.xcodeproj',
]
end
......@@ -161,32 +161,32 @@ module Pod
#-----------------------------------------------------------------------#
describe "Private Helpers" do
describe 'Private Helpers' do
it "uses the path of the workspace defined in the podfile" do
path = "a_path"
it 'uses the path of the workspace defined in the podfile' do
path = 'a_path'
@podfile.workspace(path)
workspace_path = @integrator.send(:workspace_path)
workspace_path.to_s.should.end_with(path + ".xcworkspace")
workspace_path.to_s.should.end_with(path + '.xcworkspace')
workspace_path.should.be.absolute
workspace_path.class.should == Pathname
end
it "names the workspace after the user project if needed" do
it 'names the workspace after the user project if needed' do
@integrator.send(:workspace_path).should == temporary_directory + 'SampleProject.xcworkspace'
end
it "raises if no workspace could be selected" do
@integrator.expects(:user_project_paths).returns(%w[ project1 project2 ])
it 'raises if no workspace could be selected' do
@integrator.expects(:user_project_paths).returns(%w( project1 project2 ))
e = lambda { @integrator.send(:workspace_path) }.should.raise Informative
end
it "returns the paths of the user projects" do
@integrator.send(:user_project_paths).should == [ @sample_project_path ]
it 'returns the paths of the user projects' do
@integrator.send(:user_project_paths).should == [@sample_project_path]
end
it "skips libraries with empty target definitions" do
@integrator.targets.map(&:name).should == ["Pods", "Pods-empty"]
it 'skips libraries with empty target definitions' do
@integrator.targets.map(&:name).should == ['Pods', 'Pods-empty']
@integrator.send(:targets_to_integrate).map(&:name).should == ['Pods']
end
......
......@@ -45,7 +45,7 @@ module Pod
#-------------------------------------------------------------------------#
describe "In general" do
describe 'In general' do
before do
@installer.stubs(:resolve_dependencies)
......@@ -56,7 +56,7 @@ module Pod
@installer.stubs(:perform_post_install_actions)
end
it "in runs the pre-install hooks before cleaning the Pod sources" do
it 'in runs the pre-install hooks before cleaning the Pod sources' do
@installer.unstub(:download_dependencies)
@installer.stubs(:create_file_accessors)
@installer.stubs(:install_pod_sources)
......@@ -69,7 +69,7 @@ module Pod
@installer.install!
end
it "in runs the post-install hooks before serializing the Pods project" do
it 'in runs the post-install hooks before serializing the Pods project' do
@installer.stubs(:prepare_pods_project)
@installer.stubs(:run_pre_install_hooks)
@installer.stubs(:install_file_references)
......@@ -87,7 +87,7 @@ module Pod
@installer.install!
end
it "integrates the user targets if the corresponding config is set" do
it 'integrates the user targets if the corresponding config is set' do
config.integrate_targets = true
@installer.expects(:integrate_user_project)
@installer.install!
......@@ -116,28 +116,28 @@ module Pod
#-------------------------------------------------------------------------#
describe "Dependencies Resolution" do
describe 'Dependencies Resolution' do
describe "#analyze" do
describe '#analyze' do
it "prints a warning if the version of the Lockfile is higher than the one of the executable" do
it 'prints a warning if the version of the Lockfile is higher than the one of the executable' do
Lockfile.any_instance.stubs(:cocoapods_version).returns(Version.new('999'))
STDERR.expects(:puts)
@installer.send(:analyze)
end
it "analyzes the Podfile, the Lockfile and the Sandbox" do
it 'analyzes the Podfile, the Lockfile and the Sandbox' do
@installer.send(:analyze)
@installer.analysis_result.sandbox_state.added.should == ["JSONKit"]
@installer.analysis_result.sandbox_state.added.should == ['JSONKit']
end
it "stores the targets created by the analyzer" do
it 'stores the targets created by the analyzer' do
@installer.send(:analyze)
@installer.aggregate_targets.map(&:name).sort.should == ['Pods']
@installer.pod_targets.map(&:name).sort.should == ['Pods-JSONKit']
end
it "configures the analyzer to use update mode if appropriate" do
it 'configures the analyzer to use update mode if appropriate' do
@installer.update = true
Installer::Analyzer.any_instance.expects(:update=).with(true)
@installer.send(:analyze)
......@@ -149,7 +149,7 @@ module Pod
#--------------------------------------#
describe "#validate_whitelisted_configurations" do
describe '#validate_whitelisted_configurations' do
it "raises when a whitelisted configuration doesn’t exist in the user's project" do
target_definition = @installer.podfile.target_definitions.values.first
target_definition.whitelist_pod_for_configuration('JSONKit', 'YOLO')
......@@ -171,18 +171,18 @@ module Pod
#--------------------------------------#
describe "#clean_sandbox" do
describe '#clean_sandbox' do
before do
@analysis_result = Installer::Analyzer::AnalysisResult.new
@analysis_result.specifications = []
@analysis_result.sandbox_state = Installer::Analyzer::SpecsState.new()
@analysis_result.sandbox_state = Installer::Analyzer::SpecsState.new
@pod_targets = [PodTarget.new([], nil, config.sandbox)]
@installer.stubs(:analysis_result).returns(@analysis_result)
@installer.stubs(:pod_targets).returns(@pod_targets)
end
it "cleans the header stores" do
it 'cleans the header stores' do
config.sandbox.public_headers.expects(:implode!)
@installer.pod_targets.each do |pods_target|
pods_target.build_headers.expects(:implode!)
......@@ -190,7 +190,7 @@ module Pod
@installer.send(:clean_sandbox)
end
it "deletes the sources of the removed Pods" do
it 'deletes the sources of the removed Pods' do
@analysis_result.sandbox_state.add_name('Deleted-Pod', :deleted)
config.sandbox.expects(:clean_pod).with('Deleted-Pod')
@installer.send(:clean_sandbox)
......@@ -202,11 +202,11 @@ module Pod
#-------------------------------------------------------------------------#
describe "Downloading dependencies" do
describe 'Downloading dependencies' do
describe "#install_pod_sources" do
describe '#install_pod_sources' do
it "installs all the Pods which are marked as needing installation" do
it 'installs all the Pods which are marked as needing installation' do
spec = fixture_spec('banana-lib/BananaLib.podspec')
spec_2 = Spec.new
spec_2.name = 'RestKit'
......@@ -220,7 +220,7 @@ module Pod
@installer.send(:install_pod_sources)
end
it "correctly configures the Pod source installer" do
it 'correctly configures the Pod source installer' do
spec = fixture_spec('banana-lib/BananaLib.podspec')
pod_target = PodTarget.new([spec], nil, config.sandbox)
pod_target.stubs(:platform).returns(:ios)
......@@ -230,7 +230,7 @@ module Pod
@installer.send(:install_source_of_pod, 'BananaLib')
end
it "maintains the list of the installed specs" do
it 'maintains the list of the installed specs' do
spec = fixture_spec('banana-lib/BananaLib.podspec')
pod_target = PodTarget.new([spec], nil, config.sandbox)
pod_target.stubs(:platform).returns(:ios)
......@@ -241,7 +241,7 @@ module Pod
@installer.installed_specs.should == [spec]
end
it "prints the previous version of a pod while updating the spec" do
it 'prints the previous version of a pod while updating the spec' do
spec = Spec.new
spec.name = 'RestKit'
spec.version = '2.0'
......@@ -259,9 +259,9 @@ module Pod
#--------------------------------------#
describe "#clean" do
describe '#clean' do
it "it cleans only if the config instructs to do it" do
it 'it cleans only if the config instructs to do it' do
config.clean = false
@installer.send(:clean_pod_sources)
Installer::PodSourceInstaller.any_instance.expects(:install!).never
......@@ -276,9 +276,9 @@ module Pod
#-------------------------------------------------------------------------#
describe "Generating pods project" do
describe 'Generating pods project' do
describe "#prepare_pods_project" do
describe '#prepare_pods_project' do
before do
@installer.stubs(:aggregate_targets).returns([])
......@@ -291,26 +291,26 @@ module Pod
@installer.pods_project.build_configurations.map(&:name).sort.should == ['App Store', 'Debug', 'Release', 'Test']
end
it "sets STRIP_INSTALLED_PRODUCT to NO for all configurations for the whole project" do
it 'sets STRIP_INSTALLED_PRODUCT to NO for all configurations for the whole project' do
config.integrate_targets = true
@installer.send(:analyze)
@installer.send(:prepare_pods_project)
@installer.pods_project.build_settings('Debug')["STRIP_INSTALLED_PRODUCT"].should == "NO"
@installer.pods_project.build_settings('Test')["STRIP_INSTALLED_PRODUCT"].should == "NO"
@installer.pods_project.build_settings('Release')["STRIP_INSTALLED_PRODUCT"].should == "NO"
@installer.pods_project.build_settings('App Store')["STRIP_INSTALLED_PRODUCT"].should == "NO"
@installer.pods_project.build_settings('Debug')['STRIP_INSTALLED_PRODUCT'].should == 'NO'
@installer.pods_project.build_settings('Test')['STRIP_INSTALLED_PRODUCT'].should == 'NO'
@installer.pods_project.build_settings('Release')['STRIP_INSTALLED_PRODUCT'].should == 'NO'
@installer.pods_project.build_settings('App Store')['STRIP_INSTALLED_PRODUCT'].should == 'NO'
end
before do
@installer.stubs(:analysis_result).returns(stub(:all_user_build_configurations => {}))
end
it "creates the Pods project" do
it 'creates the Pods project' do
@installer.send(:prepare_pods_project)
@installer.pods_project.class.should == Pod::Project
end
it "preserves Pod paths specified as absolute or rooted to home" do
it 'preserves Pod paths specified as absolute or rooted to home' do
local_podfile = generate_local_podfile
local_installer = Installer.new(config.sandbox, local_podfile)
local_installer.send(:analyze)
......@@ -319,13 +319,13 @@ module Pod
Pathname.new(group.path).should.be.absolute
end
it "adds the Podfile to the Pods project" do
it 'adds the Podfile to the Pods project' do
config.stubs(:podfile_path).returns(Pathname.new('/Podfile'))
@installer.send(:prepare_pods_project)
@installer.pods_project['Podfile'].should.be.not.nil
end
it "sets the deployment target for the whole project" do
it 'sets the deployment target for the whole project' do
pod_target_ios = PodTarget.new([], nil, config.sandbox)
pod_target_osx = PodTarget.new([], nil, config.sandbox)
pod_target_ios.stubs(:platform).returns(Platform.new(:ios, '6.0'))
......@@ -335,8 +335,8 @@ module Pod
@installer.send(:prepare_pods_project)
build_settings = @installer.pods_project.build_configurations.map(&:build_settings)
build_settings.each do |build_setting|
build_setting["MACOSX_DEPLOYMENT_TARGET"].should == '10.8'
build_setting["IPHONEOS_DEPLOYMENT_TARGET"].should == '6.0'
build_setting['MACOSX_DEPLOYMENT_TARGET'].should == '10.8'
build_setting['IPHONEOS_DEPLOYMENT_TARGET'].should == '6.0'
end
end
......@@ -344,9 +344,9 @@ module Pod
#--------------------------------------#
describe "#install_file_references" do
describe '#install_file_references' do
it "installs the file references" do
it 'installs the file references' do
@installer.stubs(:pod_targets).returns([])
Installer::FileReferencesInstaller.any_instance.expects(:install!)
@installer.send(:install_file_references)
......@@ -356,9 +356,9 @@ module Pod
#--------------------------------------#
describe "#install_libraries" do
describe '#install_libraries' do
it "install the targets of the Pod project" do
it 'install the targets of the Pod project' do
spec = fixture_spec('banana-lib/BananaLib.podspec')
target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.store_pod('BananaLib')
......@@ -369,7 +369,7 @@ module Pod
@installer.send(:install_libraries)
end
it "skips empty pod targets" do
it 'skips empty pod targets' do
spec = fixture_spec('banana-lib/BananaLib.podspec')
target_definition = Podfile::TargetDefinition.new(:default, nil)
pod_target = PodTarget.new([spec], target_definition, config.sandbox)
......@@ -383,24 +383,24 @@ module Pod
Specification::Consumer.any_instance.stubs(:frameworks).returns(['QuartzCore'])
@installer.install!
names = @installer.sandbox.project['Frameworks'].children.map(&:name)
names.sort.should == ["Foundation.framework", "QuartzCore.framework"]
names.sort.should == ['Foundation.framework', 'QuartzCore.framework']
end
end
#--------------------------------------#
describe "#set_target_dependencies" do
describe '#set_target_dependencies' do
xit "sets the pod targets as dependencies of the aggregate target" do
xit 'sets the pod targets as dependencies of the aggregate target' do
end
xit "sets the dependecies of the pod targets" do
xit 'sets the dependecies of the pod targets' do
end
xit "is robusts against subspecs" do
xit 'is robusts against subspecs' do
end
......@@ -408,7 +408,7 @@ module Pod
#--------------------------------------#
describe "#write_pod_project" do
describe '#write_pod_project' do
before do
@installer.stubs(:aggregate_targets).returns([])
......@@ -416,13 +416,13 @@ module Pod
@installer.send(:prepare_pods_project)
end
it "recursively sorts the project" do
it 'recursively sorts the project' do
Xcodeproj::Project.any_instance.stubs(:recreate_user_schemes)
@installer.pods_project.main_group.expects(:sort)
@installer.send(:write_pod_project)
end
it "saves the project to the given path" do
it 'saves the project to the given path' do
Xcodeproj::Project.any_instance.stubs(:recreate_user_schemes)
path = temporary_directory + 'Pods/Pods.xcodeproj'
@installer.pods_project.expects(:save)
......@@ -433,7 +433,7 @@ module Pod
#--------------------------------------#
describe "#write_lockfiles" do
describe '#write_lockfiles' do
before do
@analysis_result = Installer::Analyzer::AnalysisResult.new
......@@ -441,18 +441,18 @@ module Pod
@installer.stubs(:analysis_result).returns(@analysis_result)
end
it "generates the lockfile" do
it 'generates the lockfile' do
@installer.send(:write_lockfiles)
@installer.lockfile.pod_names.should == ['BananaLib']
end
it "writes the lockfile" do
it 'writes the lockfile' do
@installer.send(:write_lockfiles)
lockfile = Lockfile.from_file(temporary_directory + 'Podfile.lock')
lockfile.pod_names.should == ['BananaLib']
end
it "writes the sandbox manifest" do
it 'writes the sandbox manifest' do
@installer.send(:write_lockfiles)
lockfile = Lockfile.from_file(temporary_directory + 'Pods/Manifest.lock')
lockfile.pod_names.should == ['BananaLib']
......@@ -464,9 +464,9 @@ module Pod
#-------------------------------------------------------------------------#
describe "Integrating client projects" do
describe 'Integrating client projects' do
it "integrates the client projects" do
it 'integrates the client projects' do
@installer.stubs(:aggregate_targets).returns([AggregateTarget.new(nil, config.sandbox)])
Installer::UserProjectIntegrator.any_instance.expects(:integrate!)
@installer.send(:integrate_user_project)
......@@ -474,7 +474,7 @@ module Pod
end
describe "Plugins Hooks" do
describe 'Plugins Hooks' do
before do
@installer.send(:analyze)
@specs = @installer.pod_targets.map(&:specs).flatten
......@@ -482,8 +482,8 @@ module Pod
@installer.stubs(:installed_specs).returns(@specs)
end
it "runs plugins post install hook" do
context = stub()
it 'runs plugins post install hook' do
context = stub
Installer::HooksContext.expects(:generate).returns(context)
HooksManager.expects(:run).with(:post_install, context)
@installer.send(:run_plugins_post_install_hooks)
......@@ -492,7 +492,7 @@ module Pod
#-------------------------------------------------------------------------#
describe "Hooks" do
describe 'Hooks' do
before do
@installer.send(:analyze)
......@@ -502,47 +502,47 @@ module Pod
@aggregate_target = @installer.aggregate_targets.first
end
it "runs the pre install hooks" do
installer_rep = stub()
pod_rep = stub()
library_rep = stub()
it 'runs the pre install hooks' do
installer_rep = stub
pod_rep = stub
library_rep = stub
@installer.expects(:installer_rep).returns(installer_rep)
@installer.podfile.expects(:pre_install!).with(installer_rep)
@installer.send(:run_pre_install_hooks)
end
it "run_podfile_post_install_hooks" do
installer_rep = stub()
target_installer_data = stub()
it 'run_podfile_post_install_hooks' do
installer_rep = stub
target_installer_data = stub
@installer.expects(:installer_rep).returns(installer_rep)
@installer.podfile.expects(:post_install!).with(installer_rep)
@installer.send(:run_podfile_post_install_hooks)
end
it "calls the hooks in the specs for each target" do
it 'calls the hooks in the specs for each target' do
pod_target_ios = PodTarget.new([@spec], nil, config.sandbox)
pod_target_osx = PodTarget.new([@spec], nil, config.sandbox)
pod_target_ios.stubs(:name).returns('label')
pod_target_osx.stubs(:name).returns('label')
library_ios_rep = stub()
library_osx_rep = stub()
target_installer_data = stub()
library_ios_rep = stub
library_osx_rep = stub
target_installer_data = stub
@installer.stubs(:pod_targets).returns([pod_target_ios, pod_target_osx])
@installer.stubs(:installer_rep).returns(stub())
@installer.stubs(:installer_rep).returns(stub)
@installer.podfile.expects(:pre_install!)
@installer.send(:run_pre_install_hooks)
@installer.send(:run_podfile_post_install_hooks)
end
it "returns the hook representation of the installer" do
it 'returns the hook representation of the installer' do
rep = @installer.send(:installer_rep)
rep.sandbox_root.should == @installer.sandbox.root
end
it "returns the hook representation of a pod" do
it 'returns the hook representation of a pod' do
file_accessor = stub(:spec => @spec)
@aggregate_target.pod_targets.first.stubs(:file_accessors).returns([file_accessor])
rep = @installer.send(:pod_rep, 'JSONKit')
......@@ -550,26 +550,25 @@ module Pod
rep.root_spec.should == @spec
end
it "returns the hook representation of an aggregate target" do
it 'returns the hook representation of an aggregate target' do
rep = @installer.send(:library_rep, @aggregate_target)
rep.send(:library).name.should == 'Pods'
end
it "returns the hook representation of all the pods" do
it 'returns the hook representation of all the pods' do
reps = @installer.send(:pod_reps)
reps.map(&:name).should == ['JSONKit']
end
it "returns the hook representation of all the aggregate target" do
it 'returns the hook representation of all the aggregate target' do
reps = @installer.send(:library_reps)
reps.map(&:name).sort.should == ['Pods'].sort
end
it "returns the aggregate targets which use a given Pod" do
it 'returns the aggregate targets which use a given Pod' do
libs = @installer.send(:libraries_using_spec, @spec)
libs.map(&:name).should == ['Pods']
end
end
end
end
......@@ -3,31 +3,31 @@ require File.expand_path('../../spec_helper', __FILE__)
module Pod
describe Pod::AggregateTarget do
describe "In general" do
describe 'In general' do
before do
@target_definition = Podfile::TargetDefinition.new('Pods', nil)
@target_definition.link_with_first_target = true
@lib = AggregateTarget.new(@target_definition, config.sandbox)
end
it "returns the target_definition that generated it" do
it 'returns the target_definition that generated it' do
@lib.target_definition.should == @target_definition
end
it "returns the label of the target definition" do
it 'returns the label of the target definition' do
@lib.label.should == 'Pods'
end
it "returns its name" do
it 'returns its name' do
@lib.name.should == 'Pods'
end
it "returns the name of its product" do
it 'returns the name of its product' do
@lib.product_name.should == 'libPods.a'
end
end
describe "Support files" do
describe 'Support files' do
before do
@target_definition = Podfile::TargetDefinition.new('Pods', nil)
@target_definition.link_with_first_target = true
......@@ -35,38 +35,38 @@ module Pod
@lib.client_root = config.sandbox.root.dirname
end
it "returns the absolute path of the xcconfig file" do
@lib.xcconfig_path("Release").to_s.should.include?('Pods/Pods.release.xcconfig')
it 'returns the absolute path of the xcconfig file' do
@lib.xcconfig_path('Release').to_s.should.include?('Pods/Pods.release.xcconfig')
end
it "returns the absolute path of the resources script" do
it 'returns the absolute path of the resources script' do
@lib.copy_resources_script_path.to_s.should.include?('Pods/Pods-resources.sh')
end
it "returns the absolute path of the target header file" do
it 'returns the absolute path of the target header file' do
@lib.target_environment_header_path.to_s.should.include?('Pods/Pods-environment.h')
end
it "returns the absolute path of the prefix header file" do
it 'returns the absolute path of the prefix header file' do
@lib.prefix_header_path.to_s.should.include?('Pods/Pods-prefix.pch')
end
it "returns the absolute path of the bridge support file" do
it 'returns the absolute path of the bridge support file' do
@lib.bridge_support_path.to_s.should.include?('Pods/Pods.bridgesupport')
end
it "returns the absolute path of the acknowledgements files without extension" do
it 'returns the absolute path of the acknowledgements files without extension' do
@lib.acknowledgements_basepath.to_s.should.include?('Pods/Pods-acknowledgements')
end
#--------------------------------------#
it "returns the path of the resources script relative to the user project" do
it 'returns the path of the resources script relative to the user project' do
@lib.copy_resources_script_relative_path.should == '${SRCROOT}/Pods/Pods-resources.sh'
end
it "returns the path of the xcconfig file relative to the user project" do
@lib.xcconfig_relative_path("Release").should == 'Pods/Pods.release.xcconfig'
it 'returns the path of the xcconfig file relative to the user project' do
@lib.xcconfig_relative_path('Release').should == 'Pods/Pods.release.xcconfig'
end
end
......
......@@ -9,17 +9,17 @@ module Pod
#-------------------------------------------------------------------------#
describe "In general" do
describe 'In general' do
it "creates the support files group on initialization" do
it 'creates the support files group on initialization' do
@project.support_files_group.name.should == 'Targets Support Files'
end
it "creates the Pods group on initialization" do
it 'creates the Pods group on initialization' do
@project.pods.name.should == 'Pods'
end
it "creates the development Pods group on initialization" do
it 'creates the development Pods group on initialization' do
@project.development_pods.name.should == 'Development Pods'
end
......@@ -27,28 +27,28 @@ module Pod
#-------------------------------------------------------------------------#
describe "Pod Groups" do
describe 'Pod Groups' do
describe "#add_pod_group" do
describe '#add_pod_group' do
before do
@path = config.sandbox.pod_dir('BananaLib')
end
it "adds the group for a Pod" do
it 'adds the group for a Pod' do
group = @project.add_pod_group('BananaLib', @path)
group.parent.should == @project.pods
group.name.should == 'BananaLib'
end
it "adds the group for a development Pod" do
it 'adds the group for a development Pod' do
path = config.sandbox.pod_dir('BananaLib')
group = @project.add_pod_group('BananaLib', @path, true)
group.parent.should == @project.development_pods
group.name.should == 'BananaLib'
end
it "configures the path of a new Pod group" do
it 'configures the path of a new Pod group' do
path = config.sandbox.pod_dir('BananaLib')
group = @project.add_pod_group('BananaLib', @path)
group.source_tree.should == '<group>'
......@@ -56,7 +56,7 @@ module Pod
Pathname.new(group.path).should.be.relative
end
it "configures the path of a new Pod group as absolute if requested" do
it 'configures the path of a new Pod group as absolute if requested' do
path = config.sandbox.pod_dir('BananaLib')
group = @project.add_pod_group('BananaLib', @path, false, true)
group.source_tree.should == '<absolute>'
......@@ -68,40 +68,40 @@ module Pod
#----------------------------------------#
describe "#pod_groups" do
describe '#pod_groups' do
before do
@project.add_pod_group('BananaLib', config.sandbox.pod_dir('BananaLib'))
@project.add_pod_group('OrangeLib', config.sandbox.pod_dir('OrangeLib'), true)
end
it "returns the pod groups" do
@project.pod_groups.map(&:name).sort.should == ["BananaLib", "OrangeLib"]
it 'returns the pod groups' do
@project.pod_groups.map(&:name).sort.should == %w(BananaLib OrangeLib)
end
it "doesn't alters the original groups" do
@project.pods.children.map(&:name).sort.should == ["BananaLib"]
@project.development_pods.children.map(&:name).sort.should == ["OrangeLib"]
@project.pods.children.map(&:name).sort.should == ['BananaLib']
@project.development_pods.children.map(&:name).sort.should == ['OrangeLib']
end
end
#----------------------------------------#
it "returns the group of a Pod with a given name" do
it 'returns the group of a Pod with a given name' do
@project.add_pod_group('BananaLib', config.sandbox.pod_dir('BananaLib'))
@project.pod_group('BananaLib').name.should == 'BananaLib'
end
#----------------------------------------#
describe "#group_for_spec" do
describe '#group_for_spec' do
before do
@project.add_pod_group('BananaLib', config.sandbox.pod_dir('BananaLib'))
end
it "returns the group for the spec with the given name" do
it 'returns the group for the spec with the given name' do
group = @project.group_for_spec('BananaLib/Tree')
group.hierarchy_path.should == '/Pods/BananaLib/Tree'
end
......@@ -112,7 +112,7 @@ module Pod
group_1.uuid.should == group_2.uuid
end
it "returns the subgroup with the given key" do
it 'returns the subgroup with the given key' do
group = @project.group_for_spec('BananaLib/Tree', :resources)
group.hierarchy_path.should == '/Pods/BananaLib/Tree/Resources'
end
......@@ -123,7 +123,7 @@ module Pod
group_1.uuid.should == group_2.uuid
end
it "raises if the subgroup key is unrecognized" do
it 'raises if the subgroup key is unrecognized' do
should.raise ArgumentError do
@project.group_for_spec('BananaLib/Tree', :bananaland)
end.message.should.match /Unrecognized.*key/
......@@ -132,13 +132,13 @@ module Pod
#----------------------------------------#
describe "#pod_support_files_group" do
describe '#pod_support_files_group' do
before do
@project.add_pod_group('BananaLib', @path, false, true)
end
it "creates a support file group relative to the project" do
it 'creates a support file group relative to the project' do
group = @project.pod_support_files_group('BananaLib')
group.source_tree.should == 'SOURCE_ROOT'
group.path.should.be.nil
......@@ -155,17 +155,17 @@ module Pod
#-------------------------------------------------------------------------#
describe "File references" do
describe 'File references' do
describe "#reference_for_path" do
describe '#reference_for_path' do
before do
@project.add_pod_group('BananaLib', config.sandbox.pod_dir('BananaLib'), false)
@file = config.sandbox.pod_dir('BananaLib') + "file.m"
@file = config.sandbox.pod_dir('BananaLib') + 'file.m'
@group = @project.group_for_spec('BananaLib')
end
it "adds a file references to the given file" do
it 'adds a file references to the given file' do
ref = @project.add_file_reference(@file, @group)
ref.hierarchy_path.should == '/Pods/BananaLib/file.m'
end
......@@ -177,7 +177,7 @@ module Pod
@group.children.count.should == 1
end
it "raises if the given path is not absolute" do
it 'raises if the given path is not absolute' do
should.raise ArgumentError do
@project.add_file_reference('relative/path/to/file.m', @group)
end.message.should.match /Paths must be absolute/
......@@ -187,27 +187,27 @@ module Pod
#----------------------------------------#
describe "#reference_for_path" do
describe '#reference_for_path' do
before do
@project.add_pod_group('BananaLib', config.sandbox.pod_dir('BananaLib'), false)
@file = config.sandbox.pod_dir('BananaLib') + "file.m"
@file = config.sandbox.pod_dir('BananaLib') + 'file.m'
@group = @project.group_for_spec('BananaLib')
@project.add_file_reference(@file, @group)
end
it "returns the reference for the given path" do
it 'returns the reference for the given path' do
ref = @project.reference_for_path(@file)
ref.hierarchy_path.should == '/Pods/BananaLib/file.m'
end
it "returns nil if no reference for the given path is available" do
another_file = config.sandbox.pod_dir('BananaLib') + "another_file.m"
it 'returns nil if no reference for the given path is available' do
another_file = config.sandbox.pod_dir('BananaLib') + 'another_file.m'
ref = @project.reference_for_path(another_file)
ref.should.be.nil
end
it "raises if the given path is not absolute" do
it 'raises if the given path is not absolute' do
should.raise ArgumentError do
@project.reference_for_path('relative/path/to/file.m')
end.message.should.match /Paths must be absolute/
......@@ -217,7 +217,7 @@ module Pod
#----------------------------------------#
it "adds the Podfile configured as a Ruby file" do
it 'adds the Podfile configured as a Ruby file' do
@project.add_podfile(config.sandbox.root + '../Podfile')
f = @project['Podfile']
f.source_tree.should == 'SOURCE_ROOT'
......@@ -227,8 +227,8 @@ module Pod
#----------------------------------------#
describe "#add_build_configuration" do
it "adds a preprocessor definition for build configurations" do
describe '#add_build_configuration' do
it 'adds a preprocessor definition for build configurations' do
configuration = @project.add_build_configuration('Release', :release)
settings = configuration.build_settings
settings['GCC_PREPROCESSOR_DEFINITIONS'].should.include('RELEASE=1')
......@@ -238,21 +238,20 @@ module Pod
original = @project.build_configuration_list['Debug']
original_settings = original.build_settings
original_settings['GCC_PREPROCESSOR_DEFINITIONS'].should ==
["DEBUG=1", "$(inherited)"]
['DEBUG=1', '$(inherited)']
configuration = @project.add_build_configuration('Debug', :debug)
settings = configuration.build_settings
settings['GCC_PREPROCESSOR_DEFINITIONS'].should ==
["DEBUG=1", "$(inherited)"]
['DEBUG=1', '$(inherited)']
end
it "normalizes the name of the configuration" do
it 'normalizes the name of the configuration' do
configuration = @project.add_build_configuration(
'My Awesome Configuration', :release)
settings = configuration.build_settings
settings['GCC_PREPROCESSOR_DEFINITIONS'].should ==
["MY_AWESOME_CONFIGURATION=1"]
['MY_AWESOME_CONFIGURATION=1']
end
end
end
......@@ -261,6 +260,3 @@ module Pod
end
end
......@@ -2,7 +2,7 @@ require File.expand_path('../../spec_helper', __FILE__)
module Pod
describe Resolver do
describe "In general" do
describe 'In general' do
before do
@podfile = Podfile.new do
platform :ios
......@@ -12,48 +12,48 @@ module Pod
@resolver = Resolver.new(config.sandbox, @podfile, locked_deps)
end
it "returns the sandbox" do
it 'returns the sandbox' do
@resolver.sandbox.should == config.sandbox
end
it "returns the podfile" do
it 'returns the podfile' do
@resolver.podfile.should == @podfile
end
it "returns the locked dependencies" do
it 'returns the locked dependencies' do
@resolver.locked_dependencies.should == [Dependency.new('BlocksKit', '1.5.2')]
end
#--------------------------------------#
it "resolves the specification of the podfile" do
it 'resolves the specification of the podfile' do
target_definition = @podfile.target_definitions['Pods']
specs = @resolver.resolve[target_definition]
specs.map(&:to_s).should == [
"A2DynamicDelegate (2.0.2)",
"BlocksKit (1.5.2)",
"libffi (3.0.13)"
'A2DynamicDelegate (2.0.2)',
'BlocksKit (1.5.2)',
'libffi (3.0.13)',
]
end
it "returns the resolved specifications grouped by target definition" do
it 'returns the resolved specifications grouped by target definition' do
@resolver.resolve
target_definition = @podfile.target_definitions['Pods']
specs = @resolver.specs_by_target[target_definition]
specs.map(&:to_s).should == [
"A2DynamicDelegate (2.0.2)",
"BlocksKit (1.5.2)",
"libffi (3.0.13)"
'A2DynamicDelegate (2.0.2)',
'BlocksKit (1.5.2)',
'libffi (3.0.13)',
]
end
it "it resolves specifications from external sources" do
it 'it resolves specifications from external sources' do
podspec = fixture('integration/Reachability/Reachability.podspec')
spec = Specification.from_file(podspec)
config.sandbox.expects(:specification).with('Reachability').returns(spec)
podfile = Podfile.new do
platform :ios
pod "Reachability", :podspec => podspec
pod 'Reachability', :podspec => podspec
end
resolver = Resolver.new(config.sandbox, podfile)
resolver.resolve
......@@ -64,7 +64,7 @@ module Pod
#-------------------------------------------------------------------------#
describe "Resolution" do
describe 'Resolution' do
before do
@podfile = Podfile.new do
platform :ios, '6.0'
......@@ -73,7 +73,7 @@ module Pod
@resolver = Resolver.new(config.sandbox, @podfile)
end
it "cross resolves dependencies" do
it 'cross resolves dependencies' do
@podfile = Podfile.new do
platform :ios, '6.0'
pod 'AFNetworking', '< 0.9.2' # 0.9.1 exits
......@@ -82,36 +82,36 @@ module Pod
resolver = Resolver.new(config.sandbox, @podfile)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should == ["AFNetworking (0.9.1)", "AFQuickLookView (0.1.0)"]
specs.should == ['AFNetworking (0.9.1)', 'AFQuickLookView (0.1.0)']
end
it "holds the context state, such as cached specification sets" do
it 'holds the context state, such as cached specification sets' do
@resolver.resolve
cached_sets = @resolver.send(:cached_sets)
cached_sets.values.sort_by(&:name).should == [
SourcesManager.search_by_name('A2DynamicDelegate').first,
SourcesManager.search_by_name('BlocksKit').first,
SourcesManager.search_by_name('libffi').first
SourcesManager.search_by_name('libffi').first,
].sort_by(&:name)
end
it "raises once any of the dependencies does not match the platform of its podfile target" do
it 'raises once any of the dependencies does not match the platform of its podfile target' do
Specification.any_instance.stubs(:available_platforms).returns([Platform.new(:ios, '999')])
e = lambda { @resolver.resolve }.should.raise Informative
e.message.should.match(/platform .* not compatible/)
end
it "does not raise if all dependencies are supported by the platform of the target definition" do
it 'does not raise if all dependencies are supported by the platform of the target definition' do
lambda { @resolver.resolve }.should.not.raise
end
it "includes all the subspecs of a specification node" do
it 'includes all the subspecs of a specification node' do
@podfile = Podfile.new do
platform :ios, '7.0'
pod 'RestKit', '0.10.3'
end
resolver = Resolver.new(config.sandbox, @podfile)
resolver.resolve.values.flatten.map(&:name).sort.should == %w{
resolver.resolve.values.flatten.map(&:name).sort.should == %w(
FileMD5Hash
ISO8601DateFormatter
JSONKit
......@@ -130,10 +130,10 @@ module Pod
SOCKit
XMLReader
cocoa-oauth
}
)
end
it "handles correctly subspecs from external sources" do
it 'handles correctly subspecs from external sources' do
@podfile = Podfile.new do
platform :ios
pod 'MainSpec/FirstSubSpec', :git => 'GIT-URL'
......@@ -151,7 +151,7 @@ module Pod
config.sandbox.expects(:specification).with('MainSpec').returns(spec)
resolver = Resolver.new(config.sandbox, @podfile)
specs = resolver.resolve.values.flatten.map(&:name).sort
specs.should == %w{ MainSpec/FirstSubSpec MainSpec/FirstSubSpec/SecondSubSpec }
specs.should == %w( MainSpec/FirstSubSpec MainSpec/FirstSubSpec/SecondSubSpec )
end
it "marks a specification's version to be a HEAD version" do
......@@ -168,27 +168,27 @@ module Pod
config.sandbox.head_pod?('JSONKit').should.be.true
end
it "raises if it finds two conflicting dependencies" do
it 'raises if it finds two conflicting dependencies' do
podfile = Podfile.new do
platform :ios
pod 'JSONKit', "1.4"
pod 'JSONKit', "1.5pre"
pod 'JSONKit', '1.4'
pod 'JSONKit', '1.5pre'
end
resolver = Resolver.new(config.sandbox, podfile)
e = lambda {resolver.resolve}.should.raise Pod::Informative
e = lambda { resolver.resolve }.should.raise Pod::Informative
e.message.should.match(/Unable to satisfy the following requirements/)
end
it "takes into account locked dependencies" do
it 'takes into account locked dependencies' do
podfile = Podfile.new do
platform :ios
pod 'JSONKit', "<= 1.5pre"
pod 'JSONKit', '<= 1.5pre'
end
resolver = Resolver.new(config.sandbox, podfile)
version = resolver.resolve.values.flatten.first.version
version.to_s.should == '1.5pre'
locked_deps = [Dependency.new('JSONKit', "= 1.4")]
locked_deps = [Dependency.new('JSONKit', '= 1.4')]
resolver = Resolver.new(config.sandbox, podfile, locked_deps)
version = resolver.resolve.values.flatten.first.version
version.to_s.should == '1.4'
......@@ -197,9 +197,9 @@ module Pod
#-------------------------------------------------------------------------#
describe "Pre-release versions" do
describe 'Pre-release versions' do
it "resolves explicitly requested pre-release versions" do
it 'resolves explicitly requested pre-release versions' do
@podfile = Podfile.new do
platform :ios, '6.0'
pod 'AFNetworking', '1.0RC3'
......@@ -207,10 +207,10 @@ module Pod
resolver = Resolver.new(config.sandbox, @podfile)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should == ["AFNetworking (1.0RC3)"]
specs.should == ['AFNetworking (1.0RC3)']
end
xit "resolves to latest minor version even when explicitly requesting pre-release versions when using ~>" do
xit 'resolves to latest minor version even when explicitly requesting pre-release versions when using ~>' do
@podfile = Podfile.new do
platform :ios, '6.0'
pod 'AFNetworking', '~> 1.0RC3'
......@@ -218,11 +218,11 @@ module Pod
resolver = Resolver.new(config.sandbox, @podfile)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ["AFNetworking (1.0RC3)"]
specs.should == ["AFNetworking (1.2.0)"]
specs.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.2.0)']
end
it "does not resolve to a pre-release version implicitly when matching exact version" do
it 'does not resolve to a pre-release version implicitly when matching exact version' do
@podfile = Podfile.new do
platform :ios, '6.0'
pod 'AFNetworking', '1.0'
......@@ -230,11 +230,11 @@ module Pod
resolver = Resolver.new(config.sandbox, @podfile)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ["AFNetworking (1.0RC3)"]
specs.should == ["AFNetworking (1.0)"]
specs.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.0)']
end
xit "does not resolve to a pre-release version implicitly when using <" do
xit 'does not resolve to a pre-release version implicitly when using <' do
@podfile = Podfile.new do
platform :ios, '6.0'
pod 'AFNetworking', '< 1.0'
......@@ -242,11 +242,11 @@ module Pod
resolver = Resolver.new(config.sandbox, @podfile)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ["AFNetworking (1.0RC3)"]
specs.should == ["AFNetworking (0.10.1)"]
specs.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (0.10.1)']
end
it "does not resolve to a pre-release version implicitly when using <=" do
it 'does not resolve to a pre-release version implicitly when using <=' do
@podfile = Podfile.new do
platform :ios, '6.0'
pod 'AFNetworking', '<= 1.0'
......@@ -254,11 +254,11 @@ module Pod
resolver = Resolver.new(config.sandbox, @podfile)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ["AFNetworking (1.0RC3)"]
specs.should == ["AFNetworking (1.0)"]
specs.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.0)']
end
it "does not resolve to a pre-release version implicitly when using >" do
it 'does not resolve to a pre-release version implicitly when using >' do
@podfile = Podfile.new do
platform :ios, '6.0'
pod 'AFNetworking', '> 1.0', '< 1.3'
......@@ -266,11 +266,11 @@ module Pod
resolver = Resolver.new(config.sandbox, @podfile)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ["AFNetworking (1.0RC3)"]
specs.should == ["AFNetworking (1.2.1)"]
specs.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.2.1)']
end
it "does not resolve to a pre-release version implicitly when using >=" do
it 'does not resolve to a pre-release version implicitly when using >=' do
@podfile = Podfile.new do
platform :ios, '6.0'
pod 'AFNetworking', '>= 1.0', '< 1.3'
......@@ -278,11 +278,11 @@ module Pod
resolver = Resolver.new(config.sandbox, @podfile)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ["AFNetworking (1.0RC3)"]
specs.should == ["AFNetworking (1.2.1)"]
specs.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.2.1)']
end
it "does not resolve to a pre-release version implicitly when using ~>" do
it 'does not resolve to a pre-release version implicitly when using ~>' do
@podfile = Podfile.new do
platform :ios, '6.0'
pod 'AFNetworking', '~> 1.0', '< 1.3'
......@@ -290,8 +290,8 @@ module Pod
resolver = Resolver.new(config.sandbox, @podfile)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ["AFNetworking (1.0RC3)"]
specs.should == ["AFNetworking (1.2.1)"]
specs.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.2.1)']
end
end
end
......
......@@ -11,14 +11,14 @@ module Pod
@accessor = FileAccessor.new(@path_list, @spec_consumer)
end
describe "In general" do
describe 'In general' do
it "raises if the consumer is nil" do
it 'raises if the consumer is nil' do
e = lambda { FileAccessor.new(@path_list, nil) }.should.raise Informative
e.message.should.match /without a specification consumer/
end
it "raises if the root does not exits" do
it 'raises if the root does not exits' do
root = temporary_directory + 'missing_folder'
path_list = Sandbox::PathList.new(root)
file_accessor = FileAccessor.new(path_list, @spec_consumer)
......@@ -26,15 +26,15 @@ module Pod
e.message.should.match /non existent folder/
end
it "returns the root" do
it 'returns the root' do
@accessor.root.should == @path_list.root
end
it "returns the specification" do
it 'returns the specification' do
@accessor.spec.should == @spec
end
it "returns the platform for which the spec is being consumed" do
it 'returns the platform for which the spec is being consumed' do
@accessor.platform_name.should == :ios
end
......@@ -42,114 +42,114 @@ module Pod
#-------------------------------------------------------------------------#
describe "Returning files" do
describe 'Returning files' do
it "returns the source files" do
it 'returns the source files' do
@accessor.source_files.sort.should == [
@root + "Classes/Banana.h",
@root + "Classes/Banana.m",
@root + "Classes/BananaPrivate.h",
@root + "Classes/BananaTrace.d"
@root + 'Classes/Banana.h',
@root + 'Classes/Banana.m',
@root + 'Classes/BananaPrivate.h',
@root + 'Classes/BananaTrace.d',
]
end
it "returns the header files" do
it 'returns the header files' do
@accessor.headers.sort.should == [
@root + "Classes/Banana.h",
@root + "Classes/BananaPrivate.h"
@root + 'Classes/Banana.h',
@root + 'Classes/BananaPrivate.h',
]
end
it "returns the public headers" do
it 'returns the public headers' do
@accessor.public_headers.sort.should == [
@root + "Classes/Banana.h"
@root + 'Classes/Banana.h',
]
end
it "returns all the headers if no public headers are defined" do
it 'returns all the headers if no public headers are defined' do
@spec_consumer.stubs(:public_header_files).returns([])
@accessor.public_headers.sort.should == [
@root + "Classes/Banana.h",
@root + "Classes/BananaPrivate.h"
@root + 'Classes/Banana.h',
@root + 'Classes/BananaPrivate.h',
]
end
it "filters the private headers form the public headers" do
it 'filters the private headers form the public headers' do
@spec_consumer.stubs(:public_header_files).returns([])
@spec_consumer.stubs(:private_header_files).returns(['**/*Private*'])
@accessor.public_headers.sort.should == [
@root + "Classes/Banana.h",
@root + 'Classes/Banana.h',
]
end
it "returns the resources" do
it 'returns the resources' do
@accessor.resources.sort.should == [
@root + "Resources/logo-sidebar.png",
@root + "Resources/sub_dir",
@root + 'Resources/logo-sidebar.png',
@root + 'Resources/sub_dir',
]
end
it "includes folders in the resources" do
@accessor.resources.should.include?(@root + "Resources/sub_dir")
it 'includes folders in the resources' do
@accessor.resources.should.include?(@root + 'Resources/sub_dir')
end
it "returns the preserve paths" do
it 'returns the preserve paths' do
@accessor.preserve_paths.sort.should == [
@root + "preserve_me.txt"
@root + 'preserve_me.txt',
]
end
it "includes folders in the preserve paths" do
@spec_consumer.stubs(:preserve_paths).returns(["Resources"])
@accessor.preserve_paths.should.include?(@root + "Resources")
it 'includes folders in the preserve paths' do
@spec_consumer.stubs(:preserve_paths).returns(['Resources'])
@accessor.preserve_paths.should.include?(@root + 'Resources')
end
it "returns the paths of the framework bundles" do
@accessor.vendored_frameworks.should.include?(@root + "Bananalib.framework")
it 'returns the paths of the framework bundles' do
@accessor.vendored_frameworks.should.include?(@root + 'Bananalib.framework')
end
it "returns the paths of the library files" do
@accessor.vendored_libraries.should.include?(@root + "libBananalib.a")
it 'returns the paths of the library files' do
@accessor.vendored_libraries.should.include?(@root + 'libBananalib.a')
end
it "returns the resource bundles of the pod" do
@spec_consumer.stubs(:resource_bundles).returns({"BananaLib" => "Resources/*"})
it 'returns the resource bundles of the pod' do
@spec_consumer.stubs(:resource_bundles).returns('BananaLib' => 'Resources/*')
resource_paths = [
@root + "Resources/logo-sidebar.png",
@root + "Resources/sub_dir",
@root + 'Resources/logo-sidebar.png',
@root + 'Resources/sub_dir',
]
@accessor.resource_bundles.should == { "BananaLib" => resource_paths }
@accessor.resource_bundles.should == { 'BananaLib' => resource_paths }
end
it "returns the paths of the files of the resource bundles" do
@spec_consumer.stubs(:resource_bundles).returns({"BananaLib" => "Resources/*"})
it 'returns the paths of the files of the resource bundles' do
@spec_consumer.stubs(:resource_bundles).returns('BananaLib' => 'Resources/*')
resource_paths = [
@root + "Resources/logo-sidebar.png",
@root + "Resources/sub_dir",
@root + 'Resources/logo-sidebar.png',
@root + 'Resources/sub_dir',
]
@accessor.resource_bundle_files.should == resource_paths
end
it "returns the prefix header of the specification" do
it 'returns the prefix header of the specification' do
@accessor.prefix_header.should == @root + 'Classes/BananaLib.pch'
end
it "returns the README file of the specification" do
it 'returns the README file of the specification' do
@accessor.readme.should == @root + 'README'
end
it "returns the license file of the specification" do
it 'returns the license file of the specification' do
@accessor.license.should == @root + 'LICENSE'
end
#--------------------------------------#
it "respects the exclude files" do
@spec_consumer.stubs(:exclude_files).returns(["Classes/BananaPrivate.h"])
it 'respects the exclude files' do
@spec_consumer.stubs(:exclude_files).returns(['Classes/BananaPrivate.h'])
@accessor.source_files.sort.should == [
@root + "Classes/Banana.h",
@root + "Classes/Banana.m",
@root + "Classes/BananaTrace.d"
@root + 'Classes/Banana.h',
@root + 'Classes/Banana.m',
@root + 'Classes/BananaTrace.d',
]
end
......@@ -157,15 +157,15 @@ module Pod
#-------------------------------------------------------------------------#
describe "Private helpers" do
describe 'Private helpers' do
describe "#paths_for_attribute" do
describe '#paths_for_attribute' do
it "takes into account dir patterns and excluded files" do
file_patterns = ["Classes/*.{h,m,d}", "Vendor"]
it 'takes into account dir patterns and excluded files' do
file_patterns = ['Classes/*.{h,m,d}', 'Vendor']
options = {
:exclude_patterns => ["Classes/**/osx/**/*", "Resources/**/osx/**/*"],
:dir_pattern => "*.{h,hpp,hh,m,mm,c,cpp}",
:exclude_patterns => ['Classes/**/osx/**/*', 'Resources/**/osx/**/*'],
:dir_pattern => '*.{h,hpp,hh,m,mm,c,cpp}',
:include_dirs => false,
}
@spec.exclude_files = options[:exclude_patterns]
......
......@@ -13,38 +13,38 @@ module Pod
end
it "can add namespaced headers to it's header path using symlinks and return the relative path" do
FileUtils.mkdir_p(@sandbox.root + "ExampleLib/")
namespace_path = Pathname.new("ExampleLib")
FileUtils.mkdir_p(@sandbox.root + 'ExampleLib/')
namespace_path = Pathname.new('ExampleLib')
relative_header_paths = [
Pathname.new("ExampleLib/MyHeader.h"),
Pathname.new("ExampleLib/MyOtherHeader.h")
Pathname.new('ExampleLib/MyHeader.h'),
Pathname.new('ExampleLib/MyOtherHeader.h'),
]
relative_header_paths.each do |path|
File.open(@sandbox.root + path, "w") { |file| file.write('hello') }
File.open(@sandbox.root + path, 'w') { |file| file.write('hello') }
end
symlink_paths = @header_dir.add_files(namespace_path, relative_header_paths)
symlink_paths.each do |path|
path.should.be.symlink
File.read(path).should == "hello"
File.read(path).should == 'hello'
end
end
it 'keeps a list of unique header search paths when headers are added' do
FileUtils.mkdir_p(@sandbox.root + "ExampleLib/Dir")
namespace_path = Pathname.new("ExampleLib")
FileUtils.mkdir_p(@sandbox.root + 'ExampleLib/Dir')
namespace_path = Pathname.new('ExampleLib')
relative_header_paths = [
Pathname.new("ExampleLib/Dir/MyHeader.h"),
Pathname.new("ExampleLib/Dir/MyOtherHeader.h")
Pathname.new('ExampleLib/Dir/MyHeader.h'),
Pathname.new('ExampleLib/Dir/MyOtherHeader.h'),
]
relative_header_paths.each do |path|
File.open(@sandbox.root + path, "w") { |file| file.write('hello') }
File.open(@sandbox.root + path, 'w') { |file| file.write('hello') }
end
@header_dir.add_files(namespace_path, relative_header_paths)
@header_dir.search_paths.should.include("${PODS_ROOT}/Headers/ExampleLib")
@header_dir.search_paths.should.include('${PODS_ROOT}/Headers/ExampleLib')
end
it 'always adds the Headers root to the header search paths' do
@header_dir.search_paths.should.include("${PODS_ROOT}/Headers")
@header_dir.search_paths.should.include('${PODS_ROOT}/Headers')
end
end
end
......@@ -7,14 +7,14 @@ module Pod
@path_list = Sandbox::PathList.new(fixture('banana-lib'))
end
describe "In general" do
describe 'In general' do
it "creates the list of all the files" do
it 'creates the list of all the files' do
files = @path_list.files
files.reject! do |f|
f.include?('libPusher') || f.include?('.git') || f.include?('DS_Store')
end
expected = %w[
expected = %w(
BananaLib.podspec
Classes/Banana.h
Classes/Banana.m
......@@ -27,109 +27,109 @@ module Pod
libBananalib.a
preserve_me.txt
sub-dir/sub-dir-2/somefile.txt
]
)
files.sort.should == expected
end
it "creates the list of the directories" do
it 'creates the list of the directories' do
dirs = @path_list.dirs
dirs.reject! do |f|
f.include?('libPusher') || f.include?('.git')
end
dirs.sort.should == %w| Bananalib.framework Classes Resources Resources/sub_dir sub-dir sub-dir/sub-dir-2 |
dirs.sort.should == %w( Bananalib.framework Classes Resources Resources/sub_dir sub-dir sub-dir/sub-dir-2 )
end
it "handles directories with glob metacharacters" do
it 'handles directories with glob metacharacters' do
root = temporary_directory + '[CP] Test'
root.mkpath
FileUtils.touch(root + 'Class.h')
@path_list = Sandbox::PathList.new(root)
@path_list.files.should == ["Class.h"]
@path_list.files.should == ['Class.h']
end
end
#-------------------------------------------------------------------------#
describe "Globbing" do
it "can glob the root for a given pattern" do
describe 'Globbing' do
it 'can glob the root for a given pattern' do
paths = @path_list.relative_glob('Classes/*.{h,m}').map(&:to_s)
paths.sort.should == %w[
paths.sort.should == %w(
Classes/Banana.h
Classes/Banana.m
Classes/BananaPrivate.h
]
)
end
it "can return the absolute paths from glob" do
it 'can return the absolute paths from glob' do
paths = @path_list.glob('Classes/*.{h,m}')
paths.all? { |p| p.absolute? }.should == true
end
it "can return the relative paths from glob" do
it 'can return the relative paths from glob' do
paths = @path_list.relative_glob('Classes/*.{h,m}')
paths.any? { |p| p.absolute? }.should == false
end
it "supports the `**` glob pattern" do
it 'supports the `**` glob pattern' do
paths = @path_list.relative_glob('Classes/**/*.{h,m}').map(&:to_s)
paths.sort.should == %w[
paths.sort.should == %w(
Classes/Banana.h
Classes/Banana.m
Classes/BananaPrivate.h
]
)
end
it "supports an optional pattern for globbing directories" do
paths = @path_list.relative_glob('Classes', { :dir_pattern => '*.{h,m}'} ).map(&:to_s)
paths.sort.should == %w[
it 'supports an optional pattern for globbing directories' do
paths = @path_list.relative_glob('Classes', :dir_pattern => '*.{h,m}').map(&:to_s)
paths.sort.should == %w(
Classes/Banana.h
Classes/Banana.m
Classes/BananaPrivate.h
]
)
end
it "handles directories specified with a trailing slash" do
paths = @path_list.relative_glob('Classes/', { :dir_pattern => '*.{h,m}'} ).map(&:to_s)
paths.sort.should == %w[
it 'handles directories specified with a trailing slash' do
paths = @path_list.relative_glob('Classes/', :dir_pattern => '*.{h,m}').map(&:to_s)
paths.sort.should == %w(
Classes/Banana.h
Classes/Banana.m
Classes/BananaPrivate.h
]
)
end
it "supports an optional list of patterns to exclude" do
it 'supports an optional list of patterns to exclude' do
exclude_patterns = ['**/*.m', '**/*Private*.*']
paths = @path_list.relative_glob('Classes/*', { :exclude_patterns => exclude_patterns }).map(&:to_s)
paths.sort.should == %w[
paths = @path_list.relative_glob('Classes/*', :exclude_patterns => exclude_patterns).map(&:to_s)
paths.sort.should == %w(
Classes/Banana.h
Classes/BananaLib.pch
Classes/BananaTrace.d
]
)
end
it "allows to specify folders in the exclude patterns" do
paths = @path_list.relative_glob('Classes/*', { :exclude_patterns => 'Classes' }).map(&:to_s)
it 'allows to specify folders in the exclude patterns' do
paths = @path_list.relative_glob('Classes/*', :exclude_patterns => 'Classes').map(&:to_s)
paths.sort.should.be.empty
end
it "can optionally include the directories in the results" do
paths = @path_list.relative_glob('Resources/*', { :include_dirs => true }).map(&:to_s)
paths.sort.should == %w[
it 'can optionally include the directories in the results' do
paths = @path_list.relative_glob('Resources/*', :include_dirs => true).map(&:to_s)
paths.sort.should == %w(
Resources/logo-sidebar.png
Resources/sub_dir
]
)
end
end
#-------------------------------------------------------------------------#
describe "Private Helpers" do
describe 'Private Helpers' do
describe "#directory?" do
it "detects a directory" do
describe '#directory?' do
it 'detects a directory' do
@path_list.send(:directory?, 'classes').should == true
end
......@@ -140,39 +140,39 @@ module Pod
#--------------------------------------#
describe "#directory?" do
it "expands a pattern into all the combinations of Dir#glob literals" do
describe '#directory?' do
it 'expands a pattern into all the combinations of Dir#glob literals' do
patterns = @path_list.send(:dir_glob_equivalent_patterns, '{file1,file2}.{h,m}')
patterns.sort.should == %w[ file1.h file1.m file2.h file2.m ]
patterns.sort.should == %w( file1.h file1.m file2.h file2.m )
end
it "returns the original pattern if there are no Dir#glob expansions" do
it 'returns the original pattern if there are no Dir#glob expansions' do
patterns = @path_list.send(:dir_glob_equivalent_patterns, 'file*.*')
patterns.sort.should == %w[ file*.* ]
patterns.sort.should == %w( file*.* )
end
it "expands `**`" do
it 'expands `**`' do
patterns = @path_list.send(:dir_glob_equivalent_patterns, 'Classes/**/file.m')
patterns.sort.should == %w[ Classes/**/file.m Classes/file.m ]
patterns.sort.should == %w( Classes/**/file.m Classes/file.m )
end
it "supports a combination of `**` and literals" do
it 'supports a combination of `**` and literals' do
patterns = @path_list.send(:dir_glob_equivalent_patterns, 'Classes/**/file.{h,m}')
patterns.sort.should == %w[
patterns.sort.should == %w(
Classes/**/file.h
Classes/**/file.m
Classes/file.h
Classes/file.m
]
)
end
end
#--------------------------------------#
describe "#escape_path_for_glob" do
describe '#escape_path_for_glob' do
it "escapes metacharacters" do
it 'escapes metacharacters' do
escaped = @path_list.send(:escape_path_for_glob, '[]{}?**')
escaped.to_s.should == '\[\]\{\}\?\*\*'
end
......
......@@ -9,9 +9,9 @@ module Pod
#-------------------------------------------------------------------------#
describe "In general" do
describe 'In general' do
it "reads the real path of the root so it can be used to build relative paths" do
it 'reads the real path of the root so it can be used to build relative paths' do
root_realpath = temporary_directory + 'Folder/SubFolder'
FileUtils.mkdir_p(root_realpath)
symlink = temporary_directory + 'symlink'
......@@ -24,24 +24,24 @@ module Pod
File.directory?(temporary_directory + 'Sandbox').should.be.true
end
it "returns the manifest" do
@sandbox.manifest.should == nil
it 'returns the manifest' do
@sandbox.manifest.should.nil?
end
it "returns the project" do
@sandbox.project.should == nil
it 'returns the project' do
@sandbox.project.should.nil?
end
it "returns the public headers store" do
it 'returns the public headers store' do
@sandbox.public_headers.root.should == temporary_directory + 'Sandbox/Headers'
end
it "deletes the entire root directory on implode" do
it 'deletes the entire root directory on implode' do
@sandbox.implode
File.directory?(temporary_directory + 'Sandbox').should.be.false
end
it "cleans any trace of the Pod with the given name" do
it 'cleans any trace of the Pod with the given name' do
pod_root = @sandbox.root + 'BananaLib'
pod_root.mkpath
@sandbox.store_podspec('BananaLib', fixture('banana-lib/BananaLib.podspec'))
......@@ -63,51 +63,51 @@ module Pod
#-------------------------------------------------------------------------#
describe "Paths" do
describe 'Paths' do
it "returns the path of the manifest" do
it 'returns the path of the manifest' do
@sandbox.manifest_path.should == temporary_directory + 'Sandbox/Manifest.lock'
end
it "returns the path of the Pods project" do
it 'returns the path of the Pods project' do
@sandbox.project_path.should == temporary_directory + 'Sandbox/Pods.xcodeproj'
end
it "returns the directory for the support files of a library" do
it 'returns the directory for the support files of a library' do
@sandbox.library_support_files_dir('Pods').should == temporary_directory + 'Sandbox'
end
it "returns the directory where a Pod is stored" do
it 'returns the directory where a Pod is stored' do
@sandbox.pod_dir('JSONKit').should == temporary_directory + 'Sandbox/JSONKit'
end
it "returns the directory where a local Pod is stored" do
it 'returns the directory where a local Pod is stored' do
@sandbox.store_local_path('BananaLib', Pathname.new('Some Path'))
@sandbox.pod_dir('BananaLib').should.be == Pathname.new('Some Path')
end
it "returns the directory where to store the documentation" do
it 'returns the directory where to store the documentation' do
@sandbox.documentation_dir.should == temporary_directory + 'Sandbox/Documentation'
end
it "handles symlinks in /tmp" do
tmp_sandbox = Pod::Sandbox.new("/tmp/CocoaPods")
tmp_sandbox.root.should.be == Pathname.new("/private/tmp/CocoaPods")
it 'handles symlinks in /tmp' do
tmp_sandbox = Pod::Sandbox.new('/tmp/CocoaPods')
tmp_sandbox.root.should.be == Pathname.new('/private/tmp/CocoaPods')
tmp_sandbox.implode
end
end
#-------------------------------------------------------------------------#
describe "Specification store" do
describe 'Specification store' do
it "loads the stored specification with the given name" do
it 'loads the stored specification with the given name' do
(@sandbox.root + 'Local Podspecs').mkdir
FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.root + 'Local Podspecs')
@sandbox.specification('BananaLib').name.should == 'BananaLib'
end
it "loads the stored specification from the original path" do
it 'loads the stored specification from the original path' do
spec_file = fixture('banana-lib/BananaLib.podspec')
spec = Specification.from_file(spec_file)
Specification.expects(:from_file).with do
......@@ -119,7 +119,7 @@ module Pod
@sandbox.specification('BananaLib')
end
it "returns the directory where to store the specifications" do
it 'returns the directory where to store the specifications' do
@sandbox.specifications_dir.should == temporary_directory + 'Sandbox/Local Podspecs'
end
......@@ -129,14 +129,14 @@ module Pod
@sandbox.specification_path('BananaLib').should == @sandbox.root + 'Local Podspecs/BananaLib.podspec'
end
it "stores a podspec with a given path into the sandbox" do
it 'stores a podspec with a given path into the sandbox' do
@sandbox.store_podspec('BananaLib', fixture('banana-lib/BananaLib.podspec'))
path = @sandbox.root + 'Local Podspecs/BananaLib.podspec'
path.should.exist
@sandbox.specification_path('BananaLib').should == path
end
it "stores a podspec with the given string into the sandbox" do
it 'stores a podspec with the given string into the sandbox' do
podspec_string = fixture('banana-lib/BananaLib.podspec').read
@sandbox.store_podspec('BananaLib', podspec_string)
path = @sandbox.root + 'Local Podspecs/BananaLib.podspec'
......@@ -148,14 +148,14 @@ module Pod
#-------------------------------------------------------------------------#
describe "Pods information" do
describe 'Pods information' do
it "stores the list of the names of the pre-downloaded pods" do
it 'stores the list of the names of the pre-downloaded pods' do
@sandbox.store_pre_downloaded_pod('BananaLib')
@sandbox.predownloaded_pods.should == ['BananaLib']
end
it "returns whether a Pod has been pre-downloaded" do
it 'returns whether a Pod has been pre-downloaded' do
@sandbox.predownloaded_pods << 'BananaLib'
@sandbox.predownloaded?('BananaLib').should.be.true
@sandbox.predownloaded?('BananaLib/Subspec').should.be.true
......@@ -164,12 +164,12 @@ module Pod
#--------------------------------------#
it "stores the list of the names of the pre-downloaded pods" do
it 'stores the list of the names of the pre-downloaded pods' do
@sandbox.store_head_pod('BananaLib')
@sandbox.head_pods.should == ['BananaLib']
end
it "returns whether a Pod has been pre-downloaded" do
it 'returns whether a Pod has been pre-downloaded' do
@sandbox.head_pods << 'BananaLib'
@sandbox.head_pod?('BananaLib').should.be.true
@sandbox.head_pod?('BananaLib/Subspec').should.be.true
......@@ -178,36 +178,36 @@ module Pod
#--------------------------------------#
it "returns the checkout sources of the Pods" do
it 'returns the checkout sources of the Pods' do
@sandbox.store_pre_downloaded_pod('BananaLib/Subspec')
@sandbox.predownloaded_pods.should == ['BananaLib']
end
it "stores the checkout source of a Pod" do
source = {:git => 'example.com', :commit => 'SHA'}
@sandbox.store_checkout_source('BananaLib/Subspec', source )
it 'stores the checkout source of a Pod' do
source = { :git => 'example.com', :commit => 'SHA' }
@sandbox.store_checkout_source('BananaLib/Subspec', source)
@sandbox.checkout_sources['BananaLib'].should == source
end
it "returns the checkout sources of the Pods" do
source = {:git => 'example.com', :commit => 'SHA'}
@sandbox.store_checkout_source('BananaLib', source )
it 'returns the checkout sources of the Pods' do
source = { :git => 'example.com', :commit => 'SHA' }
@sandbox.store_checkout_source('BananaLib', source)
@sandbox.checkout_sources.should == { 'BananaLib' => source }
end
#--------------------------------------#
it "stores the local path of a Pod" do
it 'stores the local path of a Pod' do
@sandbox.store_local_path('BananaLib/Subspec', Pathname.new('Some Path'))
@sandbox.development_pods['BananaLib'].should == 'Some Path'
end
it "returns the path of the local pods grouped by name" do
it 'returns the path of the local pods grouped by name' do
@sandbox.store_local_path('BananaLib', 'Some Path')
@sandbox.development_pods.should == { 'BananaLib' => 'Some Path' }
end
it "returns whether a Pod is local" do
it 'returns whether a Pod is local' do
@sandbox.store_local_path('BananaLib', Pathname.new('Some Path'))
@sandbox.local?('BananaLib').should.be.true
@sandbox.local?('BananaLib/Subspec').should.be.true
......
......@@ -2,26 +2,26 @@ require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe AggregateTarget do
describe "In general" do
describe 'In general' do
before do
@target_definition = Podfile::TargetDefinition.new('Pods', nil)
@target_definition.link_with_first_target = true
@target = AggregateTarget.new(@target_definition, config.sandbox)
end
it "returns the target_definition that generated it" do
it 'returns the target_definition that generated it' do
@target.target_definition.should == @target_definition
end
it "returns the label of the target definition" do
it 'returns the label of the target definition' do
@target.label.should == 'Pods'
end
it "returns its name" do
it 'returns its name' do
@target.name.should == 'Pods'
end
it "returns the name of its product" do
it 'returns the name of its product' do
@target.product_name.should == 'libPods.a'
end
......@@ -35,7 +35,7 @@ module Pod
end
end
describe "Support files" do
describe 'Support files' do
before do
@target_definition = Podfile::TargetDefinition.new('Pods', nil)
@target_definition.link_with_first_target = true
......@@ -43,40 +43,40 @@ module Pod
@target.client_root = config.sandbox.root.dirname
end
it "returns the absolute path of the xcconfig file" do
@target.xcconfig_path("Release").to_s.should.include?('Pods/Pods.release.xcconfig')
it 'returns the absolute path of the xcconfig file' do
@target.xcconfig_path('Release').to_s.should.include?('Pods/Pods.release.xcconfig')
end
it "returns the absolute path of the resources script" do
it 'returns the absolute path of the resources script' do
@target.copy_resources_script_path.to_s.should.include?('Pods/Pods-resources.sh')
end
it "returns the absolute path of the target header file" do
it 'returns the absolute path of the target header file' do
@target.target_environment_header_path.to_s.should.include?('Pods/Pods-environment.h')
end
it "returns the absolute path of the prefix header file" do
it 'returns the absolute path of the prefix header file' do
@target.prefix_header_path.to_s.should.include?('Pods/Pods-prefix.pch')
end
it "returns the absolute path of the bridge support file" do
it 'returns the absolute path of the bridge support file' do
@target.bridge_support_path.to_s.should.include?('Pods/Pods.bridgesupport')
end
it "returns the absolute path of the acknowledgements files without extension" do
it 'returns the absolute path of the acknowledgements files without extension' do
@target.acknowledgements_basepath.to_s.should.include?('Pods/Pods-acknowledgements')
end
it "returns the path of the resources script relative to the user project" do
it 'returns the path of the resources script relative to the user project' do
@target.copy_resources_script_relative_path.should == '${SRCROOT}/Pods/Pods-resources.sh'
end
it "returns the path of the xcconfig file relative to the user project" do
@target.xcconfig_relative_path("Release").should == 'Pods/Pods.release.xcconfig'
it 'returns the path of the xcconfig file relative to the user project' do
@target.xcconfig_relative_path('Release').should == 'Pods/Pods.release.xcconfig'
end
end
describe "Pod targets" do
describe 'Pod targets' do
before do
@spec = fixture_spec('banana-lib/BananaLib.podspec')
@target_definition = Podfile::TargetDefinition.new('Pods', nil)
......@@ -86,33 +86,33 @@ module Pod
@target.pod_targets = [@pod_target]
end
it "returns pod targets by build configuration" do
it 'returns pod targets by build configuration' do
pod_target_release = PodTarget.new([@spec], @target_definition, config.sandbox)
pod_target_release.expects(:include_in_build_config?).with("Debug").returns(false)
pod_target_release.expects(:include_in_build_config?).with("Release").returns(true)
pod_target_release.expects(:include_in_build_config?).with('Debug').returns(false)
pod_target_release.expects(:include_in_build_config?).with('Release').returns(true)
@target.pod_targets = [@pod_target, pod_target_release]
@target.user_build_configurations = {
"Debug" => :debug,
"Release" => :release
'Debug' => :debug,
'Release' => :release,
}
expected = {
"Debug" => @pod_target.specs,
"Release" => (@pod_target.specs + pod_target_release.specs)
'Debug' => @pod_target.specs,
'Release' => (@pod_target.specs + pod_target_release.specs),
}
@target.specs_by_build_configuration.should == expected
end
it "returns the specs of the Pods used by this aggregate target" do
@target.specs.map(&:name).should == ["BananaLib"]
it 'returns the specs of the Pods used by this aggregate target' do
@target.specs.map(&:name).should == ['BananaLib']
end
it "returns the specs of the Pods used by this aggregate target" do
@target.specs.map(&:name).should == ["BananaLib"]
it 'returns the specs of the Pods used by this aggregate target' do
@target.specs.map(&:name).should == ['BananaLib']
end
it "returns the spec consumers for the pod targets" do
consumer_reps = @target.spec_consumers.map { |consumer| [consumer.spec.name, consumer.platform_name ] }
consumer_reps.should == [["BananaLib", :ios]]
it 'returns the spec consumers for the pod targets' do
consumer_reps = @target.spec_consumers.map { |consumer| [consumer.spec.name, consumer.platform_name] }
consumer_reps.should == [['BananaLib', :ios]]
end
end
end
......
......@@ -9,48 +9,48 @@ module Pod
@pod_target.stubs(:platform).returns(:ios)
end
describe "In general" do
it "returns the target_definition that generated it" do
describe 'In general' do
it 'returns the target_definition that generated it' do
@pod_target.target_definition.should == @target_definition
end
it "returns its name" do
it 'returns its name' do
@pod_target.name.should == 'Pods-BananaLib'
end
it "returns the name of its product" do
it 'returns the name of its product' do
@pod_target.product_name.should == 'libPods-BananaLib.a'
end
it "returns the spec consumers for the pod targets" do
@pod_target.spec_consumers.should.not == nil
it 'returns the spec consumers for the pod targets' do
@pod_target.spec_consumers.should.not.nil?
end
it "returns the root spec" do
it 'returns the root spec' do
@pod_target.root_spec.name.should == 'BananaLib'
end
it "returns the name of the Pod" do
it 'returns the name of the Pod' do
@pod_target.pod_name.should == 'BananaLib'
end
it "returns the name of the Pods on which this target depends" do
@pod_target.dependencies.should == ["monkey"]
it 'returns the name of the Pods on which this target depends' do
@pod_target.dependencies.should == ['monkey']
end
it "returns whether it is whitelisted in a build configuration" do
it 'returns whether it is whitelisted in a build configuration' do
@target_definition.store_pod('BananaLib')
@target_definition.whitelist_pod_for_configuration('BananaLib', 'debug')
@pod_target.include_in_build_config?('Debug').should.be.true
@pod_target.include_in_build_config?('Release').should.be.false
end
it "is whitelisted on all build configurations of it is a dependency of other Pods" do
it 'is whitelisted on all build configurations of it is a dependency of other Pods' do
@pod_target.include_in_build_config?('Debug').should.be.true
@pod_target.include_in_build_config?('Release').should.be.true
end
it "raises if a Pod is whitelisted for different build configurations" do
it 'raises if a Pod is whitelisted for different build configurations' do
@target_definition.store_pod('BananaLib')
@target_definition.store_pod('BananaLib/Subspec')
@target_definition.whitelist_pod_for_configuration('BananaLib', 'debug')
......@@ -60,24 +60,24 @@ module Pod
end
end
describe "Support files" do
it "returns the absolute path of the xcconfig file" do
@pod_target.xcconfig_path("Release").to_s.should.include 'Pods/Pods-BananaLib.release.xcconfig'
describe 'Support files' do
it 'returns the absolute path of the xcconfig file' do
@pod_target.xcconfig_path('Release').to_s.should.include 'Pods/Pods-BananaLib.release.xcconfig'
end
it "returns the absolute path of the target header file" do
it 'returns the absolute path of the target header file' do
@pod_target.target_environment_header_path.to_s.should.include 'Pods/Pods-environment.h'
end
it "returns the absolute path of the prefix header file" do
it 'returns the absolute path of the prefix header file' do
@pod_target.prefix_header_path.to_s.should.include 'Pods/Pods-BananaLib-prefix.pch'
end
it "returns the absolute path of the bridge support file" do
it 'returns the absolute path of the bridge support file' do
@pod_target.bridge_support_path.to_s.should.include 'Pods/Pods-BananaLib.bridgesupport'
end
it "returns the absolute path of the public and private xcconfig files" do
it 'returns the absolute path of the public and private xcconfig files' do
@pod_target.xcconfig_path.to_s.should.include 'Pods/Pods-BananaLib.xcconfig'
@pod_target.xcconfig_private_path.to_s.should.include 'Pods/Pods-BananaLib-Private.xcconfig'
end
......
......@@ -77,7 +77,7 @@ EOS
EOS
@report.stubs(:host_information).returns(':host_information')
@report.stubs(:xcode_information).returns(':xcode_information')
@report.stubs(:repo_information).returns(['repo_1', 'repo_2'])
@report.stubs(:repo_information).returns(%w(repo_1 repo_2))
report = remove_color(@report.report(@exception))
report.should == expected
end
......
......@@ -6,7 +6,7 @@ module Bacon
alias_method :after_webmock, :after
def after(&block)
after_webmock do
block.call()
block.call
WebMock.reset!
end
end
......@@ -24,7 +24,7 @@ module Pod
#
def write_podspec(text, name = 'JSONKit.podspec.json')
file = temporary_directory + name
File.open(file, 'w') {|f| f.write(text) }
File.open(file, 'w') { |f| f.write(text) }
file
end
......@@ -45,8 +45,8 @@ module Pod
#-------------------------------------------------------------------------#
describe "Quick mode" do
it "validates a correct podspec" do
describe 'Quick mode' do
it 'validates a correct podspec' do
sut = Validator.new(podspec_path)
sut.quick = true
sut.validate
......@@ -54,7 +54,7 @@ module Pod
sut.validated?.should.be.true
end
it "lints the podspec during validation" do
it 'lints the podspec during validation' do
podspec = stub_podspec(/.*name.*/, '"name": "TEST",')
file = write_podspec(podspec)
sut = Validator.new(file)
......@@ -64,7 +64,7 @@ module Pod
sut.validated?.should.be.false
end
it "respects quick mode" do
it 'respects quick mode' do
file = write_podspec(stub_podspec)
sut = Validator.new(file)
sut.quick = true
......@@ -72,7 +72,7 @@ module Pod
sut.validate
end
it "respects the only errors option" do
it 'respects the only errors option' do
podspec = stub_podspec(/.*summary.*/, '"summary": "A short description of",')
file = write_podspec(podspec)
sut = Validator.new(file)
......@@ -83,21 +83,21 @@ module Pod
sut.validated?.should.be.true
end
it "handles symlinks" do
it 'handles symlinks' do
file = write_podspec(stub_podspec)
validator = Validator.new(file)
validator.quick = true
validator.stubs(:validate_url)
validator.validate
validator.validation_dir.should.be == Pathname.new("/private/tmp/CocoaPods/Lint")
validator.validation_dir.should.be == Pathname.new('/private/tmp/CocoaPods/Lint')
end
end
#-------------------------------------------------------------------------#
describe "Extensive analysis" do
describe 'Extensive analysis' do
describe "URL validation" do
describe 'URL validation' do
before do
@sut = Validator.new(podspec_path)
@sut.stubs(:install_pod)
......@@ -108,61 +108,61 @@ module Pod
WebMock::API.stub_request(:get, /not-found/).to_return(:status => 404)
end
describe "Homepage validation" do
it "checks if the homepage is valid" do
describe 'Homepage validation' do
it 'checks if the homepage is valid' do
Specification.any_instance.stubs(:homepage).returns('http://banana-corp.local/not-found/')
@sut.validate
@sut.results.map(&:to_s).first.should.match /The URL (.*) is not reachable/
end
it "indicates if it was not able to validate the homepage" do
it 'indicates if it was not able to validate the homepage' do
WebMock::API.stub_request(:head, 'banana-corp.local').to_raise(SocketError)
Specification.any_instance.stubs(:homepage).returns('http://banana-corp.local/')
@sut.validate
@sut.results.map(&:to_s).first.should.match /There was a problem validating the URL/
end
it "does not fail if the homepage redirects" do
it 'does not fail if the homepage redirects' do
WebMock::API.stub_request(:head, /redirect/).to_return(
:status => 301, :headers => { 'Location' => 'http://banana-corp.local/found/' } )
WebMock::API.stub_request(:head, /found/).to_return( :status => 200 )
:status => 301, :headers => { 'Location' => 'http://banana-corp.local/found/' })
WebMock::API.stub_request(:head, /found/).to_return(:status => 200)
Specification.any_instance.stubs(:homepage).returns('http://banana-corp.local/redirect/')
@sut.validate
@sut.results.length.should.equal 0
end
it "does not fail if the homepage does not support HEAD" do
WebMock::API.stub_request(:head, /page/).to_return( :status => 405 )
WebMock::API.stub_request(:get, /page/).to_return( :status => 200 )
it 'does not fail if the homepage does not support HEAD' do
WebMock::API.stub_request(:head, /page/).to_return(:status => 405)
WebMock::API.stub_request(:get, /page/).to_return(:status => 200)
Specification.any_instance.stubs(:homepage).returns('http://banana-corp.local/page/')
@sut.validate
@sut.results.length.should.equal 0
end
it "does not fail if the homepage errors on HEAD" do
WebMock::API.stub_request(:head, /page/).to_return( :status => 500 )
WebMock::API.stub_request(:get, /page/).to_return( :status => 200 )
it 'does not fail if the homepage errors on HEAD' do
WebMock::API.stub_request(:head, /page/).to_return(:status => 500)
WebMock::API.stub_request(:get, /page/).to_return(:status => 200)
Specification.any_instance.stubs(:homepage).returns('http://banana-corp.local/page/')
@sut.validate
@sut.results.length.should.equal 0
end
it "does not follow redirects infinitely" do
it 'does not follow redirects infinitely' do
WebMock::API.stub_request(:head, /redirect/).to_return(
:status => 301,
:headers => { 'Location' => 'http://banana-corp.local/redirect/' } )
:headers => { 'Location' => 'http://banana-corp.local/redirect/' })
Specification.any_instance.stubs(:homepage).returns(
'http://banana-corp.local/redirect/')
@sut.validate
@sut.results.map(&:to_s).first.should.match /The URL \(.*\) is not reachable/
end
it "supports relative redirects" do
it 'supports relative redirects' do
WebMock::API.stub_request(:head, /redirect/).to_return(
:status => 302,
:headers => { 'Location' => '/foo' })
WebMock::API.stub_request(:head, /foo/).to_return(
:status => 200 )
:status => 200)
Specification.any_instance.stubs(:homepage).returns(
'http://banana-corp.local/redirect')
@sut.validate
......@@ -170,19 +170,19 @@ module Pod
end
end
describe "Screenshot validation" do
describe 'Screenshot validation' do
before do
@sut.stubs(:validate_homepage)
WebMock::API.stub_request(:head, 'banana-corp.local/valid-image.png').to_return(:status => 200, :headers => { 'Content-Type' => 'image/png' })
end
it "checks if the screenshots are valid" do
it 'checks if the screenshots are valid' do
Specification.any_instance.stubs(:screenshots).returns(['http://banana-corp.local/valid-image.png'])
@sut.validate
@sut.results.should.be.empty?
end
it "should fail if any of the screenshots URLS do not return an image" do
it 'should fail if any of the screenshots URLS do not return an image' do
WebMock::API.stub_request(:head, 'banana-corp.local/').to_return(:status => 200)
Specification.any_instance.stubs(:screenshots).returns(['http://banana-corp.local/valid-image.png', 'http://banana-corp.local/'])
@sut.validate
......@@ -190,12 +190,12 @@ module Pod
end
end
describe "social media URL validation" do
describe 'social media URL validation' do
before do
@sut.stubs(:validate_homepage)
end
it "checks if the social media URL is valid" do
it 'checks if the social media URL is valid' do
Specification.any_instance.stubs(:social_media_urlon_url).returns('http://banana-corp.local/')
WebMock::API.stub_request(:head, /banana-corp.local/).to_return(:status => 200)
@sut.validate
......@@ -210,12 +210,12 @@ module Pod
end
end
describe "documentation URL validation" do
describe 'documentation URL validation' do
before do
@sut.stubs(:validate_homepage)
end
it "checks if the documentation URL is valid" do
it 'checks if the documentation URL is valid' do
Specification.any_instance.stubs(:documentation_url).returns('http://banana-corp.local/')
WebMock::API.stub_request(:head, /banana-corp.local/).to_return(:status => 200)
@sut.validate
......@@ -229,12 +229,12 @@ module Pod
end
end
describe "docset URL validation" do
describe 'docset URL validation' do
before do
@sut.stubs(:validate_homepage)
end
it "checks if the docset URL is valid" do
it 'checks if the docset URL is valid' do
Specification.any_instance.stubs(:docset_url).returns('http://banana-corp.local/')
WebMock::API.stub_request(:head, /banana-corp.local/).to_return(:status => 200)
@sut.validate
......@@ -249,7 +249,7 @@ module Pod
end
end
it "respects the no clean option" do
it 'respects the no clean option' do
file = write_podspec(stub_podspec)
sut = Validator.new(file)
sut.stubs(:validate_url)
......@@ -258,7 +258,7 @@ module Pod
sut.validation_dir.should.exist
end
it "builds the pod per platform" do
it 'builds the pod per platform' do
file = write_podspec(stub_podspec)
sut = Validator.new(file)
sut.stubs(:validate_url)
......@@ -268,35 +268,35 @@ module Pod
sut.validate
end
it "uses the deployment target of the specification" do
it 'uses the deployment target of the specification' do
sut = Validator.new(podspec_path)
sut.stubs(:validate_url)
sut.stubs(:validate_screenshots)
podfile = sut.send(:podfile_from_spec, :ios, '5.0')
dependency = podfile.target_definitions['Pods'].dependencies.first
dependency.external_source.has_key?(:podspec).should.be.true
dependency.external_source.key?(:podspec).should.be.true
end
it "respects the local option" do
it 'respects the local option' do
sut = Validator.new(podspec_path)
sut.stubs(:validate_url)
podfile = sut.send(:podfile_from_spec, :ios, '5.0')
deployment_target = podfile.target_definitions['Pods'].platform.deployment_target
deployment_target.to_s.should == "5.0"
deployment_target.to_s.should == '5.0'
end
it "uses xcodebuild to generate notes and warnings" do
it 'uses xcodebuild to generate notes and warnings' do
sut = Validator.new(podspec_path)
sut.stubs(:check_file_patterns)
sut.stubs(:xcodebuild).returns("file.m:1:1: warning: direct access to objective-c's isa is deprecated")
sut.stubs(:validate_url)
sut.validate
first = sut.results.map(&:to_s).first
first.should.include "[xcodebuild]"
first.should.include '[xcodebuild]'
sut.result_type.should == :note
end
it "checks for file patterns" do
it 'checks for file patterns' do
file = write_podspec(stub_podspec(/.*source_files.*/, '"source_files": "wrong_paht.*",'))
sut = Validator.new(file)
sut.stubs(:build_pod)
......@@ -306,11 +306,11 @@ module Pod
sut.result_type.should == :error
end
it "validates a podspec with dependencies" do
it 'validates a podspec with dependencies' do
podspec = stub_podspec(/.*name.*/, '"name": "ZKit",')
podspec.gsub!(/.*requires_arc.*/, '"dependencies": { "SBJson": [ "~> 3.2" ] }, "requires_arc": false')
podspec.gsub!(/.*license.*$/, '"license": "Public Domain",')
file = write_podspec(podspec, "ZKit.podspec.json")
file = write_podspec(podspec, 'ZKit.podspec.json')
spec = Specification.from_file(file)
sut = Validator.new(spec)
......
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