fig 2.0.0.pre.alpha.2 → 2.0.0.pre.alpha.4

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: 8016bb7d559da6494a599f732340222272f56f001fcae4186f6f43377d57823f
4
- data.tar.gz: 8fe1d2462572ba968651d6c66e41e4f0a657a2dbcf17408592b03e00055694ea
3
+ metadata.gz: e7b0a1e7e7c54f5641e35e7ae6cb79f68d99ecbf29fcea10db478169599ae532
4
+ data.tar.gz: d13a64acc3c9f804a96454039a54005098b3869f83af7e1f037fa61e445e6dab
5
5
  SHA512:
6
- metadata.gz: dc59c14253bd39d46a5a44cbdce3efb103e41ed089eba614f27bc246fb41333ab23cd439d8d6bcd1d0eaed88c720f07e48655e261e5f1ec27fd10bc8c9069cc1
7
- data.tar.gz: dceb0d12693a8df6229b04e52b1fc9cf8a4e74ad007b0897fe08564d5455b69acca53e16090bff08354c52dcc216bfce29da8e0aa7f1c31e0055d06f0ad4ccc2
6
+ metadata.gz: e62dcf96e9bb214fb48a4d88428006ef893b7c7d0e93c4fc63752e3931261f5eaf1549eade14ac836d5f022bbcddc5f165f1315d773fb5748f275ca799cf963b
7
+ data.tar.gz: de2f11e4a62585e3c23d1ca6193d8564be023bb3765b9e9c2e1baec8e2e05952a6b9c2d3ad5c719a5c40368450c786c71b019dd6cfab6a4eb50105b72b9e6ffa
@@ -5,7 +5,8 @@ module Fig; end
5
5
  # Configuration for the Fig program, as opposed to a config in a package.
6
6
  class Fig::ApplicationConfiguration
7
7
  attr_accessor :base_whitelisted_url
8
- attr_accessor :remote_repository_url
8
+ attr_accessor :remote_download_url
9
+ attr_accessor :remote_upload_url
9
10
 
10
11
  def initialize()
11
12
  @data = []
@@ -115,8 +115,10 @@ required or allowed is dependent upon what your are doing.
115
115
 
116
116
  Environment variables:
117
117
 
118
- FIG_REMOTE_URL location of remote repository, required for remote
119
- operations
118
+ FIG_DOWNLOAD_URL location of remote repository for download, required for remote
119
+ download operations
120
+ FIG_UPLOAD_URL location of remote repository for upload, required for remote
121
+ publish/upload operations
120
122
  FIG_HOME path to local repository, defaults to $HOME/.fighome
121
123
  FIG_SVN_EXECUTABLE path to svn executable, set to empty string to suppress
122
124
  use of Subversion
@@ -712,7 +712,7 @@ Running commands:
712
712
  end
713
713
 
714
714
  @parser.on('--no-figrc', 'ignore ~/.figrc') { @no_figrc = true }
715
- @parser.on('--no-remote-figrc', 'ignore $FIG_REMOTE_URL/_meta/figrc') {
715
+ @parser.on('--no-remote-figrc', 'ignore $FIG_DOWNLOAD_URL/_meta/figrc') {
716
716
  @no_remote_figrc = true
717
717
  }
718
718
 
data/lib/fig/command.rb CHANGED
@@ -236,20 +236,28 @@ class Fig::Command
236
236
  def set_up_application_configuration()
237
237
  @application_configuration = Fig::FigRC.find(
238
238
  @options.figrc,
239
- ENV['FIG_REMOTE_URL'],
239
+ ENV['FIG_DOWNLOAD_URL'],
240
+ ENV['FIG_UPLOAD_URL'],
240
241
  @operating_system,
241
242
  @options.home,
242
243
  @options.no_figrc?,
243
244
  @options.no_remote_figrc?
244
245
  )
245
246
 
246
- if \
247
- remote_operation_necessary? \
248
- && @application_configuration.remote_repository_url.nil?
247
+ if remote_operation_necessary?
248
+ # Check if any action is a publishing operation. Note that "publish" doesn't
249
+ # necessarily mean "upload" b/c it could be publishing to a local repo.
250
+ publishing_operation = @options.actions.any? {|action| action.publish?}
249
251
 
250
- raise Fig::UserInputError.new(
251
- 'Please define the FIG_REMOTE_URL environment variable.'
252
- )
252
+ if publishing_operation && @application_configuration.remote_upload_url.nil?
253
+ raise Fig::UserInputError.new(
254
+ 'Must set FIG_UPLOAD_URL for publish/upload operations.'
255
+ )
256
+ elsif !publishing_operation && @application_configuration.remote_download_url.nil?
257
+ raise Fig::UserInputError.new(
258
+ 'Must set FIG_DOWNLOAD_URL for download repository operations.'
259
+ )
260
+ end
253
261
  end
254
262
 
255
263
  return
@@ -261,7 +269,8 @@ class Fig::Command
261
269
  @options,
262
270
  @operating_system,
263
271
  @options.home(),
264
- @application_configuration.remote_repository_url,
272
+ @application_configuration.remote_download_url,
273
+ @application_configuration.remote_upload_url,
265
274
  @parser,
266
275
  @publish_listeners,
267
276
  )
