makit 0.0.170 → 0.0.172

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: 4ca893d50f58b61946c9d5990fd3ecfce41d16268c43f475181652ea7b5d3104
4
- data.tar.gz: 7f94c3dff71442437093145d8270780d3b18313b9b991a26f4cba5829c014ba1
3
+ metadata.gz: 3d33beba3997ecb2f3df901e594a88a7e297b0b9c668142e95f12e467695522f
4
+ data.tar.gz: 8379dea16c7a518519e8d911d666cf9d79a1adb241a0e8f1693d3bed54969f8a
5
5
  SHA512:
6
- metadata.gz: a22daf468412bde6d78ae770ec1a55317d775a600699786c0373b8e280ded8bd841b45462f10f85bd7f7089d38188952de20539989d22fa7aa2c6e2c097e5d22
7
- data.tar.gz: 695c6dfeafa745c8836f8287e058e363db3be921a799459fff232dfd7d2dc88d47aef88d4a59d8031733083b281bd75a89ecf3a2aafc9365fb2011848e4478bf
6
+ metadata.gz: f9050bff2fb06f6f5a265ea874354c13711de49b2a764e603d1fc8505248852c3839164b5e778d5f2cdf06852b14cead94e3e29dce1d0b0f49e75c0ac88a170f
7
+ data.tar.gz: 0072df008c5b88eef16b6ebec531608a3efd9656028ace1caf7ef5c7566e4c4248165af9af2982346e045d55975888b3d1e7a5fa61b72ef5e8041234d7f8f862
data/lib/makit/nuget.rb CHANGED
@@ -64,12 +64,156 @@ module Makit
64
64
  system("dotnet nuget push #{path} --source #{path}")
65
65
  end
66
66
 
67
+ # Publishes a NuGet package to a remote or local NuGet feed
68
+ #
69
+ # This method pushes a .nupkg file to a NuGet source using `dotnet nuget push`.
70
+ # It automatically includes `--skip-duplicate` to avoid errors when the package
71
+ # version already exists on the feed.
72
+ #
73
+ # When an API key is provided, it is used for authentication but is masked
74
+ # in the console output for security. When no API key is provided (nil or empty),
75
+ # the `--api-key` flag is omitted, which is useful for:
76
+ # - Local directory feeds that don't require authentication
77
+ # - Azure DevOps feeds using Azure CLI authentication
78
+ # - Feeds with credential providers configured
79
+ #
80
+ # @param package [String] Path to the .nupkg file to publish
81
+ # @param api_key [String, nil] API key for authentication (nil to skip)
82
+ # @param source [String] NuGet feed URL or source name
83
+ # @return [void]
84
+ #
85
+ # @example Publish to NuGet.org with an API key
86
+ # api_key = ENV["NUGET_API_KEY"]
87
+ # Makit::NuGet.publish(
88
+ # "bin/Release/MyPackage.1.0.0.nupkg",
89
+ # api_key,
90
+ # "https://api.nuget.org/v3/index.json"
91
+ # )
92
+ #
93
+ # @example Publish to Azure DevOps feed (using Azure CLI auth, no API key needed)
94
+ # # First authenticate with: az login
95
+ # Makit::NuGet.publish(
96
+ # "artifacts/MyCompany.Utils.1.2.3.nupkg",
97
+ # nil,
98
+ # "https://pkgs.dev.azure.com/myorg/myproject/_packaging/myfeed/nuget/v3/index.json"
99
+ # )
100
+ #
101
+ # @example Publish to Azure DevOps feed with PAT token
102
+ # pat_token = ENV["AZURE_DEVOPS_PAT"]
103
+ # Makit::NuGet.publish(
104
+ # "artifacts/MyCompany.Utils.1.2.3.nupkg",
105
+ # pat_token,
106
+ # "https://pkgs.dev.azure.com/myorg/myproject/_packaging/myfeed/nuget/v3/index.json"
107
+ # )
108
+ #
109
+ # @example Publish to a local directory feed (no API key)
110
+ # Makit::NuGet.publish(
111
+ # "bin/Release/MyPackage.1.0.0.nupkg",
112
+ # nil,
113
+ # "/Users/louie/code/nuget"
114
+ # )
115
+ #
116
+ # @example Publish to a configured source by name
117
+ # # Using a source name configured via `dotnet nuget add source`
118
+ # Makit::NuGet.publish(
119
+ # "MyPackage.1.0.0.nupkg",
120
+ # nil,
121
+ # "local"
122
+ # )
123
+ #
124
+ # @example Publish with API key from secrets management
125
+ # api_key = Makit::Secrets.get("NUGET_API_KEY")
126
+ # Makit::NuGet.publish(
127
+ # "bin/Release/MyPackage.1.0.0.nupkg",
128
+ # api_key,
129
+ # "https://api.nuget.org/v3/index.json"
130
+ # )
131
+ #
132
+ # @see publish_to_directory For publishing to local directory feeds with deduplication
133
+ # @see configure_source For setting up NuGet sources
134
+ #
67
135
  def self.publish(package, api_key, source)
68
- # we do not want the api_key echoed to the console, substitute *****
69
- puts "dotnet nuget push #{package} --skip-duplicate --api-key ***** --source #{source}"
70
- puts `dotnet nuget push #{package} --skip-duplicate --api-key #{api_key} --source #{source}`
136
+ if api_key.nil? || api_key.to_s.strip.empty?
137
+ # No API key provided, skip --api-key flag
138
+ puts "dotnet nuget push #{package} --skip-duplicate --source #{source}"
139
+ puts `dotnet nuget push #{package} --skip-duplicate --source #{source}`
140
+ else
141
+ # we do not want the api_key echoed to the console, substitute *****
142
+ puts "dotnet nuget push #{package} --skip-duplicate --api-key ***** --source #{source}"
143
+ puts `dotnet nuget push #{package} --skip-duplicate --api-key #{api_key} --source #{source}`
144
+ end
71
145
  end
