lg_pod_plugin 1.1.6.7 → 1.1.7.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) 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/init.rb +1 -1
  5. data/lib/command/install.rb +1 -1
  6. data/lib/command/update.rb +1 -1
  7. data/lib/lg_pod_plugin/config/l_config.rb +4 -5
  8. data/lib/lg_pod_plugin/db/database.rb +82 -112
  9. data/lib/lg_pod_plugin/downloader/downloader.rb +7 -6
  10. data/lib/lg_pod_plugin/downloader/l_cache.rb +11 -2
  11. data/lib/lg_pod_plugin/downloader/overload_cache.rb +329 -0
  12. data/lib/lg_pod_plugin/downloader/request.rb +32 -32
  13. data/lib/lg_pod_plugin/git/gitlab_api.rb +41 -25
  14. data/lib/lg_pod_plugin/installer/PodDownload +0 -0
  15. data/lib/lg_pod_plugin/installer/install.rb +1 -4
  16. data/lib/lg_pod_plugin/installer/main.rb +0 -1
  17. data/lib/lg_pod_plugin/installer/project.rb +2 -7
  18. data/lib/lg_pod_plugin/pod/release-pod.rb +11 -42
  19. data/lib/lg_pod_plugin/version.rb +1 -1
  20. data/lib/lg_pod_plugin.rb +1 -0
  21. metadata +43 -119
  22. data/lib/sqlite3-1.5.3-arm64-darwin/API_CHANGES.md +0 -49
  23. data/lib/sqlite3-1.5.3-arm64-darwin/CHANGELOG.md +0 -462
  24. data/lib/sqlite3-1.5.3-arm64-darwin/CONTRIBUTING.md +0 -24
  25. data/lib/sqlite3-1.5.3-arm64-darwin/ChangeLog.cvs +0 -88
  26. data/lib/sqlite3-1.5.3-arm64-darwin/README.md +0 -235
  27. data/lib/sqlite3-1.5.3-arm64-darwin/dependencies.yml +0 -14
  28. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/aggregator.c +0 -274
  29. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/aggregator.h +0 -12
  30. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/backup.c +0 -168
  31. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/backup.h +0 -15
  32. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/database.c +0 -853
  33. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/database.h +0 -17
  34. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/exception.c +0 -98
  35. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/exception.h +0 -8
  36. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/extconf.rb +0 -251
  37. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/sqlite3.c +0 -163
  38. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/sqlite3_ruby.h +0 -48
  39. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/statement.c +0 -442
  40. data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/statement.h +0 -16
  41. data/lib/sqlite3-1.5.3-arm64-darwin/faq/faq.md +0 -431
  42. data/lib/sqlite3-1.5.3-arm64-darwin/faq/faq.rb +0 -145
  43. data/lib/sqlite3-1.5.3-arm64-darwin/faq/faq.yml +0 -426
  44. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/2.6/sqlite3_native.bundle +0 -0
  45. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/2.7/sqlite3_native.bundle +0 -0
  46. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/3.0/sqlite3_native.bundle +0 -0
  47. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/3.1/sqlite3_native.bundle +0 -0
  48. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/3.2/sqlite3_native.bundle +0 -0
  49. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/constants.rb +0 -50
  50. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/database.rb +0 -741
  51. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/errors.rb +0 -35
  52. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/pragmas.rb +0 -595
  53. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/resultset.rb +0 -187
  54. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/statement.rb +0 -145
  55. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/translator.rb +0 -118
  56. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/value.rb +0 -57
  57. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/version.rb +0 -23
  58. data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3.rb +0 -15
  59. data/lib/sqlite3-1.5.3-arm64-darwin/test/helper.rb +0 -27
  60. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_backup.rb +0 -33
  61. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_collation.rb +0 -82
  62. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database.rb +0 -545
  63. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database_flags.rb +0 -95
  64. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database_readonly.rb +0 -36
  65. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database_readwrite.rb +0 -41
  66. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_deprecated.rb +0 -44
  67. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_encoding.rb +0 -155
  68. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration.rb +0 -507
  69. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_aggregate.rb +0 -336
  70. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_open_close.rb +0 -30
  71. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_pending.rb +0 -115
  72. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_resultset.rb +0 -142
  73. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_statement.rb +0 -194
  74. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_result_set.rb +0 -37
  75. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_sqlite3.rb +0 -30
  76. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_statement.rb +0 -263
  77. data/lib/sqlite3-1.5.3-arm64-darwin/test/test_statement_execute.rb +0 -35
  78. data/lib/sqlite3-1.5.3-x86_64-darwin/API_CHANGES.md +0 -49
  79. data/lib/sqlite3-1.5.3-x86_64-darwin/CHANGELOG.md +0 -462
  80. data/lib/sqlite3-1.5.3-x86_64-darwin/CONTRIBUTING.md +0 -24
  81. data/lib/sqlite3-1.5.3-x86_64-darwin/ChangeLog.cvs +0 -88
  82. data/lib/sqlite3-1.5.3-x86_64-darwin/README.md +0 -235
  83. data/lib/sqlite3-1.5.3-x86_64-darwin/dependencies.yml +0 -14
  84. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/aggregator.c +0 -274
  85. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/aggregator.h +0 -12
  86. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/backup.c +0 -168
  87. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/backup.h +0 -15
  88. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/database.c +0 -853
  89. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/database.h +0 -17
  90. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/exception.c +0 -98
  91. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/exception.h +0 -8
  92. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/extconf.rb +0 -251
  93. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/sqlite3.c +0 -163
  94. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/sqlite3_ruby.h +0 -48
  95. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/statement.c +0 -442
  96. data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/statement.h +0 -16
  97. data/lib/sqlite3-1.5.3-x86_64-darwin/faq/faq.md +0 -431
  98. data/lib/sqlite3-1.5.3-x86_64-darwin/faq/faq.rb +0 -145
  99. data/lib/sqlite3-1.5.3-x86_64-darwin/faq/faq.yml +0 -426
  100. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/2.6/sqlite3_native.bundle +0 -0
  101. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/2.7/sqlite3_native.bundle +0 -0
  102. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/3.0/sqlite3_native.bundle +0 -0
  103. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/3.1/sqlite3_native.bundle +0 -0
  104. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/3.2/sqlite3_native.bundle +0 -0
  105. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/constants.rb +0 -50
  106. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/database.rb +0 -741
  107. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/errors.rb +0 -35
  108. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/pragmas.rb +0 -595
  109. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/resultset.rb +0 -187
  110. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/statement.rb +0 -145
  111. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/translator.rb +0 -118
  112. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/value.rb +0 -57
  113. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/version.rb +0 -23
  114. data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3.rb +0 -15
  115. data/lib/sqlite3-1.5.3-x86_64-darwin/test/helper.rb +0 -27
  116. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_backup.rb +0 -33
  117. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_collation.rb +0 -82
  118. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database.rb +0 -545
  119. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database_flags.rb +0 -95
  120. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database_readonly.rb +0 -36
  121. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database_readwrite.rb +0 -41
  122. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_deprecated.rb +0 -44
  123. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_encoding.rb +0 -155
  124. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration.rb +0 -507
  125. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_aggregate.rb +0 -336
  126. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_open_close.rb +0 -30
  127. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_pending.rb +0 -115
  128. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_resultset.rb +0 -142
  129. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_statement.rb +0 -194
  130. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_result_set.rb +0 -37
  131. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_sqlite3.rb +0 -30
  132. data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_statement.rb +0 -263
  133. 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: f4b61db7b5001df6188133eaf111f4570d0580fe4e71bc3e89863f2245d9c3ff
