makit 0.0.166 → 0.0.167

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: cbdc6dc57fc34e1150d90d14048257cd0ee40e11c568ca3c27a9466d24bbaeba
4
- data.tar.gz: f7c3cd5c6d05f1fb1bed0e73676393b9c9230a4619e1c5d3f9cf831776a49aee
3
+ metadata.gz: 981ebe579212bb1f5564fce546f684024510145881af327602af27d2e7203f81
4
+ data.tar.gz: 52404ee70c5a81b6f3feaa250b29cb992121d86d8728c1b318aea2a5c02c16f3
5
5
  SHA512:
6
- metadata.gz: 75d1075334bddd3033108669813f10bcca61824d0fe07ff50dd4678300d871b904ccf2e367850fb615c60b483097704ab208f2724d042b3311be9a3f7fb57ecd
7
- data.tar.gz: 075705c5eb17f98daabb1a4553ff6228fa54c2b3b1b93aecbe86737cc8f2cdf14eaeacd1f18e013ad95d1e865e75164ca44961db684364b427d56fb00a351893
6
+ metadata.gz: 16c11cbd1fd9090703402f5a43f1dad8d44c5f13e5ce5d75610fb866f096b8b5ab6392fb576f25b799912e3c849e7242849d7a10e02410708b3675f37da527d1
7
+ data.tar.gz: ee847b727077884e1d777f8286e2483e72c89644c3b726955536cf0ccca62fe805bc667efb500924a5d61560d78f0b5777af83ef00cb0af4410b3e4807efded6
@@ -134,6 +134,55 @@ module Makit
134
134
  exit 1
135
135
  end
136
136
  end
137
+ # Publishes a NuGet package to an Azure DevOps feed
138
+ #
139
+ # @param package_name [String] The name of the NuGet package
140
+ # @param package_version [String] The version of the package
141
+ # @param package_file [String] Path to the .nupkg file
142
+ # @param feed_source [String] The name of the Azure DevOps feed
143
+ # @param api_key [String, nil] Optional API key (defaults to "az" for Azure CLI)
144
+ # @raise [RuntimeError] If the push fails and it's not a duplicate package error
145
+ def self.publish(package_name:, package_version:, package_file:, feed_source:, api_key: "az")
146
+ puts " Checking if package #{package_name} version #{package_version} already exists in feed..."
147
+
148
+ # Check if package version already exists
149
+ list_command = "dotnet nuget list \"#{package_name}\" --source \"#{feed_source}\" --api-key #{api_key}"
150
+ list_output = `#{list_command} 2>&1`
151
+ list_exit_code = $?.exitstatus
152
+
153
+ if list_exit_code == 0 && list_output.include?(package_version)
154
+ puts " Package #{package_name} version #{package_version} already exists in feed. Skipping push."
155
+ elsif list_exit_code != 0 && list_output =~ /401|Unauthorized|credential/i
156
+ puts " Authentication failed when checking feed. Will attempt to push anyway."
157
+ puts " (To check manually, run: #{list_command} --interactive)"
158
+ push_package(package_file: package_file, feed_source: feed_source, api_key: api_key, package_name: package_name, package_version: package_version)
159
+ else
160
+ puts " Package #{package_name} version #{package_version} not found in feed (or unable to verify). Attempting to push..."
161
+ push_package(package_file: package_file, feed_source: feed_source, api_key: api_key, package_name: package_name, package_version: package_version)
162
+ end
163
+ end
164
+
165
+ private
166
+
167
+ def self.push_package(package_file:, feed_source:, api_key:, package_name:, package_version:)
168
+ push_command = "dotnet nuget push \"#{package_file}\" --source \"#{feed_source}\" --api-key #{api_key} --skip-duplicate"
169
+ push_output = `#{push_command} 2>&1`
170
+ push_exit_code = $?.exitstatus
171
+
172
+ if push_exit_code == 0
173
+ puts " Package pushed successfully to #{feed_source} feed."
174
+ elsif push_output =~ /already exists|conflict|409/i
175
+ puts " Package #{package_name} version #{package_version} already exists in feed. This is expected."
176
+ else
177
+ puts " Error pushing package to #{feed_source} feed:"
178
+ puts push_output
179
+ puts ""
180
+ puts " To retry manually, run:"
181
+ puts " #{push_command} --interactive"
182
+ puts ""
183
+ raise "Failed to push package to #{feed_source} feed"
184
+ end
185
+ end
137
186
  end
138
187
  end
139
188
 
data/lib/makit/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Makit
4
4
  # Static version for now to avoid circular dependency issues
5
- #VERSION = "0.0.166"
5
+ #VERSION = "0.0.167"
6
6
 
7
7
  # Version management utilities for various file formats
8
8
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: makit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.166
4
+ version: 0.0.167
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow