lg_pod_plugin 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/bin/lg +2 -2
  3. data/lib/command/command.rb +1 -2
  4. data/lib/command/install.rb +7 -2
  5. data/lib/command/update.rb +4 -1
  6. data/lib/lg_pod_plugin/config/l_config.rb +59 -0
  7. data/lib/lg_pod_plugin/config/lockfile_model.rb +59 -0
  8. data/lib/lg_pod_plugin/config/podspec.rb +266 -0
  9. data/lib/lg_pod_plugin/config/target.rb +33 -0
  10. data/lib/lg_pod_plugin/{database.rb → db/database.rb} +76 -16
  11. data/lib/lg_pod_plugin/downloader/downloader.rb +156 -0
  12. data/lib/lg_pod_plugin/{l_cache.rb → downloader/l_cache.rb} +41 -22
  13. data/lib/lg_pod_plugin/downloader/request.rb +233 -0
  14. data/lib/lg_pod_plugin/git/git_clone.rb +85 -0
  15. data/lib/lg_pod_plugin/git/git_download.rb +53 -0
  16. data/lib/lg_pod_plugin/git/github_api.rb +137 -0
  17. data/lib/lg_pod_plugin/git/github_archive.rb +165 -0
  18. data/lib/lg_pod_plugin/git/gitlab_api.rb +265 -0
  19. data/lib/lg_pod_plugin/git/gitlab_archive.rb +177 -0
  20. data/lib/lg_pod_plugin/git/http_download.rb +39 -0
  21. data/lib/lg_pod_plugin/installer/PodDownload +0 -0
  22. data/lib/lg_pod_plugin/installer/concurrency.rb +21 -0
  23. data/lib/lg_pod_plugin/installer/install.rb +111 -0
  24. data/lib/lg_pod_plugin/installer/main.rb +63 -0
  25. data/lib/lg_pod_plugin/installer/project.rb +47 -0
  26. data/lib/lg_pod_plugin/net/l_uri.rb +88 -0
  27. data/lib/lg_pod_plugin/net/net-ping.rb +27 -0
  28. data/lib/lg_pod_plugin/pod/external_pod.rb +21 -0
  29. data/lib/lg_pod_plugin/pod/release-pod.rb +158 -0
  30. data/lib/lg_pod_plugin/utils/aes-crypt.rb +82 -0
  31. data/lib/lg_pod_plugin/{file_path.rb → utils/file_path.rb} +3 -5
  32. data/lib/lg_pod_plugin/utils/l_util.rb +133 -0
  33. data/lib/lg_pod_plugin/{log.rb → utils/log.rb} +1 -1
  34. data/lib/lg_pod_plugin/{string.rb → utils/string.rb} +0 -0
  35. data/lib/lg_pod_plugin/version.rb +1 -1
  36. data/lib/lg_pod_plugin.rb +24 -9
  37. data/lib/sqlite3-1.5.3-arm64-darwin/API_CHANGES.md +49 -0
  38. data/lib/sqlite3-1.5.3-arm64-darwin/CHANGELOG.md +462 -0
  39. data/lib/sqlite3-1.5.3-arm64-darwin/CONTRIBUTING.md +24 -0
  40. data/lib/sqlite3-1.5.3-arm64-darwin/ChangeLog.cvs +88 -0
  41. data/lib/sqlite3-1.5.3-arm64-darwin/README.md +235 -0
  42. data/lib/sqlite3-1.5.3-arm64-darwin/dependencies.yml +14 -0
  43. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/aggregator.c +274 -0
  44. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/aggregator.h +12 -0
  45. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/backup.c +168 -0
  46. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/backup.h +15 -0
  47. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/database.c +853 -0
  48. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/database.h +17 -0
  49. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/exception.c +98 -0
  50. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/exception.h +8 -0
  51. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/extconf.rb +251 -0
  52. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/sqlite3.c +163 -0
  53. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/sqlite3_ruby.h +48 -0
  54. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/statement.c +442 -0
  55. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/statement.h +16 -0
  56. data/lib/sqlite3-1.5.3-arm64-darwin/faq/faq.md +431 -0
  57. data/lib/sqlite3-1.5.3-arm64-darwin/faq/faq.rb +145 -0
  58. data/lib/sqlite3-1.5.3-arm64-darwin/faq/faq.yml +426 -0
  59. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/2.6/sqlite3_native.bundle +0 -0
  60. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/2.7/sqlite3_native.bundle +0 -0
  61. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/3.0/sqlite3_native.bundle +0 -0
  62. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/3.1/sqlite3_native.bundle +0 -0
  63. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/constants.rb +50 -0
  64. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/database.rb +741 -0
  65. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/errors.rb +35 -0
  66. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/pragmas.rb +595 -0
  67. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/resultset.rb +187 -0
  68. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/statement.rb +145 -0
  69. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/translator.rb +118 -0
  70. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/value.rb +57 -0
  71. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/version.rb +23 -0
  72. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3.rb +15 -0
  73. data/lib/sqlite3-1.5.3-arm64-darwin/test/helper.rb +27 -0
  74. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_backup.rb +33 -0
  75. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_collation.rb +82 -0
  76. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database.rb +545 -0
  77. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database_flags.rb +95 -0
  78. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database_readonly.rb +36 -0
  79. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database_readwrite.rb +41 -0
  80. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_deprecated.rb +44 -0
  81. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_encoding.rb +155 -0
  82. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration.rb +507 -0
  83. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_aggregate.rb +336 -0
  84. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_open_close.rb +30 -0
  85. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_pending.rb +115 -0
  86. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_resultset.rb +142 -0
  87. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_statement.rb +194 -0
  88. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_result_set.rb +37 -0
  89. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_sqlite3.rb +30 -0
  90. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_statement.rb +263 -0
  91. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_statement_execute.rb +35 -0
  92. data/lib/sqlite3-1.5.3-x86_64-darwin/API_CHANGES.md +49 -0
  93. data/lib/sqlite3-1.5.3-x86_64-darwin/CHANGELOG.md +462 -0
  94. data/lib/sqlite3-1.5.3-x86_64-darwin/CONTRIBUTING.md +24 -0
  95. data/lib/sqlite3-1.5.3-x86_64-darwin/ChangeLog.cvs +88 -0
  96. data/lib/sqlite3-1.5.3-x86_64-darwin/README.md +235 -0
  97. data/lib/sqlite3-1.5.3-x86_64-darwin/dependencies.yml +14 -0
  98. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/aggregator.c +274 -0
  99. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/aggregator.h +12 -0
  100. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/backup.c +168 -0
  101. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/backup.h +15 -0
  102. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/database.c +853 -0
  103. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/database.h +17 -0
  104. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/exception.c +98 -0
  105. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/exception.h +8 -0
  106. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/extconf.rb +251 -0
  107. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/sqlite3.c +163 -0
  108. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/sqlite3_ruby.h +48 -0
  109. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/statement.c +442 -0
  110. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/statement.h +16 -0
  111. data/lib/sqlite3-1.5.3-x86_64-darwin/faq/faq.md +431 -0
  112. data/lib/sqlite3-1.5.3-x86_64-darwin/faq/faq.rb +145 -0
  113. data/lib/sqlite3-1.5.3-x86_64-darwin/faq/faq.yml +426 -0
  114. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/2.6/sqlite3_native.bundle +0 -0
  115. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/2.7/sqlite3_native.bundle +0 -0
  116. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/3.0/sqlite3_native.bundle +0 -0
  117. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/3.1/sqlite3_native.bundle +0 -0
  118. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/constants.rb +50 -0
  119. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/database.rb +741 -0
  120. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/errors.rb +35 -0
  121. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/pragmas.rb +595 -0
  122. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/resultset.rb +187 -0
  123. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/statement.rb +145 -0
  124. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/translator.rb +118 -0
  125. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/value.rb +57 -0
  126. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/version.rb +23 -0
  127. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3.rb +15 -0
  128. data/lib/sqlite3-1.5.3-x86_64-darwin/test/helper.rb +27 -0
  129. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_backup.rb +33 -0
  130. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_collation.rb +82 -0
  131. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database.rb +545 -0
  132. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database_flags.rb +95 -0
  133. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database_readonly.rb +36 -0
  134. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database_readwrite.rb +41 -0
  135. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_deprecated.rb +44 -0
  136. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_encoding.rb +155 -0
  137. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration.rb +507 -0
  138. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_aggregate.rb +336 -0
  139. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_open_close.rb +30 -0
  140. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_pending.rb +115 -0
  141. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_resultset.rb +142 -0
  142. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_statement.rb +194 -0
  143. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_result_set.rb +37 -0
  144. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_sqlite3.rb +30 -0
  145. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_statement.rb +263 -0
  146. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_statement_execute.rb +35 -0
  147. metadata +146 -53
  148. data/lib/lg_pod_plugin/downloader.rb +0 -57
  149. data/lib/lg_pod_plugin/gitlab_api.rb +0 -147
  150. data/lib/lg_pod_plugin/gitlab_archive.rb +0 -352
  151. data/lib/lg_pod_plugin/gitlab_download.rb +0 -159
  152. data/lib/lg_pod_plugin/install.rb +0 -81
  153. data/lib/lg_pod_plugin/l_config.rb +0 -83
  154. data/lib/lg_pod_plugin/l_util.rb +0 -145
  155. data/lib/lg_pod_plugin/net-ping.rb +0 -41
  156. data/lib/lg_pod_plugin/podspec.rb +0 -156
  157. data/lib/lg_pod_plugin/release-pod.rb +0 -90
  158. data/lib/lg_pod_plugin/request.rb +0 -221
  159. data/lib/lg_pod_plugin/runner.rb +0 -114
  160. data/lib/lg_pod_plugin/specification.rb +0 -52
