cocoapods-tj 1.0.0
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/LICENSE.txt +21 -0
- data/README.md +1 -0
- data/lib/cocoapods-tj/command/bin/archive.rb +203 -0
- data/lib/cocoapods-tj/command/bin/auto.rb +189 -0
- data/lib/cocoapods-tj/command/bin/code.rb +198 -0
- data/lib/cocoapods-tj/command/bin/imy.rb +45 -0
- data/lib/cocoapods-tj/command/bin/init.rb +65 -0
- data/lib/cocoapods-tj/command/bin/initHotKey.rb +66 -0
- data/lib/cocoapods-tj/command/bin/install.rb +41 -0
- data/lib/cocoapods-tj/command/bin/lib/lint.rb +66 -0
- data/lib/cocoapods-tj/command/bin/local.rb +142 -0
- data/lib/cocoapods-tj/command/bin/repo/update.rb +42 -0
- data/lib/cocoapods-tj/command/bin/spec/create.rb +68 -0
- data/lib/cocoapods-tj/command/bin/spec/push.rb +114 -0
- data/lib/cocoapods-tj/command/bin/update.rb +144 -0
- data/lib/cocoapods-tj/command/bin.rb +42 -0
- data/lib/cocoapods-tj/command.rb +2 -0
- data/lib/cocoapods-tj/config/config.rb +129 -0
- data/lib/cocoapods-tj/config/config_asker.rb +49 -0
- data/lib/cocoapods-tj/config/config_builder.rb +201 -0
- data/lib/cocoapods-tj/config/config_hot_key.rb +102 -0
- data/lib/cocoapods-tj/config/config_hot_key_asker.rb +48 -0
- data/lib/cocoapods-tj/gem_version.rb +10 -0
- data/lib/cocoapods-tj/helpers/Info.plist +0 -0
- data/lib/cocoapods-tj/helpers/build_helper.rb +154 -0
- data/lib/cocoapods-tj/helpers/build_utils.rb +62 -0
- data/lib/cocoapods-tj/helpers/framework.rb +79 -0
- data/lib/cocoapods-tj/helpers/framework_builder.rb +391 -0
- data/lib/cocoapods-tj/helpers/library.rb +54 -0
- data/lib/cocoapods-tj/helpers/library_builder.rb +89 -0
- data/lib/cocoapods-tj/helpers/local/loca_llibrary.rb +57 -0
- data/lib/cocoapods-tj/helpers/local/local_build_helper.rb +177 -0
- data/lib/cocoapods-tj/helpers/local/local_framework.rb +85 -0
- data/lib/cocoapods-tj/helpers/local/local_framework_builder.rb +226 -0
- data/lib/cocoapods-tj/helpers/local/local_library_builder.rb +91 -0
- data/lib/cocoapods-tj/helpers/sources_helper.rb +32 -0
- data/lib/cocoapods-tj/helpers/spec_creator.rb +150 -0
- data/lib/cocoapods-tj/helpers/spec_files_helper.rb +73 -0
- data/lib/cocoapods-tj/helpers/spec_source_creator.rb +189 -0
- data/lib/cocoapods-tj/helpers/upload_helper.rb +81 -0
- data/lib/cocoapods-tj/helpers.rb +5 -0
- data/lib/cocoapods-tj/native/acknowledgements.rb +26 -0
- data/lib/cocoapods-tj/native/analyzer.rb +29 -0
- data/lib/cocoapods-tj/native/file_accessor.rb +20 -0
- data/lib/cocoapods-tj/native/installation_options.rb +21 -0
- data/lib/cocoapods-tj/native/installer.rb +106 -0
- data/lib/cocoapods-tj/native/linter.rb +26 -0
- data/lib/cocoapods-tj/native/path_source.rb +29 -0
- data/lib/cocoapods-tj/native/pod_source_installer.rb +18 -0
- data/lib/cocoapods-tj/native/pod_target_installer.rb +81 -0
- data/lib/cocoapods-tj/native/podfile.rb +91 -0
- data/lib/cocoapods-tj/native/podfile_env.rb +37 -0
- data/lib/cocoapods-tj/native/podfile_generator.rb +135 -0
- data/lib/cocoapods-tj/native/podspec_finder.rb +23 -0
- data/lib/cocoapods-tj/native/resolver.rb +202 -0
- data/lib/cocoapods-tj/native/sandbox_analyzer.rb +11 -0
- data/lib/cocoapods-tj/native/source.rb +35 -0
- data/lib/cocoapods-tj/native/sources_manager.rb +18 -0
- data/lib/cocoapods-tj/native/specification.rb +10 -0
- data/lib/cocoapods-tj/native/target_validator.rb +41 -0
- data/lib/cocoapods-tj/native/validator.rb +40 -0
- data/lib/cocoapods-tj/native.rb +23 -0
- data/lib/cocoapods-tj/source_provider_hook.rb +50 -0
- data/lib/cocoapods-tj.rb +2 -0
- data/lib/cocoapods_plugin.rb +3 -0
- data/spec/command/bin_spec.rb +12 -0
- data/spec/spec_helper.rb +50 -0
- metadata +182 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require 'yaml'
|
|
2
|
+
require 'cocoapods-tj/config/config_hot_key'
|
|
3
|
+
|
|
4
|
+
module CBin
|
|
5
|
+
class Config_Hot_Key
|
|
6
|
+
class Asker
|
|
7
|
+
def show_prompt
|
|
8
|
+
print ' > '.green
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def ask_with_answer(question, pre_answer, selection)
|
|
12
|
+
print "\n#{question}\n"
|
|
13
|
+
|
|
14
|
+
print_selection_info = lambda {
|
|
15
|
+
print "可选值:[ #{selection.join(' / ')} ]\n" if selection
|
|
16
|
+
}
|
|
17
|
+
print_selection_info.call
|
|
18
|
+
print "旧值:#{pre_answer}\n" unless pre_answer.nil?
|
|
19
|
+
|
|
20
|
+
answer = ''
|
|
21
|
+
loop do
|
|
22
|
+
show_prompt
|
|
23
|
+
answer = STDIN.gets.chomp.strip
|
|
24
|
+
|
|
25
|
+
if answer == '' && !pre_answer.nil?
|
|
26
|
+
answer = pre_answer
|
|
27
|
+
print answer.yellow
|
|
28
|
+
print "\n"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
next if answer.empty?
|
|
32
|
+
break if !selection || selection.include?(answer)
|
|
33
|
+
|
|
34
|
+
print_selection_info.call
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
answer
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def wellcome_message
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def done_message
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
Binary file
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
|
|
2
|
+
require 'cocoapods-tj/native/podfile'
|
|
3
|
+
require 'cocoapods/command/gen'
|
|
4
|
+
require 'cocoapods/generate'
|
|
5
|
+
require 'cocoapods-tj/helpers/framework_builder'
|
|
6
|
+
require 'cocoapods-tj/helpers/library_builder'
|
|
7
|
+
require 'cocoapods-tj/config/config_builder'
|
|
8
|
+
|
|
9
|
+
module CBin
|
|
10
|
+
class Build
|
|
11
|
+
class Helper
|
|
12
|
+
include Pod
|
|
13
|
+
@@build_defines = ""
|
|
14
|
+
def initialize(spec,
|
|
15
|
+
platform,
|
|
16
|
+
framework_output,
|
|
17
|
+
zip,
|
|
18
|
+
rootSpec,
|
|
19
|
+
skip_archive = false,
|
|
20
|
+
build_model="Release")
|
|
21
|
+
@spec = spec
|
|
22
|
+
@platform = platform
|
|
23
|
+
@build_model = build_model
|
|
24
|
+
@rootSpec = rootSpec
|
|
25
|
+
@isRootSpec = rootSpec.name == spec.name
|
|
26
|
+
@skip_archive = skip_archive
|
|
27
|
+
@framework_output = framework_output
|
|
28
|
+
@zip = zip
|
|
29
|
+
|
|
30
|
+
@framework_path
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def build
|
|
34
|
+
UI.section("Building static framework #{@spec}") do
|
|
35
|
+
|
|
36
|
+
build_static_framework
|
|
37
|
+
unless @skip_archive
|
|
38
|
+
unless CBin::Build::Utils.is_framework(@spec)
|
|
39
|
+
build_static_library
|
|
40
|
+
zip_static_library
|
|
41
|
+
else
|
|
42
|
+
zip_static_framework
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def build_static_framework
|
|
51
|
+
source_dir = Dir.pwd
|
|
52
|
+
file_accessor = Sandbox::FileAccessor.new(Pathname.new('.').expand_path, @spec.consumer(@platform))
|
|
53
|
+
Dir.chdir(workspace_directory) do
|
|
54
|
+
builder = CBin::Framework::Builder.new(@spec, file_accessor, @platform, source_dir, @isRootSpec, @build_model )
|
|
55
|
+
@@build_defines = builder.build if @isRootSpec
|
|
56
|
+
begin
|
|
57
|
+
@framework_path = builder.lipo_build(@@build_defines) unless @skip_archive
|
|
58
|
+
rescue
|
|
59
|
+
@skip_archive = true
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def build_static_library
|
|
65
|
+
source_dir = zip_dir
|
|
66
|
+
file_accessor = Sandbox::FileAccessor.new(Pathname.new('.').expand_path, @spec.consumer(@platform))
|
|
67
|
+
Dir.chdir(workspace_directory) do
|
|
68
|
+
builder = CBin::Library::Builder.new(@spec, file_accessor, @platform, source_dir,@framework_path)
|
|
69
|
+
builder.build
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def zip_static_framework
|
|
74
|
+
Dir.chdir(File.join(workspace_directory,@framework_path.root_path)) do
|
|
75
|
+
output_name = File.join(zip_dir, framework_name_zip)
|
|
76
|
+
unless File.exist?(framework_name)
|
|
77
|
+
return
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
UI.puts "Compressing #{framework_name} into #{output_name}"
|
|
81
|
+
`zip --symlinks -r #{output_name} #{framework_name}`
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def zip_static_library
|
|
86
|
+
Dir.chdir(zip_dir) do
|
|
87
|
+
output_library = "#{library_name}.zip"
|
|
88
|
+
unless File.exist?(library_name)
|
|
89
|
+
raise Informative, "没有需要压缩的 library 文件:#{library_name}"
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
UI.puts "Compressing #{library_name} into #{output_library}"
|
|
93
|
+
|
|
94
|
+
`zip --symlinks -r #{output_library} #{library_name}`
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def clean_workspace
|
|
101
|
+
UI.puts 'Cleaning workspace'
|
|
102
|
+
|
|
103
|
+
FileUtils.rm_rf(gen_name)
|
|
104
|
+
Dir.chdir(zip_dir) do
|
|
105
|
+
FileUtils.rm_rf(framework_name) if @zip
|
|
106
|
+
FileUtils.rm_rf(library_name)
|
|
107
|
+
FileUtils.rm_rf(framework_name) unless @framework_output
|
|
108
|
+
FileUtils.rm_rf("#{framework_name}.zip") unless @framework_output
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def framework_name
|
|
113
|
+
CBin::Config::Builder.instance.framework_name(@spec)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def framework_name_zip
|
|
117
|
+
CBin::Config::Builder.instance.framework_name_version(@spec) + ".zip"
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def library_name
|
|
121
|
+
CBin::Config::Builder.instance.library_name(@spec)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def workspace_directory
|
|
125
|
+
File.expand_path("#{gen_name}/#{@rootSpec.name}")
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def zip_dir
|
|
129
|
+
CBin::Config::Builder.instance.zip_dir
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def gen_name
|
|
133
|
+
CBin::Config::Builder.instance.gen_dir
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def spec_file
|
|
138
|
+
@spec_file ||= begin
|
|
139
|
+
if @podspec
|
|
140
|
+
find_spec_file(@podspec)
|
|
141
|
+
else
|
|
142
|
+
if code_spec_files.empty?
|
|
143
|
+
raise Informative, '当前目录下没有找到可用源码 podspec.'
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
spec_file = code_spec_files.first
|
|
147
|
+
spec_file
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require 'yaml'
|
|
2
|
+
require 'cocoapods-tj/config/config'
|
|
3
|
+
|
|
4
|
+
module CBin
|
|
5
|
+
class Build
|
|
6
|
+
|
|
7
|
+
class Utils
|
|
8
|
+
|
|
9
|
+
def Utils.is_framework(spec)
|
|
10
|
+
if Utils.uses_frameworks?
|
|
11
|
+
return true
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
return Utils.is_swift_module(spec)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def Utils.is_swift_module(spec)
|
|
18
|
+
|
|
19
|
+
is_framework = false
|
|
20
|
+
dir = File.join(CBin::Config::Builder.instance.gen_dir, CBin::Config::Builder.instance.target_name)
|
|
21
|
+
if File.exist?(dir)
|
|
22
|
+
Dir.chdir(dir) do
|
|
23
|
+
public_headers = Array.new
|
|
24
|
+
spec_header_dir = "./Headers/Public/#{spec.name}"
|
|
25
|
+
|
|
26
|
+
unless File.exist?(spec_header_dir)
|
|
27
|
+
spec_header_dir = "./Pods/Headers/Public/#{spec.name}"
|
|
28
|
+
end
|
|
29
|
+
return false unless File.exist?(spec_header_dir)
|
|
30
|
+
|
|
31
|
+
is_framework = File.exist?(File.join(spec_header_dir, "#{spec.name}-umbrella.h"))
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
if $ARGV[1] == "local"
|
|
36
|
+
is_framework = File.exist?(File.join(CBin::Config::Builder.instance.xcode_build_dir, "#{spec.name}.framework"))
|
|
37
|
+
unless is_framework
|
|
38
|
+
is_framework = File.exist?(File.join(CBin::Config::Builder.instance.xcode_BuildProductsPath_dir, "#{spec.name}","Swift Compatibility Header"))
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
is_framework
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def Utils.uses_frameworks?
|
|
46
|
+
uses_frameworks = false
|
|
47
|
+
Pod::Config.instance.podfile.target_definitions.each do |key,value|
|
|
48
|
+
if key != "Pods"
|
|
49
|
+
uses_frameworks = value.uses_frameworks?
|
|
50
|
+
if uses_frameworks
|
|
51
|
+
break ;
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
return uses_frameworks
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# copy from https://github.com/CocoaPods/cocoapods-packager
|
|
2
|
+
|
|
3
|
+
module CBin
|
|
4
|
+
class Framework
|
|
5
|
+
attr_reader :headers_path
|
|
6
|
+
attr_reader :module_map_path
|
|
7
|
+
attr_reader :resources_path
|
|
8
|
+
attr_reader :root_path
|
|
9
|
+
attr_reader :versions_path
|
|
10
|
+
attr_reader :swift_module_path
|
|
11
|
+
attr_reader :fwk_path
|
|
12
|
+
|
|
13
|
+
def initialize(name, platform)
|
|
14
|
+
@name = name
|
|
15
|
+
@platform = platform
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def make
|
|
19
|
+
make_root
|
|
20
|
+
make_framework
|
|
21
|
+
make_headers
|
|
22
|
+
make_resources
|
|
23
|
+
make_current_version
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def delete_resources
|
|
27
|
+
Pathname.new(@resources_path).rmtree if File.exist? (@resources_path)
|
|
28
|
+
(Pathname.new(@fwk_path) + Pathname.new('Resources')).delete if File.exist?(Pathname.new(@fwk_path) + Pathname.new('Resources'))
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def remove_current_version
|
|
32
|
+
FileUtils.rm_f(File.join(@fwk_path,@name))
|
|
33
|
+
FileUtils.rm_f(File.join(@fwk_path,"Headers"))
|
|
34
|
+
FileUtils.rm_f(File.join(@fwk_path,"Resources"))
|
|
35
|
+
|
|
36
|
+
FileUtils.cp_r("#{@versions_path}/.", @fwk_path)
|
|
37
|
+
FileUtils.remove_dir("#{@fwk_path}/Versions")
|
|
38
|
+
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
def make_current_version
|
|
44
|
+
current_version_path = @versions_path + Pathname.new('../Current')
|
|
45
|
+
`ln -sf A #{current_version_path}`
|
|
46
|
+
`ln -sf Versions/Current/Headers #{@fwk_path}/`
|
|
47
|
+
`ln -sf Versions/Current/Resources #{@fwk_path}/`
|
|
48
|
+
`ln -sf Versions/Current/#{@name} #{@fwk_path}/`
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def make_framework
|
|
54
|
+
@fwk_path = @root_path + Pathname.new(@name + '.framework')
|
|
55
|
+
@fwk_path.mkdir unless @fwk_path.exist?
|
|
56
|
+
|
|
57
|
+
@module_map_path = @fwk_path + Pathname.new('Modules')
|
|
58
|
+
@swift_module_path = @module_map_path + Pathname.new(@name + '.swiftmodule')
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@versions_path = @fwk_path + Pathname.new('Versions/A')
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def make_headers
|
|
65
|
+
@headers_path = @versions_path + Pathname.new('Headers')
|
|
66
|
+
@headers_path.mkpath unless @headers_path.exist?
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def make_resources
|
|
70
|
+
@resources_path = @versions_path + Pathname.new('Resources')
|
|
71
|
+
@resources_path.mkpath unless @resources_path.exist?
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def make_root
|
|
75
|
+
@root_path = Pathname.new(@platform)
|
|
76
|
+
@root_path.mkpath unless @root_path.exist?
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|