cocoapods-sources 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/Gemfile +13 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +22 -0
- data/README.md +11 -0
- data/Rakefile +13 -0
- data/cocoapods-sources.gemspec +23 -0
- data/lib/cocoapods-sources.rb +1 -0
- data/lib/cocoapods-sources/command.rb +1 -0
- data/lib/cocoapods-sources/command/sources.rb +44 -0
- data/lib/cocoapods-sources/gem_version.rb +3 -0
- data/lib/cocoapods-sources/native/aggregate.rb +30 -0
- data/lib/cocoapods-sources/native/podfile.rb +28 -0
- data/lib/cocoapods-sources/native/resolver.rb +10 -0
- data/lib/cocoapods-sources/source_provider_hook.rb +14 -0
- data/lib/cocoapods_plugin.rb +3 -0
- data/spec/command/sources_spec.rb +12 -0
- data/spec/spec_helper.rb +50 -0
- metadata +92 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 514157851b68ae55348c1da7c03ac17d270e1f58
|
4
|
+
data.tar.gz: e70902e7863c59385fb8824a466cf1bcd5b87d5c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8c4b34bbe85ecec9ca9fecf7e1adaa296c5fc82a00cdad66dc24ab9e8bf8d795971915f96d6e39572eb5e4960a8129bc10e4bcfff972695ebb095906dffe51dc
|
7
|
+
data.tar.gz: 39dab604be05d05e659a6dac9bb5ab0625844aa443197abd85ef83baff577834664a7f62c29ea197b71ec2c500d828a8fb9f46a8b99bc5330803adf6b0f031ba
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 Mrdaios
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2019 mrdaios <mrdaios@gmail.com>
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cocoapods-sources/gem_version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cocoapods-sources'
|
8
|
+
spec.version = CocoapodsSources::VERSION
|
9
|
+
spec.authors = ['mrdaios']
|
10
|
+
spec.email = ['mrdaios@gmail.com']
|
11
|
+
spec.description = %q{a plugin for manage cocoapods source.}
|
12
|
+
spec.summary = %q{a plugin for manage cocoapods source.}
|
13
|
+
spec.homepage = 'https://github.com/mrdaios/cocoapods-sources'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-sources/gem_version'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-sources/command/sources'
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
# This is an example of a cocoapods plugin adding a top-level subcommand
|
4
|
+
# to the 'pod' command.
|
5
|
+
#
|
6
|
+
# You can also create subcommands of existing or new commands. Say you
|
7
|
+
# wanted to add a subcommand to `list` to show newly deprecated pods,
|
8
|
+
# (e.g. `pod list deprecated`), there are a few things that would need
|
9
|
+
# to change.
|
10
|
+
#
|
11
|
+
# - move this file to `lib/pod/command/list/deprecated.rb` and update
|
12
|
+
# the class to exist in the the Pod::Command::List namespace
|
13
|
+
# - change this class to extend from `List` instead of `Command`. This
|
14
|
+
# tells the plugin system that it is a subcommand of `list`.
|
15
|
+
# - edit `lib/cocoapods_plugins.rb` to require this file
|
16
|
+
#
|
17
|
+
# @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
|
18
|
+
# in the `plugins.json` file, once your plugin is released.
|
19
|
+
#
|
20
|
+
class Sources < Command
|
21
|
+
self.summary = 'Short description of cocoapods-sources.'
|
22
|
+
|
23
|
+
self.description = <<-DESC
|
24
|
+
Longer description of cocoapods-sources.
|
25
|
+
DESC
|
26
|
+
|
27
|
+
self.arguments = 'NAME'
|
28
|
+
|
29
|
+
def initialize(argv)
|
30
|
+
@name = argv.shift_argument
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
def validate!
|
35
|
+
super
|
36
|
+
help! 'A Pod name is required.' unless @name
|
37
|
+
end
|
38
|
+
|
39
|
+
def run
|
40
|
+
UI.puts "Add your implementation for the cocoapods-sources plugin in #{__FILE__}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
require 'cocoapods-sources/native/podfile'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Source::Aggregate
|
6
|
+
def cocoapods_sources_search(dependency, podfile)
|
7
|
+
pod_with_source = podfile.get_options[:pod_with_source]
|
8
|
+
if pod_with_source.blank?
|
9
|
+
search(dependency)
|
10
|
+
else
|
11
|
+
specific_source = pod_with_source[dependency.to_s]
|
12
|
+
if specific_source.blank?
|
13
|
+
search(dependency)
|
14
|
+
else
|
15
|
+
found_sources = sources.select do |s|
|
16
|
+
if specific_source == s.url
|
17
|
+
s.search(dependency)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
unless found_sources.empty?
|
21
|
+
title = "Changing #{dependency} (to #{specific_source})"
|
22
|
+
UI.titled_section(title.green, { :verbose_prefix => '-> '.green }) do
|
23
|
+
Specification::Set.new(dependency.root_name, found_sources)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Podfile
|
5
|
+
COCOAPODS_SOURCES_OPTIONS = 'cocoapods_sources_options'.freeze
|
6
|
+
|
7
|
+
public
|
8
|
+
|
9
|
+
def set_options(options)
|
10
|
+
set_internal_hash_value(COCOAPODS_SOURCES_OPTIONS,options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_options
|
14
|
+
get_internal_hash_value(COCOAPODS_SOURCES_OPTIONS, {})
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
# set_hash_value 有 key 限制
|
20
|
+
def set_internal_hash_value(key, value)
|
21
|
+
internal_hash[key] = value
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_internal_hash_value(key, default = nil)
|
25
|
+
internal_hash.fetch(key, default)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Resolver
|
5
|
+
alias_method :old_create_set_from_sources, :create_set_from_sources
|
6
|
+
def create_set_from_sources(dependency)
|
7
|
+
aggregate_for_dependency(dependency).cocoapods_sources_search(dependency,podfile)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
|
3
|
+
Pod::HooksManager.register('cocoapods-sources', :pre_install) do |context, options|
|
4
|
+
require 'cocoapods-sources/native/aggregate'
|
5
|
+
require 'cocoapods-sources/native/podfile'
|
6
|
+
require 'cocoapods-sources/native/resolver'
|
7
|
+
|
8
|
+
context.podfile.set_options(options)
|
9
|
+
end
|
10
|
+
|
11
|
+
Pod::HooksManager.register('cocoapods-sources', :source_provider) do |context, _|
|
12
|
+
sources_manager = Pod::Config.instance.sources_manager
|
13
|
+
podfile = Pod::Config.instance.podfile
|
14
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,50 @@
|
|
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 'pathname'
|
11
|
+
require 'cocoapods'
|
12
|
+
|
13
|
+
Mocha::Configuration.prevent(:stubbing_non_existent_method)
|
14
|
+
|
15
|
+
require 'cocoapods_plugin'
|
16
|
+
|
17
|
+
#-----------------------------------------------------------------------------#
|
18
|
+
|
19
|
+
module Pod
|
20
|
+
|
21
|
+
# Disable the wrapping so the output is deterministic in the tests.
|
22
|
+
#
|
23
|
+
UI.disable_wrap = true
|
24
|
+
|
25
|
+
# Redirects the messages to an internal store.
|
26
|
+
#
|
27
|
+
module UI
|
28
|
+
@output = ''
|
29
|
+
@warnings = ''
|
30
|
+
|
31
|
+
class << self
|
32
|
+
attr_accessor :output
|
33
|
+
attr_accessor :warnings
|
34
|
+
|
35
|
+
def puts(message = '')
|
36
|
+
@output << "#{message}\n"
|
37
|
+
end
|
38
|
+
|
39
|
+
def warn(message = '', actions = [])
|
40
|
+
@warnings << "#{message}\n"
|
41
|
+
end
|
42
|
+
|
43
|
+
def print(message)
|
44
|
+
@output << message
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
#-----------------------------------------------------------------------------#
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-sources
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- mrdaios
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-09-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: a plugin for manage cocoapods source.
|
42
|
+
email:
|
43
|
+
- mrdaios@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- cocoapods-sources.gemspec
|
55
|
+
- lib/cocoapods-sources.rb
|
56
|
+
- lib/cocoapods-sources/command.rb
|
57
|
+
- lib/cocoapods-sources/command/sources.rb
|
58
|
+
- lib/cocoapods-sources/gem_version.rb
|
59
|
+
- lib/cocoapods-sources/native/aggregate.rb
|
60
|
+
- lib/cocoapods-sources/native/podfile.rb
|
61
|
+
- lib/cocoapods-sources/native/resolver.rb
|
62
|
+
- lib/cocoapods-sources/source_provider_hook.rb
|
63
|
+
- lib/cocoapods_plugin.rb
|
64
|
+
- spec/command/sources_spec.rb
|
65
|
+
- spec/spec_helper.rb
|
66
|
+
homepage: https://github.com/mrdaios/cocoapods-sources
|
67
|
+
licenses:
|
68
|
+
- MIT
|
69
|
+
metadata: {}
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
requirements: []
|
85
|
+
rubyforge_project:
|
86
|
+
rubygems_version: 2.5.2.3
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: a plugin for manage cocoapods source.
|
90
|
+
test_files:
|
91
|
+
- spec/command/sources_spec.rb
|
92
|
+
- spec/spec_helper.rb
|