Skip to content

Instantly share code, notes, and snippets.

Created April 11, 2016 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2911cff2ecd1cccb0b53512cf11f415b to your computer and use it in GitHub Desktop.
Save anonymous/2911cff2ecd1cccb0b53512cf11f415b to your computer and use it in GitHub Desktop.
# TODO: This really needs optional params / enforced params, but the concept is there
parsed_successfully = true
config = Configuration.getConfiguration() # Gets a hash from a .yml stored in root's home folder.
logger = get_logger(config)
ARGV.options do |opts|
opts.banner = "Usage: restore_custom_files.rb --application [app] --seed [seed] --overwrite [bool]"
opts.on("-a", "--application=val", String) { |val| config[:opentempo][:application_name] = val } # The app getting overwritten
opts.on("-s", "--seed=val", String) { |val| config[:opentempo][:seed] = val } # The backup file itself
opts.on("-C", "--clear_customfiles", "Pass --all to back up all OpenTempo applications running on the server.") { |val| config[:assets][:custom_file_directory][:clear] = val }
# opts.on("-b", "--branch=val", String) { |val| config[:opentempo][:branch] = val }
# opts.on("-e", "--email=val", String) { |val| config[:opentempo][:email] = val }
# opts.on("-t", "--timezone=val", String) { |val| config[:opentempo][:timezone] = val }
# opts.on("-f", "--firstdayofweek=val", String) { |val| config[:opentempo][:first_day_of_week] = val }
# opts.on("-d", "--domain=val", String) { |val| config[:apache][:domain_name] = val }
# opts.on("-R", "--release_date=val", String) { |val| config[:opentempo][:release_date] = val } # TODO: this should be a date, Ruby 2.2
# opts.on("-C", "--reason_for_reservation=val", String) { |val| config[:opentempo][:reason_for_reservation] = val }
begin
opts.parse!
rescue OptionParser::InvalidOption => e
puts opts.banner
parsed_successfully = false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment