Sha256: ee9a72986dbe5589ca84cdac209bd80f8495fa4bc71794c487231aee031004e8

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

#!/usr/bin/env ruby
$LOAD_PATH << File.join(File.dirname(__FILE__), "..", "lib")
require "rubygems"
require "optparse"
require "keen"

options = {
  :env => "production",
}

required = [
  :storage_mode, # this has to be something understood by Keen::Client.process_queue(options)
]

begin
  parser = OptionParser.new()
  parser.banner = "#{File.basename($0)} [<log_dir>]\n\n"

  parser.on("-e", "--env ENVIRONMENT", "The environment to run in. Default: production") do |e|
    options[:env] = e
  end

  parser.on("-p", "--storage_mode redis|flat_file", "Where is the queue you're reading?") do |f|
    options[:storage_mode] = f
  end

  parser.on_tail("-h", "--help", "This help.") do
    puts parser
    exit
  end

  opts = parser.parse(ARGV)
rescue => e
  $stderr.puts "\nERROR: #{e.message}\n\n"
  $stderr.puts parser.help
  exit(-1)
end


# confirm required options:
required.each do |key|
  raise OptionParser::MissingArgument.new("you must send `#{key}` when running this command") if options[key].nil?
end

Keen::Client.process_queue(options)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
keen-0.0.4 bin/keen_send