72
146
 
147
+ # Publishes a NuGet package to a local directory feed
148
+ #
149
+ # This method pushes a .nupkg file to a local directory-based NuGet feed.
150
+ # If the package already exists at the target location, it skips the push
151
+ # and displays a message indicating the package is already present.
152
+ #
153
+ # The target path follows the standard NuGet directory feed structure:
154
+ # {directory}/{package_name}/{version}/{package_name}.{version}.nupkg
155
+ #
156
+ # @param nuget_package_path [String] Full path to the .nupkg file to publish
157
+ # @param directory [String] Path to the local NuGet feed directory
158
+ # @param package_name [String] Name of the NuGet package (e.g., "MyCompany.MyPackage")
159
+ # @param version [String] Version of the package (e.g., "1.2.3")
160
+ # @return [void]
161
+ #
162
+ # @example Publish a package to a local feed directory
163
+ # # First, configure a local NuGet source named "local"
164
+ # Makit::NuGet.configure_source("local", "/Users/louie/code/nuget")
165
+ #
166
+ # # Publish a package to the local feed
167
+ # Makit::NuGet.publish_to_directory(
168
+ # "/path/to/MyPackage.1.0.0.nupkg",
169
+ # "/Users/louie/code/nuget",
170
+ # "MyPackage",
171
+ # "1.0.0"
172
+ # )
173
+ # # Creates: /Users/louie/code/nuget/mypackage/1.0.0/mypackage.1.0.0.nupkg
174
+ #
175
+ # @example Publish multiple versions of a package
176
+ # local_feed = "/Users/louie/code/nuget"
177
+ #
178
+ # # Publish version 1.0.0
179
+ # Makit::NuGet.publish_to_directory(
180
+ # "artifacts/MyCompany.Utils.1.0.0.nupkg",
181
+ # local_feed,
182
+ # "MyCompany.Utils",
183
+ # "1.0.0"
184
+ # )
185
+ #
186
+ # # Publish version 1.0.1
187
+ # Makit::NuGet.publish_to_directory(
188
+ # "artifacts/MyCompany.Utils.1.0.1.nupkg",
189
+ # local_feed,
190
+ # "MyCompany.Utils",
191
+ # "1.0.1"
192
+ # )
193
+ #
194
+ # @example Use with a configured "local" source
195
+ # # Configure the "local" source if not already configured
196
+ # Makit::NuGet.configure_source("local", "/Users/louie/code/nuget")
197
+ #
198
+ # # Get the source directory from the configured sources
199
+ # sources = Makit::NuGet.list_sources
200
+ # local_source = sources.find { |s| s[:name] == "local" }
201
+ # local_dir = local_source[:url] if local_source
202
+ #
203
+ # # Publish to the local source
204
+ # if local_dir
205
+ # Makit::NuGet.publish_to_directory(
206
+ # "bin/Release/MyApp.1.2.3.nupkg",
207
+ # local_dir,
208
+ # "MyApp",
209
+ # "1.2.3"
210
+ # )
211
+ # end
212
+ #
213
+ # @see configure_source For setting up the local NuGet source
214
+ # @see list_sources For retrieving configured NuGet sources
215
+ # @see migrate_packages For migrating packages between feeds
216
+ #
73
217
  def self.publish_to_directory(nuget_package_path, directory, package_name, version)
74
218
  target_package_path = "#{directory}/#{package_name}/#{version}/#{package_name}.#{version}.nupkg".downcase
75
219
  if File.exist?(target_package_path)
@@ -43,13 +43,13 @@ module Makit
43
43
  project.save
44
44
 
45
45
  # Setup the sln, then slnx
46
- if (!File.exist?("#{project.name}.slnx"))
47
- Makit::DotNet.new_solution(project.name)
48
- Makit::DotNet.sln_add_projects(project.name)
49
- # migrate the sln to slnx
50
- "dotnet sln migrate #{project.name}.sln".run
51
- FileUtils.rm_f("#{project.name}.sln") if File.exist?("#{project.name}.slnx")
52
- end
46
+ #if (!File.exist?("#{project.name}.slnx"))
47
+ # Makit::DotNet.new_solution(project.name)
48
+ # Makit::DotNet.sln_add_projects(project.name)
49
+ # # migrate the sln to slnx
50
+ # "dotnet sln migrate #{project.name}.sln".run
51
+ # FileUtils.rm_f("#{project.name}.sln") if File.exist?("#{project.name}.slnx")
52
+ #end
53
53
  Makit::Logging.default_logger.debug("Project setup completed")
54
54
  end
55
55
 
@@ -5,7 +5,7 @@ task :update do
5
5
  "bundle update".run if File.exist?("Gemfile")
6
6
  # are there any *.sln files?
7
7
  Dir.glob("**/*.sln").each do |sln_file|
8
- "dotnet sln migrate #{sln_file}".run
8
+ #"dotnet sln migrate #{sln_file}".run
9
9
  #FileUtils.rm_f(sln_file) if File.exist?(sln_file.gsub(".sln", ".slnx"))
10
10
  end
11
11
  "dotnet tool update --global dotnet-outdated-tool".run
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.170"
5
+ #VERSION = "0.0.172"
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.170
4
+ version: 0.0.172
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow