cocoapods-qpodfile 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a3902a1c0fc88b06246918634b64ca15a816777d24e15a615a182907c60c9331
4
+ data.tar.gz: 77006972a11d42ffb9a67c4034b0381ae6881104cba98bd3c08b391a477b9dbd
5
+ SHA512:
6
+ metadata.gz: a4371e6d669f7fb28fa89186f45a55ba1e10b9bebc66167b7bae2b11016290e5564c3418e5c95e1d171b8b206c8241630aa20474879e5b2dda6c6115ad3c6a71
7
+ data.tar.gz: e611ee02d998dab78975358c1e064a9250a1d97090100cf963a7f3ec9d2c02aff834366f3d237e9d593507ea93a0dd70220c79645d96455c2ae05e6e552a56b0
@@ -0,0 +1 @@
1
+ require 'cocoapods-qpodfile/gem_version'
@@ -0,0 +1 @@
1
+ require 'cocoapods-qpodfile/command/qpodfile'
@@ -0,0 +1,130 @@
1
+ require 'yaml'
2
+ module Pod
3
+ class Command
4
+ # This is an example of a cocoapods plugin adding a top-level subcommand
5
+ # to the 'pod' command.
6
+ #
7
+ # You can also create subcommands of existing or new commands. Say you
8
+ # wanted to add a subcommand to `list` to show newly deprecated pods,
9
+ # (e.g. `pod list deprecated`), there are a few things that would need
10
+ # to change.
11
+ #
12
+ # - move this file to `lib/pod/command/list/deprecated.rb` and update
13
+ # the class to exist in the the Pod::Command::List namespace
14
+ # - change this class to extend from `List` instead of `Command`. This
15
+ # tells the plugin system that it is a subcommand of `list`.
16
+ # - edit `lib/cocoapods_plugins.rb` to require this file
17
+ #
18
+ # @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
19
+ # in the `plugins.json` file, once your plugin is released.
20
+ #
21
+ class Qpodfile < Command
22
+ self.summary = 'config pofile modules.'
23
+
24
+ self.description = <<-DESC
25
+ config pofile modules
26
+ Examples:
27
+
28
+ $ pod qpodfile AFNNetWorking,Masonry
29
+ DESC
30
+
31
+
32
+ def initialize(argv)
33
+ @modules = argv.shift_argument
34
+ super
35
+ end
36
+
37
+ def validate!
38
+ super
39
+ help! 'modules is required.' unless @modules
40
+ end
41
+
42
+ def run
43
+ verify_podfile_exists!
44
+ podfile_path = Pathname.pwd + 'Podfile'
45
+ podfile = Podfile.from_file(podfile_path)
46
+ podfileYAML = podfile.to_yaml
47
+ podfileHash = YAML.load(podfileYAML)
48
+ configModule = @modules.split(",")
49
+ hash = podfileHash["target_definitions"]
50
+ contents ||= File.open(podfile_path, 'r:utf-8') { |f| f.read }
51
+ podfile.target_definitions.each do |name, definition|
52
+ if name != "Pods" && (@target == nil || @target == name)
53
+ if name == "Qiyeyun"
54
+ target_code = "target '#{name}' do\n\n"
55
+ hash = podfileHash["target_definitions"]
56
+ hash.each do |config|
57
+ config["children"].each do |t|
58
+ if name == t["name"]
59
+ t["dependencies"].each do |depend|
60
+ base_code = ""
61
+ if depend.class == String
62
+ if configModule.include?(depend)
63
+ base_code = "pod '#{depend}'"
64
+ if t.key?("configuration_pod_whitelist")
65
+ buildConfigs1 = Array.new()
66
+ if t["configuration_pod_whitelist"].key?("Debug")
67
+ if t["configuration_pod_whitelist"]["Debug"].include?(depend)
68
+ buildConfigs1 << "Debug"
69
+ end
70
+ end
71
+
72
+ if t["configuration_pod_whitelist"].key?("Release")
73
+ if t["configuration_pod_whitelist"]["Release"].include?(depend)
74
+ buildConfigs1 << "Release"
75
+ end
76
+ end
77
+
78
+ if !buildConfigs1.empty?
79
+ base_code += ", :configurations => #{buildConfigs1.to_s}"
80
+ end
81
+ end
82
+ base_code += "\n"
83
+ end
84
+ elsif depend.class == Hash
85
+ if configModule.include?(depend.keys[0])
86
+ base_code = "pod '#{depend.keys[0]}'"
87
+ depend.values[0].each do |value|
88
+ if value.class == String
89
+ base_code += ", '#{value}'"
90
+ elsif value.class == Hash
91
+ base_code += ", :#{value.keys[0]} => '#{value.values[0]}'"
92
+ end
93
+ end
94
+ if t.key?("configuration_pod_whitelist")
95
+ buildConfigs2 = Array.new()
96
+ if t["configuration_pod_whitelist"].key?("Debug")
97
+ if t["configuration_pod_whitelist"]["Debug"].include?(depend.keys[0])
98
+ buildConfigs2 << "Debug"
99
+ end
100
+ end
101
+
102
+ if t["configuration_pod_whitelist"].key?("Release")
103
+ if t["configuration_pod_whitelist"]["Release"].include?(depend.keys[0])
104
+ buildConfigs2 << "Release"
105
+ end
106
+ end
107
+
108
+ if !buildConfigs2.empty?
109
+ base_code += ", :configurations => #{buildConfigs2.to_s}"
110
+ end
111
+ end
112
+ base_code += "\n"
113
+ end
114
+ end
115
+ target_code += base_code
116
+ end
117
+ break
118
+ end
119
+ end
120
+ end
121
+ target_code += "\nend"
122
+ contents = contents.gsub(/^target\s[\"|']#{name}[\"|'].+?end\n[\n]?/m, (target_code + "\n\n"))
123
+ podfile_path.open('w') { |f| f << contents}
124
+ end
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end
@@ -0,0 +1,3 @@
1
+ module CocoapodsQpodfile
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-qpodfile/command'
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-qpodfile
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - huainanzi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-03-02 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
+ - !ruby/object:Gem::Dependency
42
+ name: yaml
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: A short description of cocoapods-qpodfile.
56
+ email:
57
+ - 1401315607@qq.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/cocoapods-qpodfile.rb
63
+ - lib/cocoapods-qpodfile/command.rb
64
+ - lib/cocoapods-qpodfile/command/qpodfile.rb
65
+ - lib/cocoapods-qpodfile/gem_version.rb
66
+ - lib/cocoapods_plugin.rb
67
+ homepage: https://github.com/EXAMPLE/cocoapods-qpodfile
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubygems_version: 3.1.2
87
+ signing_key:
88
+ specification_version: 4
89
+ summary: A longer description of cocoapods-qpodfile.
90
+ test_files: []