cocoapods-git-private-repo 0.1.1 → 0.1.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f0407365e723398f091ede37a3f5895cd17748fa1f3b71111860799a33b491b
|
4
|
+
data.tar.gz: 0a5b341a278b0f79bc7f753c3e022521e107fd8621d94ac8986c06762c173ed0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8204b5770defacd3e49718c45a6f4c58e71398340065cde8cacf9ce540ece4a18ce8e09fc5bed128963db0ffd626e59dcae56b6e201b7bf8093df22bb1209715
|
7
|
+
data.tar.gz: 26d7ba9d5c55322aedd894b5ea0c4659680823780d486fbbbfb9a1e15da2c3c5d591bac202c811008be48f959fe8feab8582f9158dcb466c851b7bb134b121b6
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'cocoapods-core/source'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
module GitPrivateRepoSourceExtension
|
6
|
+
def repo_git(args, include_error: false)
|
7
|
+
# Check for private key in configuration
|
8
|
+
if private_key_path = find_private_key_for_repo
|
9
|
+
# Build git command with SSH key
|
10
|
+
command = "GIT_SSH_COMMAND='ssh -i #{private_key_path} -o IdentitiesOnly=yes' git -C \"#{repo}\" " << args.join(' ')
|
11
|
+
command << ' 2>&1' if include_error
|
12
|
+
|
13
|
+
(`#{command}` || '').strip
|
14
|
+
else
|
15
|
+
# Use original implementation if no private key is found
|
16
|
+
super(args, include_error: include_error)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def update_git_repo(show_output = false)
|
21
|
+
# If we have a private key, use our custom implementation
|
22
|
+
if private_key_path = find_private_key_for_repo
|
23
|
+
command = ['pull']
|
24
|
+
command << '--progress' if show_output
|
25
|
+
repo_git(command)
|
26
|
+
else
|
27
|
+
# Use original implementation if no private key is found
|
28
|
+
super(show_output)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def find_private_key_for_repo
|
35
|
+
# Check if a JSON configuration file exists with private key mappings
|
36
|
+
json_config_path = 'keys.json'
|
37
|
+
return nil unless File.exist?(json_config_path)
|
38
|
+
|
39
|
+
private_key_configs = JSON.parse(File.read(json_config_path))
|
40
|
+
|
41
|
+
# Find a matching repo URL in the configuration
|
42
|
+
if private_key_configs.is_a?(Array)
|
43
|
+
# Directly get git remote url from repo to avoid recursion
|
44
|
+
repo_url = get_git_remote_url(repo)
|
45
|
+
return nil unless repo_url
|
46
|
+
|
47
|
+
matching_config = private_key_configs.find { |config| config["url"] == repo_url }
|
48
|
+
return matching_config["key_path"] if matching_config && matching_config["key_path"]
|
49
|
+
end
|
50
|
+
|
51
|
+
nil
|
52
|
+
end
|
53
|
+
|
54
|
+
# Safely get the git remote URL directly without using Source#url
|
55
|
+
def get_git_remote_url(repo_path)
|
56
|
+
return nil unless repo_path
|
57
|
+
|
58
|
+
# Use git directly to get URL from the repo config
|
59
|
+
url_command = "git -C \"#{repo_path}\" config --get remote.origin.url"
|
60
|
+
remote_url = `#{url_command}`.strip
|
61
|
+
return remote_url unless remote_url.empty?
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Prepend the module to Source to override methods
|
66
|
+
Source.prepend(GitPrivateRepoSourceExtension)
|
67
|
+
end
|
data/lib/cocoapods_plugin.rb
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
require 'cocoapods-git-private-repo/
|
1
|
+
require 'cocoapods-git-private-repo/cocoapods_downloader'
|
2
|
+
require 'cocoapods-git-private-repo/cocoapods_sources_manager'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-git-private-repo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nonthawat Srichad
|
@@ -53,7 +53,8 @@ files:
|
|
53
53
|
- Rakefile
|
54
54
|
- cocoapods-git-private-repo.gemspec
|
55
55
|
- lib/cocoapods-git-private-repo.rb
|
56
|
-
- lib/cocoapods-git-private-repo/
|
56
|
+
- lib/cocoapods-git-private-repo/cocoapods_downloader.rb
|
57
|
+
- lib/cocoapods-git-private-repo/cocoapods_sources_manager.rb
|
57
58
|
- lib/cocoapods-git-private-repo/gem_version.rb
|
58
59
|
- lib/cocoapods-git-private-repo/git_private_repo_downloader.rb
|
59
60
|
- lib/cocoapods_plugin.rb
|
File without changes
|