cocoapods-install_tal 0.0.1

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
+ SHA256:
3
+ metadata.gz: e7f5d807954ea9c0be6becc482118f98f29b27d3b1a00b17f5b169958ebd9a0d
4
+ data.tar.gz: ad557e99ab79a7c8c2978fe254cd4668c50c304b1b27f8f264c29b3aa8e59d2d
5
+ SHA512:
6
+ metadata.gz: 939f682213445e014b08e7e75d74d1b07a9857f22867b254ff34252d9a4a8f9805fd43544e8846b534db5a3ea6b8c76d4c23515c4dbe6eb79843ed524573dec8
7
+ data.tar.gz: 8a7493c43bbfe86dc16d5cb34f13be3e6e88582e55080b425787f4a104c1249e0afefd4d77fdeea861d6d6acd4f692f55fa4c4d91a0d56c1f77e923c341959ad
@@ -0,0 +1,50 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cocoapods-install_tal.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'cocoapods'
8
+
9
+ gem 'mocha'
10
+ gem 'bacon'
11
+ gem 'mocha-on-bacon'
12
+ gem 'prettybacon'
13
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Minlison
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.
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2019 MinLison <yuanhang.1991@icloud.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.
@@ -0,0 +1,11 @@
1
+ # cocoapods-install_tal
2
+
3
+ A description of cocoapods-install_tal.
4
+
5
+ ## Installation
6
+
7
+ $ gem install cocoapods-install_tal
8
+
9
+ ## Usage
10
+
11
+ $ pod spec install_tal POD_NAME
@@ -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-install_tal/gem_version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-install_tal'
8
+ spec.version = CocoapodsInstall_tal::VERSION
9
+ spec.authors = ['MinLison']
10
+ spec.email = ['yuanhang.1991@icloud.com']
11
+ spec.description = %q{A short description of cocoapods-install_tal.}
12
+ spec.summary = %q{A longer description of cocoapods-install_tal.}
13
+ spec.homepage = 'https://github.com/EXAMPLE/cocoapods-install_tal'
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_dependency "cocoapods", '>= 1.5.3', '< 2.0'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.3'
24
+ spec.add_development_dependency 'rake'
25
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-install_tal/gem_version'
@@ -0,0 +1,2 @@
1
+ require 'cocoapods-install_tal/command/install_tal'
2
+ require 'cocoapods-install_tal/command/update_tal'
@@ -0,0 +1,35 @@
1
+ module Pod
2
+ class Command
3
+ class Install_tal < Installer
4
+ # self.summary = '替代 Cocoapods 原生 install,可以自动解决库中冲突 lib'
5
+
6
+ # self.description = <<-DESC
7
+ # 替代 Cocoapods 原生 install,可以自动解决库中冲突 lib
8
+ # DESC
9
+
10
+ def self.options
11
+ [
12
+ ['--no-fix', 'not fix conflict after install before generate project']
13
+ ].concat(super)
14
+ end
15
+
16
+ def initialize(argv)
17
+ @no_fix = argv.flag?('no-fix', false)
18
+ super
19
+ end
20
+
21
+ def installer_tal_for_config
22
+ InstallerTal.new(config.sandbox, config.podfile, config.lockfile, !@no_fix)
23
+ end
24
+
25
+ def run
26
+ verify_podfile_exists!
27
+ installer = installer_tal_for_config
28
+ installer.repo_update = repo_update?(:default => false)
29
+ installer.update = false
30
+ installer.install!
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,45 @@
1
+ module Pod
2
+ class Command
3
+ class Update_tal < Update
4
+
5
+ # self.summary = '替代 Cocoapods 原生 install,可以自动解决库中冲突 lib'
6
+
7
+ # self.description = <<-DESC
8
+ # 替代 Cocoapods 原生 install,可以自动解决库中冲突 lib
9
+ # DESC
10
+
11
+ def self.options
12
+ [
13
+ ['--no-fix', 'not fix conflict after install before generate project'],
14
+ ].concat(super)
15
+ end
16
+
17
+ def initialize(argv)
18
+ @no_fix = argv.flag?('no-fix', false)
19
+ super
20
+ end
21
+
22
+ def installer_tal_for_config
23
+ InstallerTal.new(config.sandbox, config.podfile, config.lockfile, !@no_fix)
24
+ end
25
+
26
+ def run
27
+ verify_podfile_exists!
28
+
29
+ installer = installer_tal_for_config
30
+ installer.repo_update = repo_update?(:default => true)
31
+ if @pods
32
+ verify_lockfile_exists!
33
+ verify_pods_are_installed!
34
+ installer.update = { :pods => @pods }
35
+ else
36
+ UI.puts 'Update all pods'.yellow
37
+ installer.update = true
38
+ end
39
+ installer.install!
40
+ end
41
+
42
+ end
43
+ end
44
+ end
45
+
@@ -0,0 +1,3 @@
1
+ module CocoapodsInstall_tal
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,2 @@
1
+ require 'cocoapods-install_tal/src/installer_tal'
2
+ require 'cocoapods-install_tal/src/target_validator_tal'
@@ -0,0 +1,32 @@
1
+ module Pod
2
+ class InstallerTal < Installer
3
+ def initialize(sandbox, podfile, lockfile = nil, auto_fix_conflict = true)
4
+ @sandbox = sandbox
5
+ @podfile = podfile
6
+ @lockfile = lockfile
7
+ @auto_fix_conflict = auto_fix_conflict
8
+
9
+ @use_default_plugins = true
10
+ @has_dependencies = true
11
+ end
12
+
13
+ def install!
14
+ prepare
15
+ resolve_dependencies
16
+ download_dependencies
17
+ validate_targets_remove_confilict
18
+ generate_pods_project
19
+ if installation_options.integrate_targets?
20
+ integrate_user_project
21
+ else
22
+ UI.section 'Skipping User Project Integration'
23
+ end
24
+ perform_post_install_actions
25
+ end
26
+
27
+ def validate_targets_remove_confilict
28
+ validator = Xcode::TargetValidatorTal.new(aggregate_targets, pod_targets, @auto_fix_conflict)
29
+ validator.validate!
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,61 @@
1
+ module Pod
2
+ class Installer
3
+ class Xcode
4
+ class TargetValidatorTal < TargetValidator
5
+
6
+ def initialize(aggregate_targets, pod_targets, auto_fix_conflict = true)
7
+ @aggregate_targets = aggregate_targets
8
+ @pod_targets = pod_targets
9
+ @auto_fix_conflict = auto_fix_conflict
10
+ end
11
+
12
+ def verify_no_duplicate_framework_and_library_names
13
+ aggregate_targets.each do |aggregate_target|
14
+ aggregate_target.user_build_configurations.keys.each do |config|
15
+ pod_targets = aggregate_target.pod_targets_for_build_configuration(config)
16
+ file_accessors = pod_targets.flat_map(&:file_accessors)
17
+
18
+ frameworks = file_accessors.flat_map(&:vendored_frameworks).uniq.map(&:basename)
19
+ frameworks += pod_targets.select { |pt| pt.should_build? && pt.requires_frameworks? }.map(&:product_module_name).uniq
20
+ verify_no_duplicate_names(frameworks, aggregate_target, 'frameworks', file_accessors)
21
+
22
+ libraries = file_accessors.flat_map(&:vendored_libraries).uniq.map(&:basename)
23
+ libraries += pod_targets.select { |pt| pt.should_build? && !pt.requires_frameworks? }.map(&:product_name)
24
+ verify_no_duplicate_names(libraries, aggregate_target, 'libraries', file_accessors)
25
+ end
26
+ end
27
+ end
28
+
29
+ def verify_no_duplicate_names(names, aggregate_target, type, file_accessors)
30
+ duplicates = names.map { |n| n.to_s.downcase }.group_by { |f| f }.select { |_, v| v.size > 1 }.keys
31
+
32
+ if !duplicates.empty? && @auto_fix_conflict
33
+ # 移除冲突文件
34
+ duplicate_files = Array.new
35
+ duplicates.each do |d|
36
+ tmp_duplicate = file_accessors.flat_map(&:vendored_libraries).uniq.find_all { |p|
37
+ d == p.basename.to_s && File.exist?(p)
38
+ }.sort || []
39
+ duplicate_files << tmp_duplicate
40
+ end
41
+
42
+ duplicate_files.each do |dfs|
43
+ if dfs.count > 1
44
+ dfs.pop
45
+ dfs.each do |file|
46
+ puts "remove confliting file #{file}"
47
+ FileUtils.rm(file) if File.exist?(file)
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ if duplicates.empty? && !@auto_fix_conflict
54
+ raise Informative, "The '#{aggregate_target.label}' target has " \
55
+ "#{type} with conflicting names: #{duplicates.to_sentence}."
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,2 @@
1
+ require 'cocoapods-install_tal/command'
2
+ require 'cocoapods-install_tal/src'
@@ -0,0 +1,12 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Command::Install_tal do
5
+ describe 'CLAide' do
6
+ it 'registers it self' do
7
+ Command.parse(%w{ install_tal }).should.be.instance_of Command::Install_tal
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -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,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-install_tal
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - MinLison
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-07-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cocoapods
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.5.3
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 1.5.3
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.3'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.3'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ description: A short description of cocoapods-install_tal.
62
+ email:
63
+ - yuanhang.1991@icloud.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - ".gitignore"
69
+ - Gemfile
70
+ - LICENSE
71
+ - LICENSE.txt
72
+ - README.md
73
+ - Rakefile
74
+ - cocoapods-install_tal.gemspec
75
+ - lib/cocoapods-install_tal.rb
76
+ - lib/cocoapods-install_tal/command.rb
77
+ - lib/cocoapods-install_tal/command/install_tal.rb
78
+ - lib/cocoapods-install_tal/command/update_tal.rb
79
+ - lib/cocoapods-install_tal/gem_version.rb
80
+ - lib/cocoapods-install_tal/src.rb
81
+ - lib/cocoapods-install_tal/src/installer_tal.rb
82
+ - lib/cocoapods-install_tal/src/target_validator_tal.rb
83
+ - lib/cocoapods_plugin.rb
84
+ - spec/command/install_tal_spec.rb
85
+ - spec/spec_helper.rb
86
+ homepage: https://github.com/EXAMPLE/cocoapods-install_tal
87
+ licenses:
88
+ - MIT
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubygems_version: 3.0.4
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: A longer description of cocoapods-install_tal.
109
+ test_files:
110
+ - spec/command/install_tal_spec.rb
111
+ - spec/spec_helper.rb