Sha256: 7e30a6d6877dcc6712df7a43e315b61163c8a18bf4bb5bdbf9f58da7aecfe763

Contents?: true

Size: 1.03 KB

Versions: 2

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

2 entries across 2 versions & 1 rubygems

Version Path
keen-0.0.2 bin/keen_send
keen-0.0.1 bin/keen_send