cocoapods-gitee-repo 1.0.2 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c9603a0e6d541e7844a38179b121e159d146429cdaba00de41344b031d6a223
4
- data.tar.gz: 0a609a47e547d2bb506a7d921cacdc735d08d0fe3d8cfc6989408a6268505403
3
+ metadata.gz: 14a394d4ebf53e7ec26aad5e4d49267140d57ddbc58606abefe55a07439c059e
4
+ data.tar.gz: fe1daf5528d13fb3e192df316f219ecef7949f958f287ec45d0b25bad619d566
5
5
  SHA512:
6
- metadata.gz: 15c29b5a556e019be9cc99c076840f747b37c420302279d89e4476a3b1c9af29c9678c53f06246607c23b16d2e06d42d05fdff55dd6fd4555218a07046126ea2
7
- data.tar.gz: 89027fc11504bc06427581401e65d60efc3ba503bd851a50426985966ea78ac5ec2f49c0cde0cd078289dbae99fba3a687912ba463ad19eaddeb372284a27f97
6
+ metadata.gz: 91c2a4a37512a5617b62c6847c5b7d5e756af6a597e9779bc05377dc24a08497cd1889af8fea8796a7347eeeef62382df6d05d6425b907ba3552f7d21f1bd751
7
+ data.tar.gz: 4d0659211cc6a3db371551e6435dcdd44aba7565dd3b2f042424b359407f7b8cd973dd0a25bc31ed711ccf07a9847f9bd2050a384d1489a9c62f3c42a20398c1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocoapods-gitee-repo (1.0.0)
4
+ cocoapods-gitee-repo (1.0.3)
5
5
 
6
6
  GEM
