bin/rb2exe in rb2exe-0.2.3 vs bin/rb2exe in rb2exe-0.2.4
- old
+ new
@@ -15,10 +15,11 @@
# Arguments
options = {
quiet: false,
add: nil,
+ ignore_folder: '.git',
output: nil,
rails: false,
daemon: false,
target: 'l64'
}
@@ -26,10 +27,11 @@
opts.banner = "Usage: rb2exe RUBY_SCRIPT [options]"
opts.version = Rb2exe::VERSION
opts.on("-q", "--quiet", "Do not run verbosely") { |v| options[:quiet] = v }
opts.on("-a", "--add=FOLDER", "Add an entire folder (eg. \".\")") { |v| options[:add] = v }
+ opts.on("-i", "--ignore-folder=FOLDER", "Do not add a folder") { |v| options[:ignore_folder] = v }
opts.on("-o", "--output=OUTPUT", "Output executable filename") { |v| options[:output] = v }
opts.on("-r", "--rails", "Rails support") { |v| options[:rails] = v }
opts.on("-d", "--daemon", "Runs the app as a background task") { |v| options[:daemon] = v }
opts.on("-t", "--target=[osx|l32|l64|win]", "Target platform (binary)") { |v| options[:target] = v }
opts.on("-h","--help", "Help") { puts opt_parser }
@@ -93,11 +95,11 @@
FileUtils.mkdir_p("#{tmp_dir}/payload/lib/app/")
FileUtils.cp_r(main_app_path, "#{tmp_dir}/payload/lib/app/")
else
FileUtils.cp_r(app_dir, "#{tmp_dir}/payload/lib/app")
end
- FileUtils.cp_r("#{gem_dir}/bin/installer", "#{tmp_dir}/payload/") # Create a wrapper script (name it as "installer")
+ FileUtils.cp_r("#{gem_dir}/bin/installer", "#{tmp_dir}/payload/") # Create a wrapper script (name is "installer")
# Gemfile support
if File.exists?("#{tmp_dir}/payload/lib/app/Gemfile")
puts "Gemfile detected. Loading gems." unless options[:quiet]
FileUtils.mkdir_p("#{tmp_dir}/payload/lib/tmp") # Create a "tmp" folder on ".package/payload/lib"
@@ -114,9 +116,15 @@
FileUtils.cp("#{tmp_dir}/payload/lib/app/Gemfile", "#{tmp_dir}/payload/lib/vendor/") # Copy the Gemfile to the vendor folder
FileUtils.cp("#{tmp_dir}/payload/lib/app/Gemfile.lock", "#{tmp_dir}/payload/lib/vendor/") if File.exists?("#{tmp_dir}/payload/lib/app/Gemfile.lock")
# Create a bundler config
FileUtils.mkdir_p("#{tmp_dir}/payload/lib/vendor/.bundle")
FileUtils.cp("#{gem_dir}/lib/bundler-config", "#{tmp_dir}/payload/lib/vendor/.bundle/config")
+ end
+
+ # ignore folder: remove folder (usually .git)
+ if options[:ignore_folder]
+ puts "Ignoring #{options[:ignore_folder]}" unless options[:quiet]
+ FileUtils.rm_rf("#{tmp_dir}/payload/lib/app/#{options[:ignore_folder]}")
end
FileUtils.cp_r("#{gem_dir}/bin/build", "#{tmp_dir}/") # Package builder
FileUtils.cp_r("#{gem_dir}/bin/decompress", "#{tmp_dir}/")
result = `#{tmp_dir}/build #{tmp_dir} #{main_app_path} #{exe_fn} #{options[:quiet]} #{options[:rails]} #{options[:daemon]}`