lg_pod_plugin 1.1.6.7 → 1.1.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/lib/command/command.rb +1 -0
  3. data/lib/command/doctor.rb +31 -0
  4. data/lib/command/install.rb +1 -1
  5. data/lib/command/update.rb +1 -1
  6. data/lib/lg_pod_plugin/config/l_config.rb +4 -5
  7. data/lib/lg_pod_plugin/db/database.rb +116 -110
  8. data/lib/lg_pod_plugin/downloader/downloader.rb +7 -6
  9. data/lib/lg_pod_plugin/downloader/l_cache.rb +11 -2
  10. data/lib/lg_pod_plugin/downloader/overload_cache.rb +329 -0
  11. data/lib/lg_pod_plugin/downloader/request.rb +32 -32
  12. data/lib/lg_pod_plugin/git/gitlab_api.rb +29 -18
  13. data/lib/lg_pod_plugin/installer/PodDownload +0 -0
  14. data/lib/lg_pod_plugin/installer/install.rb +1 -4
  15. data/lib/lg_pod_plugin/installer/main.rb +0 -1
  16. data/lib/lg_pod_plugin/installer/project.rb +2 -7
  17. data/lib/lg_pod_plugin/pod/release-pod.rb +11 -42
  18. data/lib/lg_pod_plugin/version.rb +1 -1
  19. data/lib/lg_pod_plugin.rb +1 -0
  20. metadata +29 -119
  21. data/lib/sqlite3-1.5.3-arm64-darwin/API_CHANGES.md +0 -49
  22. data/lib/sqlite3-1.5.3-arm64-darwin/CHANGELOG.md +0 -462
  23. data/lib/sqlite3-1.5.3-arm64-darwin/CONTRIBUTING.md +0 -24
  24. data/lib/sqlite3-1.5.3-arm64-darwin/ChangeLog.cvs +0 -88
  25. data/lib/sqlite3-1.5.3-arm64-darwin/README.md +0 -235
  26. data/lib/sqlite3-1.5.3-arm64-darwin/dependencies.yml +0 -14
  27. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/aggregator.c +0 -274
  28. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/aggregator.h +0 -12
  29. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/backup.c +0 -168
  30. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/backup.h +0 -15
  31. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/database.c +0 -853
  32. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/database.h +0 -17
  33. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/exception.c +0 -98
  34. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/exception.h +0 -8
  35. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/extconf.rb +0 -251
  36. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/sqlite3.c +0 -163
  37. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/sqlite3_ruby.h +0 -48
  38. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/statement.c +0 -442
  39. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/statement.h +0 -16
  40. data/lib/sqlite3-1.5.3-arm64-darwin/faq/faq.md +0 -431
  41. data/lib/sqlite3-1.5.3-arm64-darwin/faq/faq.rb +0 -145
  42. data/lib/sqlite3-1.5.3-arm64-darwin/faq/faq.yml +0 -426
  43. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/2.6/sqlite3_native.bundle +0 -0
  44. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/2.7/sqlite3_native.bundle +0 -0
  45. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/3.0/sqlite3_native.bundle +0 -0
  46. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/3.1/sqlite3_native.bundle +0 -0
  47. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/3.2/sqlite3_native.bundle +0 -0
  48. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/constants.rb +0 -50
  49. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/database.rb +0 -741
  50. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/errors.rb +0 -35
  51. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/pragmas.rb +0 -595
  52. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/resultset.rb +0 -187
  53. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/statement.rb +0 -145
  54. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/translator.rb +0 -118
  55. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/value.rb +0 -57
  56. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/version.rb +0 -23
  57. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3.rb +0 -15
  58. data/lib/sqlite3-1.5.3-arm64-darwin/test/helper.rb +0 -27
  59. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_backup.rb +0 -33
  60. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_collation.rb +0 -82
  61. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database.rb +0 -545
  62. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database_flags.rb +0 -95
  63. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database_readonly.rb +0 -36
  64. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database_readwrite.rb +0 -41
  65. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_deprecated.rb +0 -44
  66. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_encoding.rb +0 -155
  67. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration.rb +0 -507
  68. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_aggregate.rb +0 -336
  69. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_open_close.rb +0 -30
  70. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_pending.rb +0 -115
  71. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_resultset.rb +0 -142
  72. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_statement.rb +0 -194
  73. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_result_set.rb +0 -37
  74. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_sqlite3.rb +0 -30
  75. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_statement.rb +0 -263
  76. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_statement_execute.rb +0 -35
  77. data/lib/sqlite3-1.5.3-x86_64-darwin/API_CHANGES.md +0 -49
  78. data/lib/sqlite3-1.5.3-x86_64-darwin/CHANGELOG.md +0 -462
  79. data/lib/sqlite3-1.5.3-x86_64-darwin/CONTRIBUTING.md +0 -24
  80. data/lib/sqlite3-1.5.3-x86_64-darwin/ChangeLog.cvs +0 -88
  81. data/lib/sqlite3-1.5.3-x86_64-darwin/README.md +0 -235
  82. data/lib/sqlite3-1.5.3-x86_64-darwin/dependencies.yml +0 -14
  83. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/aggregator.c +0 -274
  84. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/aggregator.h +0 -12
  85. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/backup.c +0 -168
  86. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/backup.h +0 -15
  87. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/database.c +0 -853
  88. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/database.h +0 -17
  89. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/exception.c +0 -98
  90. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/exception.h +0 -8
  91. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/extconf.rb +0 -251
  92. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/sqlite3.c +0 -163
  93. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/sqlite3_ruby.h +0 -48
  94. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/statement.c +0 -442
  95. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/statement.h +0 -16
  96. data/lib/sqlite3-1.5.3-x86_64-darwin/faq/faq.md +0 -431
  97. data/lib/sqlite3-1.5.3-x86_64-darwin/faq/faq.rb +0 -145
  98. data/lib/sqlite3-1.5.3-x86_64-darwin/faq/faq.yml +0 -426
  99. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/2.6/sqlite3_native.bundle +0 -0
  100. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/2.7/sqlite3_native.bundle +0 -0
  101. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/3.0/sqlite3_native.bundle +0 -0
  102. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/3.1/sqlite3_native.bundle +0 -0
  103. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/3.2/sqlite3_native.bundle +0 -0
  104. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/constants.rb +0 -50
  105. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/database.rb +0 -741
  106. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/errors.rb +0 -35
  107. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/pragmas.rb +0 -595
  108. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/resultset.rb +0 -187
  109. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/statement.rb +0 -145
  110. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/translator.rb +0 -118
  111. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/value.rb +0 -57
  112. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/version.rb +0 -23
  113. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3.rb +0 -15
  114. data/lib/sqlite3-1.5.3-x86_64-darwin/test/helper.rb +0 -27
  115. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_backup.rb +0 -33
  116. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_collation.rb +0 -82
  117. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database.rb +0 -545
  118. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database_flags.rb +0 -95
  119. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database_readonly.rb +0 -36
  120. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database_readwrite.rb +0 -41
  121. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_deprecated.rb +0 -44
  122. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_encoding.rb +0 -155
  123. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration.rb +0 -507
  124. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_aggregate.rb +0 -336
  125. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_open_close.rb +0 -30
  126. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_pending.rb +0 -115
  127. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_resultset.rb +0 -142
  128. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_statement.rb +0 -194
  129. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_result_set.rb +0 -37
  130. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_sqlite3.rb +0 -30
  131. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_statement.rb +0 -263
  132. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_statement_execute.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad00d26eddca0197af9e74cce63dde7b58620b66694e5c97efeb6c8ca00c451d