7
7
  remote: https://gems.ruby-china.com/
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/cocoapods-gitee-repo.svg)](https://badge.fury.io/rb/cocoapods-gitee-repo)
2
2
 
3
- # cocoapods-gitee-repo插件
3
+ # cocoapods-gitee-repo
4
4
  与 Gitee Repo 一起使用的 CocoaPods 插件
5
5
 
6
6
  ## 安装
@@ -36,7 +36,7 @@ export COCOAPODS_GITEE_REPO_NETRC_PATH=$HOME/myproject/.netrc
36
36
  或者,您可以直接从环境变量指定用户名和密码/API密钥,而不是使用 .netrc 文件,方法是将 `COCOAPODS_GITEE_REPO_CREDENTIALS` 的值设置为您的 Gitee Repo 用户名和用冒号分隔的密码:
37
37
  ```
38
38
  export COCOAPODS_GITEE_REPO_CREDENTIALS="admin:password"
39
- ````
39
+ ```
40
40
 
41
41
  如果设置了 `COCOAPODS_GITEE_REPO_CREDENTIALS` 变量,它的值将取代 .netrc 文件中指定的任何凭据,导致它们被忽略。
42
42
 
@@ -54,6 +54,7 @@ set COCOAPODS_GITEE_REPO_SSL_NO_REVOKE=true
54
54
  pod gitee-repo add
55
55
  pod gitee-repo lint
56
56
  pod gitee-repo list
57
+ pod gitee-repo publish
57
58
  pod gitee-repo remove
58
59
  pod gitee-repo update
59
60
  ```
@@ -17,7 +17,6 @@ Gem::Specification.new do |spec|
17
17
  spec.files += Dir['[A-Z]*'] + Dir['test/**/*']
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
- spec.extra_rdoc_files = ['README.md']
21
20
 
22
21
  spec.add_development_dependency 'bundler', '~> 2.4.2'
23
22
  spec.add_development_dependency 'rake', '~> 0'
@@ -2,5 +2,5 @@
2
2
  # The namespace of the CocoaPods Gitee Repo plugin.
3
3
  #
4
4
  module CocoaPodsGiteeRepo
5
- VERSION = '1.0.2'
5
+ VERSION = '1.0.4'
6
6
  end
@@ -0,0 +1,91 @@
1
+ require 'util/gitee_repo_util'
2
+
3
+ module Pod
4
+ class Command
5
+ class GiteeRepo
6
+ class Publish < GiteeRepo
7
+ UTIL = Pod::GiteeRepo::GiteeRepoUtil
8
+
9
+ extend Executable
10
+ executable :curl
11
+
12
+ self.summary = 'Publish a package to Gitee Repo'
13
+
14
+ self.description = <<-DESC
15
+ Publish the compressed package to GiteeRepo,
16
+ <TARGET_FILE_PATH> is the absolute path after the file is published to the Gitee Repo warehouse, for example /cocoapods.tar.gz,
17
+ <PATH_TO_FILE> is the local file path.
18
+ DESC
19
+
20
+ self.arguments = [
21
+ CLAide::Argument.new('REPO', true),
22
+ CLAide::Argument.new('TARGET_FILE_PATH', true),
23
+ CLAide::Argument.new('PATH_TO_FILE', true)
24
+ ]
25
+
26
+ def initialize(argv)
27
+ @repo = argv.shift_argument
28
+ @target_file_path = argv.shift_argument
29
+ @path_to_file = argv.shift_argument
30
+ super
31
+ end
32
+
33
+ def validate!
34
+ super
35
+ unless @repo && @target_file_path && @path_to_file
36
+ help! 'This command requires both a repo name and a target_file_path and a path_to_file.'
37
+ end
38
+ help! 'Please fill in the absolute path of the file according to the repo root directory' if !is_absolute_path(@target_file_path)
39
+ end
40
+
41
+ def run
42
+ publish_package_to_repo
43
+ end
44
+
45
+ # Publish a package to Gitee Repo
46
+ def publish_package_to_repo
47
+ UI.puts "Publish a package to repo `#{@repo}'\n"
48
+ url = UTIL.get_gitee_repo_url(repo_root_dir).gsub("api/pods", "repository")
49
+ begin
50
+ upload_file(url)
51
+ rescue => e
52
+ raise Informative, "Error pushing package to Gitee Repo: #{e.message}"
53
+ end
54
+ UI.puts "Package pushed successfully to Gitee Repo".green
55
+ end
56
+
57
+ def upload_file(url)
58
+ file_expand_path = File.expand_path(@path_to_file)
59
+ parameters = ["-XPUT", "-f", "-L", "#{url}#{@target_file_path}", '-T', "#{file_expand_path}", "--netrc-optional", '--retry', '2']
60
+
61
+ netrc_path = ENV["COCOAPODS_GITEE_REPO_NETRC_PATH"]
62
+ parameters.concat(["--netrc-file", Pathname.new(netrc_path).expand_path]) if netrc_path
63
+
64
+ art_credentials = ENV["COCOAPODS_GITEE_REPO_CREDENTIALS"]
65
+ parameters.concat(["--user", art_credentials]) if art_credentials
66
+
67
+ win_ssl_no_revoke = ENV["COCOAPODS_GITEE_REPO_SSL_NO_REVOKE"]
68
+ parameters.concat(["--ssl-no-revoke"]) if defined? win_ssl_no_revoke && "true".casecmp(win_ssl_no_revoke)
69
+
70
+ curl! parameters
71
+ end
72
+
73
+ # @return [Pathname] The root directory of the repository.
74
+ def repo_root_dir
75
+ root_dir = config.repos_dir + @repo
76
+ raise Informative, "'#{@repo}' is not an Gitee-backed Specs repo" unless UTIL.gitee_repo?(root_dir)
77
+ root_dir
78
+ end
79
+
80
+ def is_absolute_path(path)
81
+ # 判断路径是否以'/'或'\\'开头,如果是,则是绝对路径
82
+ return true if path.start_with?('/') || path.start_with?('\\')
83
+
84
+ # 如果以上条件都不满足,则不是绝对路径
85
+ false
86
+ end
87
+
88
+ end
89
+ end
90
+ end
91
+ end
@@ -5,6 +5,7 @@ module Pod
5
5
  class GiteeRepo < Command
6
6
  require 'pod/command/gitee_repo/add'
7
7
  require 'pod/command/gitee_repo/lint'
8
+ require 'pod/command/gitee_repo/publish'
8
9
  require 'pod/command/gitee_repo/remove'
9
10
  require 'pod/command/gitee_repo/update'
10
11
  require 'pod/command/gitee_repo/list'
@@ -42,7 +42,7 @@ module Pod
42
42
  #
43
43
  # @param [Pathname] repo_root_path root directory of the repo.
44
44
  #
45
- def self.art_repo?(repo_root_path)
45
+ def self.gitee_repo?(repo_root_path)
46
46
  true if File.exist?("#{repo_root_path}/.artpodrc")
47
47
  end
48
48
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-gitee-repo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Feldman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-06 00:00:00.000000000 Z
11
+ date: 2023-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,8 +44,7 @@ email:
44
44
  - art-dev@jfrog.com
45
45
  executables: []
46
46
  extensions: []
47
- extra_rdoc_files:
48
- - README.md
47
+ extra_rdoc_files: []
49
48
  files:
50
49
  - Gemfile
51
50
  - Gemfile.lock
@@ -61,6 +60,7 @@ files:
61
60
  - lib/pod/command/gitee_repo/add.rb
62
61
  - lib/pod/command/gitee_repo/lint.rb
63
62
  - lib/pod/command/gitee_repo/list.rb
63
+ - lib/pod/command/gitee_repo/publish.rb
64
64
  - lib/pod/command/gitee_repo/remove.rb
65
65
  - lib/pod/command/gitee_repo/update.rb
66
66
  - lib/pod/gitee_artifact_repo.rb