cocoapods-fix-module-universal 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0a048bf884235304c6c834392028133ce3c36c9d
4
+ data.tar.gz: e939b8a72f0b0994ae9713f13bd621f4f42654ab
5
+ SHA512:
6
+ metadata.gz: 37c59a7e6c687ed0e303fe16e609561e80ea1d18aab4c8d998864dc27aa2ed793b46bc72cb9e56c76fdd0e4c71fb225a6b7fceb6028a97a53a923c0f2d20ae34
7
+ data.tar.gz: 13a585ea6550518e132154917d088a76cd482bfa57691ad525ddcac2ff63ef88669f0f29f15171284274e16cd9f2cb706992bf1d17bdffd799599373da04e79c
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cocoapods-fix-module-universal.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.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2019 Gao <gaoji@bytedance.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
@@ -0,0 +1,20 @@
1
+ # cocoapods-fix-module-universal
2
+
3
+
4
+ Fix the missing module of pod which have no source but binaries, by adding a placeholder source file to the sources.
5
+
6
+ It's compatible with static library or framework.
7
+
8
+
9
+ ## Installation
10
+
11
+ $ gem install cocoapods-fix-module-universal
12
+
13
+
14
+ ## Usage
15
+
16
+ Add the following to the podfile:
17
+
18
+ plugin "cocoapods-fix-module-universal"
19
+
20
+ You may need to delete the Pods folder for the first time.
data/Rakefile ADDED
@@ -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,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-fix-module-universal/gem_version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-fix-module-universal'
8
+ spec.version = CocoapodsFixModuleUniversal::VERSION
9
+ spec.authors = ['Gao']
10
+ spec.email = ['gaoji@bytedance.com']
11
+ spec.description = %q{fix the missing module of pod which have no source but binaries.}
12
+ spec.summary = %q{fix the missing module of pod which have no source but binaries by adding a placeholder file to the source}
13
+ spec.homepage = 'https://github.com/EXAMPLE/cocoapods-fix-module-universal'
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', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-fix-module-universal/gem_version'
@@ -0,0 +1,3 @@
1
+ module CocoapodsFixModuleUniversal
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,65 @@
1
+
2
+ module CocoapodsFixModuleUniversal
3
+ def self.place_holder_file_name
4
+ "CocoapodsFixModuleUniversal_placeholder_source.m"
5
+ end
6
+
7
+ def self.write_blank_source_to_path(target_dir) # return value ,the relative path to the target_dir
8
+ name = place_holder_file_name
9
+ dir = Pathname.new(target_dir)
10
+ dir.mkpath unless dir.exist?
11
+ file_path = dir + name
12
+ File.write(file_path, "// This file left blank intentionally") unless file_path.exist?
13
+ return name
14
+ end
15
+ end
16
+
17
+
18
+ module Pod
19
+
20
+
21
+ class Installer
22
+
23
+
24
+ cocoapods_fix_module_universal_old_resolve_dependencies = instance_method(:resolve_dependencies)
25
+ define_method(:resolve_dependencies) do
26
+
27
+ # call original
28
+ result = cocoapods_fix_module_universal_old_resolve_dependencies.bind(self).()
29
+
30
+ # patch
31
+ # add the blank source to podspec.source_files
32
+ specs = self.analysis_result.specifications.select(&:root?)
33
+ specs.each do |spec|
34
+
35
+ original_content = spec.attributes_hash["source_files"]
36
+ if original_content.kind_of? String
37
+ original_content = [original_content]
38
+ end
39
+ raise "wrong type: #{original_content}" unless original_content.kind_of? Array
40
+ original_content << CocoapodsFixModuleUniversal.place_holder_file_name
41
+ spec.attributes_hash["source_files"] = original_content
42
+
43
+ end
44
+
45
+ next result
46
+ end
47
+
48
+
49
+
50
+ class PodSourceInstaller
51
+
52
+ # add the placeholder .m file
53
+ CocoapodsFixModuleUniversalOLD_install = instance_method :install!
54
+ define_method :install! do |*args|
55
+ result = CocoapodsFixModuleUniversalOLD_install.bind(self).(*args)
56
+ CocoapodsFixModuleUniversal.write_blank_source_to_path(root)
57
+ next result
58
+ end
59
+
60
+ end
61
+
62
+
63
+
64
+ end
65
+ end
@@ -0,0 +1,5 @@
1
+
2
+ Pod::HooksManager.register('cocoapods-fix-module-universal', :pre_install) do |installer_context|
3
+ require 'cocoapods-fix-module-universal/patch'
4
+ end
5
+
@@ -0,0 +1,12 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Command::Universal do
5
+ describe 'CLAide' do
6
+ it 'registers it self' do
7
+ Command.parse(%w{ universal }).should.be.instance_of Command::Universal
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,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-fix-module-universal
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Gao
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-03-31 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: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
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: fix the missing module of pod which have no source but binaries.
42
+ email:
43
+ - gaoji@bytedance.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - cocoapods-fix-module-universal.gemspec
54
+ - lib/cocoapods-fix-module-universal.rb
55
+ - lib/cocoapods-fix-module-universal/gem_version.rb
56
+ - lib/cocoapods-fix-module-universal/patch.rb
57
+ - lib/cocoapods_plugin.rb
58
+ - spec/command/universal_spec.rb
59
+ - spec/spec_helper.rb
60
+ homepage: https://github.com/EXAMPLE/cocoapods-fix-module-universal
61
+ licenses:
62
+ - MIT
63
+ metadata: {}
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 2.5.2.3
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: fix the missing module of pod which have no source but binaries by adding
84
+ a placeholder file to the source
85
+ test_files:
86
+ - spec/command/universal_spec.rb
87
+ - spec/spec_helper.rb