Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed crash due to FileUtils now using named arguments instead of options hash #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/releasy/builders/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def setup; end
def copy_files_relative(files, folder)
files.each do |file|
destination = File.join(folder, File.dirname(file))
mkdir_p destination, fileutils_options unless File.exists? destination
cp file, destination, fileutils_options
mkdir_p destination, **fileutils_options unless File.exists? destination
cp file, destination, **fileutils_options
end
end
end
Expand Down
18 changes: 9 additions & 9 deletions lib/releasy/builders/osx_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def generate_tasks
task "build:osx:app" => folder

file folder => project.files + [wrapper] do
mkdir_p folder, fileutils_options
mkdir_p folder, **fileutils_options
build
end
end
Expand All @@ -79,15 +79,15 @@ def build

# Copy the app files.
execute_command %[#{seven_zip_command} x -so -bd "#{wrapper}" 2>#{null_file} | 7z x -si -mmt -bd -ttar -o"#{folder}"]
mv File.join(folder, "RubyGosu App.app"), new_app, fileutils_options
mv File.join(folder, "RubyGosu App.app"), new_app, **fileutils_options

## Copy my source files.
copy_files_relative project.files, File.join(new_app, 'Contents/Resources/application')

remove_encoding if encoding_excluded?

# Copy accompanying files.
project.exposed_files.each {|file| cp file, folder, fileutils_options }
project.exposed_files.each {|file| cp file, folder, **fileutils_options }

copy_gems vendored_gem_names(BINARY_GEMS), File.join(new_app, 'Contents/Resources/vendor')
create_main new_app
Expand Down Expand Up @@ -128,29 +128,29 @@ def create_executable_setter
def remove_encoding
encoding_files = Dir[File.join folder, "#{app_name}/Contents/Resources/lib/enc/**/*.bundle"]
required_encoding_files = REQUIRED_ENCODING_FILES.map {|f| File.join folder, "#{app_name}/Contents/Resources/lib/enc", f }
rm_r encoding_files - required_encoding_files, fileutils_options
rm_r encoding_files - required_encoding_files, **fileutils_options
end

protected
def rename_executable(app)
new_executable = "#{app}/Contents/MacOS/#{project.name}"
mv "#{app}/Contents/MacOS/RubyGosu App" , new_executable, fileutils_options
chmod 0755, new_executable, fileutils_options
mv "#{app}/Contents/MacOS/RubyGosu App" , new_executable, **fileutils_options
chmod 0755, new_executable, **fileutils_options
end

protected
# Remove unnecessary gems from the distribution.
def remove_gems(app)
SOURCE_GEMS_TO_REMOVE.each do |gem|
rm_r "#{app}/Contents/Resources/lib/#{gem}", fileutils_options
rm_r "#{app}/Contents/Resources/lib/#{gem}", **fileutils_options
end
end

protected
def update_icon(app)
if icon
rm "#{app}/Contents/Resources/Gosu.icns", fileutils_options
cp icon, "#{app}/Contents/Resources", fileutils_options
rm "#{app}/Contents/Resources/Gosu.icns", **fileutils_options
cp icon, "#{app}/Contents/Resources", **fileutils_options
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/releasy/builders/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def generate_tasks
task "build:source" => folder

file folder => project.files do
mkdir_p folder, fileutils_options
mkdir_p folder, **fileutils_options
copy_files_relative project.files, folder
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/releasy/builders/windows_folder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@ class WindowsFolder < OcraBuilder
# FOLDER containing EXE, Ruby + source.
def generate_tasks
file folder => project.files do
mkdir_p project.output_path, fileutils_options
mkdir_p project.output_path, **fileutils_options
tmp_ocra_executable = "#{folder}.exe"

execute_command %[#{ocra_command} --output "#{tmp_ocra_executable}" --debug-extract]

# Extract the files from the executable.
system tmp_ocra_executable
rm tmp_ocra_executable, fileutils_options
rm tmp_ocra_executable, **fileutils_options

extracted_folder_pattern = "#{File.dirname(folder)}/ocr*.tmp"
extracted_folder = Dir[extracted_folder_pattern].first
raise "Failed to find extracted folder matching: #{extracted_folder_pattern}" unless extracted_folder
mv extracted_folder, folder, fileutils_options
mv extracted_folder, folder, **fileutils_options

maker = Releasy::WindowsWrapperMaker.new
maker.build_executable("#{folder}/#{executable_name}", "src/#{project.executable}",
:icon => icon, :windows => (effective_executable_type == :windows))

create_link_files folder
project.exposed_files.each {|file| cp file, folder, fileutils_options }
project.exposed_files.each {|file| cp file, folder, **fileutils_options }
end

desc "Build windows folder"
Expand Down
6 changes: 3 additions & 3 deletions lib/releasy/builders/windows_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ class WindowsInstaller < OcraBuilder
# Regular windows installer, but some users consider them evil.
def generate_tasks
file folder => project.files do
mkdir_p folder, fileutils_options
mkdir_p folder, **fileutils_options
create_link_files folder
project.exposed_files.each {|file| cp file, folder, fileutils_options }
project.exposed_files.each {|file| cp file, folder, **fileutils_options }

create_installer installer_name, :links => true

rm temp_installer_script, fileutils_options
rm temp_installer_script, **fileutils_options
end

desc "Build windows installer"
Expand Down
4 changes: 2 additions & 2 deletions lib/releasy/builders/windows_standalone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class WindowsStandalone < OcraBuilder
# Self-extracting standalone executable.
def generate_tasks
file folder => project.files do
mkdir_p folder, fileutils_options
mkdir_p folder, **fileutils_options

project.exposed_files.each {|file| cp file, folder, fileutils_options }
project.exposed_files.each {|file| cp file, folder, **fileutils_options }

create_link_files folder

Expand Down
16 changes: 8 additions & 8 deletions lib/releasy/builders/windows_wrapped.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def generate_tasks
raise ConfigError, "#wrapper not valid wrapper: #{wrapper}" unless File.basename(wrapper) =~ VALID_RUBY_DIST

file folder => project.files + [wrapper] do
mkdir_p project.output_path, fileutils_options
mkdir_p project.output_path, **fileutils_options
build
end

Expand All @@ -79,7 +79,7 @@ def build
copy_files_relative project.files, File.join(folder, 'src')

create_link_files folder
project.exposed_files.each {|file| cp file, folder, fileutils_options }
project.exposed_files.each {|file| cp file, folder, **fileutils_options }

create_executable

Expand All @@ -92,13 +92,13 @@ def build
protected
def delete_excluded_files
# Remove TCL/TK dlls, lib folder and source.
rm_r Dir[*(TCL_TK_FILES.map {|f| File.join(folder, f) })].uniq.sort, fileutils_options if @exclude_tcl_tk
rm_r Dir[*(TCL_TK_FILES.map {|f| File.join(folder, f) })].uniq.sort, **fileutils_options if @exclude_tcl_tk

# Remove Encoding files on Ruby 1.9
if encoding_excluded? and wrapper =~ /1\.9\.\d/
encoding_files = Dir[File.join folder, "lib/ruby/1.9.1/i386-mingw32/enc/**/*.so"]
required_encoding_files = REQUIRED_ENCODING_FILES.map {|f| File.join folder, "lib/ruby/1.9.1/i386-mingw32/enc", f }
rm_r encoding_files - required_encoding_files, fileutils_options
rm_r encoding_files - required_encoding_files, **fileutils_options
end
end

Expand All @@ -116,11 +116,11 @@ def executable_name; "#{project.underscored_name}.exe"; end
def copy_ruby_distribution
archive_name = File.basename(wrapper).chomp(File.extname(wrapper))
execute_command %[#{seven_zip_command} x "#{wrapper}" -o"#{File.dirname folder}"]
mv File.join(File.dirname(folder), archive_name), folder, fileutils_options
rm_r File.join(folder, "share"), fileutils_options
rm_r File.join(folder, "include"), fileutils_options if File.exists? File.join(folder, "include")
mv File.join(File.dirname(folder), archive_name), folder, **fileutils_options
rm_r File.join(folder, "share"), **fileutils_options
rm_r File.join(folder, "include"), **fileutils_options if File.exists? File.join(folder, "include")
unused_exe = effective_executable_type == :windows ? "ruby.exe" : "rubyw.exe"
rm File.join(folder, "bin", unused_exe), fileutils_options
rm File.join(folder, "bin", unused_exe), **fileutils_options
end

protected
Expand Down
4 changes: 2 additions & 2 deletions lib/releasy/deployers/local.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def deploy(file)

# If destination file already exists or is as new as the one we are going to copy over it, don't bother.
if (not File.exists?(destination)) or (File.ctime(destination) < File.ctime(file))
mkdir_p path, fileutils_options unless File.exists? path
cp file, path, fileutils_options
mkdir_p path, **fileutils_options unless File.exists? path
cp file, path, **fileutils_options
else
warn "Skipping '#{File.basename(file)}' because it already exists in '#{path}'"
end
Expand Down
8 changes: 4 additions & 4 deletions lib/releasy/mixins/has_gemspecs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ def copy_gems(gems, destination)

gems_dir = "#{destination}/gems"
specs_dir = "#{destination}/specifications"
mkdir_p gems_dir, fileutils_options
mkdir_p specs_dir, fileutils_options
mkdir_p gems_dir, **fileutils_options
mkdir_p specs_dir, **fileutils_options

gems.each do |gem|
spec = gemspecs.find {|g| g.name == gem }
gem_dir = spec.full_gem_path
info "Copying gem: #{spec.name} #{spec.version}"
cp_r gem_dir, gems_dir, fileutils_options
cp_r gem_dir, gems_dir, **fileutils_options
spec_file = File.expand_path("../../specifications/#{File.basename gem_dir}.gemspec", gem_dir)
cp_r spec_file, specs_dir, fileutils_options
cp_r spec_file, specs_dir, **fileutils_options
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/releasy/packagers/packager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def archive(folder)
pkg = package folder

heading "Creating #{pkg}"
rm pkg, fileutils_options if File.exist? pkg
cd project.output_path, fileutils_options do
rm pkg, **fileutils_options if File.exist? pkg
cd project.output_path, **fileutils_options do
execute_command command(File.basename folder)
end

Expand Down