Skip to content

Commit

Permalink
Make the bin file more standard
Browse files Browse the repository at this point in the history
This removes the obsolete -with-config style of bin file
with the standard OpenFlight format
  • Loading branch information
WilliamMcCumstie committed Aug 17, 2020
1 parent 56b1071 commit b4299c4
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 59 deletions.
40 changes: 37 additions & 3 deletions bin/asset
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,42 @@
# https://github.com/alces-flight/alces-flight/flight-asset-cli
#==============================================================================

# Adds the config onto the front of ARGV
ARGV.unshift File.expand_path('../etc/config.yaml', __dir__)
begin
# Reads the environment setup
ENV['BUNDLE_GEMFILE'] ||= File.join(__FILE__, '../../Gemfile')

load File.join(__dir__, 'asset-with-config')
require 'rubygems'
require 'bundler'
Bundler.setup(:default)

# Loads the config
require_relative '../lib/flight_asset/config'

# Attempt to enable development mode if requested
if FlightAsset::Config::CACHE.development?
begin
Bundler.setup(:default, :development)
require 'pry'
require 'pry-byebug'
rescue StandardError, LoadError
Bundler.setup(:default)
$stderr.puts "An error occurred when enabling development mode!"
end
end

# Builds and runs the CLI
require_relative '../lib/flight_asset/cli'

# Runs the command within the original directory
Dir.chdir(ENV.fetch('FLIGHT_CWD', '.')) do
OpenFlight.set_standard_env rescue nil
FlightAsset::CLI.run!(*ARGV)
end
rescue Interrupt
if Kernel.const_defined?(:Paint)
$stderr.puts "\n#{Paint['WARNING', :underline, :yellow]}: Cancelled by user"
else
$stderr.puts "\nWARNING: Cancelled by user"
end
exit(130)
end
56 changes: 0 additions & 56 deletions bin/asset-with-config

This file was deleted.

0 comments on commit b4299c4

Please sign in to comment.