cocoapods-NameMappedModule 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
+ SHA256:
3
+ metadata.gz: 4f8d502947bf4d205948f5245388c7cf6b4762465ea9cab400c74233ce919cf1
4
+ data.tar.gz: c07182c121700fb7dc0905ee27c41711c0bf62ed70ad855a1f1c0360488c2766
5
+ SHA512:
6
+ metadata.gz: b4d139eb24ea4b89ca32c2b453a00238e235907921f7ccd954db874ff390a987b40614212692b311b5de5312d2e266c72ab5accffd0a742d988bc0ceb7999463
7
+ data.tar.gz: 525cc88881db084d084474a65208e5ac67f02757c383dd94b2e66851e6f28b49a182c79c1b567bdb4ad4f63e9b8726e62f0f1d98712c47ff1e7583d04640e714
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-NameMappedModule.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/Gemfile.lock ADDED
@@ -0,0 +1,97 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cocoapods-NameMappedModule (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ CFPropertyList (3.0.1)
10
+ activesupport (4.2.11.1)
11
+ i18n (~> 0.7)
12
+ minitest (~> 5.1)
13
+ thread_safe (~> 0.3, >= 0.3.4)
14
+ tzinfo (~> 1.1)
15
+ atomos (0.1.3)
16
+ bacon (1.2.0)
17
+ claide (1.0.3)
18
+ cocoapods (1.7.5)
19
+ activesupport (>= 4.0.2, < 5)
20
+ claide (>= 1.0.2, < 2.0)
21
+ cocoapods-core (= 1.7.5)
22
+ cocoapods-deintegrate (>= 1.0.3, < 2.0)
23
+ cocoapods-downloader (>= 1.2.2, < 2.0)
24
+ cocoapods-plugins (>= 1.0.0, < 2.0)
25
+ cocoapods-search (>= 1.0.0, < 2.0)
26
+ cocoapods-stats (>= 1.0.0, < 2.0)
27
+ cocoapods-trunk (>= 1.3.1, < 2.0)
28
+ cocoapods-try (>= 1.1.0, < 2.0)
29
+ colored2 (~> 3.1)
30
+ escape (~> 0.0.4)
31
+ fourflusher (>= 2.3.0, < 3.0)
32
+ gh_inspector (~> 1.0)
33
+ molinillo (~> 0.6.6)
34
+ nap (~> 1.0)
35
+ ruby-macho (~> 1.4)
36
+ xcodeproj (>= 1.10.0, < 2.0)
37
+ cocoapods-core (1.7.5)
38
+ activesupport (>= 4.0.2, < 6)
39
+ fuzzy_match (~> 2.0.4)
40
+ nap (~> 1.0)
41
+ cocoapods-deintegrate (1.0.4)
42
+ cocoapods-downloader (1.2.2)
43
+ cocoapods-plugins (1.0.0)
44
+ nap
45
+ cocoapods-search (1.0.0)
46
+ cocoapods-stats (1.1.0)
47
+ cocoapods-trunk (1.4.0)
48
+ nap (>= 0.8, < 2.0)
49
+ netrc (~> 0.11)
50
+ cocoapods-try (1.1.0)
51
+ colored2 (3.1.2)
52
+ concurrent-ruby (1.1.5)
53
+ escape (0.0.4)
54
+ fourflusher (2.3.1)
55
+ fuzzy_match (2.0.4)
56
+ gh_inspector (1.1.3)
57
+ i18n (0.9.5)
58
+ concurrent-ruby (~> 1.0)
59
+ metaclass (0.0.4)
60
+ minitest (5.11.3)
61
+ mocha (1.2.1)
62
+ metaclass (~> 0.0.1)
63
+ mocha-on-bacon (0.2.3)
64
+ mocha (>= 0.13.0)
65
+ molinillo (0.6.6)
66
+ nanaimo (0.2.6)
67
+ nap (1.1.0)
68
+ netrc (0.11.0)
69
+ prettybacon (0.0.2)
70
+ bacon (~> 1.2)
71
+ rake (12.3.3)
72
+ ruby-macho (1.4.0)
73
+ thread_safe (0.3.6)
74
+ tzinfo (1.2.5)
75
+ thread_safe (~> 0.1)
76
+ xcodeproj (1.12.0)
77
+ CFPropertyList (>= 2.3.3, < 4.0)
78
+ atomos (~> 0.1.3)
79
+ claide (>= 1.0.2, < 2.0)
80
+ colored2 (~> 3.1)
81
+ nanaimo (~> 0.2.6)
82
+
83
+ PLATFORMS
84
+ ruby
85
+
86
+ DEPENDENCIES
87
+ bacon
88
+ bundler (~> 2.0.1)
89
+ cocoapods
90
+ cocoapods-NameMappedModule!
91
+ mocha
92
+ mocha-on-bacon
93
+ prettybacon
94
+ rake
95
+
96
+ BUNDLED WITH
97
+ 2.0.2
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2019 xiongzenghui <zxcvb1234001@163.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,95 @@
1
+ # cocoapods-NameMappedModule
2
+
3
+ ## 经常会出现 podspec name 与 module name 不一样的情况
4
+
5
+ ### [UIAlertView-Blocks](https://github.com/jivadevoe/UIAlertView-Blocks/blob/master/UIAlertView-Blocks.podspec)
6
+
7
+ ```ruby
8
+ Pod::Spec.new do |s|
9
+ s.name = 'UIAlertView-Blocks'
10
+ s.version = '1.0'
11
+ s.platform = :ios
12
+ s.author = 'Jiva Devoe'
13
+ s.license = { :type => 'MIT', :file => 'LICENSE' }
14
+ s.requires_arc = true
15
+ s.summary = 'Category for UIAlertView and UIActionSheet which allows you to use blocks rather than implementing a delegate.'
16
+ s.description = 'A category for UIAlertView and UIActionSheet which allows you to use blocks to handle the pressed button events rather than implementing a delegate.'
17
+ s.source_files = '*.{h,m}'
18
+ s.homepage = 'https://github.com/jivadevoe/UIAlertView-Blocks'
19
+ s.source = { :git => 'https://github.com/jivadevoe/UIAlertView-Blocks.git', :tag => '1.0' }
20
+ end
21
+ ```
22
+
23
+ ### [lottie-ios](https://github.com/airbnb/lottie-ios/blob/master/lottie-ios.podspec)
24
+
25
+ ```ruby
26
+ Pod::Spec.new do |s|
27
+ s.name = 'lottie-ios'
28
+ s.version = '3.1.3'
29
+ s.summary = 'A library to render native animations from bodymovin json. Now in Swift!'
30
+
31
+ s.description = <<-DESC
32
+ Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations exported as json with bodymovin and renders the vector animations natively on mobile and through React Native!
33
+ For the first time, designers can create and ship beautiful animations without an engineer painstakingly recreating it be hand. Since the animation is backed by JSON they are extremely small in size but can be large in complexity! Animations can be played, resized, looped, sped up, slowed down, and even interactively scrubbed.
34
+ DESC
35
+
36
+ s.homepage = 'https://github.com/airbnb/lottie-ios'
37
+ s.license = { :type => 'Apache', :file => 'LICENSE' }
38
+ s.author = { 'Brandon Withrow' => 'buba447@gmail.com' }
39
+ s.source = { :git => 'https://github.com/airbnb/lottie-ios.git', :tag => s.version.to_s }
40
+
41
+ s.swift_version = '5.0'
42
+ s.ios.deployment_target = '9.0'
43
+ s.osx.deployment_target = '10.10'
44
+ s.tvos.deployment_target = '9.0'
45
+
46
+ s.source_files = 'lottie-swift/src/**/*'
47
+ s.ios.source_files = 'lottie-swift/iOS/*.swift'
48
+ s.ios.exclude_files = 'lottie-swift/src/Public/MacOS/**/*'
49
+ s.tvos.exclude_files = 'lottie-swift/src/Public/MacOS/**/*'
50
+ s.osx.exclude_files = 'lottie-swift/src/Public/iOS/**/*'
51
+
52
+ s.ios.frameworks = ['UIKit', 'CoreGraphics', 'QuartzCore']
53
+ s.tvos.frameworks = ['UIKit', 'CoreGraphics', 'QuartzCore']
54
+ s.osx.frameworks = ['AppKit', 'CoreGraphics', 'QuartzCore']
55
+ s.module_name = 'Lottie'
56
+ s.header_dir = 'Lottie'
57
+ end
58
+ ```
59
+
60
+ 显示使用 `Pod::Spec#module_name = 'Lottie'`
61
+
62
+ ### 最终这2个库构建生成的 framework
63
+
64
+ ![](imgs/Snip20190922_21.png)
65
+
66
+ 映射关系是:
67
+
68
+ ```ruby
69
+ pod 'UIAlertView-Blocks' ==> UIAlertView_Blocks.framework
70
+ pod 'lottie-ios' ==> Lottie.framework
71
+ ```
72
+
73
+ 那么就会造成在解析时, 无法得到 pod 与 framework 的映射关系。
74
+
75
+ ### 这个插件作用, 建立这个映射关系, 写入本地文件中
76
+
77
+ ```json
78
+ {
79
+ "AFNetworking": "AFNetworking.framework",
80
+ "SDWebImage": "SDWebImage.framework",
81
+ "UIAlertView-Blocks": "UIAlertView_Blocks.framework",
82
+ "YYCache": "YYCache.framework",
83
+ "lottie-ios": "Lottie.framework"
84
+ }
85
+ ```
86
+
87
+
88
+
89
+ ## Installation
90
+
91
+ $ gem install cocoapods-NameMappedModule
92
+
93
+ ## Usage
94
+
95
+ $ pod spec NameMappedModule POD_NAME
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-NameMappedModule/gem_version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-NameMappedModule'
8
+ spec.version = CocoapodsNamemappedmodule::VERSION
9
+ spec.authors = ['xiongzenghui']
10
+ spec.email = ['zxcvb1234001@163.com']
11
+ spec.description = %q{create pod name mapping to framework.}
12
+ spec.summary = %q{create pod name mapping to framework.}
13
+ spec.homepage = 'https://github.com/xzhhe/cocoapods-name_mapped_module'
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', '~> 2.0.1'
22
+ spec.add_development_dependency 'rake'
23
+ end
Binary file
@@ -0,0 +1 @@
1
+ require 'cocoapods-NameMappedModule/gem_version'
@@ -0,0 +1 @@
1
+ require 'cocoapods-NameMappedModule/command/NameMappedModule'
@@ -0,0 +1,46 @@
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 Namemappedmodule < Command
21
+ self.summary = 'create pod name mapping to framework.'
22
+
23
+ self.description = <<-DESC
24
+ create pod name mapping to framework.
25
+ DESC
26
+
27
+ self.arguments = [
28
+ CLAide::Argument.new('OUTPUT', true)
29
+ ]
30
+
31
+ def initialize(argv)
32
+ @name = argv.shift_argument
33
+ super
34
+ end
35
+
36
+ def validate!
37
+ super
38
+ help! 'A Pod name is required.' unless @name
39
+ end
40
+
41
+ def run
42
+ UI.puts " ❌ not support command tool"
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,3 @@
1
+ module CocoapodsNamemappedmodule
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,32 @@
1
+ module CocoapodsNameMappedModuleHooks
2
+ module Helper
3
+ require 'cocoapods'
4
+ require 'json'
5
+ require 'pp'
6
+
7
+ def generate(context, args = {})
8
+ puts ' ⚠️ podspec name <==> module name'
9
+ name_framework_mapping = {}
10
+ context.umbrella_targets.each { |t|
11
+ t.specs.each { |s|
12
+ name_framework_mapping[s.root.name] = if s.root.module_name
13
+ "#{s.root.module_name}.framework"
14
+ else
15
+ "#{s.root.name}.framework"
16
+ end
17
+ }
18
+ }
19
+
20
+ puts "🚗 name_framework_mapping"
21
+ pp name_framework_mapping
22
+
23
+ file = args[:output]
24
+ if file
25
+ File.open(file, 'w+') { |f| f.write(JSON.pretty_generate(name_framework_mapping)) }
26
+ puts " 🚙 write name_framework_mapping hash to #{file}"
27
+ end
28
+
29
+ name_framework_mapping
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,10 @@
1
+ require 'cocoapods-NameMappedModule/command'
2
+ require_relative 'cocoapods-NameMappedModule/helper/name_mapped_module_helper'
3
+
4
+ include(CocoapodsNameMappedModuleHooks::Helper)
5
+
6
+ module CocoapodsNameMappedModuleHooks
7
+ Pod::HooksManager.register('cocoapods-NameMappedModule', :post_install) do |context|
8
+ generate(context, output: File.expand_path('.name_framework_mapping.json', Dir.pwd))
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Command::Namemappedmodule do
5
+ describe 'CLAide' do
6
+ it 'registers it self' do
7
+ Command.parse(%w{ NameMappedModule }).should.be.instance_of Command::Namemappedmodule
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,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-NameMappedModule
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - xiongzenghui
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-09-22 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: 2.0.1
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.1
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: create pod name mapping to framework.
42
+ email:
43
+ - zxcvb1234001@163.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - Gemfile.lock
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - cocoapods-NameMappedModule.gemspec
55
+ - imgs/Snip20190922_21.png
56
+ - lib/cocoapods-NameMappedModule.rb
57
+ - lib/cocoapods-NameMappedModule/command.rb
58
+ - lib/cocoapods-NameMappedModule/command/NameMappedModule.rb
59
+ - lib/cocoapods-NameMappedModule/gem_version.rb
60
+ - lib/cocoapods-NameMappedModule/helper/name_mapped_module_helper.rb
61
+ - lib/cocoapods_plugin.rb
62
+ - spec/command/NameMappedModule_spec.rb
63
+ - spec/spec_helper.rb
64
+ homepage: https://github.com/xzhhe/cocoapods-name_mapped_module
65
+ licenses:
66
+ - MIT
67
+ metadata: {}
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubygems_version: 3.0.4
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: create pod name mapping to framework.
87
+ test_files:
88
+ - spec/command/NameMappedModule_spec.rb
89
+ - spec/spec_helper.rb