Sha256: 951d09e827562e37dc8d69adb25fd1435785ed4c863ca664b9106060fcce1811
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
require File.expand_path('../../mls', __FILE__) require 'uri' require 'optparse' module MLS::CLI def self.options if !class_variable_defined?(:@@options) @@options = {} end @@options end def self.parse_args(args) OptionParser.new do |opts| opts.on("-aURL", "--auth=URL", "URL Credentials for MLS, S3 or B2") do |arg| url = URI.parse(arg) case url.scheme when 's3' # ACCESS_KEY:SECRET_KEY@BUCKET[/PREFIX][?parition=4] MLS::CLI.options[:s3] = { access_key_id: URI.unescape(url.user), secret_access_key: URI.unescape(url.password), bucket: URI.unescape(url.host) } MLS::CLI.options[:s3][:prefix] = url.path if url.path && !url.path.empty? url.query.split('&').each do |qp| key, value = qp.split('=').map { |d| URI.unescape(d) } case key when 'partition' MLS::CLI.options[:s3][:partition] = true MLS::CLI.options[:s3][:partition_depth] = value.to_i end end when 'b2' when 'mls' arg = arg.sub('mls://', 'https://') MLS::CLI.options[:mls] = arg MLS::Model.establish_connection(adapter: 'sunstone', url: arg) end end end.parse!(args) end end require File.expand_path('../cli/storage', __FILE__) require File.expand_path('../cli/documents', __FILE__)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mls-1.6.0 | lib/mls/cli.rb |