aircon 0.2.1 → 0.2.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 +4 -4
- data/lib/aircon/commands/up.rb +23 -15
- data/lib/aircon/version.rb +1 -1
- 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: d76315d35b51587153fc8df9ef838132d3c3e86a0c3e4c2cd8a0316efae9c69a
|
|
4
|
+
data.tar.gz: c563bde8c95b8fe48de22520b014a3b98a6b0cd81974b6ced35b1aa600e4c4b2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d951bf39261652772719424735e55cbab79ed819e2fb36347b6e93d61c4c6c534660c64eaa578f68480e46b689e0c37737ff6841dca58e5375dd2af8d492c55f
|
|
7
|
+
data.tar.gz: 8d331471642fc173bd1f770559e0c8a55a773517089082378918b8144fc1220f2b43cc779f9305da896ebaf3dc5e2abdb76492e15a0e20512616a95d051ff8e7
|
data/lib/aircon/commands/up.rb
CHANGED
|
@@ -170,26 +170,34 @@ module Aircon
|
|
|
170
170
|
system("docker", "exec", container, "git", "config", "--global",
|
|
171
171
|
"url.#{authed}.insteadOf", "git@github.com:")
|
|
172
172
|
end
|
|
173
|
-
|
|
174
|
-
current_branch, = Open3.capture2("docker", "exec", container, "git", "rev-parse", "--abbrev-ref", "HEAD")
|
|
175
|
-
if current_branch.strip != branch
|
|
176
|
-
# Check if branch exists on remote; if so, check it out, otherwise create new
|
|
177
|
-
_, status = Open3.capture2("docker", "exec", container, "git", "ls-remote", "--heads", "origin", branch)
|
|
178
|
-
if status.success? && !_.strip.empty?
|
|
179
|
-
system("docker", "exec", container, "git", "fetch", "origin", branch)
|
|
180
|
-
system("docker", "exec", container, "git", "checkout", "-f", "-b", branch, "origin/#{branch}")
|
|
181
|
-
system("docker", "exec", container, "git", "clean", "-fd")
|
|
182
|
-
else
|
|
183
|
-
system("docker", "exec", container, "git", "fetch", "origin", "main")
|
|
184
|
-
system("docker", "exec", container, "git", "checkout", "-f", "--no-track", "-b", branch, "origin/main")
|
|
185
|
-
system("docker", "exec", container, "git", "clean", "-fd")
|
|
186
|
-
end
|
|
187
|
-
end
|
|
173
|
+
checkout_branch(container, branch)
|
|
188
174
|
|
|
189
175
|
# If you have the official anthropic marketplace plugin installed, it will always make a call to the anthropic github repo on claude startup. It uses SSH, but it should be https for universal compatibility since its a public repository.
|
|
190
176
|
system("docker", "exec", container, "git", "config", "--global", "url.\"https://github.com/anthropics/\".insteadOf", "ssh://git@github.com/anthropics/")
|
|
191
177
|
end
|
|
192
178
|
|
|
179
|
+
def checkout_branch(container, branch)
|
|
180
|
+
current_branch, = Open3.capture2("docker", "exec", container, "git", "rev-parse", "--abbrev-ref", "HEAD")
|
|
181
|
+
return if current_branch.strip == branch
|
|
182
|
+
|
|
183
|
+
_, local_status = Open3.capture2("docker", "exec", container, "git", "rev-parse", "--verify", branch)
|
|
184
|
+
if local_status.success?
|
|
185
|
+
system("docker", "exec", container, "git", "checkout", "-f", branch)
|
|
186
|
+
elsif branch_exists_on_remote?(container, branch)
|
|
187
|
+
system("docker", "exec", container, "git", "fetch", "origin", branch)
|
|
188
|
+
system("docker", "exec", container, "git", "checkout", "-f", "-b", branch, "origin/#{branch}")
|
|
189
|
+
else
|
|
190
|
+
system("docker", "exec", container, "git", "fetch", "origin", "main")
|
|
191
|
+
system("docker", "exec", container, "git", "checkout", "-f", "--no-track", "-b", branch, "origin/main")
|
|
192
|
+
end
|
|
193
|
+
system("docker", "exec", container, "git", "clean", "-fd")
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
def branch_exists_on_remote?(container, branch)
|
|
197
|
+
output, status = Open3.capture2("docker", "exec", container, "git", "ls-remote", "--heads", "origin", branch)
|
|
198
|
+
status.success? && !output.strip.empty?
|
|
199
|
+
end
|
|
200
|
+
|
|
193
201
|
def run_init_script(container)
|
|
194
202
|
return unless @config.init_script && !@config.init_script.to_s.empty?
|
|
195
203
|
|
data/lib/aircon/version.rb
CHANGED