lib/akamai_ccu/cli.rb in akamai_ccu-1.5.3 vs lib/akamai_ccu/cli.rb in akamai_ccu-1.5.4
- old
+ new
@@ -16,17 +16,17 @@
@logger = Logger.new(io)
@logger.level = LOG_LEVEL
@wrapper_klass = wrapper_klass
@secret_klass = secret_klass
@endpoint_klass = endpoint_klass
+ @secret = File.expand_path("~/.edgerc")
@network = Endpoint::Network::STAGING
end
def call
parser.parse!(@args)
return @logger.warn("specify contents to purge by bulk, CP codes or urls") if Array(@objects).empty?
- return @logger.warn("specify path to the secret file either by edgerc or by txt") unless @secret
return @logger.warn("specified secret file does not exist") unless File.exist?(@secret)
@wrapper_klass.setup(@secret_klass.by_file(@secret), Client, @logger)
wrapper = @wrapper_klass.new(endpoint: endpoint, headers: Array(@headers))
@logger.info wrapper.call(@objects).to_s
end
@@ -49,11 +49,11 @@
private def parser
OptionParser.new do |opts|
opts.banner = "Usage: ccu_#{@action} --secret=~/.edgerc --production --cp=12345,98765"
- opts.on("-sSECRET", "--secret=SECRET", "Load secret data by file") do |secret|
+ opts.on("-sSECRET", "--secret=SECRET", "Load secret by file (default to ~/.edgerc)") do |secret|
@secret = File.expand_path(secret)
end
opts.on("-cCP", "--cp=CP", "Specify contents by provider (CP) codes") do |objects|
@objects = objects.split(",").map(&:strip).map(&:to_i)
@@ -65,10 +65,10 @@
opts.on("-bBULK", "--bulk=BULK", "Specify bulk contents in a file") do |bulk|
@objects = bulk_objects(File.expand_path(bulk))
end
- opts.on("--headers=HEADERS", "Specify HTTP headers to sign") do |headers|
+ opts.on("--headers=HEADERS", "Specify any HTTP headers to sign") do |headers|
@headers = headers.split(",").map(&:strip)
end
opts.on("-p", "--production", "Purge on production network") do |prod|
@network = Endpoint::Network::PRODUCTION