@@ -0,0 +1,158 @@
1
+ require 'cocoapods'
2
+ require 'cocoapods-core'
3
+ require_relative '../config/podspec'
4
+ require_relative '../installer/concurrency'
5
+
6
+ module LgPodPlugin
7
+
8
+ class ReleasePod < ExternalPod
9
+ def initialize(target, name, hash, spec)
10
+ @spec = spec
11
+ @name = name
12
+ @target = target
13
+ @released_pod = true
14
+ @checkout_options = hash
15
+ end
16
+
17
+ def self.check_release_pod_exist(name, requirements, spec, released_pod)
18
+ is_exist, _, _ = (LCache.new.pod_cache_exist(name, requirements, spec, released_pod))
19
+ return is_exist
20
+ end
21
+
22
+ def self.resolve_dependencies(lockfile, installer)
23
+ installer.resolve_dependencies
24
+ external_pods = LProject.shared.external_pods ||= {}
25
+ analysis_result = installer.send(:analysis_result)
26
+ return unless analysis_result
27
+ root_specs = analysis_result.specifications.map(&:root).uniq
28
+ root_specs = root_specs.reject! do |spec|
29
+ spec_name = spec.send(:attributes_hash)["name"]
30
+ external_pods[spec_name] || external_pods[spec_name.split("/").first]
31
+ end unless external_pods.empty?
32
+ return unless root_specs
33
+ all_installers = Array.new
34
+ root_specs.sort_by(&:name).each do |spec|
35
+ attributes_hash = spec.send(:attributes_hash)
36
+ next unless attributes_hash.is_a?(Hash)
37
+ pod_name = attributes_hash["name"]
38
+ source = attributes_hash['source']
39
+ next unless source.is_a?(Hash)
40
+ git = source["git"]
41
+ tag = source["tag"]
42
+ http = source["http"]
43
+ checksum = spec.send(:checksum)
44
+ if http
45
+ if http.include?("https://github.com") && http.include?("releases/download")
46
+ http = "https://ghproxy.com/" + http
47
+ source["http"] = http
48
+ end
49
+ version = attributes_hash["version"]
50
+ requirements = {:http => http, :version => version}
51
+ elsif git && tag
52
+ tag = tag.to_s unless LUtils.is_a_string? tag
53
+ requirements = { :git => git, :tag => tag }
54
+ else
55
+ next
56
+ end
57
+ pod_exist = check_release_pod_exist(pod_name, requirements, spec, true)
58
+ if lockfile && checksum
59
+ internal_data = lockfile.send(:internal_data)
60
+ lock_checksums = internal_data["SPEC CHECKSUMS"] ||= {}
61
+ lock_checksum = lock_checksums[pod_name]
62
+ next if (lock_checksum == checksum) && (pod_exist)
63
+ else
64
+ next if pod_exist
65
+ end
66
+ LProject.shared.cache_specs[pod_name] = spec
67
+ lg_spec = LgPodPlugin::PodSpec.form_pod_spec spec
68
+ release_pod = ReleasePod.new(nil, pod_name, requirements, lg_spec)
69
+ pod_install = LgPodPlugin::LPodInstaller.new
70
+ download_params = pod_install.install(release_pod)
71
+ all_installers.append pod_install if download_params
72
+ end
73
+ # 通过 swift 可执行文件进行异步下载任务
74
+ LgPodPlugin::Concurrency.async_download_pods all_installers
75
+ end
76
+
77
+ def self.dependencies(installer)
78
+ installer.download_dependencies
79
+ installer.send(:validate_targets)
80
+ installation_options = installer.send(:installation_options)
81
+ skip_pods_project_generation = installation_options.send(:skip_pods_project_generation)
82
+ if skip_pods_project_generation
83
+ installer.show_skip_pods_project_generation_message
84
+ else
85
+ installer.integrate
86
+ end
87
+ installer.send(:write_lockfiles)
88
+ installer.send(:perform_post_install_actions)
89
+ end
90
+
91
+ def self.lockfile_missing_pods(pods, lockfile)
92
+ lockfile_roots = lockfile.pod_names.map { |pod| Pod::Specification.root_name(pod) }
93
+ pods.map { |pod| Pod::Specification.root_name(pod) }.uniq - lockfile_roots
94
+ end
95
+
96
+ # Check if all given pods are installed
97
+ #
98
+ def self.verify_pods_are_installed!(pods, lockfile)
99
+ missing_pods = lockfile_missing_pods(pods, lockfile)
100
+
101
+ unless missing_pods.empty?
102
+ message = if missing_pods.length > 1
103
+ "Pods `#{missing_pods.join('`, `')}` are not " \
104
+ 'installed and cannot be updated'
105
+ else
106
+ "The `#{missing_pods.first}` Pod is not installed " \
107
+ 'and cannot be updated'
108
+ end
109
+ raise Pod::Informative, message
110
+ end
111
+ end
112
+
113
+ def self.verify_lockfile_exists!(lockfile)
114
+ unless lockfile
115
+ raise Pod::Informative, "No `Podfile.lock' found in the project directory, run `pod install'."
116
+ end
117
+ end
118
+
119
+ def self.install_release_pod(update, repo_update, verbose)
120
+ #切换工作目录到当前工程下, 开始执行pod install
121
+ workspace = LProject.shared.workspace
122
+ FileUtils.chdir(workspace)
123
+ # 安装 release_pod
124
+ LgPodPlugin.log_blue "Pre-downloading Release Pods"
125
+ Pod::Config.instance.verbose = verbose
126
+ pods_path = LProject.shared.workspace.join('Pods')
127
+ podfile = LProject.shared.podfile
128
+ lockfile = LProject.shared.lockfile
129
+ sandbox = Pod::Sandbox.new(pods_path)
130
+ installer = Pod::Installer.new(sandbox, podfile, lockfile)
131
+ installer.repo_update = repo_update
132
+ if update
133
+ need_update_pods = LProject.shared.need_update_pods ||= Hash.new
134
+ pods = need_update_pods.keys ||= []
135
+ begin
136
+ verify_lockfile_exists!(lockfile)
137
+ verify_pods_are_installed!(pods, lockfile)
138
+ if pods.empty?
139
+ installer.update = true
140
+ else
141
+ installer.update = { :pods => pods }
142
+ end
143
+ rescue
144
+ installer.update = false
145
+ end
146
+ else
147
+ installer.update = false
148
+ end
149
+ installer.deployment = false
150
+ installer.clean_install = false
151
+ installer.prepare
152
+ resolve_dependencies(lockfile, installer)
153
+ dependencies(installer)
154
+ end
155
+
156
+ end
157
+
158
+ end
@@ -0,0 +1,82 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ # The encrypt_data and decrypt_data methods are Copyright (c) 2007 Brent Sowers
4
+ # and have been included with prior permission.
5
+ #
6
+ # Copyright (c) 2012 Gurpartap Singh
7
+ #
8
+ # MIT License
9
+ #
10
+ # Permission is hereby granted, free of charge, to any person obtaining
11
+ # a copy of this software and associated documentation files (the
12
+ # "Software"), to deal in the Software without restriction, including
13
+ # without limitation the rights to use, copy, modify, merge, publish,
14
+ # distribute, sublicense, and/or sell copies of the Software, and to
15
+ # permit persons to whom the Software is furnished to do so, subject to
16
+ # the following conditions:
17
+ #
18
+ # The above copyright notice and this permission notice shall be
19
+ # included in all copies or substantial portions of the Software.
20
+ #
21
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
+
29
+ require 'openssl'
30
+
31
+ module AESCrypt
32
+ def self.encrypt(message, password)
33
+ Base64.encode64(self.encrypt_data(message.to_s.strip, password, nil, "AES-256-ECB"))
34
+ end
35
+
36
+ def self.decrypt(message, password)
37
+ base64_decoded = Base64.decode64(message.to_s.strip)
38
+ self.decrypt_data(base64_decoded, password, nil, "AES-256-ECB")
39
+ end
40
+
41
+ def self.key_digest(password)
42
+ OpenSSL::Digest::SHA256.new(password).digest
43
+ end
44
+
45
+ # Decrypts a block of data (encrypted_data) given an encryption key
46
+ # and an initialization vector (iv). Keys, iv's, and the data
47
+ # returned are all binary strings. Cipher_type should be
48
+ # "AES-256-CBC", "AES-256-ECB", or any of the cipher types
49
+ # supported by OpenSSL. Pass nil for the iv if the encryption type
50
+ # doesn't use iv's (like ECB).
51
+ #:return: => String
52
+ #:arg: encrypted_data => String
53
+ #:arg: key => String
54
+ #:arg: iv => String
55
+ #:arg: cipher_type => String
56
+ def self.decrypt_data(encrypted_data, key, iv, cipher_type)
57
+ aes = OpenSSL::Cipher::Cipher.new(cipher_type)
58
+ aes.decrypt
59
+ aes.key = key
60
+ aes.iv = iv if iv != nil
61
+ aes.update(encrypted_data) + aes.final
62
+ end
63
+
64
+ # Encrypts a block of data given an encryption key and an
65
+ # initialization vector (iv). Keys, iv's, and the data returned
66
+ # are all binary strings. Cipher_type should be "AES-256-CBC",
67
+ # "AES-256-ECB", or any of the cipher types supported by OpenSSL.
68
+ # Pass nil for the iv if the encryption type doesn't use iv's (like
69
+ # ECB).
70
+ #:return: => String
71
+ #:arg: data => String
72
+ #:arg: key => String
73
+ #:arg: iv => String
74
+ #:arg: cipher_type => String
75
+ def self.encrypt_data(data, key, iv, cipher_type)
76
+ aes = OpenSSL::Cipher::Cipher.new(cipher_type)
77
+ aes.encrypt
78
+ aes.key = key
79
+ aes.iv = iv if iv != nil
80
+ aes.update(data) + aes.final
81
+ end
82
+ end
@@ -10,10 +10,8 @@ module LgPodPlugin
10
10
  # 本地下载路径 ~Library/Caches/LgPodPlugin