4
+ data.tar.gz: 14afb884ec6e4247b37f95b0002c2dd19098c75cf464fe07d3c79565f83916a0
5
5
  SHA512:
6
- metadata.gz: efa9785b96cd87f2d8af38fa907b6df5f036a7d4c6f3caa8c4cf338d07233271d27c78d1a0177fddda2117a760cefd3adb6f9c111045634e35d733131e774198
7
- data.tar.gz: ee86b67391bafbfc0db8b4b9063935b3f736f38487f181e2a729402d6cc1368806ace7f8acb21850b229a0436307e6e099dde50448e305ffa9d3a3acafe2875d
6
+ metadata.gz: b2ee449bb57c15cc6d9cd7d5566aa91af414c34a3c2aabc1a2e858650447b93df9bba3d705d248beffed8bee615b31cfc2db935c525b6eed2178658f7ab2a655
7
+ data.tar.gz: c3f587b3ed1ccb1ca27a902db900346767bb012e082f45a6f1aa8a60b17d6da913fa6cf926645b966020fc813517470a1b85d621f51a3849b255683da87bdcde
@@ -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
data/lib/command/init.rb CHANGED
@@ -52,7 +52,7 @@ module LgPodPlugin
52
52
  File.open(token_file.to_path, 'w+') { |f| f.write(str) }
