Sha256: ee8c6f605fe5d5fdd7fe19440b2fc9dba045a5ca1b24441d5d9d197c43368fc8

Contents?: true

Size: 1.17 KB

Versions: 9

Compression:

Stored size: 1.17 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

storage_handler = Keen::Client.create_new_storage_handler(options[:storage_mode])
worker = Keen::Async::Worker.new(storage_handler)
results = worker.process_queue


puts results

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
keen-0.1.9 bin/keen_send
keen-0.1.8 bin/keen_send
keen-0.1.7 bin/keen_send
keen-0.1.6 bin/keen_send
keen-0.1.5 bin/keen_send
keen-0.1.4 bin/keen_send
keen-0.1.3 bin/keen_send
keen-0.1.0 bin/keen_send
keen-0.0.53 bin/keen_send