aircon 0.2.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d51871327109dc3145685c8ff1b808658592ebc527baaab88fc7d54d3a2b5d1
4
- data.tar.gz: 60ddec11a21faf68d0c8d43beae7a424d935e82df72c0be5e09ff90a2102829b
3
+ metadata.gz: d76315d35b51587153fc8df9ef838132d3c3e86a0c3e4c2cd8a0316efae9c69a
4
+ data.tar.gz: c563bde8c95b8fe48de22520b014a3b98a6b0cd81974b6ced35b1aa600e4c4b2
5
5
  SHA512:
6
- metadata.gz: 23e48ab217b5c812dffac335ff9dbebb72233379dbf601fe86369e2fa38960b798d1bd325ddbde3164951927a798a60ca9c129aa87b49f2e2333cdafae5a9934
7
- data.tar.gz: 8d93936b25ce81e580a5741706cd3e7a6cd4ae1bc46776e6db1a25864a51ca2c08b42f33d8e583b84c05bd040c2e42fa646e3c7d03d486ef7723ca4ecfbae8b8
6
+ metadata.gz: d951bf39261652772719424735e55cbab79ed819e2fb36347b6e93d61c4c6c534660c64eaa578f68480e46b689e0c37737ff6841dca58e5375dd2af8d492c55f
7
+ data.tar.gz: 8d331471642fc173bd1f770559e0c8a55a773517089082378918b8144fc1220f2b43cc779f9305da896ebaf3dc5e2abdb76492e15a0e20512616a95d051ff8e7
@@ -170,18 +170,32 @@ module Aircon
170
170
  system("docker", "exec", container, "git", "config", "--global",
171
171
  "url.#{authed}.insteadOf", "git@github.com:")
172
172
  end
173
- # Check if branch exists on remote; if so, check it out, otherwise create new
174
- _, status = Open3.capture2("docker", "exec", container, "git", "ls-remote", "--heads", "origin", branch)
175
- if status.success? && !_.strip.empty?
173
+ checkout_branch(container, branch)
174
+
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.
176
+ system("docker", "exec", container, "git", "config", "--global", "url.\"https://github.com/anthropics/\".insteadOf", "ssh://git@github.com/anthropics/")
177
+ end
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)
176
187
  system("docker", "exec", container, "git", "fetch", "origin", branch)
177
- system("docker", "exec", container, "git", "checkout", "-b", branch, "origin/#{branch}")
188
+ system("docker", "exec", container, "git", "checkout", "-f", "-b", branch, "origin/#{branch}")
178
189
  else
179
190
  system("docker", "exec", container, "git", "fetch", "origin", "main")
180
- system("docker", "exec", container, "git", "checkout", "-b", branch, "origin/main")
191
+ system("docker", "exec", container, "git", "checkout", "-f", "--no-track", "-b", branch, "origin/main")
181
192
  end
193
+ system("docker", "exec", container, "git", "clean", "-fd")
194
+ end
182
195
 
183
- # 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.
184
- system("docker", "exec", container, "git", "config", "--global", "url.\"https://github.com/anthropics/\".insteadOf", "ssh://git@github.com/anthropics/")
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?
185
199
  end
186
200
 
187
201
  def run_init_script(container)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Aircon
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aircon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Nguyen