53
53
  LSqliteDb.shared.init_database
54
54
  user_id = LUserAuthInfo.get_user_id(self.host)
55
- user_model = LUserAuthInfo.new(user_id, "", "", self.host, self.token, "", (created_at + expires_in))
55
+ user_model = LUserAuthInfo.new(user_id, "", "", self.host, self.token, "", (created_at + expires_in), created_at, 1)
56
56
  LSqliteDb.shared.insert_user_info(user_model)
57
57
  LgPodPlugin.log_green "设置私人访问令牌成功"
58
58
  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,19 @@ 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
51
-
52
24
  class LUserAuthInfo
53
- REQUIRED_ATTRS ||= %i[id username password host access_token refresh_token expires_in].freeze
25
+ REQUIRED_ATTRS ||= %i[id username password host access_token refresh_token expires_in update_time type].freeze
54
26
  attr_accessor(*REQUIRED_ATTRS)
55
27
 
56
- def initialize(id = nil, name = nil, pwd = nil, host = nil, token = nil, refresh_token = nil, time = nil)
28
+ def initialize(id = nil, name = nil, pwd = nil, host = nil, token = nil, refresh_token = nil, time = nil, update_time = nil, type = 0)
57
29
  self.id = id
30
+ self.type = type
58
31
  self.host = host
59
32
  self.password = pwd
60
33
  self.username = name
61
34
  self.expires_in = time
62
35
  self.access_token = token
36
+ self.update_time = update_time
63
37
  self.refresh_token = refresh_token
64
38
  end
65
39
 
@@ -110,6 +84,20 @@ module LgPodPlugin
110
84
  expires_in TimeStamp NOT NULL DEFAULT CURRENT_TIMESTAMP);"
111
85
  self.db.execute(sql1)
112
86
 
87
+ sel_sql = "select * from sqlite_master where name = '#{K_USER_TABLE}' and sql like '%update_time%'; "
88
+ resultSetPrincipal = self.db.execute(sel_sql)
89
+ if resultSetPrincipal.count == 0
90
+ alter = "ALTER TABLE #{K_USER_TABLE} ADD 'update_time' TimeStamp;"
91
+ self.db.execute(alter)
92
+ end
93
+
94
+ user_sel_sql2 = "select * from sqlite_master where name = '#{K_USER_TABLE}' and sql like '%type%'; "
95
+ resultSetPrincipal2 = self.db.execute(user_sel_sql2)
96
+ if resultSetPrincipal2.count == 0
97
+ alter = "ALTER TABLE #{K_USER_TABLE} ADD 'type' INT;"
98
+ self.db.execute(alter)
99
+ end
100
+
113
101
  #添加项目表
114
102
  sql2 = "create table if not exists #{K_USER_PROJECTS}(
115
103
  id varchar(100) primary key not null,
@@ -124,26 +112,6 @@ module LgPodPlugin
124
112
  );"
125
113
  self.db.execute(sql2)
126
114
 
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)
137
-
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
115
  end
148
116
 
149
117
  public
@@ -151,11 +119,11 @@ module LgPodPlugin
151
119
  # pp "user.id => #{user.id}"
