Load default gems based on bundle config.

This commit is contained in:
Martin Edenhofer 2017-04-27 09:34:40 +02:00
parent 2f2b4e0262
commit 093d679187
2 changed files with 16 additions and 4 deletions

View file

@ -3,8 +3,18 @@
$LOAD_PATH << './lib'
require 'rubygems'
require 'daemons'
# load rails env
dir = File.expand_path(File.join(File.dirname(__FILE__), '..'))
Dir.chdir dir
RAILS_ENV = ENV['RAILS_ENV'] || 'development'
require 'rails/all'
require 'bundler'
Bundler.require(:default, Rails.env)
require File.join(dir, 'config', 'environment')
require 'daemons'
daemon_options = {
multiple: false,
@ -22,12 +32,10 @@ Daemons.run_proc(name, daemon_options) do
end
Dir.chdir dir
RAILS_ENV = ARGV.first || ENV['RAILS_ENV'] || 'development'
$stdout.reopen( dir + '/log/' + name + '_out.log', 'w')
$stderr.reopen( dir + '/log/' + name + '_err.log', 'w')
require File.join(dir, 'config', 'environment')
require 'scheduler'
require 'scheduler'
Scheduler.threads
end

View file

@ -14,6 +14,10 @@ require 'daemons'
dir = File.expand_path(File.join(File.dirname(__FILE__), '..'))
Dir.chdir dir
RAILS_ENV = ENV['RAILS_ENV'] || 'development'
require 'rails/all'
require 'bundler'
Bundler.require(:default, Rails.env)
require File.join(dir, 'config', 'environment')
require 'sessions'