4
- data.tar.gz: 6f67d7bf931020022b87d2bb2de40b74d25716e6a4ef5b1dad0f70b0a7a03e67
3
+ metadata.gz: 44d4ceb34301dcc5a0312f8591cdbde166e1a4b7e2cb8a885738fa6997192de8
4
+ data.tar.gz: 0f770eba1a322ed7294d68d7ed81f9aef997f546a0d9c3c61f315cb563824e8d
5
5
  SHA512:
6
- metadata.gz: efa9785b96cd87f2d8af38fa907b6df5f036a7d4c6f3caa8c4cf338d07233271d27c78d1a0177fddda2117a760cefd3adb6f9c111045634e35d733131e774198
7
- data.tar.gz: ee86b67391bafbfc0db8b4b9063935b3f736f38487f181e2a729402d6cc1368806ace7f8acb21850b229a0436307e6e099dde50448e305ffa9d3a3acafe2875d
6
+ metadata.gz: 06506e9cd1131a5932ea3e550cc641832f13f194cd9427edfafcff2bcdd93758da909a8f0542c282869be565b23f42b80fee02c2e0ae52515eabefee433bcbb3
7
+ data.tar.gz: 72be08ac45145844d3c7082bdf1fe53e68b8892ac3bef7b9c58d6bfabe35448c2033290e66aace828a3397490e641926c8a7297c5480eb4b6cb61770da2ebc41
@@ -6,6 +6,7 @@ module LgPodPlugin
6
6
  require_relative 'update'
