Commit 437c0b30 authored by Samuel Giddins's avatar Samuel Giddins

[Bundle] Update RuboCop to 0.34

parent f650a391
# This configuration was generated by `rubocop --auto-gen-config`
# on 2015-03-15 18:04:06 -0700 using RuboCop version 0.29.1.
# This configuration was generated by
# `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
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# 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
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.
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
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.3.6)
ast (2.0.0)
astrolabe (1.3.0)
parser (>= 2.2.0.pre.3, < 3.0)
ast (2.1.0)
astrolabe (1.3.1)
parser (~> 2.2)
awesome_print (1.6.1)
bacon (1.2.0)
clintegracon (0.6.1)
......@@ -147,9 +147,9 @@ GEM
nap (1.0.0)
netrc (0.7.8)
notify (0.5.2)
parser (2.2.0.3)
parser (2.2.2.6)
ast (>= 1.1, < 3.0)
powerpack (0.1.0)
powerpack (0.1.1)
prettybacon (0.0.2)
bacon (~> 1.2)
pry (0.10.1)
......@@ -163,14 +163,14 @@ GEM
ffi (>= 0.5.0)
rb-kqueue (0.2.3)
ffi (>= 0.5.0)
rubocop (0.29.1)
rubocop (0.34.2)
astrolabe (~> 1.3)
parser (>= 2.2.0.1, < 3.0)
parser (>= 2.2.2.5, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4)
ruby-prof (0.15.2)
ruby-progressbar (1.7.1)
ruby-progressbar (1.7.5)
safe_yaml (1.0.4)
slop (3.6.0)
sparkr (0.4.1)
......
......@@ -36,7 +36,7 @@ module Pod
def self.options
[
['--silent', 'Show nothing'],
['--silent', 'Show nothing'],
].concat(super)
end
......
......@@ -23,7 +23,9 @@ module Pod
def initialize(argv)
@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
end
......
......@@ -48,7 +48,7 @@ module Pod
set = sets.find { |s| s.name == spec }
else
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
unless show_all
......@@ -77,7 +77,7 @@ module Pod
versions.each do |version|
spec = source.specification(set.name, version)
paths += "#{ pathname_from_spec(spec, source) }\n"
paths += "#{pathname_from_spec(spec, source)}\n"
end
end
......@@ -102,7 +102,7 @@ module Pod
end
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
[best_source.specification(set.name, best_version), best_source]
......
......@@ -37,7 +37,7 @@ module Pod
query = @use_regex ? @query : Regexp.escape(@query)
filepath = if @show_all
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]
else
get_path_of_spec(query)
......
......@@ -15,7 +15,8 @@ module Pod
]
def initialize(argv)
@name_or_url, @url = argv.shift_argument, argv.shift_argument
@name_or_url = argv.shift_argument
@url = argv.shift_argument
super
end
......@@ -73,7 +74,7 @@ module Pod
data[:name] = repo['name']
data[:summary] = (repo['description'] || '').gsub(/["]/, '\"')
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[:source_url] = repo['clone_url']
......
......@@ -45,7 +45,7 @@ module Pod
end
exec_editor(filepath.to_s) if File.exist? filepath
raise Informative, "#{ filepath } doesn't exist."
raise Informative, "#{filepath} doesn't exist."
end
# Looks up an executable in the search paths
......
......@@ -34,7 +34,7 @@ module Pod
result = cache.download_pod(request)
else
require 'cocoapods/installer/pod_source_preparer'
result, _ = download_request(request, target)
result, = download_request(request, target)
Installer::PodSourcePreparer.new(result.spec, result.location).prepare!
end
......
......@@ -68,7 +68,7 @@ module Pod
# download request.
#
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?
"Release/#{name}/#{spec.version}#{checksum}"
else
......
......@@ -54,13 +54,16 @@ module Pod
if Config.instance.verbose?
UI.message("$ #{full_command}")
stdout, stderr = Indenter.new(STDOUT), Indenter.new(STDERR)
stdout = Indenter.new(STDOUT)
stderr = Indenter.new(STDERR)
else
stdout, stderr = Indenter.new, Indenter.new
stdout = Indenter.new
stderr = Indenter.new
end
status = popen3(bin, command, stdout, stderr)
stdout, stderr = stdout.join, stderr.join
stdout = stdout.join
stderr = stderr.join
output = stdout + stderr
unless status.success?
if raise_on_failure
......@@ -197,7 +200,7 @@ module Pod
#
def <<(value)
super
io << "#{ indent }#{ value }" if io
io << "#{indent}#{value}" if io
end
end
end
......
......@@ -77,7 +77,7 @@ module Pod
if license_file.exist?
text = IO.read(license_file)
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}`"
end
end
......
......@@ -47,7 +47,7 @@ module Pod
config = {
'OTHER_LDFLAGS' => XCConfigHelper.default_ld_flags(target),
'PODS_ROOT' => '${SRCROOT}',
'PODS_ROOT' => '${SRCROOT}',
'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(search_paths),
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
'SKIP_INSTALL' => 'YES',
......
......@@ -18,7 +18,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 the default linker flags
......
......@@ -105,7 +105,7 @@ module Pod
if registrations
hooks = registrations[name]
if hooks
UI.message "- Running #{name.to_s.gsub('_', ' ')} hooks" do
UI.message "- Running #{name.to_s.tr('_', ' ')} hooks" do
hooks.each do |hook|
next if whitelisted_plugins && !whitelisted_plugins.key?(hook.plugin_name)
UI.message "- #{hook.plugin_name || 'unknown plugin'} from " \
......
......@@ -732,7 +732,7 @@ module Pod
# information in the lockfile.
#
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
integrator = UserProjectIntegrator.new(podfile, sandbox, installation_root, aggregate_targets)
integrator.integrate!
......
......@@ -293,7 +293,7 @@ module Pod
if targets_by_distinctors.count > 1
# There are different sets of subspecs or the spec is used across different platforms
targets_by_distinctors.map do |distinctor, target_definitions|
specs, _ = *distinctor
specs, = *distinctor
generate_pod_target(target_definitions, specs, :scoped => true)
end
else
......
......@@ -23,9 +23,9 @@ module Pod
@unchanged = []
if pods_by_state
@added = pods_by_state[:added] || []
@deleted = pods_by_state[:removed] || []
@changed = pods_by_state[:changed] || []
@added = pods_by_state[:added] || []
@deleted = pods_by_state[:removed] || []
@changed = pods_by_state[:changed] || []
@unchanged = pods_by_state[:unchanged] || []
end
end
......@@ -51,10 +51,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) }
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) }
unchanged.sort.each { |pod| UI.message('-' + " #{pod}", '', 2) }
end
# Adds the name of a Pod to the give state.
......
......@@ -174,7 +174,7 @@ module Pod
#
def requirement_satisfied_by?(requirement, activated, spec)
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
existing = existing_vertices.map(&:payload).compact.first
requirement_satisfied =
......
......@@ -49,7 +49,7 @@ module Pod
end
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}/.." }
......
......@@ -252,7 +252,8 @@ module Pod
def check_version_information(dir)
versions = version_information(dir)
unless repo_compatible?(dir)
min, max = versions['min'], versions['max']
min = versions['min']
max = versions['max']
version_msg = (min == max) ? min : "#{min} - #{max}"
raise Informative, "The `#{dir.basename}` repo requires " \
"CocoaPods #{version_msg} (currently using #{Pod::VERSION})\n".red +
......@@ -293,7 +294,8 @@ module Pod
def repo_compatible?(dir)
versions = version_information(dir)
min, max = versions['min'], versions['max']
min = versions['min']
max = versions['max']
bin_version = Gem::Version.new(Pod::VERSION)
supports_min = !min || bin_version >= Gem::Version.new(min)
supports_max = !max || bin_version <= Gem::Version.new(max)
......@@ -329,7 +331,7 @@ module Pod
#
def version_information(dir)
require 'yaml'
yaml_file = dir + 'CocoaPods-version.yml'
yaml_file = dir + 'CocoaPods-version.yml'
return {} unless yaml_file.exist?
begin
YAMLHelper.load_file(yaml_file)
......
......@@ -7,7 +7,7 @@ module Pod
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
......@@ -298,14 +298,14 @@ module Pod
#
def choose_from_array(array, message)
array.each_with_index do |item, index|
UI.puts "#{ index + 1 }: #{ item }"
UI.puts "#{index + 1}: #{item}"
end
UI.puts message
index = UI.gets.chomp.to_i - 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
index
end
......
......@@ -35,7 +35,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)
......@@ -48,7 +48,7 @@ module Pod
repo_make('test_repo')
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.send(:podspec_files).should == [Pathname('JSON.podspec.json')]
end
......
......@@ -45,13 +45,13 @@ module Pod
path = temporary_directory + 'Bananas.podspec'
spec = Specification.from_file(path)
spec.name.should == 'Bananas'
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.source.should == { :git => 'http://EXAMPLE/Bananas.git', :tag => '0.0.1' }
spec.name.should == 'Bananas'
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.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
......@@ -70,13 +70,13 @@ module Pod
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.version.should == Version.new('1.4')
spec.summary.should == 'An Objective-C interface to Pusher (pusherapp.com)'
spec.name.should == 'libPusher'
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.source.should == { :git => 'https://github.com/lukeredpath/libPusher.git', :tag => 'v1.4' }
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
......@@ -93,7 +93,7 @@ module Pod
run_command('spec', 'create', 'other_name', 'https://github.com/lukeredpath/libPusher.git')
path = temporary_directory + 'other_name.podspec'
spec = Specification.from_file(path)
spec.name.should == 'other_name'
spec.name.should == 'other_name'
spec.homepage.should == 'https://github.com/lukeredpath/libPusher'
end
......@@ -113,7 +113,7 @@ module Pod
path = temporary_directory + 'libPusher.podspec'
spec = Specification.from_file(path)
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
it "raises an informative message when the GitHub repository doesn't have any commits" do
......
......@@ -7,7 +7,7 @@ class Xcodeproj::Project
sections = []
sorted_keys = ['File References', 'Targets', 'Build Configurations']
sorted_keys.each do |key|
yaml = { key => pretty_print_output[key] }.to_yaml
yaml = { key => pretty_print_output[key] }.to_yaml
sections << yaml
end
(sections * "\n\n").gsub!('---', '')
......
......@@ -65,7 +65,7 @@ module Pod
end
should.not.raise do
@hooks_manager.run(:post_install, Object.new, 'plugin2' => {})
@hooks_manager.run(:post_install, Object.new, 'plugin2' => {})
end
end
......@@ -75,7 +75,7 @@ module Pod
end
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
......
......@@ -47,10 +47,10 @@ module Pod
it 'computes the state of the Podfile respect to the Lockfile' do
state = @analyzer.analyze.podfile_state
state.added.should == %w(AFNetworking libextobjc/EXTKeyPathCoding libextobjc/EXTSynthesize)
state.changed.should == %w()
state.added.should == %w(AFNetworking libextobjc/EXTKeyPathCoding libextobjc/EXTSynthesize)
state.changed.should == %w()
state.unchanged.should == %w(JSONKit SVPullToRefresh)
state.deleted.should == %w(NUI)
state.deleted.should == %w(NUI)
end
#--------------------------------------#
......@@ -239,7 +239,7 @@ module Pod
end
it 'unlocks dependencies in a case-insensitive manner' do
@analyzer.update = { :pods => %w(JSONKit) }
@analyzer.update = { :pods => %w(JSONKit) }
@analyzer.analyze
@analyzer.send(:locked_dependencies).map(&:payload).map(&:to_s).
should == ['SVPullToRefresh (= 0.4)']
......
......@@ -4,7 +4,9 @@ require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Installer::PreInstallHooksContext 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.class.should == Installer::PreInstallHooksContext
......
......@@ -85,7 +85,7 @@ module Pod
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
......
......@@ -53,7 +53,7 @@ module Pod
it "adds the user's build configurations to the target" do
@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
......
......@@ -10,9 +10,9 @@ module Pod
target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.link_with_first_target = true
@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.user_target_uuids = [@target.uuid]
@pod_bundle.user_target_uuids = [@target.uuid]
configuration = Xcodeproj::Config.new(
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
)
......
......@@ -15,9 +15,9 @@ module Pod
target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.link_with_first_target = true
@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.user_target_uuids = [@target.uuid]
@pod_bundle.user_target_uuids = [@target.uuid]
configuration = Xcodeproj::Config.new(
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
)
......@@ -189,7 +189,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
......@@ -197,7 +197,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
......
......@@ -180,7 +180,7 @@ module Pod
end
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
end
......
......@@ -69,6 +69,7 @@ module Pod
def @installer.run_podfile_pre_install_hooks
@hook_called = true
end
def @installer.clean_pod_sources
@hook_called.should.be.true
end
......@@ -87,6 +88,7 @@ module Pod
def @installer.run_podfile_post_install_hooks
@hook_called = true
end
def @installer.write_pod_project
@hook_called.should.be.true
end
......@@ -102,6 +104,7 @@ module Pod
def @installer.run_source_provider_hooks
@hook_called = true
end
def @installer.analyze(*)
@hook_called.should.be.true
end
......@@ -180,7 +183,7 @@ module Pod
pod 'monkey', :path => (fixture_path + 'monkey').to_s
target 'TestRunner', :exclusive => true do
pod 'monkey', :path => (fixture_path + 'monkey').to_s
pod 'monkey', :path => (fixture_path + 'monkey').to_s
end
end
lockfile = generate_lockfile
......
......@@ -102,7 +102,7 @@ module Pod
end
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(
Classes/Banana.h
Classes/Banana.m
......@@ -111,7 +111,7 @@ module Pod
end
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(
Classes/Banana.h
Classes/Banana.m
......@@ -121,7 +121,7 @@ module Pod
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 = @path_list.relative_glob('Classes/*', :exclude_patterns => exclude_patterns).map(&:to_s)
paths.sort.should == %w(
Classes/Banana.h
Classes/BananaLib.pch
......@@ -135,7 +135,7 @@ module Pod
end
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(
Resources/Images.xcassets
Resources/logo-sidebar.png
......@@ -162,17 +162,17 @@ module Pod
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
patterns = @path_list.send(:dir_glob_equivalent_patterns, 'file*.*')
patterns.sort.should == %w( file*.* )
patterns.sort.should == %w( file*.* )
end
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
......
......@@ -67,21 +67,21 @@ module Pod
it 'searches sets by name' do
sets = SourcesManager.search_by_name('BananaLib')
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
it 'can perform a full text search of the sets' do
SourcesManager.stubs(:all).returns([@test_source])
sets = SourcesManager.search_by_name('Chunky', 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
it 'can perform a full text regexp search of the sets' do
SourcesManager.stubs(:all).returns([@test_source])
sets = SourcesManager.search_by_name('Ch[aeiou]nky', 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
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