Skip to content

Commit

Permalink
using our nice environment management stuff everywhere.
Browse files Browse the repository at this point in the history
cron jobs run in time zone.
  • Loading branch information
cromulus committed May 16, 2016
1 parent eff9b5f commit 6de4d45
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Backup/models/my_backup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#
require 'yaml'
Model.new(:my_backup, 'Description for my_backup') do
env_file = File.join(Rails.root, 'config', 'local_env.yml')
defaults = File.join(Rails.root, 'config', 'sample.local_env.yml')
env_file = File.dirname(__FILE__) + '/../../config/local_env.yml'
defaults = File.dirname(__FILE__) + '/../../config/sample.local_env.yml'

YAML.load(File.open(env_file)).each do |key, value|
ENV[key.to_s] = value
Expand Down
6 changes: 5 additions & 1 deletion config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
require 'rvm/capistrano'
require 'rvm/capistrano/gem_install_uninstall'

#loading environment variables so we can all use the same deployment
# loading environment variables so we can all use the same deployment
YAML.load(File.open(File.dirname(__FILE__) + '/local_env.yml')).each do |key, value|
ENV[key.to_s] = value
puts ENV[key.to_s]
end if File.exist?(File.dirname(__FILE__) + '/local_env.yml')

# loading in defaults
YAML.load(File.open(File.dirname(__FILE__) + '/sample.local_env.yml')).each do |key, value|
ENV[key.to_s] = value
end

set :repository, ENV['GIT_REPOSITORY']

Expand Down
7 changes: 5 additions & 2 deletions config/schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

# loading our environment variables and defaults
require 'yaml'
env_file = File.join(Rails.root, 'config', 'local_env.yml')
defaults = File.join(Rails.root, 'config', 'sample.local_env.yml')
env_file = File.dirname(__FILE__) + '/local_env.yml'
defaults = File.dirname(__FILE__) + '/sample.local_env.yml'

YAML.load(File.open(env_file)).each do |key, value|
ENV[key.to_s] = value
Expand All @@ -16,7 +16,10 @@
YAML.load(File.open(defaults)).each do |key, value|
ENV[key.to_s] = value unless ENV[key]
end

path = File.expand_path(File.dirname(File.dirname(__FILE__)))

# run our jobs in the right time zone
set :job_template, "TZ=\"#{ENV['TIME_ZONE']}\" bash -l -c ':job'"
set :output, "#{path}/log/cron_log.log"
#
Expand Down

0 comments on commit 6de4d45

Please sign in to comment.