7
7
  require_relative 'init'
8
8
  require_relative 'install'
9
+ require_relative 'doctor'
9
10
  self.command = 'lg'
10
11
  self.version = VERSION
11
12
  self.abstract_command = true
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+ require 'claide'
3
+ require_relative 'command'
4
+
5
+ module LgPodPlugin
6
+ class Command
7
+ class Doctor < Command
8
+ self.abstract_command = false
9
+ self.summary = 'Manipulate the CocoaPods cache'
10
+
11
+ self.description = <<-DESC
12
+ Manipulate the download cache for pods, like printing the cache content
13
+ or cleaning the pods cache.
14
+ DESC
15
+
16
+ def initialize(argv)
17
+ # pp argv
18
+ super
19
+ end
20
+
21
+ def run
22
+ pwd = Pathname.new(File.dirname(__FILE__)).realpath
23
+ exexPath = pwd.parent.join("lg_pod_plugin/installer")
24
+ FileUtils.chdir exexPath
25
+ pp "sudo xattr -rd com.apple.quarantine ./PodDownload"
26
+ result = %x(sudo xattr -rd com.apple.quarantine ./PodDownload)
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -42,7 +42,7 @@ module LgPodPlugin
42
42
  self.log = argv.flag?('verbose')
43
43
  repo_flag = argv.flag?('repo-update')
44
44
  if repo_flag.nil?
45
- self.repo_update = true
45
+ self.repo_update = false
46
46
  else
47
47
  self.repo_update = repo_flag
48
48
  end
@@ -29,7 +29,7 @@ module LgPodPlugin
29
29
  self.log = argv.flag?('verbose')
30
30
  repo_flag = argv.flag?('repo-update')
31
31
  if repo_flag.nil?
32
- self.repo_update = true
32
+ self.repo_update = false
33
33
  else
34
34
  self.repo_update = repo_flag
35
35
  end
@@ -17,16 +17,15 @@ module LgPodPlugin
17
17
 
18
18
  public
19
19
  def self.get_config(git, uri)
20
- return nil unless uri&.host
20
+ return nil unless uri&.hostname
21
21
  return nil unless LUtils.is_gitlab_uri(git, uri.hostname)
22
22
  user_id = LUserAuthInfo.get_user_id(uri.hostname)
23
23
  user_info = LSqliteDb.shared.query_user_info(user_id)
24
- # 用户授权 token 不存在, 提示用户输入用户名密码
25
- unless user_info
24
+ if user_info != nil
25
+ user_info = GitLabAPI.check_gitlab_access_token_valid(uri, user_info)
26
+ else
26
27
  user_info = GitLabAPI.get_gitlab_access_token(uri, user_id)
27
- return nil unless user_info
28
28
  end
29
- user_info = GitLabAPI.check_gitlab_access_token_valid(uri, user_info)
30
29
  return nil unless user_info
31
30
  config = LConfig.new
32
31
  config.host = uri.hostname
@@ -1,10 +1,6 @@
1
1
  require 'singleton'
2
- arch = %x(ruby -v)
3
- if arch.include?("arm64")
4
- require_relative '../../sqlite3-1.5.3-arm64-darwin/lib/sqlite3'
5
- else
6
- require_relative '../../sqlite3-1.5.3-x86_64-darwin/lib/sqlite3'
7
- end
2
+ # arch = %x(ruby -v)
3
+ require 'sqlite3'
8
4
  module LgPodPlugin
9
5
 
10
6
  class ProjectModel