11
11
  def self.download_director
12
12
  cache_path = self.cache_director.join("LgPodPlugin")
13
- unless cache_path.exist?
14
- # pp "文件路径不存在"
15
- cache_path.mkdir(0700)
16
- end
13
+ # pp "文件路径不存在, 就创建"
14
+ cache_path.mkdir(0700) unless cache_path.exist?
17
15
  cache_path
18
16
  end
19
17
 
@@ -21,7 +19,7 @@ module LgPodPlugin
21
19
  def self.cache_workspace(root)
22
20
  timestamp = "_#{Time.now.to_i}_"
23
21
  key = root.to_path + timestamp + "#{(rand * 10000000).to_i}"
24
- director = Digest::MD5.hexdigest(key)
22
+ director = LUtils.md5(key)
25
23
  return self.download_director.join(director)
26
24
  end
27
25
 
@@ -0,0 +1,133 @@
1
+ require 'json'
2
+ require 'resolv'
3
+ require "ipaddr"
4
+ require 'base64'
5
+ require 'fileutils'
6
+ require_relative 'aes-crypt'
7
+
8
+ module LgPodPlugin
9
+
10
+ class LUtils
11
+
12
+ def self.encrypt(message, password)
13
+ encrypted_data = AESCrypt.encrypt(message, password)
14
+ encrypted_data.tr("\n", "")
15
+ end
16
+
17
+ def self.decrypt(message, password)
18
+ AESCrypt.decrypt message, password
19
+ end
20
+
21
+ def self.md5(text)
22
+ return "" unless text
23
+ return Digest::MD5.hexdigest(text)
24
+ end
25
+
26
+ def self.base64_encode(text)
27
+ Base64.encode64(text)
28
+ end
29
+
30
+ def self.base64_decode(text)
31
+ Base64.decode64(text)
32
+ end
33
+
34
+ #判断对象是不是 String
35
+ def self.is_a_string?(obj)
36
+ if "#{obj.class}" == "String"
37
+ return true
38
+ else
39
+ return false
40
+ end
41
+ end
42
+
43
+ # 通过 git ls-remote获取最新 commit
44
+ public
45
+ def self.refs_from_ls_remote(git, branch)
46
+ cmds = ['git']
47
+ cmds << "ls-remote"
48
+ cmds << git
49
+ cmds << branch if branch
50
+ cmds_to_s = cmds.join(" ")
51
+ LgPodPlugin.log_blue cmds_to_s
52
+ begin
53
+ return %x(timeout 5 #{cmds_to_s})
54
+ rescue
55
+ return %x(#{cmds_to_s})
56
+ end
57
+ end
58
+
59
+ # 解析git ls-remote结果
60
+ public
61
+ def self.sha_from_result(output, branch_name)
62
+ return nil if branch_name.nil?
63
+ encoded_branch_name = branch_name.dup.force_encoding(Encoding::ASCII_8BIT)
64
+ if branch_name == "HEAD"
65
+ match1 = %r{([a-z0-9]*)\t#{Regexp.quote(encoded_branch_name)}}.match(output)
66
+ if match1.nil?
67
+ sha = ""
68
+ else
69
+ sha = match1[1]
70
+ end
71
+ return [nil, nil] unless sha && !sha.empty?
72
+ match2 = %r{(#{sha})\trefs\/heads\/([a-z0-9]*)}.match(output)
73
+ return [nil, nil] if match2.nil?
74
+ if match2[1] == sha
75
+ new_branch = match2[2]
76
+ return [sha, new_branch]
77
+ else
78
+ return [nil, nil]
79
+ end
80
+ else
81
+ match = %r{([a-z0-9]*)\trefs\/(heads|tags)\/#{Regexp.quote(encoded_branch_name)}}.match(output)
82
+ if !match.nil?
83
+ sha = match[1]
84
+ branch = match[0].split("refs/heads/").last
85
+ else
86
+ sha = nil
87
+ branch = nil
88
+ end
89
+ return [sha, branch]
90
+ end
91
+ end
92
+
93
+ #截取git-url 拿到项目绝对名称 比如 l-base-ios
94
+ public
95
+ def self.get_git_project_name(git)
96
+ base_url = self.get_gitlab_base_url(git)
97
+ match = %r{[^/]+$}.match(base_url)
98
+ return match[0] unless match.nil?
99
+ end
100
+
101
+ # 截取 url
102
+ public
103
+ def self.get_gitlab_base_url(git)
104
+ if git.include?(".git")
105
+ math = /(.*(?=.git))/.match(git)
106
+ return math[0] unless math.nil?
107
+ else
108
+ return git
109
+ end
110
+ end
111
+
112
+ public
113
+ def self.url_encode(url)
114
+ url.to_s.b.gsub(/[^a-zA-Z0-9_\-.~]/n) { |m| sprintf('%%%02X', m.unpack1('C')) }
115
+ end
116
+
117
+ public
118
+ def self.pod_real_name(name)
119
+ math = %r{(.*(?=/))}.match(name)
120
+ return name unless math
121
+ return math[0]
122
+ end
123
+
124
+ public
125
+ def self.is_gitlab_uri(git, hostname)
126
+ match1 = %r{(github.com|gitee.com|coding.net|code.aliyun.com)}.match(git)
127
+ match2 = %r{(github.com|gitee.com|coding.net|code.aliyun.com)}.match(hostname)
128
+ return match1.nil? && match2.nil?
129
+ end
130
+
131
+ end
132
+
133
+ end
@@ -1,5 +1,5 @@
1
1
 
2
- require_relative 'string'
2
+ require 'cocoapods'
3
3
  require 'cocoapods/user_interface'
4
4
 
5
5
  module LgPodPlugin
File without changes
@@ -1,3 +1,3 @@
1
1
  module LgPodPlugin
2
- VERSION = "1.1.3"
2
+ VERSION = "1.1.4"
3
3
  end
data/lib/lg_pod_plugin.rb CHANGED
@@ -1,17 +1,32 @@
1
- require 'git'
1
+ # require 'git'
2
2
  require 'claide'
3
3
  require 'cocoapods-downloader'
4
4
  require "lg_pod_plugin/version"
5
- require_relative 'lg_pod_plugin/log'
6
- require_relative 'lg_pod_plugin/runner'
7
- require_relative 'lg_pod_plugin/install'
8
- require_relative 'lg_pod_plugin/request'
9
- require_relative 'lg_pod_plugin/database'
10
- require_relative 'lg_pod_plugin/downloader'
11
- require_relative 'lg_pod_plugin/gitlab_api'
12
- require_relative 'lg_pod_plugin/gitlab_download'
13
5
  require 'cocoapods-core/podfile/target_definition'
14
6
 
7
+ require_relative 'lg_pod_plugin/db/database'
8
+ require_relative 'lg_pod_plugin/utils/log'
9
+ require_relative 'lg_pod_plugin/config/target'
10
+ require_relative 'lg_pod_plugin/pod/external_pod'
11
+ require_relative 'lg_pod_plugin/pod/release-pod'
12
+ require_relative 'lg_pod_plugin/installer/project'
13
+ require_relative 'lg_pod_plugin/downloader/l_cache'
14
+ require_relative 'lg_pod_plugin/utils/file_path'
15
+ require_relative 'lg_pod_plugin/config/l_config'
16
+ require_relative 'lg_pod_plugin/installer/main'
17
+ require_relative 'lg_pod_plugin/installer/install'
18
+ require_relative 'lg_pod_plugin/downloader/request'
19
+ require_relative 'lg_pod_plugin/db/database'
20
+ require_relative 'lg_pod_plugin/net/l_uri'
21
+ require_relative 'lg_pod_plugin/utils/l_util'
22
+ require_relative 'lg_pod_plugin/git/gitlab_api'
23
+ require_relative 'lg_pod_plugin/net/net-ping'
24
+ require_relative 'lg_pod_plugin/git/gitlab_archive'
25
+ require_relative 'lg_pod_plugin/config/lockfile_model'
26
+ require_relative 'lg_pod_plugin/downloader/downloader'
27
+ require_relative 'lg_pod_plugin/git/git_download'
28
+ require_relative 'lg_pod_plugin/git/git_clone'
29
+
15
30
  module LgPodPlugin
16
31
  autoload :Command, 'command/command'
17
32
  class Error < StandardError; end
@@ -0,0 +1,49 @@
1
+ # API Changes
2
+
3
+ * SQLite3::Database#execute only accepts an array for bind parameters.
4
+
5
+ * SQLite3::ResultSet used to query the database for the first row, regardless
6
+ of whether the user asked for it or not. I have removed that so that rows
7
+ will not be returned until the user asks for them. This is a subtle but
8
+ sometimes important change in behavior.
9
+
10
+ 83882d2208ed189361617d5ab8532a325aaf729d
11
+
12
+ * SQLite3::Database#trace now takes either a block or an object that responds
13
+ to "call". The previous implementation passed around a VALUE that was cast
14
+ to a void *. This is dangerous because the value could get garbage collected
15
+ before the proc was called. If the user wants data passed around with the
16
+ block, they should use variables available to the closure or create an
17
+ object.
18
+
19
+ * SQLite3::Statement#step automatically converts to ruby types, where before
20
+ all values were automatically yielded as strings. This will only be a
21
+ problem for people who were accessing information about the database that
22
+ wasn't previously passed through the pure ruby conversion code.
23
+
24
+ * SQLite3::Database#errmsg no longer takes a parameter to return error
25
+ messages as UTF-16. Do people even use that? I opt for staying UTF-8 when
26
+ possible. See test_integration.rb test_errmsg_utf16
27
+
28
+ * SQLite3::Database#authorize same changes as trace
29
+
30
+ * test/test_tc_database.rb was removed because we no longer use the Driver
31
+ design pattern.
32
+
33
+ # Garbage Collection Strategy
34
+
35
+ All statements keep pointers back to their respective database connections.
36
+ The @connection instance variable on the Statement handle keeps the database
37
+ connection alive. Memory allocated for a statement handler will be freed in
38
+ two cases:
39
+
40
+ * close is called on the statement
41
+ * The SQLite3::Database object gets garbage collected
42
+
43
+ We can't free the memory for the statement in the garbage collection function
44
+ for the statement handler. The reason is because there exists a race
45
+ condition. We cannot guarantee the order in which objects will be garbage
46
+ collected. So, it is possible that a connection and a statement are up for
47
+ garbage collection. If the database connection were to be free'd before the
48
+ statement, then boom. Instead we'll be conservative and free unclosed
49
+ statements when the connection is terminated.