diff --git a/bin/enqueue b/bin/enqueue deleted file mode 100755 index cb4d3f3..0000000 --- a/bin/enqueue +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env ruby -require 'sidekiq' -options = { - url: ENV['REDIS_URL'], - namespace: :cryptcheck -} -client = Sidekiq::Client.new Sidekiq::RedisConnection.create options -clazz, *args = ARGV -clazz += 'Worker' -client.push({ 'class' => clazz, 'args' => args }) diff --git a/bin/enqueue b/bin/enqueue new file mode 120000 index 0000000..22882cf --- /dev/null +++ b/bin/enqueue @@ -0,0 +1 @@ +runner \ No newline at end of file diff --git a/bin/enqueue.rb b/bin/enqueue.rb new file mode 100755 index 0000000..615dcf0 --- /dev/null +++ b/bin/enqueue.rb @@ -0,0 +1,22 @@ +#!/usr/bin/env ruby +ENV['RAILS_ENV'] ||= 'development' +require 'dotenv' +Dotenv.load ".env.#{ENV['RAILS_ENV']}", '.env' + +if ENV['RAILS_ENV'] == 'development' + DIR = File.dirname File.dirname File.expand_path __FILE__ + require File.join DIR, 'config/environment' + ENV['RAILS_ENV'] = 'test' + require 'sidekiq/testing/inline' +end + +require 'sidekiq' +options = { + url: ENV['REDIS_URL'], + namespace: :cryptcheck +} +client = Sidekiq::Client.new Sidekiq::RedisConnection.create options + +clazz, *args = ARGV +clazz += 'Worker' +client.push({ 'class' => clazz, 'args' => args }) diff --git a/bin/runner b/bin/runner new file mode 100755 index 0000000..a717c09 --- /dev/null +++ b/bin/runner @@ -0,0 +1,3 @@ +#!/bin/bash +DIR="$(readlink -m "$(dirname "$0")")" +LD_LIBRARY_PATH="${DIR}/../../cryptcheck/lib" "${0}.rb" $* diff --git a/bin/sidekiq b/bin/sidekiq deleted file mode 100755 index 948103d..0000000 --- a/bin/sidekiq +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env ruby -$:.unshift File.expand_path File.join File.dirname(__FILE__), '../../cryptcheck/lib' -require 'rubygems' -require 'bundler/setup' - -$TESTING = false -$CELLULOID_DEBUG = false - -require 'sidekiq/cli' - -begin - cli = Sidekiq::CLI.instance - cli.parse - cli.run -rescue => e - raise e if $DEBUG - STDERR.puts e.message - STDERR.puts e.backtrace.join("\n") - exit 1 -end diff --git a/bin/sidekiq b/bin/sidekiq new file mode 120000 index 0000000..22882cf --- /dev/null +++ b/bin/sidekiq @@ -0,0 +1 @@ +runner \ No newline at end of file diff --git a/bin/sidekiq.rb b/bin/sidekiq.rb new file mode 100755 index 0000000..948103d --- /dev/null +++ b/bin/sidekiq.rb @@ -0,0 +1,20 @@ +#!/usr/bin/env ruby +$:.unshift File.expand_path File.join File.dirname(__FILE__), '../../cryptcheck/lib' +require 'rubygems' +require 'bundler/setup' + +$TESTING = false +$CELLULOID_DEBUG = false + +require 'sidekiq/cli' + +begin + cli = Sidekiq::CLI.instance + cli.parse + cli.run +rescue => e + raise e if $DEBUG + STDERR.puts e.message + STDERR.puts e.backtrace.join("\n") + exit 1 +end