Browse Source

Better binaries

new-scoring
aeris 2 years ago
parent
commit
88c4151328
7 changed files with 47 additions and 30 deletions
  1. 0
    10
      bin/enqueue
  2. 1
    0
      bin/enqueue
  3. 22
    0
      bin/enqueue.rb
  4. 3
    0
      bin/runner
  5. 0
    20
      bin/sidekiq
  6. 1
    0
      bin/sidekiq
  7. 20
    0
      bin/sidekiq.rb

+ 0
- 10
bin/enqueue View File

@@ -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 })

+ 1
- 0
bin/enqueue View File

@@ -0,0 +1 @@
runner

+ 22
- 0
bin/enqueue.rb View File

@@ -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 })

+ 3
- 0
bin/runner View File

@@ -0,0 +1,3 @@
#!/bin/bash
DIR="$(readlink -m "$(dirname "$0")")"
LD_LIBRARY_PATH="${DIR}/../../cryptcheck/lib" "${0}.rb" $*

+ 0
- 20
bin/sidekiq View File

@@ -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

+ 1
- 0
bin/sidekiq View File

@@ -0,0 +1 @@
runner

+ 20
- 0
bin/sidekiq.rb View File

@@ -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

Loading…
Cancel
Save