data/lib/fig/figrc.rb CHANGED
@@ -15,10 +15,10 @@ module Fig; end
15
15
  class Fig::FigRC
16
16
  REPOSITORY_CONFIGURATION =
17
17
  "#{Fig::Repository::METADATA_SUBDIRECTORY}/figrc"
18
-
19
18
  def self.find(
20
19
  override_path,
21
- specified_repository_url,
20
+ download_repository_url,
21
+ upload_repository_url,
22
22
  operating_system,
23
23
  fig_home,
24
24
  disable_figrc = false,
@@ -28,17 +28,44 @@ class Fig::FigRC
28
28
 
29
29
  handle_override_configuration(configuration, override_path)
30
30
  handle_figrc(configuration) if not disable_figrc
31
+
32
+ # Check for legacy environment variable usage
33
+ download_url = derive_repository_url(download_repository_url, 'DOWNLOAD', configuration)
34
+ upload_url = derive_repository_url(upload_repository_url, 'UPLOAD', configuration)
35
+ remote_url = ENV['FIG_REMOTE_URL']
36
+
37
+ has_download = !download_url.nil? && !download_url.strip.empty?
38
+ has_upload = !upload_url.nil? && !upload_url.strip.empty?
39
+ has_remote = !remote_url.nil? && !remote_url.strip.empty?
40
+
41
+ # Error case: FIG_REMOTE_URL exists but one or both new URLs missing
42
+ if has_remote && (!has_download || !has_upload)
43
+ raise Fig::UserInputError.new(
44
+ 'FIG_REMOTE_URL is set but FIG_DOWNLOAD_URL and/or FIG_UPLOAD_URL are missing. ' +
45
+ 'Please set both FIG_DOWNLOAD_URL and FIG_UPLOAD_URL instead of FIG_REMOTE_URL.'
46
+ )
47
+ end
31
48
 
32
- repository_url =
33
- derive_repository_url(specified_repository_url, configuration)
34
-
35
- configuration.base_whitelisted_url = repository_url
36
- configuration.remote_repository_url = repository_url
37
-
38
- handle_repository_configuration(
39
- configuration, repository_url, operating_system, fig_home
40
- ) if not disable_remote_figrc
41
-
49
+ # Warning case: All three variables exist
50
+ if has_remote && has_download && has_upload
51
+ $stderr.puts "WARNING: FIG_REMOTE_URL is set but will be ignored. Using FIG_DOWNLOAD_URL and FIG_UPLOAD_URL instead."
52
+ end
53
+
54
+ # Set the new URL attributes
55
+ configuration.remote_download_url = download_url
56
+ configuration.remote_upload_url = upload_url
57
+
58
+ # For backward compatibility with code expecting whitelisted URLs
59
+ url_for_whitelist = has_download ? download_url : nil
60
+ configuration.base_whitelisted_url = url_for_whitelist
61
+
62
+ # Handle repository configuration if enabled
63
+ if !disable_remote_figrc && has_download
64
+ handle_repository_configuration(
65
+ configuration, download_url, operating_system, fig_home
66
+ )
67
+ end
68
+
42
69
  return configuration
43
70
  end
44
71
 
@@ -73,9 +100,9 @@ class Fig::FigRC
73
100
  return
74
101
  end
75
102
 
76
- def self.derive_repository_url(specified_repository_url, configuration)
103
+ def self.derive_repository_url(specified_repository_url, which, configuration)
77
104
  if specified_repository_url.nil?
78
- return configuration['default FIG_REMOTE_URL']
105
+ return configuration["default FIG_#{which}_URL"]
79
106
  end
80
107
 
81
108
  if specified_repository_url.empty? || specified_repository_url =~ /\A\s*\z/
@@ -21,10 +21,12 @@ class Fig::Protocol::File
21
21
  return packages if ! ::File.exist?(unescaped_path)
22
22
 
23
23
  ls = ''
24
+
25
+ unescaped_path = FileTest.symlink?(unescaped_path) ? ::File.realpath(unescaped_path) : unescaped_path
24
26
  Find.find(unescaped_path) {
25
27
  |file|
26
28
 
27
- if FileTest.directory? file
29
+ if FileTest.directory?(file)
28
30
  ls << file.to_s
29
31
  ls << "\n"
30
32
  end
@@ -90,17 +90,17 @@ class Fig::Protocol::FTP
90
90
  end
91
91
 
92
92
  def upload(local_file, uri)
93
- ftp_uri = Fig::URL.parse(ENV['FIG_REMOTE_URL'])
93
+ ftp_uri = Fig::URL.parse(ENV['FIG_UPLOAD_URL'])
94
94
  ftp_root_path = ftp_uri.path
95
95
  ftp_root_dirs = ftp_uri.path.split('/')
96
- remote_publish_path = uri.path[0, uri.path.rindex('/')]
97
- remote_publish_dirs = remote_publish_path.split('/')
96
+ remote_upload_path = uri.path[0, uri.path.rindex('/')]
97
+ remote_upload_dirs = remote_upload_path.split('/')
98
98
  # Use array subtraction to deduce which project/version folder to upload
99
99
  # to, i.e. [1,2,3] - [2,3,4] = [1]
100
- remote_project_dirs = remote_publish_dirs - ftp_root_dirs
100
+ remote_project_dirs = remote_upload_dirs - ftp_root_dirs
101
101
  Net::FTP.open(uri.host) do |ftp|
102
102
  ftp_login(ftp, uri.host, :prompt_for_login)
103
- # Assume that the FIG_REMOTE_URL path exists.
103
+ # Assume that the FIG_UPLOAD_URL path exists.
104
104
  ftp.chdir(ftp_root_path)
105
105
  remote_project_dirs.each do |dir|
106
106
  # Can't automatically create parent directories, so do it manually.
@@ -33,7 +33,8 @@ class Fig::Repository
33
33
  options,
34
34
  operating_system,
35
35
  local_repository_directory,
36
- remote_repository_url,
36
+ remote_download_url,
37
+ remote_upload_url,
37
38
  parser,
38
39
  publish_listeners
39
40
  )
@@ -41,7 +42,8 @@ class Fig::Repository
41
42
  @options = options
42
43
  @operating_system = operating_system
43
44
  @local_repository_directory = local_repository_directory
44
- @remote_repository_url = remote_repository_url
45
+ @remote_download_url = remote_download_url
46
+ @remote_upload_url = remote_upload_url
45
47
  @parser = parser
46
48
  @publish_listeners = publish_listeners
47
49
 
@@ -77,7 +79,7 @@ class Fig::Repository
77
79
  def list_remote_packages
78
80
  check_remote_repository_format()
79
81
 
80
- paths = @operating_system.download_list(remote_repository_url())
82
+ paths = @operating_system.download_list(remote_download_url())
81
83
 
82
84
  return paths.reject { |path| path =~ %r< ^ #{METADATA_SUBDIRECTORY} / >xs }
83
85
  end
@@ -156,9 +158,9 @@ class Fig::Repository
156
158
 
157
159
  if not local_only
158
160
  publisher.remote_directory_for_package =
159
- remote_directory_for_package(descriptor)
161
+ remote_directory_for_package(descriptor, for_publishing: true)
160
162
  publisher.remote_fig_file_for_package =
161
- remote_fig_file_for_package(descriptor)
163
+ remote_fig_file_for_package(descriptor, for_publishing: true)
162
164
  end
163
165
 
164
166
  return publisher.publish_package()
@@ -174,7 +176,8 @@ class Fig::Repository
174
176
 
175
177
  private
176
178
 
177
- attr_reader :remote_repository_url
179
+ attr_reader :remote_download_url
180
+ attr_reader :remote_upload_url
178
181
 
179
182
  def initialize_local_repository()
180
183
  FileUtils.mkdir_p(@local_repository_directory)
@@ -244,7 +247,7 @@ class Fig::Repository
244
247
  temp_dir = base_temp_dir()
245
248
  @operating_system.delete_and_recreate_directory(temp_dir)
246
249
  remote_version_file = Fig::URL.append_path_components(
247
- remote_repository_url(), [VERSION_FILE_NAME]
250
+ remote_download_url(), [VERSION_FILE_NAME]
248
251
  )
249
252
  local_version_file = File.join(temp_dir, "remote-#{VERSION_FILE_NAME}")
250
253
  begin
@@ -452,9 +455,9 @@ class Fig::Repository
452
455
  return
453
456
  end
454
457
 
455
- def remote_fig_file_for_package(descriptor)
458
+ def remote_fig_file_for_package(descriptor, for_publishing: false)
456
459
  return Fig::URL.append_path_components(
457
- remote_directory_for_package(descriptor), [PACKAGE_FILE_IN_REPO]
460
+ remote_directory_for_package(descriptor, for_publishing: for_publishing), [PACKAGE_FILE_IN_REPO]
458
461
  )
459
462
  end
460
463
 
@@ -466,9 +469,10 @@ class Fig::Repository
466
469
  File.join(package_download_dir, PACKAGE_FILE_IN_REPO)
467
470
  end
468
471
 
469
- def remote_directory_for_package(descriptor)
472
+ def remote_directory_for_package(descriptor, for_publishing: false)
473
+ url = for_publishing ? remote_upload_url() : remote_download_url()
470
474
  return Fig::URL.append_path_components(
471
- remote_repository_url(), [descriptor.name, descriptor.version]
475
+ url, [descriptor.name, descriptor.version]
472
476
  )
473
477
  end
474
478
 
@@ -11,5 +11,10 @@ module Fig
11
11
  @urls = urls
12
12
  @descriptor = descriptor
13
13
  end
14
+
15
+ def message
16
+ "URLAccessDisallowedError:\n descriptor = #{descriptor.inspect}\n urls = " +
17
+ @urls.map { |k,v| " - #{k}: #{v.inspect}" }.join("\n ")
18
+ end
14
19
  end
15
20
  end
data/lib/fig/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
2
 
3
3
  module Fig
4
- VERSION = '2.0.0-alpha.2'.freeze
4
+ VERSION = '2.0.0-alpha.4'.freeze
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fig
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.alpha.2
4
+ version: 2.0.0.pre.alpha.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fig Folks
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-01 00:00:00.000000000 Z
10
+ date: 2025-06-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bcrypt_pbkdf
@@ -85,14 +85,14 @@ dependencies:
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: 0.3.0
88
+ version: 0.4.1
89
89
  type: :runtime
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 0.3.0
95
+ version: 0.4.1
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: log4r
98
98
  requirement: !ruby/object:Gem::Requirement
@@ -163,6 +163,20 @@ dependencies:
163
163
  - - "~>"
164
164
  - !ruby/object:Gem::Version
165
165
  version: 7.3.0
166
+ - !ruby/object:Gem::Dependency
167
+ name: logger
168
+ requirement: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - "~>"
171
+ - !ruby/object:Gem::Version
172
+ version: 1.6.0
173
+ type: :runtime
174
+ prerelease: false
175
+ version_requirements: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - "~>"
178
+ - !ruby/object:Gem::Version
179
+ version: 1.6.0
166
180
  - !ruby/object:Gem::Dependency
167
181
  name: treetop
168
182
  requirement: !ruby/object:Gem::Requirement
@@ -292,7 +306,7 @@ dependencies:
292
306
  description: |-
293
307
  Fig is a utility for configuring environments and managing dependencies across a team of developers. Given a list of packages and a command to run, Fig builds environment variables named in those packages (e.g., CLASSPATH), then executes the command in that environment. The caller's environment is not affected.
294
308
 
295
- Built from git SHA1: b5a5d92
309
+ Built from git SHA1: c0b5d8c
296
310
  email: maintainer@figpackagemanager.org
297
311
  executables:
298
312
  - fig
@@ -464,7 +478,7 @@ files:
464
478
  licenses:
465
479
  - BSD-3-Clause
466
480
  metadata:
467
- git_sha: b5a5d92
481
+ git_sha: c0b5d8c
468
482
  rdoc_options: []
469
483
  require_paths:
470
484
  - lib
@@ -482,5 +496,5 @@ requirements: []
482
496
  rubygems_version: 3.6.1
483
497
  specification_version: 4
484
498
  summary: 'Utility for configuring environments and managing dependencies across a
485
- team of developers. Built from git SHA1: b5a5d92'
499
+ team of developers. Built from git SHA1: c0b5d8c'
486
500
  test_files: []