@@ -25,41 +21,42 @@ module LgPodPlugin
25
21
 
26
22
  end
27
23
 
28
- class LPodLatestRefs
29
- attr_accessor :id
30
- attr_accessor :name
31
- attr_accessor :tag
32
- attr_accessor :git
33
- attr_accessor :branch
34
- attr_accessor :commit
35
-
36
- def initialize(id, name, git, branch, tag, commit)
37
- self.id = id
38
- self.git = git
39
- self.tag = tag
40
- self.name = name
41
- self.branch = branch
42
- self.commit = commit
43
- end
44
-
45
- def self.get_pod_id(name, git, branch)
46
- key = name + git + branch
47
- return Digest::MD5.hexdigest(key)
48
- end
49
-
50
- end
24
+ # class LPodLatestRefs
25
+ # attr_accessor :id
26
+ # attr_accessor :name
27
+ # attr_accessor :tag
28
+ # attr_accessor :git
29
+ # attr_accessor :branch
30
+ # attr_accessor :commit
31
+ #
32
+ # def initialize(id, name, git, branch, tag, commit)
33
+ # self.id = id
34
+ # self.git = git
35
+ # self.tag = tag
36
+ # self.name = name
37
+ # self.branch = branch
38
+ # self.commit = commit
39
+ # end
40
+ #
41
+ # def self.get_pod_id(name, git, branch)
42
+ # key = name + git + branch
43
+ # return Digest::MD5.hexdigest(key)
44
+ # end
45
+ #
46
+ # end
51
47
 
52
48
  class LUserAuthInfo
53
- REQUIRED_ATTRS ||= %i[id username password host access_token refresh_token expires_in].freeze
49
+ REQUIRED_ATTRS ||= %i[id username password host access_token refresh_token expires_in update_time].freeze
54
50
  attr_accessor(*REQUIRED_ATTRS)
55
51
 
56
- def initialize(id = nil, name = nil, pwd = nil, host = nil, token = nil, refresh_token = nil, time = nil)
52
+ def initialize(id = nil, name = nil, pwd = nil, host = nil, token = nil, refresh_token = nil, time = nil, update_time = nil)
57
53
  self.id = id
58
54
  self.host = host
59
55
  self.password = pwd
60
56
  self.username = name
61
57
  self.expires_in = time
62
58
  self.access_token = token
59
+ self.update_time = update_time
63
60
  self.refresh_token = refresh_token
64
61
  end
65
62
 
@@ -110,6 +107,13 @@ module LgPodPlugin
110
107
  expires_in TimeStamp NOT NULL DEFAULT CURRENT_TIMESTAMP);"
111
108
  self.db.execute(sql1)
112
109
 
110
+ sel_sql = "select * from sqlite_master where name = '#{K_USER_TABLE}' and sql like '%update_time%'; "
111
+ resultSetPrincipal = self.db.execute(sel_sql)
112
+ if resultSetPrincipal.count == 0
113
+ alter = "ALTER TABLE #{K_USER_TABLE} ADD 'update_time' TimeStamp;"
114
+ self.db.execute(alter)
115
+ end
116
+
113
117
  #添加项目表
114
118
  sql2 = "create table if not exists #{K_USER_PROJECTS}(
115
119
  id varchar(100) primary key not null,
@@ -124,26 +128,27 @@ module LgPodPlugin
124
128
  );"
125
129
  self.db.execute(sql2)
126
130
 
127
- #添加项目表
128
- sql3 = "create table if not exists #{K_POD_LATEST_REFS}(
129
- id varchar(100) primary key not null,
130
- name varchar(100),
131
- git varchar(100),
132
- branch varchar(100),
133
- tag varchar(100),
134
- sha varchar(100)
135
- );"
136
- self.db.execute(sql3)
131
+ # #添加项目表
132
+ # sql3 = "create table if not exists #{K_POD_LATEST_REFS}(
133
+ # id varchar(100) primary key not null,
134
+ # name varchar(100),
135
+ # git varchar(100),
136
+ # branch varchar(100),
137
+ # tag varchar(100),
138
+ # sha varchar(100)
139
+ # );"
140
+ # self.db.execute(sql3)
141
+ #
142
+ # #添加项目表
143
+ # sql4 = "create table if not exists #{K_POD_SHA_BRANCH}(
144
+ # id varchar(100) primary key not null,
145
+ # name varchar(100),
146
+ # git varchar(100),
147
+ # branch varchar(100),
148
+ # sha varchar(100)
149
+ # );"
150
+ # self.db.execute(sql4)
137
151
 
138
- #添加项目表
139
- sql4 = "create table if not exists #{K_POD_SHA_BRANCH}(
140
- id varchar(100) primary key not null,
141
- name varchar(100),
142
- git varchar(100),
143
- branch varchar(100),
144
- sha varchar(100)
145
- );"
146
- self.db.execute(sql4)
147
152
  end
148
153
 
149
154
  public
@@ -151,11 +156,11 @@ module LgPodPlugin
151
156
  # pp "user.id => #{user.id}"
152
157
  if self.query_user_info(user.id) != nil
153
158
  self.db.execute_batch(
154
- "UPDATE #{K_USER_TABLE} SET username = (:username), password = (:password), host = (:host), access_token = (:access_token), expires_in = (:expires_in), refresh_token = (:refresh_token) where (id = :id)", { "username" => user.username, "password" => user.password, "host" => user.host, "access_token" => user.access_token, :expires_in => user.expires_in, :id => user.id, :refresh_token => user.refresh_token }
159
+ "UPDATE #{K_USER_TABLE} SET username = (:username), password = (:password), host = (:host), access_token = (:access_token), expires_in = (:expires_in), refresh_token = (:refresh_token), update_time = (:update_time) where (id = :id)", { "username" => user.username, "password" => user.password, "host" => user.host, "access_token" => user.access_token, :expires_in => user.expires_in, :id => user.id, :refresh_token => user.refresh_token , :update_time => user.update_time}
155
160
  )
156
161
  else
157
- self.db.execute("INSERT INTO #{K_USER_TABLE} (id, username, password, host, access_token,refresh_token, expires_in)
158
- VALUES (?, ?, ?, ?,?,?,?)", [user.id, user.username, user.password, user.host, user.access_token, user.refresh_token, user.expires_in])
162
+ self.db.execute("INSERT INTO #{K_USER_TABLE} (id, username, password, host, access_token,refresh_token, expires_in, update_time)
163
+ VALUES (?, ?, ?, ?,?,?,?, ?)", [user.id, user.username, user.password, user.host, user.access_token, user.refresh_token, user.expires_in, user.update_time])
159
164
  end
160
165
 
161
166
  end
@@ -173,6 +178,7 @@ module LgPodPlugin
173
178
  user_info.access_token = row[4]
174
179
  user_info.refresh_token = row[5]
175
180
  user_info.expires_in = row[6]
181
+ user_info.update_time = row[7]
176
182
  end
177
183
  user_info
178
184
  end
@@ -220,67 +226,67 @@ module LgPodPlugin
220
226
  ps.execute('n' => project_id)
221
227
  end
222
228
 
223
- def insert_pod_refs(name, git, branch, tag, commit)
224
- id = LPodLatestRefs.get_pod_id(name, git, branch)
225
- pod = LPodLatestRefs.new(id, name, git, branch, tag, commit)
226
- if self.query_pod_refs(id) != nil
227
- self.db.execute_batch(
228
- "UPDATE #{K_POD_LATEST_REFS} SET name = (:name), git = (:git), branch = (:branch), tag = (:tag), sha = (:sha) where (id = :id)", { "name" => pod.name, "git" => pod.git, "sha" => pod.commit, "branch" => pod.branch, :tag => pod.tag, :id => pod.id }
229
- )
230
- else
231
- self.db.execute("INSERT INTO #{K_POD_LATEST_REFS} (id, name, git, branch, tag, sha)
232
- VALUES (?, ?, ?, ?, ?, ?)", [pod.id, pod.name, pod.git, pod.branch, pod.tag, pod.commit])
233
- end
234
- self.insert_pod_sha_with_branch(name, git, commit, branch)
235
- end
236
-
237
- def query_pod_refs(id)
238
- pod_info = nil
239
- self.db.execute("select * from #{K_POD_LATEST_REFS} where id = '#{id}';") do |row|
240
- id = row[0]
241
- name = row[1]
242
- git = row[2]
243
- branch = row[3]
244
- tag = row[4]
245
- commit = row[5]
246
- pod_info = LPodLatestRefs.new(id, name, git, branch, tag, commit)
247
- end
248
- pod_info
249
- end
229
+ # def insert_pod_refs(name, git, branch, tag, commit)
230
+ # id = LPodLatestRefs.get_pod_id(name, git, branch)
231
+ # pod = LPodLatestRefs.new(id, name, git, branch, tag, commit)
232
+ # if self.query_pod_refs(id) != nil
233
+ # self.db.execute_batch(
234
+ # "UPDATE #{K_POD_LATEST_REFS} SET name = (:name), git = (:git), branch = (:branch), tag = (:tag), sha = (:sha) where (id = :id)", { "name" => pod.name, "git" => pod.git, "sha" => pod.commit, "branch" => pod.branch, :tag => pod.tag, :id => pod.id }
235
+ # )
236
+ # else
237
+ # self.db.execute("INSERT INTO #{K_POD_LATEST_REFS} (id, name, git, branch, tag, sha)
238
+ # VALUES (?, ?, ?, ?, ?, ?)", [pod.id, pod.name, pod.git, pod.branch, pod.tag, pod.commit])
239
+ # end
240
+ # self.insert_pod_sha_with_branch(name, git, commit, branch)
241
+ # end
242
+ #
243
+ # def query_pod_refs(id)
244
+ # pod_info = nil
245
+ # self.db.execute("select * from #{K_POD_LATEST_REFS} where id = '#{id}';") do |row|
246
+ # id = row[0]
247
+ # name = row[1]
248
+ # git = row[2]
249
+ # branch = row[3]
250
+ # tag = row[4]
251
+ # commit = row[5]
252
+ # pod_info = LPodLatestRefs.new(id, name, git, branch, tag, commit)
253
+ # end
254
+ # pod_info
255
+ # end
250
256
 
251
257
  # 保存 sha, branch 到数据库
252
- def insert_pod_sha_with_branch(name, git, sha, branch)
253
- return unless name && git && sha
254
- id = Digest::MD5.hexdigest(name + git + sha)
255
- if self.query_branch_with_sha(name, git, sha)[:sha] != nil
256
- self.db.execute_batch(
257
- "UPDATE #{K_POD_SHA_BRANCH} SET name = (:name), git = (:git), branch = (:branch), sha = (:sha) where (id = :id)", { "name" => name, "git" => git, "branch" => branch, :id => id, :sha => sha }
258
- )
259
- else
260
- self.db.execute("INSERT INTO #{K_POD_SHA_BRANCH} (id, name, git, branch, sha)
261
- VALUES (?, ?, ?, ?, ?)", [id, name, git, branch, sha])
262
- end
263
- end
258
+ # def insert_pod_sha_with_branch(name, git, sha, branch)
259
+ # return unless name && git && sha
260
+ # id = Digest::MD5.hexdigest(name + git + sha)
261
+ # if self.query_branch_with_sha(name, git, sha)[:sha] != nil
262
+ # self.db.execute_batch(
263
+ # "UPDATE #{K_POD_SHA_BRANCH} SET name = (:name), git = (:git), branch = (:branch), sha = (:sha) where (id = :id)", { "name" => name, "git" => git, "branch" => branch, :id => id, :sha => sha }
264
+ # )
265
+ # else
266
+ # self.db.execute("INSERT INTO #{K_POD_SHA_BRANCH} (id, name, git, branch, sha)
267
+ # VALUES (?, ?, ?, ?, ?)", [id, name, git, branch, sha])
268
+ # end
269
+ # end
264
270
 
265
271
  # 通过 sha 查询对应 branch
266
- def query_branch_with_sha(id = nil, name, git, sha)
267
- hash_map = Hash.new
268
- id = Digest::MD5.hexdigest(name + git + sha) unless id
269
- self.db.execute("select * from #{K_POD_SHA_BRANCH} where id = '#{id}' and name = '#{name}' and git = '#{git}' ;") do |row|
270
- new_id = row[0]
271
- new_sha = row[4]
272
- new_git = row[2]
273
- new_name = row[1]
274
- new_branch = row[3]
275
- hash_map[:id] = new_id
276
- hash_map[:git] = new_git
277
- hash_map[:sha] = new_sha
278
- hash_map[:name] = new_name
279
- hash_map[:branch] = new_branch
280
- end
281
- hash_map
282
- end
283
-
272
+ # def query_branch_with_sha(id = nil, name, git, sha)
273
+ # hash_map = Hash.new
274
+ # id = Digest::MD5.hexdigest(name + git + sha) unless id
275
+ # self.db.execute("select * from #{K_POD_SHA_BRANCH} where id = '#{id}' and name = '#{name}' and git = '#{git}' ;") do |row|
276
+ # new_id = row[0]
277
+ # new_sha = row[4]
278
+ # new_git = row[2]
279
+ # new_name = row[1]
280
+ # new_branch = row[3]
281
+ # hash_map[:id] = new_id
282
+ # hash_map[:git] = new_git
283
+ # hash_map[:sha] = new_sha
284
+ # hash_map[:name] = new_name
285
+ # hash_map[:branch] = new_branch
286
+ # end
287
+ # hash_map
288
+ # end
289
+ #
284
290
  end
285
291
 
286
292
  end
@@ -32,10 +32,10 @@ module LgPodPlugin
32
32
  checkout_options[:branch] = branch if branch
33
33
  end
34
34
  commit = checkout_options[:commit]
35
- unless commit
36
- commit = self.request.params[:commit] if self.request.params[:commit]
37
- checkout_options[:commit] = commit if commit
38
- end
35
+ # unless commit
36
+ # commit = self.request.params[:commit] if self.request.params[:commit]
37
+ # checkout_options[:commit] = commit if commit
38
+ # end
39
39
  if branch
40
40
  LgPodPlugin.log_green "Using `#{name}` (#{branch})"
41
41
  elsif tag
@@ -49,8 +49,8 @@ module LgPodPlugin
49
49
  LgPodPlugin.log_green "Using `#{name}`"
50
50
  end
51
51
  hash_map = self.request.get_cache_key_params
52
- self.request.checkout_options.delete(:branch) if commit
53
- self.request.checkout_options[:commit] = commit if commit
52
+ # self.request.checkout_options.delete(:branch) if commit
53
+ # self.request.checkout_options[:commit] = commit if commit
54
54
  # 发现本地有缓存, 不需要更新缓存
55
55
  pod_is_exist, destination, cache_pod_spec = LCache.new.pod_cache_exist(name, hash_map, podspec, self.request.released_pod)
56
56
  if pod_is_exist
@@ -58,6 +58,7 @@ module LgPodPlugin
58
58
  return nil
59
59
  else
60
60
  LgPodPlugin.log_green "find the new commit of `#{name}`, Git downloading now."
61
+
61
62
  # 本地 git 下载 pod 目录
62
63
  download_params = self.pre_download_git_repository(checkout_options)
63
64
  if download_params && download_params.is_a?(Hash)
@@ -13,7 +13,16 @@ module LgPodPlugin
13
13
 
14
14
  public
15
15
  def pod_cache_exist(name, options, spec = nil, released_pod = false)
16
+ # 参数为空不执行下载任务, 交给 cocoapods 处理下载
17
+ if options.nil?
18
+ return [true, nil, nil]
19
+ end
20
+
16
21
  destination, cache_pod_spec = self.find_pod_cache name, options, spec, released_pod
22
+ lock_temp_file = destination.to_path+ ".lock"
23
+ if File.exist?(lock_temp_file)
24
+ FileUtils.rm_rf lock_temp_file
25
+ end
17
26
  if (File.exist?(destination) && !destination.children.empty?) && cache_pod_spec.exist?
18
27
  return [true, destination, cache_pod_spec]
19
28
  else
@@ -29,8 +38,8 @@ module LgPodPlugin
29
38
  hash_map.delete(:version)
30
39
  end
31
40
  request = LCache.download_request(name, hash_map, spec, released_pod)
32
- destination = LCache.path_for_pod(request, {})
33
- cache_pod_spec = LCache.path_for_spec(request, {})
41
+ destination = LCache.path_for_pod(request)
42
+ cache_pod_spec = LCache.path_for_spec(request)
34
43
  [destination, cache_pod_spec]
35
44
  end
36
45