Sha256: 1c4476c5ec08c988fce9560c4c598d755dee524806beb4f34f33e76ed9048657
Contents?: true
Size: 1.82 KB
Versions: 2
Compression:
Stored size: 1.82 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require_relative '../lib/binbundle' options = { bin_for: nil, dry_run: false, file: 'Binfile', gem_for: nil, include_version: true, local: false, sudo: false, user_install: false } optparse = OptionParser.new do |opts| opts.banner = "Usage: #{File.basename(__FILE__)} [options] [bundle|install]" opts.on('--dry-run', 'Output to STDOUT instead of file') do options[:dry_run] = true end opts.on('-f', '--file FILE', 'Output to alternative filename (default Binfile)') do |opt| options[:file] = opt end opts.on('--[no-]versions', 'Include version info in output or restore (default true)') do |opt| options[:include_version] = opt end opts.on('-l', '--local', 'Use installed gems instead of Binfile for gem_for and bins_for') do options[:local] = true end opts.on('-s', '--sudo', 'Install gems with sudo') do options[:sudo] = true end opts.on('-u', '--user-install', 'Use --user-install to install gems') do options[:user_install] = true end opts.on('-v', '--version', 'Display version') do puts "#{File.basename(__FILE__)} v#{Binbundle::VERSION}" Process.exit 0 end opts.on('-h', '--help', 'Display this screen') do puts opts exit end end optparse.parse! if options[:sudo] && options[:user_install] puts 'Error: --sudo and --user-install cannot be used together' Process.exit 1 end gb = Binbundle::GemBins.new(options) if ARGV.count.positive? subcommand = ARGV.shift params = ARGV.join(' ').sub(/ *for */, '') case subcommand when /^(inst|rest)/ options[:install] = true when /^gem/ options[:gem_for] = params when /^bin/ options[:bin_for] = params end end if options[:gem_for] || options[:bin_for] puts gb.info(options) elsif options[:install] gb.install else gb.generate end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
binbundle-1.0.10 | bin/binbundle |
binbundle-1.0.9 | bin/binbundle |