xccache 0.0.1a3 → 0.0.1a4
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 +4 -4
- data/lib/xccache/core/git.rb +5 -1
- data/lib/xccache/storage/git.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f25ddb49ae65e34b141a696ca54f50bd3dcb3e65d7883609263b6e6904c8f78
|
4
|
+
data.tar.gz: 8f73671a9e7dbdfc17026a3c38176d01fa2db96d7a85436d1da52dcd63656a6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c939fbafc217ac9784278e37e2946ba4c289aee5ca67f239f0ec358d869551674720f1077cfdd4daba2da70c895f8b3918b4b2453a86c6c4233a398cd3e533d
|
7
|
+
data.tar.gz: a49f327f9e5551e2b095581ae650b5904bc09003c5b1399774ffacc635b16ac43856cc49ca02275692eda4c1f4d01430f8e3202f0dcd796ce4e69e1b934483ed
|
data/lib/xccache/core/git.rb
CHANGED
@@ -18,7 +18,11 @@ module XCCache
|
|
18
18
|
status("--porcelain", capture: true, log_cmd: false)[0].empty?
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
def init?
|
22
|
+
!root.glob(".git").empty?
|
23
|
+
end
|
24
|
+
|
25
|
+
%i[init checkout fetch pull push clean add commit branch remote switch status].each do |name|
|
22
26
|
define_method(name) do |*args, **kwargs|
|
23
27
|
run(name, *args, **kwargs)
|
24
28
|
end
|
data/lib/xccache/storage/git.rb
CHANGED
@@ -7,7 +7,8 @@ module XCCache
|
|
7
7
|
def initialize(options = {})
|
8
8
|
super
|
9
9
|
if (@remote = options[:remote])
|
10
|
-
|
10
|
+
schemes = ["http://", "https://", "git@"]
|
11
|
+
@remote = File.expand_path(@remote) unless schemes.any? { |x| @remote.start_with?(x) }
|
11
12
|
ensure_remote
|
12
13
|
end
|
13
14
|
@branch = options[:branch]
|
@@ -27,7 +28,7 @@ module XCCache
|
|
27
28
|
|
28
29
|
git.add(".")
|
29
30
|
git.commit("-m \"Update cache at #{Time.new}\"")
|
30
|
-
git.push("origin #{branch}")
|
31
|
+
git.push("-u origin #{branch}")
|
31
32
|
end
|
32
33
|
|
33
34
|
private
|
@@ -37,6 +38,7 @@ module XCCache
|
|
37
38
|
end
|
38
39
|
|
39
40
|
def ensure_remote
|
41
|
+
git.init unless git.init?
|
40
42
|
existing = git.remote("get-url origin || true", capture: true, log_cmd: false)[0].strip
|
41
43
|
return if @remote == existing
|
42
44
|
return git.remote("add origin #{@remote}") if existing.empty?
|