cocoapods-search 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 737a5f9bf12a04a61cbeafec1d193ebad0188365
4
+ data.tar.gz: bd436fee79bdfaff4075edabe1cd2dd4047fc5f1
5
+ SHA512:
6
+ metadata.gz: 613912b5b3fe032b0a6eaa3fcfe10121f67ca16357f71dc8d1a0c44409425ef900b987ed65444e8d1fa10281d1c642c10b88822b1352ceb506f14be0fe7f51c3
7
+ data.tar.gz: 1c7f1e4a88ef335ce411cd67f927de5e4f1013ba52d295063ac8a685ea336b0e74b1a25238792f37ad3263c30d2c85f2243c9c90eff2b3d373a40f4ad8ee6ac3
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ cache: bundler
3
+ rvm:
4
+ - 2.0.0-p451
5
+
6
+ branches:
7
+ only:
8
+ - master
9
+ - /.+-stable$/
10
+
@@ -0,0 +1,15 @@
1
+ # Cocoapods::Search Changelog
2
+
3
+ ## 0.1.0 (2015-09-03)
4
+ * Version number must not collide with old gem called cocoapods-search 0.0.7
5
+
6
+ ## 0.0.1 (2015-09-03)
7
+
8
+ * Initial implementation. This version is an extraction from [CocoaPods](https://github.com/CocoaPods/CocoaPods).
9
+
10
+ Original creators:
11
+ [Eloy Durán](https://github.com/alloy)
12
+ [Fabio Pelosin](https://github.com/fabiopelosin)
13
+
14
+ Extractor:
15
+ [Emma Koszinowski](http://github.com/emkosz)
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cocoapods-search.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'cocoapods'
8
+ gem 'bacon'
9
+ gem 'mocha-on-bacon'
10
+ gem 'prettybacon'
11
+ end
12
+
@@ -0,0 +1,79 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cocoapods-search (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ activesupport (4.2.3)
10
+ i18n (~> 0.7)
11
+ json (~> 1.7, >= 1.7.7)
12
+ minitest (~> 5.1)
13
+ thread_safe (~> 0.3, >= 0.3.4)
14
+ tzinfo (~> 1.1)
15
+ bacon (1.2.0)
16
+ claide (0.9.1)
17
+ cocoapods (0.38.2)
18
+ activesupport (>= 3.2.15)
19
+ claide (~> 0.9.1)
20
+ cocoapods-core (= 0.38.2)
21
+ cocoapods-downloader (~> 0.9.1)
22
+ cocoapods-plugins (~> 0.4.2)
23
+ cocoapods-stats (~> 0.5.3)
24
+ cocoapods-trunk (~> 0.6.1)
25
+ cocoapods-try (~> 0.4.5)
26
+ colored (~> 1.2)
27
+ escape (~> 0.0.4)
28
+ molinillo (~> 0.3.1)
29
+ nap (~> 0.8)
30
+ xcodeproj (~> 0.26.3)
31
+ cocoapods-core (0.38.2)
32
+ activesupport (>= 3.2.15)
33
+ fuzzy_match (~> 2.0.4)
34
+ nap (~> 0.8.0)
35
+ cocoapods-downloader (0.9.1)
36
+ cocoapods-plugins (0.4.2)
37
+ nap
38
+ cocoapods-stats (0.5.3)
39
+ nap (~> 0.8)
40
+ cocoapods-trunk (0.6.1)
41
+ nap (>= 0.8)
42
+ netrc (= 0.7.8)
43
+ cocoapods-try (0.4.5)
44
+ colored (1.2)
45
+ escape (0.0.4)
46
+ fuzzy_match (2.0.4)
47
+ i18n (0.7.0)
48
+ json (1.8.3)
49
+ metaclass (0.0.4)
50
+ minitest (5.7.0)
51
+ mocha (1.1.0)
52
+ metaclass (~> 0.0.1)
53
+ mocha-on-bacon (0.2.2)
54
+ mocha (>= 0.13.0)
55
+ molinillo (0.3.1)
56
+ nap (0.8.0)
57
+ netrc (0.7.8)
58
+ prettybacon (0.0.2)
59
+ bacon (~> 1.2)
60
+ rake (10.4.2)
61
+ thread_safe (0.3.5)
62
+ tzinfo (1.2.2)
63
+ thread_safe (~> 0.1)
64
+ xcodeproj (0.26.3)
65
+ activesupport (>= 3)
66
+ claide (~> 0.9.1)
67
+ colored (~> 1.2)
68
+
69
+ PLATFORMS
70
+ ruby
71
+
72
+ DEPENDENCIES
73
+ bacon
74
+ bundler (~> 1.3)
75
+ cocoapods
76
+ cocoapods-search!
77
+ mocha-on-bacon
78
+ prettybacon
79
+ rake
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2015 Eloy Durán <eloy.de.enige@gmail.com>, Fabio Pelosin <fabiopelosin@gmail.com>
2
+ MIT License
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,26 @@
1
+ # cocoapods-search
2
+
3
+ [![Build Status](https://travis-ci.org/CocoaPods/cocoapods-search.svg)](https://travis-ci.org/CocoaPods/cocoapods-search)
4
+
5
+ CocoaPods plugin that allows you to search your pod spec repository for specific pods matching a query.
6
+
7
+ ## Installation
8
+
9
+ $ gem install cocoapods-search
10
+
11
+ ## Usage
12
+
13
+ $ pod search QUERY
14
+
15
+ ### Options
16
+
17
+ You can use the following options with the search command.
18
+
19
+ | Flag | Description |
20
+ |-----------|-------------|
21
+ | `--regex` | Interpret the `QUERY` as a regular expression |
22
+ | `--full` | Search by name, summary, and description |
23
+ | `--stats` | Show additional stats (like GitHub watchers and forks) |
24
+ | `--ios` | Restricts the search to Pods supported on iOS |
25
+ | `--osx` | Restricts the search to Pods supported on OS X |
26
+ | `--web` | Searches on cocoapods.org |
@@ -0,0 +1,13 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ def specs(dir)
4
+ FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
5
+ end
6
+
7
+ desc 'Runs all the specs'
8
+ task :specs do
9
+ sh "bundle exec bacon #{specs('**')}"
10
+ end
11
+
12
+ task :default => :specs
13
+
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cocoapods-search/gem_version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-search'
8
+ spec.version = CocoapodsSearch::VERSION
9
+ spec.authors = ['Eloy Durán', 'Fabio Pelosin', 'Emma Koszinowski']
10
+ spec.email = ['eloy.de.enige@gmail.com', 'fabiopelosin@gmail.com', 'emkosz@gmail.com']
11
+ spec.description = %q{Search for pods.}
12
+ spec.summary = %q{Searches for pods, ignoring case, whose name matches `QUERY`. If the
13
+ `--full` option is specified, this will also search in the summary and
14
+ description of the pods.}
15
+ spec.homepage = 'https://github.com/CocoaPods/cocoapods-search'
16
+ spec.license = 'MIT'
17
+
18
+ spec.files = `git ls-files`.split($/)
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ['lib']
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.3'
24
+ spec.add_development_dependency 'rake'
25
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-search/gem_version'
@@ -0,0 +1 @@
1
+ require 'cocoapods-search/command/search'
@@ -0,0 +1,104 @@
1
+ module Pod
2
+ class Command
3
+ class Search < Command
4
+ self.summary = 'Search for pods.'
5
+
6
+ self.description = <<-DESC
7
+ Searches for pods, ignoring case, whose name matches `QUERY`. If the
8
+ `--full` option is specified, this will also search in the summary and
9
+ description of the pods.
10
+ DESC
11
+
12
+ self.arguments = [
13
+ CLAide::Argument.new('QUERY', true),
14
+ ]
15
+
16
+ def self.options
17
+ [
18
+ ['--regex', 'Interpret the `QUERY` as a regular expression'],
19
+ ['--full', 'Search by name, summary, and description'],
20
+ ['--stats', 'Show additional stats (like GitHub watchers and forks)'],
21
+ ['--ios', 'Restricts the search to Pods supported on iOS'],
22
+ ['--osx', 'Restricts the search to Pods supported on OS X'],
23
+ ['--watchos', 'Restricts the search to Pods supported on Watch OS'],
24
+ ['--web', 'Searches on cocoapods.org'],
25
+ ].concat(super.reject { |option, _| option == '--silent' })
26
+ end
27
+
28
+ def initialize(argv)
29
+ @use_regex = argv.flag?('regex')
30
+ @full_text_search = argv.flag?('full')
31
+ @stats = argv.flag?('stats')
32
+ @supported_on_ios = argv.flag?('ios')
33
+ @supported_on_osx = argv.flag?('osx')
34
+ @supported_on_watchos = argv.flag?('watchos')
35
+ @web = argv.flag?('web')
36
+ @query = argv.arguments! unless argv.arguments.empty?
37
+ config.silent = false
38
+ super
39
+ end
40
+
41
+ def validate!
42
+ super
43
+ help! 'A search query is required.' unless @query
44
+
45
+ unless @web || !@use_regex
46
+ begin
47
+ /#{@query.join(' ').strip}/
48
+ rescue RegexpError
49
+ help! 'A valid regular expression is required.'
50
+ end
51
+ end
52
+ end
53
+
54
+ def run
55
+ ensure_master_spec_repo_exists!
56
+ if @web
57
+ web_search
58
+ else
59
+ local_search
60
+ end
61
+ end
62
+
63
+ def web_search
64
+ query_parameter = [
65
+ ('on:osx' if @supported_on_osx),
66
+ ('on:ios' if @supported_on_ios),
67
+ ('on:watchos' if @supported_on_watchos),
68
+ @query,
69
+ ].compact.flatten.join(' ')
70
+ url = "https://cocoapods.org/?q=#{CGI.escape(query_parameter).gsub('+', '%20')}"
71
+ UI.puts("Opening #{url}")
72
+ open!(url)
73
+ end
74
+
75
+ def local_search
76
+ query_regex = @query.join(' ').strip
77
+ query_regex = Regexp.escape(query_regex) unless @use_regex
78
+
79
+ sets = SourcesManager.search_by_name(query_regex, @full_text_search)
80
+ if @supported_on_ios
81
+ sets.reject! { |set| !set.specification.available_platforms.map(&:name).include?(:ios) }
82
+ end
83
+ if @supported_on_osx
84
+ sets.reject! { |set| !set.specification.available_platforms.map(&:name).include?(:osx) }
85
+ end
86
+ if @supported_on_watchos
87
+ sets.reject! { |set| !set.specification.available_platforms.map(&:name).include?(:watchos) }
88
+ end
89
+
90
+ sets.each do |set|
91
+ begin
92
+ if @stats
93
+ UI.pod(set, :stats)
94
+ else
95
+ UI.pod(set, :normal)
96
+ end
97
+ rescue DSLError
98
+ UI.warn "Skipping `#{set.name}` because the podspec contains errors."
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,3 @@
1
+ module CocoapodsSearch
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-search/command'
@@ -0,0 +1,122 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Command::Search do
5
+ extend SpecHelper::TemporaryRepos
6
+
7
+ before do
8
+ @test_source = Source.new(fixture('spec-repos/test_repo'))
9
+ Source::Aggregate.any_instance.stubs(:sources).returns([@test_source])
10
+ SourcesManager.updated_search_index = nil
11
+ end
12
+
13
+ describe 'Search' do
14
+ it 'registers it self' do
15
+ Command.parse(%w{ search }).should.be.instance_of Command::Search
16
+ end
17
+
18
+ it 'runs with correct parameters' do
19
+ lambda { run_command('search', 'JSON') }.should.not.raise
20
+ lambda { run_command('search', 'JSON', '--full') }.should.not.raise
21
+ end
22
+
23
+ it 'complains for wrong parameters' do
24
+ lambda { run_command('search') }.should.raise CLAide::Help
25
+ lambda { run_command('search', 'too', '--wrong') }.should.raise CLAide::Help
26
+ lambda { run_command('search', '--wrong') }.should.raise CLAide::Help
27
+ end
28
+
29
+ it 'searches for a pod with name matching the given query ignoring case' do
30
+ output = run_command('search', 'json')
31
+ output.should.include? 'JSONKit'
32
+ end
33
+
34
+ it 'searches for a pod with name, summary, or description matching the given query ignoring case' do
35
+ output = run_command('search', 'Engelhart', '--full')
36
+ output.should.include? 'JSONKit'
37
+ end
38
+
39
+ it 'restricts the search to Pods supported on iOS' do
40
+ output = run_command('search', 'BananaLib', '--ios')
41
+ output.should.include? 'BananaLib'
42
+ Specification.any_instance.stubs(:available_platforms).returns([Platform.osx])
43
+ output = run_command('search', 'BananaLib', '--ios')
44
+ output.should.not.include? 'BananaLib'
45
+ end
46
+
47
+ it 'restricts the search to Pods supported on OS X' do
48
+ output = run_command('search', 'BananaLib', '--osx')
49
+ output.should.not.include? 'BananaLib'
50
+ end
51
+
52
+ it 'restricts the search to Pods supported on Watch OS' do
53
+ output = run_command('search', '', '--watchos')
54
+ output.should.include? 'Realm'
55
+ output.should.not.include? 'BananaLib'
56
+ end
57
+
58
+ it 'outputs with the silent parameter' do
59
+ output = run_command('search', 'BananaLib', '--silent')
60
+ output.should.include? 'BananaLib'
61
+ end
62
+
63
+ it 'shows a friendly message when locally searching with invalid regex' do
64
+ lambda { run_command('search', '--regex', '+') }.should.raise CLAide::Help
65
+ end
66
+
67
+ it 'does not try to validate the query as a regex with plain-text search' do
68
+ lambda { run_command('search', '+') }.should.not.raise CLAide::Help
69
+ end
70
+
71
+ it 'uses regex search when asked for regex mode' do
72
+ output = run_command('search', '--regex', 'Ba(na)+Lib')
73
+ output.should.include? 'BananaLib'
74
+ output.should.not.include? 'Pod+With+Plus+Signs'
75
+ output.should.not.include? 'JSONKit'
76
+ end
77
+
78
+ it 'uses plain-text search when not asked for regex mode' do
79
+ output = run_command('search', 'Pod+With+Plus+Signs')
80
+ output.should.include? 'Pod+With+Plus+Signs'
81
+ output.should.not.include? 'BananaLib'
82
+ end
83
+ end
84
+
85
+ describe 'option --web' do
86
+ extend SpecHelper::TemporaryRepos
87
+
88
+ it 'searches with invalid regex' do
89
+ Command::Search.any_instance.expects(:open!).with('https://cocoapods.org/?q=NSAttributedString%2BCCLFormat')
90
+ run_command('search', '--web', 'NSAttributedString+CCLFormat')
91
+ end
92
+
93
+ it 'should url encode search queries' do
94
+ Command::Search.any_instance.expects(:open!).with('https://cocoapods.org/?q=NSAttributedString%2BCCLFormat')
95
+ run_command('search', '--web', 'NSAttributedString+CCLFormat')
96
+ end
97
+
98
+ it 'searches the web via the open! command' do
99
+ Command::Search.any_instance.expects(:open!).with('https://cocoapods.org/?q=bananalib')
100
+ run_command('search', '--web', 'bananalib')
101
+ end
102
+
103
+ it 'includes option --osx correctly' do
104
+ Command::Search.any_instance.expects(:open!).with('https://cocoapods.org/?q=on%3Aosx%20bananalib')
105
+ run_command('search', '--web', '--osx', 'bananalib')
106
+ end
107
+
108
+ it 'includes option --ios correctly' do
109
+ Command::Search.any_instance.expects(:open!).with('https://cocoapods.org/?q=on%3Aios%20bananalib')
110
+ run_command('search', '--web', '--ios', 'bananalib')
111
+ end
112
+
113
+ it 'does not matter in which order the ios/osx options are set' do
114
+ Command::Search.any_instance.expects(:open!).with('https://cocoapods.org/?q=on%3Aosx%20on%3Aios%20bananalib')
115
+ run_command('search', '--web', '--ios', '--osx', 'bananalib')
116
+
117
+ Command::Search.any_instance.expects(:open!).with('https://cocoapods.org/?q=on%3Aosx%20on%3Aios%20bananalib')
118
+ run_command('search', '--web', '--osx', '--ios', 'bananalib')
119
+ end
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,21 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = 'BananaLib'
3
+ s.version = '1.0'
4
+ s.authors = 'Banana Corp', { 'Monkey Boy' => 'monkey@banana-corp.local' }
5
+ s.homepage = 'http://banana-corp.local/banana-lib.html'
6
+ s.summary = 'Chunky bananas!'
7
+ s.description = 'Full of chunky bananas.'
8
+ s.platform = :ios
9
+
10
+ s.source = { :git => 'http://banana-corp.local/banana-lib.git', :tag => 'v1.0' }
11
+ s.source_files = 'Classes/*.{h,m}', 'Vendor'
12
+ s.xcconfig = { 'OTHER_LDFLAGS' => '-framework SystemConfiguration' }
13
+ s.prefix_header_file = 'Classes/BananaLib.pch'
14
+ s.resources = "Resources/*.png"
15
+ s.dependency 'monkey', '~> 1.0.1', '< 1.0.9'
16
+ s.license = {
17
+ :type => 'MIT',
18
+ :file => 'LICENSE',
19
+ :text => 'Permission is hereby granted ...'
20
+ }
21
+ end
@@ -0,0 +1,11 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = 'JSONKit'
3
+ s.version = '1.4'
4
+ s.license = 'BSD / Apache License, Version 2.0'
5
+ s.summary = 'A Very High Performance Objective-C JSON Library.'
6
+ s.homepage = 'https://github.com/johnezang/JSONKit'
7
+ s.author = 'John Engelhart'
8
+ s.source = { :git => 'https://github.com/johnezang/JSONKit.git', :tag => 'v1.4' }
9
+
10
+ s.source_files = 'JSONKit.*'
11
+ end
@@ -0,0 +1,12 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = 'JSONKit'
3
+ s.version = '999.999.999'
4
+ s.license = 'BSD / Apache License, Version 2.0'
5
+ s.summary = 'A Very High Performance Objective-C JSON Library.'
6
+ s.homepage = 'https://github.com/johnezang/JSONKit'
7
+ s.author = 'John Engelhart'
8
+ s.source = { :git => 'https://github.com/johnezang/JSONKit.git', :commit => '0aff3deb5e1bb2bbc88a83fd71c8ad5550185cce' }
9
+
10
+ s.source_files = 'JSONKit.*'
11
+ s.compiler_flags = '-Wno-deprecated-objc-isa-usage', '-Wno-format'
12
+ end
@@ -0,0 +1,16 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = "OrangeFramework"
3
+ s.version = "0.1.0"
4
+ s.author = { "Swiftest Orang-Utan" => "swiftest@orang.utan.local" }
5
+ s.summary = "Fresh juice!"
6
+ s.description = "Blends fresh orange juice."
7
+ s.homepage = "http://httpbin.org/html"
8
+ s.source = { :git => "http://utan.local/orange-framework.git", :tag => s.version.to_s }
9
+ s.license = 'MIT'
10
+
11
+ s.platform = :ios, '8.0'
12
+
13
+ s.source_files = 'Source/Juicer.swift'
14
+
15
+ s.frameworks = 'UIKit'
16
+ end
@@ -0,0 +1,17 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = 'Pod+With+Plus+Signs'
3
+ s.version = '1.0'
4
+ s.authors = 'Evil Corp'
5
+ s.homepage = 'http://evil-corp.local/pod_with_plus_signs.html'
6
+ s.summary = 'Messing with special chars'
7
+ s.description = 'I love messing up with special chars in my pod name! Mouahahahahaa (evil laugh)'
8
+ s.platform = :ios
9
+
10
+ s.source = { :git => 'http://evil-corp.local/pod_with_plus_signs.git', :tag => '1.0' }
11
+ s.source_files = 'Classes/*.{h,m}'
12
+ s.license = {
13
+ :type => 'MIT',
14
+ :file => 'LICENSE',
15
+ :text => 'Permission is hereby granted ...'
16
+ }
17
+ end
@@ -0,0 +1,18 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = 'Realm'
3
+ s.version = '0.94'
4
+ s.authors = 'Realm', { 'Realm' => 'help@realm.io' }
5
+ s.homepage = 'https://realm.io/'
6
+ s.summary = 'Realm is a modern data framework & database for iOS & OS X.'
7
+ s.description = 'The Realm database, for Objective-C. (If you want to use Realm from Swift, see the “RealmSwift” pod.)\n\nRealm is a mobile database: a replacement for Core Data & SQLite. You can use it on iOS & OS X. Realm is not an ORM on top SQLite: instead it uses its own persistence engine, built for simplicity (& speed). Learn more and get help at https://realm.io'
8
+ s.platform = :watchos
9
+
10
+ s.source = { :git => 'https://github.com/realm/realm-cocoa.git', :tag => 'v0.94.0' }
11
+ s.source_files = 'Realm/*.{m,mm}', 'Realm/ObjectStore/*.cpp'
12
+ s.xcconfig = { 'CLANG_CXX_LANGUAGE_STANDARD": "compiler-default' => 'OTHER_CPLUSPLUSFLAGS": "-std=c++1y $(inherited)' }
13
+ s.prefix_header_file = 'Classes/Realm.pch'
14
+ s.license = {
15
+ :type => 'Apache 2.0',
16
+ :file => 'LICENSE'
17
+ }
18
+ end
@@ -0,0 +1,11 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = "monkey"
3
+ s.version = "1.0.2"
4
+ s.author = { "Funky Monkey" => "funky@monkey.local" }
5
+ s.summary = "🙈🙉🙊"
6
+ s.description = "See no evil! Hear no evil! Speak no evil!"
7
+ s.homepage = "http://httpbin.org/html"
8
+ s.source = { :git => "http://monkey.local/monkey.git", :tag => s.version.to_s }
9
+ s.license = 'MIT'
10
+ s.vendored_library = 'monkey.a'
11
+ end
@@ -0,0 +1,85 @@
1
+ require 'pathname'
2
+ ROOT = Pathname.new(File.expand_path('../../', __FILE__))
3
+ $:.unshift((ROOT + 'lib').to_s)
4
+ $:.unshift((ROOT + 'spec').to_s)
5
+
6
+ require 'bundler/setup'
7
+ require 'bacon'
8
+ require 'mocha-on-bacon'
9
+ require 'pretty_bacon'
10
+ require 'cocoapods'
11
+
12
+ require 'cocoapods_plugin'
13
+
14
+ require 'spec_helper/command' # Allows to run Pod commands and returns their output.
15
+ require 'spec_helper/fixture' # Provides access to the fixtures and unpacks them if needed.
16
+ require 'spec_helper/temporary_repos' # Allows to create and modify temporary spec repositories.
17
+ require 'spec_helper/user_interface' # Redirects UI to UI.output & UI.warnings.
18
+ require 'spec_helper/pre_flight' # Cleans the temporary directory, the config & the UI.output before every test.
19
+
20
+ module Bacon
21
+ class Context
22
+ include Pod::Config::Mixin
23
+ include SpecHelper::Fixture
24
+ include SpecHelper::Command
25
+
26
+ def skip_xcodebuild?
27
+ ENV['SKIP_XCODEBUILD']
28
+ end
29
+
30
+ def temporary_directory
31
+ SpecHelper.temporary_directory
32
+ end
33
+ end
34
+ end
35
+
36
+ #Mocha::Configuration.prevent(:stubbing_non_existent_method)
37
+
38
+ module SpecHelper
39
+ def self.temporary_directory
40
+ ROOT + 'tmp'
41
+ end
42
+ end
43
+
44
+ def temporary_sandbox
45
+ Pod::Sandbox.new(temporary_directory + 'Pods')
46
+ end
47
+
48
+ def fixture_spec(name)
49
+ file = SpecHelper::Fixture.fixture(name)
50
+ Pod::Specification.from_file(file)
51
+ end
52
+
53
+ def fixture_file_accessor(spec_or_name, platform = Pod::Platform.ios)
54
+ spec = spec_or_name.is_a?(Pod::Specification) ? spec_or_name : fixture_spec(spec_or_name)
55
+ path_list = Pod::Sandbox::PathList.new(spec.defined_in_file.dirname)
56
+ Pod::Sandbox::FileAccessor.new(path_list, spec.consumer(platform))
57
+ end
58
+
59
+ def fixture_target_definition(name = 'Pods', platform = Pod::Platform.ios)
60
+ Pod::Podfile::TargetDefinition.new(name, Pod::Podfile.new, 'name' => name, 'platform' => platform)
61
+ end
62
+
63
+ def fixture_pod_target(spec_or_name, target_definition = nil)
64
+ spec = spec_or_name.is_a?(Pod::Specification) ? spec_or_name : fixture_spec(spec_or_name)
65
+ target_definition ||= fixture_target_definition
66
+ target_definition.store_pod(spec.name)
67
+ Pod::PodTarget.new([spec], [target_definition], config.sandbox).tap do |pod_target|
68
+ pod_target.file_accessors << fixture_file_accessor(spec, pod_target.platform)
69
+ consumer = spec.consumer(pod_target.platform)
70
+ pod_target.spec_consumers << consumer
71
+ end
72
+ end
73
+
74
+ def fixture_aggregate_target(pod_targets = [], target_definition = nil)
75
+ target_definition ||= pod_targets.flat_map(&:target_definitions).first || fixture_target_definition
76
+ target = Pod::AggregateTarget.new(target_definition, config.sandbox)
77
+ target.client_root = config.sandbox.root.dirname
78
+ target.pod_targets = pod_targets
79
+ target
80
+ end
81
+
82
+ #-----------------------------------------------------------------------------#
83
+
84
+ SpecHelper::Fixture.fixture('banana-lib') # ensure it exists
85
+ SpecHelper::Fixture.fixture('orange-framework')
@@ -0,0 +1,27 @@
1
+ module SpecHelper
2
+ module Command
3
+ def argv(*argv)
4
+ CLAide::ARGV.new(argv)
5
+ end
6
+
7
+ def command(*argv)
8
+ argv << '--no-ansi'
9
+ Pod::Command.parse(argv)
10
+ end
11
+
12
+ def run_command(*args)
13
+ Dir.chdir(SpecHelper.temporary_directory) do
14
+ Pod::UI.output = ''
15
+ # @todo Remove this once all cocoapods has
16
+ # been converted to use the UI.puts
17
+ config_silent = config.silent?
18
+ config.silent = false
19
+ cmd = command(*args)
20
+ cmd.validate!
21
+ cmd.run
22
+ config.silent = config_silent
23
+ Pod::UI.output
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,32 @@
1
+ module SpecHelper
2
+ def self.fixture(name)
3
+ Fixture.fixture(name)
4
+ end
5
+
6
+ def self.create_sample_app_copy_from_fixture(fixture_name)
7
+ fixture_copy_path = temporary_directory + fixture_name
8
+ FileUtils.cp_r(fixture(fixture_name), temporary_directory)
9
+ fixture_copy_path + "#{fixture_name}.xcodeproj"
10
+ end
11
+
12
+ def self.test_repo_url
13
+ 'https://github.com/CocoaPods/test_repo.git'
14
+
15
+ end
16
+
17
+ module Fixture
18
+ ROOT = ::ROOT + 'spec/fixtures'
19
+
20
+ def fixture(name)
21
+ file = ROOT + name
22
+ unless file.exist?
23
+ archive = Pathname.new(file.to_s + '.tar.gz')
24
+ if archive.exist?
25
+ system "cd '#{archive.dirname}' && tar -zxvf '#{archive}' > /dev/null 2>&1"
26
+ end
27
+ end
28
+ file
29
+ end
30
+ module_function :fixture
31
+ end
32
+ end
@@ -0,0 +1,37 @@
1
+ # Restores the config to the default state before each requirement
2
+
3
+ module Bacon
4
+ class Context
5
+ old_run_requirement = instance_method(:run_requirement)
6
+
7
+
8
+ define_method(:run_requirement) do |description, spec|
9
+ ::Pod::Config.instance = nil
10
+ ::Pod::Config.instance.tap do |c|
11
+ c.verbose = false
12
+ c.silent = true
13
+ c.repos_dir = fixture('spec-repos')
14
+ c.installation_root = SpecHelper.temporary_directory
15
+ c.skip_repo_update = true
16
+ c.cache_root = SpecHelper.temporary_directory + 'Cache'
17
+ end
18
+
19
+ ::Pod::UI.output = ''
20
+ ::Pod::UI.warnings = ''
21
+ ::Pod::UI.next_input = ''
22
+ # The following prevents a nasty behaviour where the increments are not
23
+ # balanced when testing informative which might lead to sections not
24
+ # being printed to the output as they are too nested.
25
+ ::Pod::UI.indentation_level = 0
26
+ ::Pod::UI.title_level = 0
27
+
28
+ SpecHelper.temporary_directory.rmtree if SpecHelper.temporary_directory.exist?
29
+ SpecHelper.temporary_directory.mkpath
30
+
31
+ # TODO
32
+ #::Pod::SourcesManager.stubs(:search_index_path).returns(temporary_directory + 'search_index.yaml')
33
+
34
+ old_run_requirement.bind(self).call(description, spec)
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,90 @@
1
+ module SpecHelper
2
+ def self.tmp_repos_path
3
+ TemporaryRepos.tmp_repos_path
4
+ end
5
+
6
+ module TemporaryRepos
7
+ extend Pod::Executable
8
+ executable :git
9
+
10
+ # @return [Pathname] The path for the repo with the given name.
11
+ #
12
+ def repo_path(name)
13
+ tmp_repos_path + name
14
+ end
15
+
16
+ # Makes a repo with the given name.
17
+ #
18
+ def repo_make(name)
19
+ path = repo_path(name)
20
+ path.mkpath
21
+ Dir.chdir(path) do
22
+ `git init`
23
+ repo_make_readme_change(name, 'Added')
24
+ `git add .`
25
+ `git commit -m "Initialized."`
26
+ end
27
+ path
28
+ end
29
+
30
+ # Clones a repo to the given name.
31
+ #
32
+ def repo_clone(from_name, to_name)
33
+ Dir.chdir(tmp_repos_path) { `git clone #{from_name} #{to_name} 2>&1 > /dev/null` }
34
+ repo_path(to_name)
35
+ end
36
+
37
+ def repo_make_readme_change(name, string)
38
+ file = repo_path(name) + 'README'
39
+ file.open('w') { |f| f << "#{string}" }
40
+ end
41
+
42
+ #--------------------------------------#
43
+
44
+ def test_repo_path
45
+ repo_path('master')
46
+ end
47
+
48
+ # Sets up a lighweight master repo in `tmp/cocoapods/repos/master` with the
49
+ # contents of `spec/fixtures/spec-repos/test_repo`.
50
+ #
51
+ def set_up_test_repo
52
+ require 'fileutils'
53
+ test_repo_path.mkpath
54
+ origin = ROOT + 'spec/fixtures/spec-repos/test_repo/.'
55
+ destination = tmp_repos_path + 'master'
56
+ FileUtils.cp_r(origin, destination)
57
+ repo_make('master')
58
+ end
59
+
60
+ def test_old_repo_path
61
+ repo_path('../master')
62
+ end
63
+
64
+ # Sets up a lighweight master repo in `tmp/cocoapods/master` with the
65
+ # contents of `spec/fixtures/spec-repos/test_repo`.
66
+ #
67
+ def set_up_old_test_repo
68
+ require 'fileutils'
69
+ test_old_repo_path.mkpath
70
+ origin = ROOT + 'spec/fixtures/spec-repos/test_repo/.'
71
+ destination = tmp_repos_path + '../master'
72
+ FileUtils.cp_r(origin, destination)
73
+ repo_make('../master')
74
+ end
75
+
76
+ #--------------------------------------#
77
+
78
+ def tmp_repos_path
79
+ SpecHelper.temporary_directory + 'cocoapods/repos'
80
+ end
81
+
82
+ module_function :tmp_repos_path
83
+
84
+ def self.extended(base)
85
+ base.before do
86
+ TemporaryRepos.tmp_repos_path.mkpath
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,36 @@
1
+ module Pod
2
+ # Disable the wrapping so the output is deterministic in the tests.
3
+ #
4
+ UI.disable_wrap = true
5
+
6
+ # Redirects the messages to an internal store.
7
+ #
8
+ module UI
9
+ @output = ''
10
+ @warnings = ''
11
+ @next_input = ''
12
+
13
+ class << self
14
+ attr_accessor :output
15
+ attr_accessor :warnings
16
+ attr_accessor :next_input
17
+
18
+ def puts(message = '')
19
+ @output << "#{message}\n"
20
+ end
21
+
22
+ def warn(message = '', _actions = [])
23
+ @warnings << "#{message}\n"
24
+ end
25
+
26
+ def print(message)
27
+ @output << message
28
+ end
29
+
30
+ alias_method :gets, :next_input
31
+
32
+ def print_warnings
33
+ end
34
+ end
35
+ end
36
+ end
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-search
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Eloy Durán
8
+ - Fabio Pelosin
9
+ - Emma Koszinowski
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2015-09-03 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bundler
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: '1.3'
29
+ - !ruby/object:Gem::Dependency
30
+ name: rake
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ type: :development
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ description: Search for pods.
44
+ email:
45
+ - eloy.de.enige@gmail.com
46
+ - fabiopelosin@gmail.com
47
+ - emkosz@gmail.com
48
+ executables: []
49
+ extensions: []
50
+ extra_rdoc_files: []
51
+ files:
52
+ - ".gitignore"
53
+ - ".travis.yml"
54
+ - CHANGELOG.md
55
+ - Gemfile
56
+ - Gemfile.lock
57
+ - LICENSE.txt
58
+ - README.md
59
+ - Rakefile
60
+ - cocoapods-search.gemspec
61
+ - lib/cocoapods-search.rb
62
+ - lib/cocoapods-search/command.rb
63
+ - lib/cocoapods-search/command/search.rb
64
+ - lib/cocoapods-search/gem_version.rb
65
+ - lib/cocoapods_plugin.rb
66
+ - spec/command/search_spec.rb
67
+ - spec/fixtures/spec-repos/test_repo/BananaLib/1.0/BananaLib.podspec
68
+ - spec/fixtures/spec-repos/test_repo/JSONKit/1.4/JSONKit.podspec
69
+ - spec/fixtures/spec-repos/test_repo/JSONKit/999.999.999/JSONKit.podspec
70
+ - spec/fixtures/spec-repos/test_repo/OrangeFramework/0.1.0/OrangeFramework.podspec
71
+ - spec/fixtures/spec-repos/test_repo/Pod+With+Plus+Signs/1.0/Pod+With+Plus+Signs.podspec
72
+ - spec/fixtures/spec-repos/test_repo/Realm/0.94/Realm.podspec
73
+ - spec/fixtures/spec-repos/test_repo/monkey/1.0.2/monkey.podspec
74
+ - spec/spec_helper.rb
75
+ - spec/spec_helper/command.rb
76
+ - spec/spec_helper/fixture.rb
77
+ - spec/spec_helper/pre_flight.rb
78
+ - spec/spec_helper/temporary_repos.rb
79
+ - spec/spec_helper/user_interface.rb
80
+ homepage: https://github.com/CocoaPods/cocoapods-search
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project:
100
+ rubygems_version: 2.2.2
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: Searches for pods, ignoring case, whose name matches `QUERY`. If the `--full`
104
+ option is specified, this will also search in the summary and description of the
105
+ pods.
106
+ test_files:
107
+ - spec/command/search_spec.rb
108
+ - spec/fixtures/spec-repos/test_repo/BananaLib/1.0/BananaLib.podspec
109
+ - spec/fixtures/spec-repos/test_repo/JSONKit/1.4/JSONKit.podspec
110
+ - spec/fixtures/spec-repos/test_repo/JSONKit/999.999.999/JSONKit.podspec
111
+ - spec/fixtures/spec-repos/test_repo/OrangeFramework/0.1.0/OrangeFramework.podspec
112
+ - spec/fixtures/spec-repos/test_repo/Pod+With+Plus+Signs/1.0/Pod+With+Plus+Signs.podspec
113
+ - spec/fixtures/spec-repos/test_repo/Realm/0.94/Realm.podspec
114
+ - spec/fixtures/spec-repos/test_repo/monkey/1.0.2/monkey.podspec
115
+ - spec/spec_helper.rb
116
+ - spec/spec_helper/command.rb
117
+ - spec/spec_helper/fixture.rb
118
+ - spec/spec_helper/pre_flight.rb
119
+ - spec/spec_helper/temporary_repos.rb
120
+ - spec/spec_helper/user_interface.rb