cocoapods-devtool 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 +7 -0
- data/lib/cocoapods-devtool/command/change.rb +80 -0
- data/lib/cocoapods-devtool/command/devtool.rb +38 -0
- data/lib/cocoapods-devtool/command/setting.rb +76 -0
- data/lib/cocoapods-devtool/command.rb +3 -0
- data/lib/cocoapods-devtool/gem_version.rb +3 -0
- data/lib/cocoapods-devtool/setting/user_setting_tool.rb +32 -0
- data/lib/cocoapods-devtool.rb +1 -0
- data/lib/cocoapods_plugin.rb +1 -0
- data/lib/user_setting.json +1 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f820b8bde3eed8f838fe361478d0db7291620e6a78e467599f2b154e1c3d52de
|
4
|
+
data.tar.gz: 5f797145997e0baa6633e0b26834d9063b23e6c15bc864e81ec60b03c0bd62cd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 433c2ad65bb6be6eeff85bb8e0bb9b77bdeeaeef013b686cd23fe54db71b3264007e479cc891f32cec99aa46c7f11be687e520135efa142f3aedefa9c006ea48
|
7
|
+
data.tar.gz: 1505fa16884689615b6c1458d6d983470396c39a386e3adcf70e2d627bab3f89b3a15828ef2abe639d25566526843f3014cdaef8c00f79f6943b675ec9769158
|
@@ -0,0 +1,80 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'xcodeproj'
|
5
|
+
require_relative '../setting/user_setting_tool'
|
6
|
+
|
7
|
+
module Pod
|
8
|
+
class Command
|
9
|
+
class Change < DevCommand
|
10
|
+
self.summary = '修改签名'
|
11
|
+
self.description = <<-DESC
|
12
|
+
1. 将目录下所有的工程改成setting
|
13
|
+
DESC
|
14
|
+
|
15
|
+
def initialize(argv)
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
def validate!
|
20
|
+
super
|
21
|
+
settingTool = UserSetting::Setting.new()
|
22
|
+
help! "请先用pod devtool setting设置change_bundle_pre和dev_team" if settingTool.dev_team.empty? || settingTool.change_bundle_pre.empty?
|
23
|
+
end
|
24
|
+
|
25
|
+
def run
|
26
|
+
self.change_project
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def change_project
|
32
|
+
settingTool = UserSetting::Setting.new()
|
33
|
+
settingTool.readSettingData()
|
34
|
+
|
35
|
+
curdir = Dir.pwd()
|
36
|
+
|
37
|
+
projectPaths = Dir[curdir+"/**/*.{xcodeproj}"]
|
38
|
+
podProjectPath = ""
|
39
|
+
|
40
|
+
projectPaths.delete(podProjectPath) unless podProjectPath.nil?
|
41
|
+
unless projectPaths.size > 0
|
42
|
+
puts "没有工程需要修改"
|
43
|
+
else
|
44
|
+
puts "开始修改以下项目签名"
|
45
|
+
projectPaths.each do |path|
|
46
|
+
if File.exist?(path)
|
47
|
+
puts path
|
48
|
+
project = Xcodeproj::Project.open(path)
|
49
|
+
self.change_setting(project)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
puts "完成修改项目签名"
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
def change_setting(project)
|
58
|
+
settingTool = UserSetting::Setting.new()
|
59
|
+
project.targets.each do |target|
|
60
|
+
target.build_configurations.each do |config|
|
61
|
+
config.build_settings['CODE_SIGN_ENTITLEMENTS'] = ""
|
62
|
+
config.build_settings['DEVELOPMENT_TEAM'] = settingTool.dev_team
|
63
|
+
config.build_settings['DEVELOPMENT_TEAM[sdk=iphoneos*]'] = settingTool.dev_team
|
64
|
+
config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = settingTool.change_bundle_pre + "."+ config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] unless config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] .nil?
|
65
|
+
config.build_settings['CODE_SIGN_STYLE'] = "Automatic"
|
66
|
+
config.build_settings['PROVISIONING_PROFILE'] = ""
|
67
|
+
config.build_settings['PROVISIONING_PROFILE_SPECIFIER'] = ""
|
68
|
+
config.build_settings['PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]'] = ""
|
69
|
+
config.build_settings['CODE_SIGN_IDENTITY'] = "Apple Development"
|
70
|
+
config.build_settings['CODE_SIGN_IDENTITY[sdk=iphoneos*]'] = "Apple Development"
|
71
|
+
config.build_settings['ProvisioningStyle'] = "Automatic"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
project.save
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Pod
|
2
|
+
class DevCommand < 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
|
+
self.summary = 'pod开发工具,用于修改工程签名等'
|
21
|
+
|
22
|
+
self.abstract_command = true
|
23
|
+
self.command = 'devtool'
|
24
|
+
|
25
|
+
# self.description = <<-DESC
|
26
|
+
# 开发工具
|
27
|
+
# DESC
|
28
|
+
|
29
|
+
# def self.options
|
30
|
+
# [
|
31
|
+
# ["--setkey", '查看设置和修改参数'],
|
32
|
+
# ["--change", '改变签名'],
|
33
|
+
# ]
|
34
|
+
# end
|
35
|
+
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require_relative '../setting/user_setting_tool'
|
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 Setting < DevCommand
|
22
|
+
self.summary = '读取和设置参数'
|
23
|
+
|
24
|
+
self.description = <<-DESC
|
25
|
+
1. pod setting将打印所有的设置\n
|
26
|
+
2. 请以pod setkey key1=value1 key2=value2的方式设置参数
|
27
|
+
DESC
|
28
|
+
|
29
|
+
def initialize(argv)
|
30
|
+
@key_values = argv.arguments!
|
31
|
+
@debug_enable = argv.flag?("debug_enable",true)
|
32
|
+
@release_enable = argv.flag?("release_enable",true)
|
33
|
+
@distubution_enable = argv.flag?("distubution_enable",true)
|
34
|
+
@auto_sign_enable = argv.flag?("auto_sign_enable",true)
|
35
|
+
|
36
|
+
@settingTool = UserSetting::Setting.new()
|
37
|
+
@setting = @settingTool.readSettingData()
|
38
|
+
super
|
39
|
+
end
|
40
|
+
|
41
|
+
def validate!
|
42
|
+
super
|
43
|
+
@key_values.each do |value|
|
44
|
+
array = value.split("=")
|
45
|
+
help! value+' 不符合key=value的格式' unless array.size == 2
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def run
|
50
|
+
if @key_values.empty?
|
51
|
+
UI.puts '当前的设置如下'
|
52
|
+
UI.puts @setting
|
53
|
+
else
|
54
|
+
|
55
|
+
@key_values.each do |value|
|
56
|
+
array = value.split("=")
|
57
|
+
@settingTool.set(array[0],array[1])
|
58
|
+
end
|
59
|
+
#mode 解析
|
60
|
+
debugMode = "Debug"
|
61
|
+
releaseMode = "Release"
|
62
|
+
distributionModel = "Distubution"
|
63
|
+
modes = Array.[](debugMode,releaseMode,distributionModel)
|
64
|
+
|
65
|
+
modes.delete(debugMode) unless @debug_enable
|
66
|
+
modes.delete(releaseMode) unless @release_enable
|
67
|
+
modes.delete(distributionModel) unless @distubution_enable
|
68
|
+
@settingTool.set("modes",modes)
|
69
|
+
#签名
|
70
|
+
@settingTool.save()
|
71
|
+
UI.puts "设置保存成功"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'json'
|
2
|
+
module UserSetting
|
3
|
+
class Setting
|
4
|
+
attr_accessor :change_bundle_pre, :dev_team, :modes
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@jsonPath = '../../../user_setting.json'
|
8
|
+
path = File.expand_path(@jsonPath, __FILE__)
|
9
|
+
data = File.open(path) do |f|
|
10
|
+
JSON.load(f)
|
11
|
+
end
|
12
|
+
@settingData = data
|
13
|
+
@change_bundle_pre = @settingData["change_bundle_pre"]
|
14
|
+
@dev_team = @settingData["dev_team"]
|
15
|
+
@modes = @settingData["modes"]
|
16
|
+
end
|
17
|
+
|
18
|
+
def readSettingData()
|
19
|
+
@settingData
|
20
|
+
end
|
21
|
+
|
22
|
+
def set(key,value)
|
23
|
+
@settingData[key] = value
|
24
|
+
end
|
25
|
+
|
26
|
+
def save()
|
27
|
+
path = File.expand_path(@jsonPath, __FILE__)
|
28
|
+
json = JSON.generate(@settingData)
|
29
|
+
File.write(path,json)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-devtool/gem_version'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-devtool/command'
|
@@ -0,0 +1 @@
|
|
1
|
+
{"change_bundle_pre":"3","dev_team":"33","modes":["Debug","Release","Distubution"]}
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-devtool
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- sam
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-10-30 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'
|
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'
|
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 short description of cocoapods-devtool.
|
42
|
+
email:
|
43
|
+
- ''
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- lib/cocoapods-devtool.rb
|
49
|
+
- lib/cocoapods-devtool/command.rb
|
50
|
+
- lib/cocoapods-devtool/command/change.rb
|
51
|
+
- lib/cocoapods-devtool/command/devtool.rb
|
52
|
+
- lib/cocoapods-devtool/command/setting.rb
|
53
|
+
- lib/cocoapods-devtool/gem_version.rb
|
54
|
+
- lib/cocoapods-devtool/setting/user_setting_tool.rb
|
55
|
+
- lib/cocoapods_plugin.rb
|
56
|
+
- lib/user_setting.json
|
57
|
+
homepage: https://github.com/EXAMPLE/cocoapods-devtool
|
58
|
+
licenses:
|
59
|
+
- MIT
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubygems_version: 3.1.4
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: A longer description of cocoapods-devtool.
|
80
|
+
test_files: []
|