Skip to content

Commit

Permalink
fix: linting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkProminic authored Jan 9, 2024
1 parent f96e885 commit 5c30988
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions lib/vagrant-zones/action/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def call(env)
kernel = @machine.provider_config.kernel
vcc = @machine.provider_config.vagrant_cloud_creator
boxshortname = @machine.provider_config.boxshortname
include_files = {}
files = {}
raise "#{boxname}: Already exists" if File.exist?(boxname)

Expand All @@ -51,33 +50,27 @@ def call(env)
snapshot_send(datasetpath, "#{tmp_dir}/box.zss", datetime, env[:ui], @machine.provider_config)

## Include User Extra Files
if env['package.include']
env['package.include'].each do |file|
source = Pathname.new(file)
dest = if source.relative?
source
else
source.basename
end

files[file] = dest
end

if env['package.vagrantfile']
# Vagrantfiles are treated special and mapped to a specific file
files[env['package.vagrantfile']] = '_Vagrantfile'
end

# Verify the mapping
files.each_key do |from|
raise Vagrant::Errors::PackageIncludeMissing, file: from unless File.exist?(from)
end
env['package.include'].each do |file|
source = Pathname.new(file)
dest = if source.relative?
source
else
source.basename
end
files[file] = dest
end

# Save the mapping
include_files = files
if env['package.vagrantfile']
# Vagrantfiles are treated special and mapped to a specific file
files[env['package.vagrantfile']] = '_Vagrantfile'
end

copy_include_files(include_files, tmp_dir)
# Verify the mapping
files.each_key do |from|
raise Vagrant::Errors::PackageIncludeMissing, file: from unless File.exist?(from)
end

copy_include_files(files, tmp_dir)

## Create the Metadata and Vagrantfile
Dir.chdir(tmp_dir)
Expand Down

0 comments on commit 5c30988

Please sign in to comment.