pod-builder 0.1.4
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/.gitignore +8 -0
- data/.vscode/launch.json +102 -0
- data/Example/PodBuilderExample.xcodeproj/project.pbxproj +416 -0
- data/Example/PodBuilderExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/Example/PodBuilderExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- data/Example/PodBuilderExample.xcodeproj/project.xcworkspace/xcuserdata/tomas.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- data/Example/PodBuilderExample.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- data/Example/PodBuilderExample.xcworkspace/contents.xcworkspacedata +10 -0
- data/Example/PodBuilderExample/AppDelegate.swift +47 -0
- data/Example/PodBuilderExample/Assets.xcassets/AppIcon.appiconset/Contents.json +98 -0
- data/Example/PodBuilderExample/Assets.xcassets/Contents.json +6 -0
- data/Example/PodBuilderExample/Base.lproj/LaunchScreen.storyboard +25 -0
- data/Example/PodBuilderExample/Base.lproj/Main.storyboard +24 -0
- data/Example/PodBuilderExample/Info.plist +45 -0
- data/Example/PodBuilderExample/ViewController.swift +25 -0
- data/Example/Podfile +8 -0
- data/Example/Podfile.lock +16 -0
- data/Example/Pods/Alamofire/LICENSE +19 -0
- data/Example/Pods/Alamofire/README.md +242 -0
- data/Example/Pods/Alamofire/Source/AFError.swift +460 -0
- data/Example/Pods/Alamofire/Source/Alamofire.swift +465 -0
- data/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift +37 -0
- data/Example/Pods/Alamofire/Source/MultipartFormData.swift +580 -0
- data/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift +233 -0
- data/Example/Pods/Alamofire/Source/Notifications.swift +55 -0
- data/Example/Pods/Alamofire/Source/ParameterEncoding.swift +483 -0
- data/Example/Pods/Alamofire/Source/Request.swift +654 -0
- data/Example/Pods/Alamofire/Source/Response.swift +567 -0
- data/Example/Pods/Alamofire/Source/ResponseSerialization.swift +715 -0
- data/Example/Pods/Alamofire/Source/Result.swift +300 -0
- data/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift +307 -0
- data/Example/Pods/Alamofire/Source/SessionDelegate.swift +725 -0
- data/Example/Pods/Alamofire/Source/SessionManager.swift +896 -0
- data/Example/Pods/Alamofire/Source/TaskDelegate.swift +466 -0
- data/Example/Pods/Alamofire/Source/Timeline.swift +136 -0
- data/Example/Pods/Alamofire/Source/Validation.swift +315 -0
- data/Example/Pods/Manifest.lock +16 -0
- data/Example/Pods/Pods.xcodeproj/project.pbxproj +673 -0
- data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/Alamofire.xcscheme +60 -0
- data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/Pods-PodBuilderExample.xcscheme +60 -0
- data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist +21 -0
- data/Example/Pods/Target Support Files/Alamofire/Alamofire-dummy.m +5 -0
- data/Example/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch +12 -0
- data/Example/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h +16 -0
- data/Example/Pods/Target Support Files/Alamofire/Alamofire.modulemap +6 -0
- data/Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig +9 -0
- data/Example/Pods/Target Support Files/Alamofire/Info.plist +26 -0
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Info.plist +26 -0
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-acknowledgements.markdown +26 -0
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-acknowledgements.plist +58 -0
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-dummy.m +5 -0
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-frameworks.sh +153 -0
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-resources.sh +118 -0
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-umbrella.h +16 -0
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.debug.xcconfig +11 -0
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.modulemap +6 -0
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.release.xcconfig +11 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +100 -0
- data/LICENSE.txt +13 -0
- data/README.md +192 -0
- data/Rakefile +2 -0
- data/bin/console +16 -0
- data/bin/setup +8 -0
- data/exe/pod_builder +174 -0
- data/lib/pod_builder/analyze.rb +52 -0
- data/lib/pod_builder/cocoapods/analyzer.rb +24 -0
- data/lib/pod_builder/cocoapods/specification.rb +27 -0
- data/lib/pod_builder/command.rb +9 -0
- data/lib/pod_builder/command/build.rb +240 -0
- data/lib/pod_builder/command/build_all.rb +15 -0
- data/lib/pod_builder/command/clean.rb +80 -0
- data/lib/pod_builder/command/deintegrate.rb +51 -0
- data/lib/pod_builder/command/generate_podspec.rb +17 -0
- data/lib/pod_builder/command/init.rb +86 -0
- data/lib/pod_builder/command/install_sources.rb +82 -0
- data/lib/pod_builder/command/none.rb +16 -0
- data/lib/pod_builder/command/restore_all.rb +30 -0
- data/lib/pod_builder/configuration.rb +91 -0
- data/lib/pod_builder/core.rb +74 -0
- data/lib/pod_builder/install.rb +105 -0
- data/lib/pod_builder/podfile.rb +207 -0
- data/lib/pod_builder/podfile/post_actions.rb +141 -0
- data/lib/pod_builder/podfile_item.rb +216 -0
- data/lib/pod_builder/podspec.rb +71 -0
- data/lib/pod_builder/templates/build_podfile.template +78 -0
- data/lib/pod_builder/templates/build_podspec.template +19 -0
- data/lib/pod_builder/version.rb +4 -0
- data/pod-builder.gemspec +36 -0
- metadata +274 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'pod_builder/core'
|
2
|
+
|
3
|
+
module PodBuilder
|
4
|
+
module Command
|
5
|
+
class BuildAll
|
6
|
+
def self.call(options)
|
7
|
+
Configuration.check_inited
|
8
|
+
PodBuilder::prepare_basepath
|
9
|
+
|
10
|
+
ARGV << "*"
|
11
|
+
return Command::Build::call(options)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'pod_builder/core'
|
2
|
+
|
3
|
+
module PodBuilder
|
4
|
+
module Command
|
5
|
+
class Clean
|
6
|
+
def self.call(options)
|
7
|
+
Configuration.check_inited
|
8
|
+
PodBuilder::prepare_basepath
|
9
|
+
|
10
|
+
update_repo = options[:update_repos] || false
|
11
|
+
installer, analyzer = Analyze.installer_at(PodBuilder::basepath)
|
12
|
+
all_buildable_items = Analyze.podfile_items(installer, analyzer)
|
13
|
+
|
14
|
+
podspec_names = all_buildable_items.map(&:podspec_name)
|
15
|
+
rel_paths = all_buildable_items.map(&:prebuilt_rel_path)
|
16
|
+
|
17
|
+
base_path = PodBuilder::basepath("Rome")
|
18
|
+
framework_files = Dir.glob("#{base_path}/**/*.framework")
|
19
|
+
clean(framework_files, base_path, rel_paths)
|
20
|
+
|
21
|
+
rel_paths.map! { |x| "#{x}.dSYM"}
|
22
|
+
|
23
|
+
base_path = PodBuilder::basepath("dSYM/iphoneos")
|
24
|
+
dSYM_files_iphone = Dir.glob("#{base_path}/**/*.dSYM")
|
25
|
+
clean(dSYM_files_iphone, base_path, rel_paths)
|
26
|
+
|
27
|
+
base_path = PodBuilder::basepath("dSYM/iphonesimulator")
|
28
|
+
dSYM_files_sim = Dir.glob("#{base_path}/**/*.dSYM")
|
29
|
+
clean(dSYM_files_sim, base_path, rel_paths)
|
30
|
+
|
31
|
+
clean_sources(podspec_names)
|
32
|
+
|
33
|
+
puts "\n\n🎉 done!\n".green
|
34
|
+
return true
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.clean_sources(podspec_names)
|
38
|
+
puts "Cleaning sources".blue
|
39
|
+
|
40
|
+
base_path = PodBuilder::basepath("Sources")
|
41
|
+
|
42
|
+
repo_paths = Dir.glob("#{base_path}/*")
|
43
|
+
|
44
|
+
repo_paths.each do |path|
|
45
|
+
podspec_name = File.basename(path)
|
46
|
+
|
47
|
+
unless !podspec_names.include?(podspec_name)
|
48
|
+
next
|
49
|
+
end
|
50
|
+
|
51
|
+
puts "Deleting sources #{path}".blue
|
52
|
+
FileUtils.rm_rf(path)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def self.clean(files, base_path, rel_paths)
|
59
|
+
files = files.map { |x| [Pathname.new(x).relative_path_from(Pathname.new(base_path)).to_s, x] }.to_h
|
60
|
+
|
61
|
+
files.each do |rel_path, path|
|
62
|
+
unless !rel_paths.include?(rel_path)
|
63
|
+
next
|
64
|
+
end
|
65
|
+
|
66
|
+
puts "Deleting #{path}".blue
|
67
|
+
FileUtils.rm_rf(path)
|
68
|
+
end
|
69
|
+
|
70
|
+
current_dir = Dir.pwd
|
71
|
+
Dir.chdir(base_path)
|
72
|
+
# Before deleting anything be sure we're in a git repo
|
73
|
+
h = `git rev-parse --show-toplevel`.strip()
|
74
|
+
raise "\n\nNo git repository found in current folder `#{Dir.pwd}`!\n".red if h.empty?
|
75
|
+
system("find . -type d -empty -delete") # delete empty folders
|
76
|
+
Dir.chdir(current_dir)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'pod_builder/core'
|
2
|
+
|
3
|
+
module PodBuilder
|
4
|
+
module Command
|
5
|
+
class Deintegrate
|
6
|
+
def self.call(options)
|
7
|
+
raise "\n\nPodBuilder not initialized!\n".red if !Configuration.exists
|
8
|
+
|
9
|
+
prebuilt_podfile = File.join(Configuration.base_path, "Podfile")
|
10
|
+
restored_podfile = File.join(PodBuilder::xcodepath, "Podfile")
|
11
|
+
|
12
|
+
FileUtils.cp(prebuilt_podfile, restored_podfile)
|
13
|
+
|
14
|
+
podfile_content = File.read(restored_podfile)
|
15
|
+
podfile_lines = []
|
16
|
+
pre_install_indx = -1
|
17
|
+
podfile_content.each_line.with_index do |line, index|
|
18
|
+
if Podfile::PRE_INSTALL_ACTIONS.detect { |x| Podfile::strip_line(x) == Podfile::strip_line(line) }
|
19
|
+
if pre_install_indx == -1
|
20
|
+
pre_install_indx = index
|
21
|
+
end
|
22
|
+
else
|
23
|
+
podfile_lines.push(line)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
if pre_install_indx > 0 &&
|
28
|
+
Podfile::strip_line(podfile_lines[pre_install_indx - 1]).include?("pre_installdo|") &&
|
29
|
+
Podfile::strip_line(podfile_lines[pre_install_indx]) == "end"
|
30
|
+
podfile_lines.delete_at(pre_install_indx)
|
31
|
+
podfile_lines.delete_at(pre_install_indx - 1)
|
32
|
+
end
|
33
|
+
|
34
|
+
FileUtils.rm_f(restored_podfile)
|
35
|
+
File.write(restored_podfile, podfile_lines.join)
|
36
|
+
|
37
|
+
PodBuilder::safe_rm_rf(Configuration.base_path)
|
38
|
+
|
39
|
+
Dir.chdir(PodBuilder::xcodepath)
|
40
|
+
system("pod deintegrate; pod install;")
|
41
|
+
|
42
|
+
license_base = PodBuilder::xcodepath(Configuration.license_file_name)
|
43
|
+
FileUtils.rm_f("#{license_base}.plist")
|
44
|
+
FileUtils.rm_f("#{license_base}.md")
|
45
|
+
|
46
|
+
puts "\n\n🎉 done!\n".green
|
47
|
+
return true
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'pod_builder/core'
|
2
|
+
|
3
|
+
module PodBuilder
|
4
|
+
module Command
|
5
|
+
class GeneratePodspec
|
6
|
+
def self.call(options)
|
7
|
+
Configuration.check_inited
|
8
|
+
PodBuilder::prepare_basepath
|
9
|
+
|
10
|
+
Podspec::generate
|
11
|
+
|
12
|
+
puts "\n\n🎉 done!\n".green
|
13
|
+
return true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'pod_builder/core'
|
2
|
+
|
3
|
+
module PodBuilder
|
4
|
+
module Command
|
5
|
+
class Init
|
6
|
+
def self.call(options)
|
7
|
+
raise "\n\nAlready initialized\n".red if Configuration.exists
|
8
|
+
raise "\n\nXcode project missing\n".red if PodBuilder::xcodepath.nil?
|
9
|
+
|
10
|
+
options[:prebuild_path] ||= Configuration.base_path
|
11
|
+
|
12
|
+
if File.expand_path(options[:prebuild_path]) != options[:prebuild_path] # if not absolute
|
13
|
+
options[:prebuild_path] = File.expand_path(PodBuilder::xcodepath(options[:prebuild_path]))
|
14
|
+
end
|
15
|
+
|
16
|
+
FileUtils.mkdir_p(options[:prebuild_path])
|
17
|
+
FileUtils.mkdir_p("#{options[:prebuild_path]}/.pod_builder")
|
18
|
+
FileUtils.touch("#{options[:prebuild_path]}/.pod_builder/pod_builder")
|
19
|
+
|
20
|
+
File.write("#{options[:prebuild_path]}/.gitignore", "Pods/\n*.xcodeproj\nSources\n")
|
21
|
+
|
22
|
+
project_podfile_path = PodBuilder::xcodepath("Podfile")
|
23
|
+
prebuilt_podfile_path = File.join(options[:prebuild_path], "Podfile")
|
24
|
+
FileUtils.cp(project_podfile_path, prebuilt_podfile_path)
|
25
|
+
|
26
|
+
add_install_block(prebuilt_podfile_path)
|
27
|
+
|
28
|
+
add_pre_install_actions(project_podfile_path)
|
29
|
+
add_post_install_checks(project_podfile_path)
|
30
|
+
|
31
|
+
home_path = Pathname.new(PodBuilder::xcodepath)
|
32
|
+
prebuilt_path = Pathname.new(options[:prebuild_path])
|
33
|
+
relative_path = prebuilt_path.relative_path_from(home_path)
|
34
|
+
|
35
|
+
Configuration.base_path = relative_path
|
36
|
+
|
37
|
+
Configuration.write
|
38
|
+
|
39
|
+
puts "\n\n🎉 done!\n".green
|
40
|
+
return true
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def self.add_install_block(podfile_path)
|
46
|
+
add(Podfile::PRE_INSTALL_ACTIONS, "pre_install", podfile_path)
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.add_pre_install_actions(podfile_path)
|
50
|
+
pre_install_actions = ["Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_duplicate_framework_and_library_names) {}"]
|
51
|
+
add(pre_install_actions, "pre_install", podfile_path)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.add_post_install_checks(podfile_path)
|
55
|
+
post_install_actions = ["require 'pod_builder/podfile/post_actions'", "PodBuilder::Podfile::remove_target_support_duplicate_entries", "PodBuilder::Podfile::check_target_support_resource_collisions"]
|
56
|
+
add(post_install_actions, "post_install", podfile_path)
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.add(entries, marker, podfile_path)
|
60
|
+
podfile_content = File.read(podfile_path)
|
61
|
+
|
62
|
+
entries.map! { |x| " #{x}\n"}
|
63
|
+
|
64
|
+
marker_found = false
|
65
|
+
podfile_lines = []
|
66
|
+
podfile_content.each_line do |line|
|
67
|
+
stripped_line = Podfile::strip_line(line)
|
68
|
+
|
69
|
+
podfile_lines.push(line)
|
70
|
+
if stripped_line.start_with?("#{marker}do|")
|
71
|
+
marker_found = true
|
72
|
+
podfile_lines.push(entries)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
if !marker_found
|
77
|
+
podfile_lines.push("\n#{marker} do |installer|\n")
|
78
|
+
podfile_lines.push(entries)
|
79
|
+
podfile_lines.push("end\n")
|
80
|
+
end
|
81
|
+
|
82
|
+
File.write(podfile_path, podfile_lines.join)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'pod_builder/core'
|
2
|
+
|
3
|
+
module PodBuilder
|
4
|
+
module Command
|
5
|
+
class InstallSources
|
6
|
+
def self.call(options)
|
7
|
+
Configuration.check_inited
|
8
|
+
PodBuilder::prepare_basepath
|
9
|
+
|
10
|
+
update_repo = options[:update_repos] || false
|
11
|
+
installer, analyzer = Analyze.installer_at(PodBuilder::basepath)
|
12
|
+
framework_items = Analyze.podfile_items(installer, analyzer).select { |x| !x.is_prebuilt }
|
13
|
+
podspec_names = framework_items.map(&:podspec_name)
|
14
|
+
|
15
|
+
base_path = PodBuilder::basepath("Rome")
|
16
|
+
framework_files = Dir.glob("#{base_path}/**/*.framework")
|
17
|
+
|
18
|
+
framework_files.each do |path|
|
19
|
+
rel_path = Pathname.new(path).relative_path_from(Pathname.new(base_path)).to_s
|
20
|
+
|
21
|
+
if framework_spec = framework_items.detect { |x| x.prebuilt_rel_path == rel_path }
|
22
|
+
update_repo(framework_spec)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Command::Clean::clean_sources()
|
27
|
+
|
28
|
+
rewrite_lldinit
|
29
|
+
|
30
|
+
puts "\n\n🎉 done!\n".green
|
31
|
+
return true
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def self.update_repo(spec)
|
37
|
+
dest_path = PodBuilder::basepath("Sources")
|
38
|
+
FileUtils.mkdir_p(dest_path)
|
39
|
+
|
40
|
+
current_dir = Dir.pwd
|
41
|
+
Dir.chdir(dest_path)
|
42
|
+
|
43
|
+
repo_dir = File.join(dest_path, spec.podspec_name)
|
44
|
+
if !File.directory?(repo_dir)
|
45
|
+
raise "Failed cloning #{spec.name}" if !system("git clone #{spec.repo} #{spec.podspec_name}")
|
46
|
+
end
|
47
|
+
|
48
|
+
Dir.chdir(repo_dir)
|
49
|
+
puts "Checking out #{spec.podspec_name}".blue
|
50
|
+
raise "Failed cheking out #{spec.name}" if !system(spec.git_hard_checkout)
|
51
|
+
|
52
|
+
Dir.chdir(current_dir)
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.rewrite_lldinit
|
56
|
+
puts "Writing ~/.lldbinit-Xcode".blue
|
57
|
+
|
58
|
+
lldbinit_path = File.expand_path('~/.lldbinit-Xcode')
|
59
|
+
FileUtils.touch(lldbinit_path)
|
60
|
+
|
61
|
+
lldbinit_lines = []
|
62
|
+
File.read(lldbinit_path).each_line do |line|
|
63
|
+
if lldbinit_lines.include?(line.strip()) ||
|
64
|
+
line.start_with?("settings set target.source-map") ||
|
65
|
+
line.strip() == "" then
|
66
|
+
next
|
67
|
+
end
|
68
|
+
|
69
|
+
lldbinit_lines.push(line)
|
70
|
+
end
|
71
|
+
|
72
|
+
build_path = "#{PodBuilder::Configuration.build_path}/Pods"
|
73
|
+
source_path = PodBuilder::basepath("Sources")
|
74
|
+
|
75
|
+
lldbinit_lines.push("settings set target.source-map '#{build_path}' '#{source_path}'")
|
76
|
+
lldbinit_lines.push("")
|
77
|
+
|
78
|
+
File.write(lldbinit_path, lldbinit_lines.join("\n"))
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'pod_builder/core'
|
2
|
+
|
3
|
+
module PodBuilder
|
4
|
+
module Command
|
5
|
+
class RestoreAll
|
6
|
+
def self.call(options)
|
7
|
+
Configuration.check_inited
|
8
|
+
PodBuilder::prepare_basepath
|
9
|
+
|
10
|
+
ret = false
|
11
|
+
begin
|
12
|
+
File.rename(PodBuilder::basepath("Podfile"), PodBuilder::basepath("Podfile.tmp2"))
|
13
|
+
File.rename(PodBuilder::basepath("Podfile.restore"), PodBuilder::basepath("Podfile"))
|
14
|
+
|
15
|
+
ARGV << "*"
|
16
|
+
options[:skip_prebuild_update] = true
|
17
|
+
ret = Command::Build::call(options)
|
18
|
+
rescue Exception => e
|
19
|
+
raise e
|
20
|
+
ensure
|
21
|
+
FileUtils.rm_f(PodBuilder::basepath("Podfile.restore"))
|
22
|
+
File.rename(PodBuilder::basepath("Podfile"), PodBuilder::basepath("Podfile.restore"))
|
23
|
+
File.rename(PodBuilder::basepath("Podfile.tmp2"), PodBuilder::basepath("Podfile"))
|
24
|
+
end
|
25
|
+
|
26
|
+
return ret
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module PodBuilder
|
4
|
+
class Configuration
|
5
|
+
class <<self
|
6
|
+
attr_accessor :build_settings
|
7
|
+
attr_accessor :build_system
|
8
|
+
attr_accessor :config_file
|
9
|
+
attr_accessor :base_path
|
10
|
+
attr_accessor :build_path
|
11
|
+
attr_accessor :spec_overrides
|
12
|
+
attr_accessor :skip_licenses
|
13
|
+
attr_accessor :license_file_name
|
14
|
+
end
|
15
|
+
|
16
|
+
# Remember to update README.md
|
17
|
+
@build_settings = {
|
18
|
+
"ONLY_ACTIVE_ARCH" => "NO",
|
19
|
+
"ENABLE_BITCODE" => "NO",
|
20
|
+
"CLANG_ENABLE_MODULE_DEBUGGING" => "NO",
|
21
|
+
"GCC_OPTIMIZATION_LEVEL" => "s",
|
22
|
+
"SWIFT_OPTIMIZATION_LEVEL" => "-Osize",
|
23
|
+
"SWIFT_COMPILATION_MODE" => "Incremental",
|
24
|
+
}
|
25
|
+
@build_system = "Legacy" # either Latest (New build system) or Legacy (Standard build system)
|
26
|
+
@config_file = "PodBuilder.json"
|
27
|
+
@base_path = "Frameworks"
|
28
|
+
@build_path = "/tmp/pod_builder"
|
29
|
+
@spec_overrides = {}
|
30
|
+
@skip_licenses = []
|
31
|
+
@license_file_name = "Pods-acknowledgements"
|
32
|
+
|
33
|
+
def self.check_inited
|
34
|
+
count = Dir.glob("#{PodBuilder::home}/**/.pod_builder").count
|
35
|
+
raise "\n\nNot inited, run `pod_builder init`\n".red if count == 0
|
36
|
+
raise "\n\nToo many .pod_builder found `#{count}`\n".red if count > 1
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.exists
|
40
|
+
return config_path ? File.exist?(config_path) : false
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.load
|
44
|
+
unless config_path
|
45
|
+
return
|
46
|
+
end
|
47
|
+
|
48
|
+
Configuration.base_path = File.dirname(config_path)
|
49
|
+
|
50
|
+
if exists
|
51
|
+
config = JSON.parse(File.read(config_path))
|
52
|
+
if config.has_key?("spec_overrides")
|
53
|
+
Configuration.spec_overrides = config["spec_overrides"]
|
54
|
+
end
|
55
|
+
if config.has_key?("skip_licenses")
|
56
|
+
Configuration.skip_licenses = config["skip_licenses"]
|
57
|
+
end
|
58
|
+
if config.has_key?("build_settings")
|
59
|
+
Configuration.build_settings = config["build_settings"]
|
60
|
+
end
|
61
|
+
if config.has_key?("build_system")
|
62
|
+
Configuration.build_system = config["build_system"]
|
63
|
+
end
|
64
|
+
if config.has_key?("license_file_name")
|
65
|
+
Configuration.license_file_name = config["license_file_name"]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.write
|
71
|
+
config = {
|
72
|
+
# nothing here yet
|
73
|
+
}
|
74
|
+
File.write(config_path, config.to_json)
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
def self.config_path
|
80
|
+
unless PodBuilder::xcodepath
|
81
|
+
return
|
82
|
+
end
|
83
|
+
|
84
|
+
project_path = "#{PodBuilder::xcodepath}/#{base_path}/.pod_builder"
|
85
|
+
config_path = Dir.glob("#{PodBuilder::home}/**/.pod_builder").first
|
86
|
+
|
87
|
+
path = File.dirname(config_path || project_path)
|
88
|
+
return File.join(path, config_file)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|