152
120
  if self.query_user_info(user.id) != nil
153
121
  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 }
122
+ "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), type = (:type) 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, :type => user.type}
155
123
  )
156
124
  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])
125
+ self.db.execute("INSERT INTO #{K_USER_TABLE} (id, username, password, host, access_token,refresh_token, expires_in, update_time, type)
126
+ VALUES (?, ?, ?, ?,?,?,?, ?, ?)", [user.id, user.username, user.password, user.host, user.access_token, user.refresh_token, user.expires_in, user.update_time, user.type])
159
127
  end
160
128
 
161
129
  end
@@ -173,6 +141,8 @@ module LgPodPlugin
173
141
  user_info.access_token = row[4]
174
142
  user_info.refresh_token = row[5]
175
143
  user_info.expires_in = row[6]
144
+ user_info.update_time = row[7]
145
+ user_info.type = row[8]
176
146
  end
177
147
  user_info
178
148
  end
@@ -220,67 +190,67 @@ module LgPodPlugin
220
190
  ps.execute('n' => project_id)
221
191
  end
222
192
 
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
193
+ # def insert_pod_refs(name, git, branch, tag, commit)
194
+ # id = LPodLatestRefs.get_pod_id(name, git, branch)
195
+ # pod = LPodLatestRefs.new(id, name, git, branch, tag, commit)
196
+ # if self.query_pod_refs(id) != nil
197
+ # self.db.execute_batch(
198
+ # "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 }
199
+ # )
200
+ # else
201
+ # self.db.execute("INSERT INTO #{K_POD_LATEST_REFS} (id, name, git, branch, tag, sha)
202
+ # VALUES (?, ?, ?, ?, ?, ?)", [pod.id, pod.name, pod.git, pod.branch, pod.tag, pod.commit])
203
+ # end
204
+ # self.insert_pod_sha_with_branch(name, git, commit, branch)
205
+ # end
206
+ #
207
+ # def query_pod_refs(id)
208
+ # pod_info = nil
209
+ # self.db.execute("select * from #{K_POD_LATEST_REFS} where id = '#{id}';") do |row|
210
+ # id = row[0]
211
+ # name = row[1]
212
+ # git = row[2]
213
+ # branch = row[3]
214
+ # tag = row[4]
215
+ # commit = row[5]
216
+ # pod_info = LPodLatestRefs.new(id, name, git, branch, tag, commit)
217
+ # end
218
+ # pod_info
219
+ # end
250
220
 
251
221
  # 保存 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
222
+ # def insert_pod_sha_with_branch(name, git, sha, branch)
223
+ # return unless name && git && sha
224
+ # id = Digest::MD5.hexdigest(name + git + sha)
225
+ # if self.query_branch_with_sha(name, git, sha)[:sha] != nil
226
+ # self.db.execute_batch(
227
+ # "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 }
228
+ # )
229
+ # else
230
+ # self.db.execute("INSERT INTO #{K_POD_SHA_BRANCH} (id, name, git, branch, sha)
231
+ # VALUES (?, ?, ?, ?, ?)", [id, name, git, branch, sha])
232
+ # end
233
+ # end
264
234
 
265
235
  # 通过 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
-
236
+ # def query_branch_with_sha(id = nil, name, git, sha)
237
+ # hash_map = Hash.new
238
+ # id = Digest::MD5.hexdigest(name + git + sha) unless id
239
+ # self.db.execute("select * from #{K_POD_SHA_BRANCH} where id = '#{id}' and name = '#{name}' and git = '#{git}' ;") do |row|
240
+ # new_id = row[0]
241
+ # new_sha = row[4]
242
+ # new_git = row[2]
243
+ # new_name = row[1]
244
+ # new_branch = row[3]
245
+ # hash_map[:id] = new_id
246
+ # hash_map[:git] = new_git
247
+ # hash_map[:sha] = new_sha
248
+ # hash_map[:name] = new_name
249
+ # hash_map[:branch] = new_branch
250
+ # end
251
+ # hash_map
252
+ # end
253
+ #
284
254
  end
285
255
 
286
256
  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