Commit e3fd4dec authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #4265 from CocoaPods/seg-update-rubocop

[Bundle] Update RuboCop to 0.34
parents f650a391 ae73b5dc
# This configuration was generated by `rubocop --auto-gen-config` # This configuration was generated by
# on 2015-03-15 18:04:06 -0700 using RuboCop version 0.29.1. # `rubocop --auto-gen-config`
# on 2015-09-25 20:32:21 -0500 using RuboCop version 0.34.2.
# The point is for the user to remove these configuration records # The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base. # one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again. # versions of RuboCop, may require this file to be generated again.
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
Lint/EndAlignment:
Enabled: false
# Offense count: 1
Lint/NonLocalExitFromIterator:
Exclude:
- 'spec/unit/installer_spec.rb'
# Offense count: 3 # Offense count: 3
Lint/UselessAccessModifier: Lint/UselessAccessModifier:
Enabled: false Exclude:
- 'lib/cocoapods/config.rb'
- 'lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb'
# Offense count: 1278 # Offense count: 1511
# Configuration parameters: AllowURI, URISchemes. # Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength: Metrics/LineLength:
Max: 292 Max: 281
# Offense count: 12
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
Style/RegexpLiteral:
Exclude:
- 'lib/cocoapods/installer/file_references_installer.rb'
- 'lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb'
- 'lib/cocoapods/sandbox/path_list.rb'
- 'lib/cocoapods/sources_manager.rb'
- 'lib/cocoapods/validator.rb'
- 'spec/integration.rb'
- 'spec/unit/external_sources/path_source_spec.rb'
- 'spec/unit/external_sources/podspec_source_spec.rb'
- 'spec/unit/resolver_spec.rb'
...@@ -106,9 +106,9 @@ GEM ...@@ -106,9 +106,9 @@ GEM
thread_safe (~> 0.3, >= 0.3.4) thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
addressable (2.3.6) addressable (2.3.6)
ast (2.0.0) ast (2.1.0)
astrolabe (1.3.0) astrolabe (1.3.1)
parser (>= 2.2.0.pre.3, < 3.0) parser (~> 2.2)
awesome_print (1.6.1) awesome_print (1.6.1)
bacon (1.2.0) bacon (1.2.0)
clintegracon (0.6.1) clintegracon (0.6.1)
...@@ -147,9 +147,9 @@ GEM ...@@ -147,9 +147,9 @@ GEM
nap (1.0.0) nap (1.0.0)
netrc (0.7.8) netrc (0.7.8)
notify (0.5.2) notify (0.5.2)
parser (2.2.0.3) parser (2.2.2.6)
ast (>= 1.1, < 3.0) ast (>= 1.1, < 3.0)
powerpack (0.1.0) powerpack (0.1.1)
prettybacon (0.0.2) prettybacon (0.0.2)
bacon (~> 1.2) bacon (~> 1.2)
pry (0.10.1) pry (0.10.1)
...@@ -163,14 +163,14 @@ GEM ...@@ -163,14 +163,14 @@ GEM
ffi (>= 0.5.0) ffi (>= 0.5.0)
rb-kqueue (0.2.3) rb-kqueue (0.2.3)
ffi (>= 0.5.0) ffi (>= 0.5.0)
rubocop (0.29.1) rubocop (0.34.2)
astrolabe (~> 1.3) astrolabe (~> 1.3)
parser (>= 2.2.0.1, < 3.0) parser (>= 2.2.2.5, < 3.0)
powerpack (~> 0.1) powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0) rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4) ruby-progressbar (~> 1.4)
ruby-prof (0.15.2) ruby-prof (0.15.2)
ruby-progressbar (1.7.1) ruby-progressbar (1.7.5)
safe_yaml (1.0.4) safe_yaml (1.0.4)
slop (3.6.0) slop (3.6.0)
sparkr (0.4.1) sparkr (0.4.1)
......
...@@ -54,7 +54,7 @@ begin ...@@ -54,7 +54,7 @@ begin
sh "git checkout #{specs_branch}" sh "git checkout #{specs_branch}"
sh 'git pull' sh 'git pull'
yaml_file = 'CocoaPods-version.yml' yaml_file = 'CocoaPods-version.yml'
unless File.exist?(yaml_file) unless File.exist?(yaml_file)
$stderr.puts red("[!] Unable to find #{yaml_file}!") $stderr.puts red("[!] Unable to find #{yaml_file}!")
exit 1 exit 1
......
...@@ -36,7 +36,7 @@ module Pod ...@@ -36,7 +36,7 @@ module Pod
def self.options def self.options
[ [
['--silent', 'Show nothing'], ['--silent', 'Show nothing'],
].concat(super) ].concat(super)
end end
......
...@@ -23,7 +23,9 @@ module Pod ...@@ -23,7 +23,9 @@ module Pod
def initialize(argv) def initialize(argv)
@shallow = argv.flag?('shallow', false) @shallow = argv.flag?('shallow', false)
@name, @url, @branch = argv.shift_argument, argv.shift_argument, argv.shift_argument @name = argv.shift_argument
@url = argv.shift_argument
@branch = argv.shift_argument
super super
end end
......
...@@ -48,7 +48,7 @@ module Pod ...@@ -48,7 +48,7 @@ module Pod
set = sets.find { |s| s.name == spec } set = sets.find { |s| s.name == spec }
else else
names = sets.map(&:name) * ', ' names = sets.map(&:name) * ', '
raise Informative, "More than one spec found for '#{ spec }':\n#{ names }" raise Informative, "More than one spec found for '#{spec}':\n#{names}"
end end
unless show_all unless show_all
...@@ -77,7 +77,7 @@ module Pod ...@@ -77,7 +77,7 @@ module Pod
versions.each do |version| versions.each do |version|
spec = source.specification(set.name, version) spec = source.specification(set.name, version)
paths += "#{ pathname_from_spec(spec, source) }\n" paths += "#{pathname_from_spec(spec, source)}\n"
end end
end end
...@@ -102,7 +102,7 @@ module Pod ...@@ -102,7 +102,7 @@ module Pod
end end
if !best_source || !best_version if !best_source || !best_version
raise Informative, "Unable to locate highest known specification for `#{ set.name }'" raise Informative, "Unable to locate highest known specification for `#{set.name}'"
end end
[best_source.specification(set.name, best_version), best_source] [best_source.specification(set.name, best_version), best_source]
......
...@@ -37,7 +37,7 @@ module Pod ...@@ -37,7 +37,7 @@ module Pod
query = @use_regex ? @query : Regexp.escape(@query) query = @use_regex ? @query : Regexp.escape(@query)
filepath = if @show_all filepath = if @show_all
specs = get_path_of_spec(query, @show_all).split(/\n/) specs = get_path_of_spec(query, @show_all).split(/\n/)
index = UI.choose_from_array(specs, "Which spec would you like to print [1-#{ specs.count }]? ") index = UI.choose_from_array(specs, "Which spec would you like to print [1-#{specs.count}]? ")
specs[index] specs[index]
else else
get_path_of_spec(query) get_path_of_spec(query)
......
...@@ -15,7 +15,8 @@ module Pod ...@@ -15,7 +15,8 @@ module Pod
] ]
def initialize(argv) def initialize(argv)
@name_or_url, @url = argv.shift_argument, argv.shift_argument @name_or_url = argv.shift_argument
@url = argv.shift_argument
super super
end end
...@@ -73,7 +74,7 @@ module Pod ...@@ -73,7 +74,7 @@ module Pod
data[:name] = repo['name'] data[:name] = repo['name']
data[:summary] = (repo['description'] || '').gsub(/["]/, '\"') data[:summary] = (repo['description'] || '').gsub(/["]/, '\"')
data[:homepage] = (repo['homepage'] && !repo['homepage'].empty?) ? repo['homepage'] : repo['html_url'] data[:homepage] = (repo['homepage'] && !repo['homepage'].empty?) ? repo['homepage'] : repo['html_url']
data[:author_name] = user['name'] || user['login'] data[:author_name] = user['name'] || user['login']
data[:author_email] = user['email'] || 'email@address.com' data[:author_email] = user['email'] || 'email@address.com'
data[:source_url] = repo['clone_url'] data[:source_url] = repo['clone_url']
......
...@@ -45,7 +45,7 @@ module Pod ...@@ -45,7 +45,7 @@ module Pod
end end
exec_editor(filepath.to_s) if File.exist? filepath exec_editor(filepath.to_s) if File.exist? filepath
raise Informative, "#{ filepath } doesn't exist." raise Informative, "#{filepath} doesn't exist."
end end
# Looks up an executable in the search paths # Looks up an executable in the search paths
......
...@@ -34,7 +34,7 @@ module Pod ...@@ -34,7 +34,7 @@ module Pod
result = cache.download_pod(request) result = cache.download_pod(request)
else else
require 'cocoapods/installer/pod_source_preparer' require 'cocoapods/installer/pod_source_preparer'
result, _ = download_request(request, target) result, = download_request(request, target)
Installer::PodSourcePreparer.new(result.spec, result.location).prepare! Installer::PodSourcePreparer.new(result.spec, result.location).prepare!
end end
......
...@@ -68,7 +68,7 @@ module Pod ...@@ -68,7 +68,7 @@ module Pod
# download request. # download request.
# #
def slug(name: self.name, params: self.params, spec: self.spec) def slug(name: self.name, params: self.params, spec: self.spec)
checksum = spec && spec.checksum && '-' << spec.checksum[0, 5] checksum = spec && spec.checksum && '-' << spec.checksum[0, 5]
if released_pod? if released_pod?
"Release/#{name}/#{spec.version}#{checksum}" "Release/#{name}/#{spec.version}#{checksum}"
else else
......
...@@ -54,13 +54,16 @@ module Pod ...@@ -54,13 +54,16 @@ module Pod
if Config.instance.verbose? if Config.instance.verbose?
UI.message("$ #{full_command}") UI.message("$ #{full_command}")
stdout, stderr = Indenter.new(STDOUT), Indenter.new(STDERR) stdout = Indenter.new(STDOUT)
stderr = Indenter.new(STDERR)
else else
stdout, stderr = Indenter.new, Indenter.new stdout = Indenter.new
stderr = Indenter.new
end end
status = popen3(bin, command, stdout, stderr) status = popen3(bin, command, stdout, stderr)
stdout, stderr = stdout.join, stderr.join stdout = stdout.join
stderr = stderr.join
output = stdout + stderr output = stdout + stderr
unless status.success? unless status.success?
if raise_on_failure if raise_on_failure
...@@ -197,7 +200,7 @@ module Pod ...@@ -197,7 +200,7 @@ module Pod
# #
def <<(value) def <<(value)
super super
io << "#{ indent }#{ value }" if io io << "#{indent}#{value}" if io
end end
end end
end end
......
...@@ -77,7 +77,7 @@ module Pod ...@@ -77,7 +77,7 @@ module Pod
if license_file.exist? if license_file.exist?
text = IO.read(license_file) text = IO.read(license_file)
else else
UI.warn "Unable to read the license file `#{license_file }` " \ UI.warn "Unable to read the license file `#{license_file}` " \
"for the spec `#{spec}`" "for the spec `#{spec}`"
end end
end end
......
...@@ -47,7 +47,7 @@ module Pod ...@@ -47,7 +47,7 @@ module Pod
config = { config = {
'OTHER_LDFLAGS' => XCConfigHelper.default_ld_flags(target), 'OTHER_LDFLAGS' => XCConfigHelper.default_ld_flags(target),
'PODS_ROOT' => '${SRCROOT}', 'PODS_ROOT' => '${SRCROOT}',
'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(search_paths), 'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(search_paths),
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1', 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
'SKIP_INSTALL' => 'YES', 'SKIP_INSTALL' => 'YES',
......
...@@ -18,7 +18,7 @@ module Pod ...@@ -18,7 +18,7 @@ module Pod
# #
def self.quote(strings, prefix = nil) def self.quote(strings, prefix = nil)
prefix = "#{prefix} " if prefix prefix = "#{prefix} " if prefix
strings.sort.map { |s| %W( #{prefix}"#{s}" ) }.join(' ') strings.sort.map { |s| %W( #{prefix}"#{s}" ) }.join(' ')
end end
# Return the default linker flags # Return the default linker flags
......
...@@ -105,7 +105,7 @@ module Pod ...@@ -105,7 +105,7 @@ module Pod
if registrations if registrations
hooks = registrations[name] hooks = registrations[name]
if hooks if hooks
UI.message "- Running #{name.to_s.gsub('_', ' ')} hooks" do UI.message "- Running #{name.to_s.tr('_', ' ')} hooks" do
hooks.each do |hook| hooks.each do |hook|
next if whitelisted_plugins && !whitelisted_plugins.key?(hook.plugin_name) next if whitelisted_plugins && !whitelisted_plugins.key?(hook.plugin_name)
UI.message "- #{hook.plugin_name || 'unknown plugin'} from " \ UI.message "- #{hook.plugin_name || 'unknown plugin'} from " \
......
...@@ -732,7 +732,7 @@ module Pod ...@@ -732,7 +732,7 @@ module Pod
# information in the lockfile. # information in the lockfile.
# #
def integrate_user_project def integrate_user_project
UI.section "Integrating client #{'project'.pluralize(aggregate_targets.map(&:user_project_path).uniq.count) }" do UI.section "Integrating client #{'project'.pluralize(aggregate_targets.map(&:user_project_path).uniq.count)}" do
installation_root = config.installation_root installation_root = config.installation_root
integrator = UserProjectIntegrator.new(podfile, sandbox, installation_root, aggregate_targets) integrator = UserProjectIntegrator.new(podfile, sandbox, installation_root, aggregate_targets)
integrator.integrate! integrator.integrate!
......
...@@ -293,7 +293,7 @@ module Pod ...@@ -293,7 +293,7 @@ module Pod
if targets_by_distinctors.count > 1 if targets_by_distinctors.count > 1
# There are different sets of subspecs or the spec is used across different platforms # There are different sets of subspecs or the spec is used across different platforms
targets_by_distinctors.map do |distinctor, target_definitions| targets_by_distinctors.map do |distinctor, target_definitions|
specs, _ = *distinctor specs, = *distinctor
generate_pod_target(target_definitions, specs, :scoped => true) generate_pod_target(target_definitions, specs, :scoped => true)
end end
else else
......
...@@ -23,9 +23,9 @@ module Pod ...@@ -23,9 +23,9 @@ module Pod
@unchanged = [] @unchanged = []
if pods_by_state if pods_by_state
@added = pods_by_state[:added] || [] @added = pods_by_state[:added] || []
@deleted = pods_by_state[:removed] || [] @deleted = pods_by_state[:removed] || []
@changed = pods_by_state[:changed] || [] @changed = pods_by_state[:changed] || []
@unchanged = pods_by_state[:unchanged] || [] @unchanged = pods_by_state[:unchanged] || []
end end
end end
...@@ -51,10 +51,10 @@ module Pod ...@@ -51,10 +51,10 @@ module Pod
# @return [void] # @return [void]
# #
def print def print
added .sort.each { |pod| UI.message('A'.green + " #{pod}", '', 2) } added .sort.each { |pod| UI.message('A'.green + " #{pod}", '', 2) }
deleted .sort.each { |pod| UI.message('R'.red + " #{pod}", '', 2) } deleted .sort.each { |pod| UI.message('R'.red + " #{pod}", '', 2) }
changed .sort.each { |pod| UI.message('M'.yellow + " #{pod}", '', 2) } changed .sort.each { |pod| UI.message('M'.yellow + " #{pod}", '', 2) }
unchanged.sort.each { |pod| UI.message('-' + " #{pod}", '', 2) } unchanged.sort.each { |pod| UI.message('-' + " #{pod}", '', 2) }
end end
# Adds the name of a Pod to the give state. # Adds the name of a Pod to the give state.
......
...@@ -174,7 +174,7 @@ module Pod ...@@ -174,7 +174,7 @@ module Pod
# #
def requirement_satisfied_by?(requirement, activated, spec) def requirement_satisfied_by?(requirement, activated, spec)
existing_vertices = activated.vertices.values.select do |v| existing_vertices = activated.vertices.values.select do |v|
Specification.root_name(v.name) == requirement.root_name Specification.root_name(v.name) == requirement.root_name
end end
existing = existing_vertices.map(&:payload).compact.first existing = existing_vertices.map(&:payload).compact.first
requirement_satisfied = requirement_satisfied =
......
...@@ -49,7 +49,7 @@ module Pod ...@@ -49,7 +49,7 @@ module Pod
end end
root_length = root.to_s.length + 1 root_length = root.to_s.length + 1
escaped_root = escape_path_for_glob(root) escaped_root = escape_path_for_glob(root)
paths = Dir.glob(escaped_root + '**/*', File::FNM_DOTMATCH) paths = Dir.glob(escaped_root + '**/*', File::FNM_DOTMATCH)
absolute_dirs = paths.select { |path| File.directory?(path) } absolute_dirs = paths.select { |path| File.directory?(path) }
relative_dirs = absolute_dirs.map { |p| p[root_length..-1] } relative_dirs = absolute_dirs.map { |p| p[root_length..-1] }
absolute_paths = paths.reject { |p| p == "#{root}/." || p == "#{root}/.." } absolute_paths = paths.reject { |p| p == "#{root}/." || p == "#{root}/.." }
......
...@@ -252,7 +252,8 @@ module Pod ...@@ -252,7 +252,8 @@ module Pod
def check_version_information(dir) def check_version_information(dir)
versions = version_information(dir) versions = version_information(dir)
unless repo_compatible?(dir) unless repo_compatible?(dir)
min, max = versions['min'], versions['max'] min = versions['min']
max = versions['max']
version_msg = (min == max) ? min : "#{min} - #{max}" version_msg = (min == max) ? min : "#{min} - #{max}"
raise Informative, "The `#{dir.basename}` repo requires " \ raise Informative, "The `#{dir.basename}` repo requires " \
"CocoaPods #{version_msg} (currently using #{Pod::VERSION})\n".red + "CocoaPods #{version_msg} (currently using #{Pod::VERSION})\n".red +
...@@ -293,7 +294,8 @@ module Pod ...@@ -293,7 +294,8 @@ module Pod
def repo_compatible?(dir) def repo_compatible?(dir)
versions = version_information(dir) versions = version_information(dir)
min, max = versions['min'], versions['max'] min = versions['min']
max = versions['max']
bin_version = Gem::Version.new(Pod::VERSION) bin_version = Gem::Version.new(Pod::VERSION)
supports_min = !min || bin_version >= Gem::Version.new(min) supports_min = !min || bin_version >= Gem::Version.new(min)
supports_max = !max || bin_version <= Gem::Version.new(max) supports_max = !max || bin_version <= Gem::Version.new(max)
...@@ -329,7 +331,7 @@ module Pod ...@@ -329,7 +331,7 @@ module Pod
# #
def version_information(dir) def version_information(dir)
require 'yaml' require 'yaml'
yaml_file = dir + 'CocoaPods-version.yml' yaml_file = dir + 'CocoaPods-version.yml'
return {} unless yaml_file.exist? return {} unless yaml_file.exist?
begin begin
YAMLHelper.load_file(yaml_file) YAMLHelper.load_file(yaml_file)
......
...@@ -7,7 +7,7 @@ module Pod ...@@ -7,7 +7,7 @@ module Pod
module UserInterface module UserInterface
require 'colored' require 'colored'
@title_colors = %w( yellow green ) @title_colors = %w( yellow green )
@title_level = 0 @title_level = 0
@indentation_level = 2 @indentation_level = 2
@treat_titles_as_messages = false @treat_titles_as_messages = false
...@@ -298,14 +298,14 @@ module Pod ...@@ -298,14 +298,14 @@ module Pod
# #
def choose_from_array(array, message) def choose_from_array(array, message)
array.each_with_index do |item, index| array.each_with_index do |item, index|
UI.puts "#{ index + 1 }: #{ item }" UI.puts "#{index + 1}: #{item}"
end end
UI.puts message UI.puts message
index = UI.gets.chomp.to_i - 1 index = UI.gets.chomp.to_i - 1
if index < 0 || index > array.count - 1 if index < 0 || index > array.count - 1
raise Informative, "#{ index + 1 } is invalid [1-#{ array.count }]" raise Informative, "#{index + 1} is invalid [1-#{array.count}]"
else else
index index
end end
......
...@@ -35,7 +35,7 @@ module Pod ...@@ -35,7 +35,7 @@ module Pod
repo_make('test_repo') repo_make('test_repo')
Dir.chdir(temporary_directory) do Dir.chdir(temporary_directory) do
spec = "Spec.new do |s|; s.name = 'Broken'; s.version = '1.0' end" spec = "Spec.new do |s|; s.name = 'Broken'; s.version = '1.0' end"
File.open('Broken.podspec', 'w') { |f| f.write(spec) } File.open('Broken.podspec', 'w') { |f| f.write(spec) }
cmd = command('repo', 'push', 'test_repo') cmd = command('repo', 'push', 'test_repo')
Validator.any_instance.stubs(:validated?).returns(false) Validator.any_instance.stubs(:validated?).returns(false)
...@@ -48,7 +48,7 @@ module Pod ...@@ -48,7 +48,7 @@ module Pod
repo_make('test_repo') repo_make('test_repo')
Dir.chdir(temporary_directory) do Dir.chdir(temporary_directory) do
File.open('JSON.podspec.json', 'w') { |f| f.write('{}') } File.open('JSON.podspec.json', 'w') { |f| f.write('{}') }
cmd = command('repo', 'push', 'test_repo') cmd = command('repo', 'push', 'test_repo')
cmd.send(:podspec_files).should == [Pathname('JSON.podspec.json')] cmd.send(:podspec_files).should == [Pathname('JSON.podspec.json')]
end end
......
...@@ -45,13 +45,13 @@ module Pod ...@@ -45,13 +45,13 @@ module Pod
path = temporary_directory + 'Bananas.podspec' path = temporary_directory + 'Bananas.podspec'
spec = Specification.from_file(path) spec = Specification.from_file(path)
spec.name.should == 'Bananas' 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.version.should == Version.new('0.0.1')
spec.summary.should == 'A short description of Bananas.' spec.summary.should == 'A short description of Bananas.'
spec.homepage.should == 'http://EXAMPLE/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.source.should == { :git => 'http://EXAMPLE/Bananas.git', :tag => '0.0.1' }
spec.consumer(:ios).source_files.should == ['Classes', 'Classes/**/*.{h,m}'] spec.consumer(:ios).source_files.should == ['Classes', 'Classes/**/*.{h,m}']
spec.consumer(:ios).public_header_files.should == [] spec.consumer(:ios).public_header_files.should == []
end end
...@@ -70,13 +70,13 @@ module Pod ...@@ -70,13 +70,13 @@ module Pod
run_command('spec', 'create', 'https://github.com/lukeredpath/libPusher.git') run_command('spec', 'create', 'https://github.com/lukeredpath/libPusher.git')
path = temporary_directory + 'libPusher.podspec' path = temporary_directory + 'libPusher.podspec'
spec = Specification.from_file(path) spec = Specification.from_file(path)
spec.name.should == 'libPusher' spec.name.should == 'libPusher'
spec.license.should == { :type => 'MIT (example)' } spec.license.should == { :type => 'MIT (example)' }
spec.version.should == Version.new('1.4') spec.version.should == Version.new('1.4')
spec.summary.should == 'An Objective-C interface to Pusher (pusherapp.com)' spec.summary.should == 'An Objective-C interface to Pusher (pusherapp.com)'
spec.homepage.should == 'https://github.com/lukeredpath/libPusher' 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' } spec.source.should == { :git => 'https://github.com/lukeredpath/libPusher.git', :tag => 'v1.4' }
end end
it 'accepts a name when creating a podspec form github' do it 'accepts a name when creating a podspec form github' do
...@@ -93,7 +93,7 @@ module Pod ...@@ -93,7 +93,7 @@ module Pod
run_command('spec', 'create', 'other_name', 'https://github.com/lukeredpath/libPusher.git') run_command('spec', 'create', 'other_name', 'https://github.com/lukeredpath/libPusher.git')
path = temporary_directory + 'other_name.podspec' path = temporary_directory + 'other_name.podspec'
spec = Specification.from_file(path) spec = Specification.from_file(path)
spec.name.should == 'other_name' spec.name.should == 'other_name'
spec.homepage.should == 'https://github.com/lukeredpath/libPusher' spec.homepage.should == 'https://github.com/lukeredpath/libPusher'
end end
...@@ -113,7 +113,7 @@ module Pod ...@@ -113,7 +113,7 @@ module Pod
path = temporary_directory + 'libPusher.podspec' path = temporary_directory + 'libPusher.podspec'
spec = Specification.from_file(path) spec = Specification.from_file(path)
spec.version.should == Version.new('0.0.1') spec.version.should == Version.new('0.0.1')
spec.source.should == { :git => 'https://github.com/lukeredpath/libPusher.git', :commit => '5f482b0693ac2ac1ad85d1aabc27ec7547cc0bc7' } spec.source.should == { :git => 'https://github.com/lukeredpath/libPusher.git', :commit => '5f482b0693ac2ac1ad85d1aabc27ec7547cc0bc7' }
end end
it "raises an informative message when the GitHub repository doesn't have any commits" do it "raises an informative message when the GitHub repository doesn't have any commits" do
......
...@@ -137,14 +137,12 @@ describe_cli 'pod' do ...@@ -137,14 +137,12 @@ describe_cli 'pod' do
/lib/cocoapods_plugin.rb # The actual plugin file that gets loaded /lib/cocoapods_plugin.rb # The actual plugin file that gets loaded
}iox, '`\1/lib/cocoapods_plugin.rb' }iox, '`\1/lib/cocoapods_plugin.rb'
# rubocop:disable Style/RegexpLiteral
s.replace_pattern %r{ s.replace_pattern %r{
^(\s* \$ \s (CURL_BIN | #{`which curl`.strip}) .* \n) ^(\s* \$ \s (CURL_BIN | #{`which curl`.strip}) .* \n)
^\s* % \s* Total .* \n ^\s* % \s* Total .* \n
^\s* Dload \s* Upload .* \n ^\s* Dload \s* Upload .* \n
(^\s* [[:cntrl:]] .* \n)+ (^\s* [[:cntrl:]] .* \n)+
}iox, "\\1\n" }iox, "\\1\n"
# rubocop:enable Style/RegexpLiteral
end end
describe 'Pod install' do describe 'Pod install' do
......
...@@ -7,7 +7,7 @@ class Xcodeproj::Project ...@@ -7,7 +7,7 @@ class Xcodeproj::Project
sections = [] sections = []
sorted_keys = ['File References', 'Targets', 'Build Configurations'] sorted_keys = ['File References', 'Targets', 'Build Configurations']
sorted_keys.each do |key| sorted_keys.each do |key|
yaml = { key => pretty_print_output[key] }.to_yaml yaml = { key => pretty_print_output[key] }.to_yaml
sections << yaml sections << yaml
end end
(sections * "\n\n").gsub!('---', '') (sections * "\n\n").gsub!('---', '')
......
...@@ -65,7 +65,7 @@ module Pod ...@@ -65,7 +65,7 @@ module Pod
end end
should.not.raise do should.not.raise do
@hooks_manager.run(:post_install, Object.new, 'plugin2' => {}) @hooks_manager.run(:post_install, Object.new, 'plugin2' => {})
end end
end end
...@@ -75,7 +75,7 @@ module Pod ...@@ -75,7 +75,7 @@ module Pod
end end
should.not.raise do should.not.raise do
@hooks_manager.run(:post_install, Object.new, 'plugin' => { 'key' => 'value' }) @hooks_manager.run(:post_install, Object.new, 'plugin' => { 'key' => 'value' })
end end
end end
......
...@@ -47,10 +47,10 @@ module Pod ...@@ -47,10 +47,10 @@ module Pod
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 = @analyzer.analyze.podfile_state
state.added.should == %w(AFNetworking libextobjc/EXTKeyPathCoding libextobjc/EXTSynthesize) state.added.should == %w(AFNetworking libextobjc/EXTKeyPathCoding libextobjc/EXTSynthesize)
state.changed.should == %w() state.changed.should == %w()
state.unchanged.should == %w(JSONKit SVPullToRefresh) state.unchanged.should == %w(JSONKit SVPullToRefresh)
state.deleted.should == %w(NUI) state.deleted.should == %w(NUI)
end end
#--------------------------------------# #--------------------------------------#
...@@ -239,7 +239,7 @@ module Pod ...@@ -239,7 +239,7 @@ module Pod
end end
it 'unlocks dependencies in a case-insensitive manner' do it 'unlocks dependencies in a case-insensitive manner' do
@analyzer.update = { :pods => %w(JSONKit) } @analyzer.update = { :pods => %w(JSONKit) }
@analyzer.analyze @analyzer.analyze
@analyzer.send(:locked_dependencies).map(&:payload).map(&:to_s). @analyzer.send(:locked_dependencies).map(&:payload).map(&:to_s).
should == ['SVPullToRefresh (= 0.4)'] should == ['SVPullToRefresh (= 0.4)']
......
...@@ -4,7 +4,9 @@ require File.expand_path('../../../spec_helper', __FILE__) ...@@ -4,7 +4,9 @@ require File.expand_path('../../../spec_helper', __FILE__)
module Pod module Pod
describe Installer::PreInstallHooksContext do describe Installer::PreInstallHooksContext do
it 'offers a convenience method to be generated' do it 'offers a convenience method to be generated' do
sandbox, podfile, lockfile = stub, stub, stub sandbox = stub
podfile = stub
lockfile = stub
result = Installer::PreInstallHooksContext.generate(sandbox, podfile, lockfile) result = Installer::PreInstallHooksContext.generate(sandbox, podfile, lockfile)
result.class.should == Installer::PreInstallHooksContext result.class.should == Installer::PreInstallHooksContext
......
...@@ -85,7 +85,7 @@ module Pod ...@@ -85,7 +85,7 @@ module Pod
it "adds the user's build configurations to the target" do it "adds the user's build configurations to the target" do
@installer.install! @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 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
......
...@@ -53,7 +53,7 @@ module Pod ...@@ -53,7 +53,7 @@ module Pod
it "adds the user's build configurations to the target" do 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! @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 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
......
...@@ -10,9 +10,9 @@ module Pod ...@@ -10,9 +10,9 @@ module Pod
target_definition = Podfile::TargetDefinition.new('Pods', nil) target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.link_with_first_target = true target_definition.link_with_first_target = true
@pod_bundle = AggregateTarget.new(target_definition, config.sandbox) @pod_bundle = AggregateTarget.new(target_definition, config.sandbox)
@pod_bundle.user_project_path = project_path @pod_bundle.user_project_path = project_path
@pod_bundle.client_root = project_path.dirname @pod_bundle.client_root = project_path.dirname
@pod_bundle.user_target_uuids = [@target.uuid] @pod_bundle.user_target_uuids = [@target.uuid]
configuration = Xcodeproj::Config.new( configuration = Xcodeproj::Config.new(
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1', 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
) )
......
...@@ -15,9 +15,9 @@ module Pod ...@@ -15,9 +15,9 @@ module Pod
target_definition = Podfile::TargetDefinition.new('Pods', nil) target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.link_with_first_target = true target_definition.link_with_first_target = true
@pod_bundle = AggregateTarget.new(target_definition, config.sandbox) @pod_bundle = AggregateTarget.new(target_definition, config.sandbox)
@pod_bundle.user_project_path = project_path @pod_bundle.user_project_path = project_path
@pod_bundle.client_root = project_path.dirname @pod_bundle.client_root = project_path.dirname
@pod_bundle.user_target_uuids = [@target.uuid] @pod_bundle.user_target_uuids = [@target.uuid]
configuration = Xcodeproj::Config.new( configuration = Xcodeproj::Config.new(
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1', 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
) )
...@@ -189,7 +189,7 @@ module Pod ...@@ -189,7 +189,7 @@ module Pod
build_file.file_ref = @project.new(Xcodeproj::Project::PBXVariantGroup) build_file.file_ref = @project.new(Xcodeproj::Project::PBXVariantGroup)
@target_integrator.stubs(:user_project).returns(@project) @target_integrator.stubs(:user_project).returns(@project)
@target.frameworks_build_phase.files << build_file @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
it 'is robust against build files with missing file references' do it 'is robust against build files with missing file references' do
...@@ -197,7 +197,7 @@ module Pod ...@@ -197,7 +197,7 @@ module Pod
build_file.file_ref = nil build_file.file_ref = nil
@target_integrator.stubs(:user_project).returns(@project) @target_integrator.stubs(:user_project).returns(@project)
@target.frameworks_build_phase.files << build_file @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 end
end end
......
...@@ -180,7 +180,7 @@ module Pod ...@@ -180,7 +180,7 @@ module Pod
end end
it 'raises if no workspace could be selected' do it 'raises if no workspace could be selected' do
@integrator.expects(:user_project_paths).returns(%w( project1 project2 )) @integrator.expects(:user_project_paths).returns(%w( project1 project2 ))
lambda { @integrator.send(:workspace_path) }.should.raise Informative lambda { @integrator.send(:workspace_path) }.should.raise Informative
end end
......
...@@ -69,6 +69,7 @@ module Pod ...@@ -69,6 +69,7 @@ module Pod
def @installer.run_podfile_pre_install_hooks def @installer.run_podfile_pre_install_hooks
@hook_called = true @hook_called = true
end end
def @installer.clean_pod_sources def @installer.clean_pod_sources
@hook_called.should.be.true @hook_called.should.be.true
end end
...@@ -87,6 +88,7 @@ module Pod ...@@ -87,6 +88,7 @@ module Pod
def @installer.run_podfile_post_install_hooks def @installer.run_podfile_post_install_hooks
@hook_called = true @hook_called = true
end end
def @installer.write_pod_project def @installer.write_pod_project
@hook_called.should.be.true @hook_called.should.be.true
end end
...@@ -102,6 +104,7 @@ module Pod ...@@ -102,6 +104,7 @@ module Pod
def @installer.run_source_provider_hooks def @installer.run_source_provider_hooks
@hook_called = true @hook_called = true
end end
def @installer.analyze(*) def @installer.analyze(*)
@hook_called.should.be.true @hook_called.should.be.true
end end
...@@ -180,7 +183,7 @@ module Pod ...@@ -180,7 +183,7 @@ module Pod
pod 'monkey', :path => (fixture_path + 'monkey').to_s pod 'monkey', :path => (fixture_path + 'monkey').to_s
target 'TestRunner', :exclusive => true do target 'TestRunner', :exclusive => true do
pod 'monkey', :path => (fixture_path + 'monkey').to_s pod 'monkey', :path => (fixture_path + 'monkey').to_s
end end
end end
lockfile = generate_lockfile lockfile = generate_lockfile
......
...@@ -102,7 +102,7 @@ module Pod ...@@ -102,7 +102,7 @@ module Pod
end end
it 'supports an optional pattern for globbing directories' do it 'supports an optional pattern for globbing directories' do
paths = @path_list.relative_glob('Classes', :dir_pattern => '*.{h,m}').map(&:to_s) paths = @path_list.relative_glob('Classes', :dir_pattern => '*.{h,m}').map(&:to_s)
paths.sort.should == %w( paths.sort.should == %w(
Classes/Banana.h Classes/Banana.h
Classes/Banana.m Classes/Banana.m
...@@ -111,7 +111,7 @@ module Pod ...@@ -111,7 +111,7 @@ module Pod
end end
it 'handles directories specified with a trailing slash' do it 'handles directories specified with a trailing slash' do
paths = @path_list.relative_glob('Classes/', :dir_pattern => '*.{h,m}').map(&:to_s) paths = @path_list.relative_glob('Classes/', :dir_pattern => '*.{h,m}').map(&:to_s)
paths.sort.should == %w( paths.sort.should == %w(
Classes/Banana.h Classes/Banana.h
Classes/Banana.m Classes/Banana.m
...@@ -121,7 +121,7 @@ module Pod ...@@ -121,7 +121,7 @@ module Pod
it 'supports an optional list of patterns to exclude' do it 'supports an optional list of patterns to exclude' do
exclude_patterns = ['**/*.m', '**/*Private*.*'] exclude_patterns = ['**/*.m', '**/*Private*.*']
paths = @path_list.relative_glob('Classes/*', :exclude_patterns => exclude_patterns).map(&:to_s) paths = @path_list.relative_glob('Classes/*', :exclude_patterns => exclude_patterns).map(&:to_s)
paths.sort.should == %w( paths.sort.should == %w(
Classes/Banana.h Classes/Banana.h
Classes/BananaLib.pch Classes/BananaLib.pch
...@@ -135,7 +135,7 @@ module Pod ...@@ -135,7 +135,7 @@ module Pod
end end
it 'can optionally include the directories in the results' do it 'can optionally include the directories in the results' do
paths = @path_list.relative_glob('Resources/*', :include_dirs => true).map(&:to_s) paths = @path_list.relative_glob('Resources/*', :include_dirs => true).map(&:to_s)
paths.sort.should == %w( paths.sort.should == %w(
Resources/Images.xcassets Resources/Images.xcassets
Resources/logo-sidebar.png Resources/logo-sidebar.png
...@@ -162,17 +162,17 @@ module Pod ...@@ -162,17 +162,17 @@ module Pod
describe '#directory?' do describe '#directory?' do
it 'expands a pattern into all the combinations of Dir#glob literals' 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 = @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 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 = @path_list.send(:dir_glob_equivalent_patterns, 'file*.*')
patterns.sort.should == %w( file*.* ) patterns.sort.should == %w( file*.* )
end end
it 'expands `**`' do it 'expands `**`' do
patterns = @path_list.send(:dir_glob_equivalent_patterns, 'Classes/**/file.m') 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 end
it 'supports a combination of `**` and literals' do it 'supports a combination of `**` and literals' do
......
...@@ -67,21 +67,21 @@ module Pod ...@@ -67,21 +67,21 @@ module Pod
it 'searches sets by name' do it 'searches sets by name' do
sets = SourcesManager.search_by_name('BananaLib') sets = SourcesManager.search_by_name('BananaLib')
sets.all? { |s| s.class == Specification::Set }.should.be.true sets.all? { |s| s.class == Specification::Set }.should.be.true
sets.any? { |s| s.name == 'BananaLib' }.should.be.true sets.any? { |s| s.name == 'BananaLib' }.should.be.true
end end
it 'can perform a full text search of the sets' do it 'can perform a full text search of the sets' do
SourcesManager.stubs(:all).returns([@test_source]) SourcesManager.stubs(:all).returns([@test_source])
sets = SourcesManager.search_by_name('Chunky', true) sets = SourcesManager.search_by_name('Chunky', true)
sets.all? { |s| s.class == Specification::Set }.should.be.true sets.all? { |s| s.class == Specification::Set }.should.be.true
sets.any? { |s| s.name == 'BananaLib' }.should.be.true sets.any? { |s| s.name == 'BananaLib' }.should.be.true
end end
it 'can perform a full text regexp search of the sets' do it 'can perform a full text regexp search of the sets' do
SourcesManager.stubs(:all).returns([@test_source]) SourcesManager.stubs(:all).returns([@test_source])
sets = SourcesManager.search_by_name('Ch[aeiou]nky', true) sets = SourcesManager.search_by_name('Ch[aeiou]nky', true)
sets.all? { |s| s.class == Specification::Set }.should.be.true sets.all? { |s| s.class == Specification::Set }.should.be.true
sets.any? { |s| s.name == 'BananaLib' }.should.be.true sets.any? { |s| s.name == 'BananaLib' }.should.be.true
end end
it "generates the search index before performing a search if it doesn't exits" do it "generates the search index before performing a search if it doesn't exits" do
......
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