Created
November 5, 2010 21:22
-
-
Save timuruski/664893 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
$LOAD_PATH.unshift File.dirname(__FILE__) + '/vendor/mongo_mapper/lib' | |
require 'rubygems' | |
require 'mongo_mapper' | |
require 'sunspot' | |
require 'chronic' | |
require 'logger' | |
# Configure logging | |
$log = Logger.new('log/rake.log') | |
<<<<<<< HEAD | |
# Configure timezone | |
Time.zone = "UTC" | |
Chronic.time_class = Time.zone | |
if ENV['RACK_ENV'] == 'prod' || ENV['RACK_ENV'] == 'production' | |
ENV['RACK_ENV'] = 'production' | |
MongoMapper.connection = Mongo::Connection.new({:left => ["vzmongo020.vuze.com", 27017], :right => ["vzmongo021.vuze.com", 27017]}, nil, :pool_size => 10, :timeout => 5) | |
MongoMapper.database = 'tmdb' | |
Sunspot.config.solr.url = 'http://vzmongo021.vuze.com:8983/solr' | |
load 'lib/helpers.rb' | |
load 'lib/machine_id.rb' | |
load 'lib/utils.rb' | |
load 'lib/plugins.rb' | |
load 'lib/models.rb' | |
load '/tmdb/org/sites/tmdb.org/lib/solr_config.rb' | |
elsif ENV['RACK_ENV'] == "dev" || ENV['RACK_ENV'] == 'development' | |
ENV['RACK_ENV'] = 'development' | |
MongoMapper.connection = Mongo::Connection.new("127.0.0.1", 27017, :pool_size => 5, :timeout => 5) | |
MongoMapper.database = 'tmdb' | |
Sunspot.config.solr.url = 'http://127.0.0.1:8983/solr' | |
load 'lib/helpers.rb' | |
load 'lib/machine_id.rb' | |
load 'lib/utils.rb' | |
load 'lib/plugins.rb' | |
load 'lib/models.rb' | |
load "/Users/#{`whoami`.strip}/Sites/tmdb.org/lib/solr_config.rb" | |
# load "/Users/#{`whoami`.strip}/Sites/api.themoviedb.org/lib/solr_config.rb" | |
end | |
======= | |
# CONFIG | |
load 'lib/_config.rb' | |
>>>>>>> 5fbe4f42dfa7d3738352001e017a60938708b860 | |
# HELPERS | |
include TMDb::TVDB | |
import 'lib/tasks/import_tvdb.rake' | |
namespace :dev do | |
# SETUP | |
# =================================== | |
task :setup do | |
ENV['RACK_ENV'] = 'development' | |
MongoMapper.database = 'tmdb_dev' | |
end | |
# SERVER | |
# =================================== | |
namespace :server do | |
desc 'Startup dev server at 127.0.0.1:4568' | |
task :start do | |
sh "rerun 'rackup --server Thin --port 4568 --env development'" | |
# sh 'open http://127.0.0.1:4569' | |
end # start | |
end # server | |
end | |
namespace :staging do | |
# SETUP | |
# =================================== | |
task :setup do | |
ENV['RACK_ENV'] = 'staging' | |
MongoMapper.database = 'tmdb' | |
end | |
# SERVER | |
# =================================== | |
namespace :server do | |
desc 'Startup dev server at http://fhdev120.vuze.com:8082/2.1' | |
task :start do | |
begin | |
sh "/home/vzuser/.rvm/gems/ruby-1.9.1-p378/bin/unicorn -c ./conf/unicorn.conf.rb -D -E staging" | |
puts "Unicorn started." | |
rescue | |
puts "Unicorn failed to start. Better see what's up." | |
end | |
end #start | |
task :stop do | |
pid = `cat /var/run/unicorn/unicorn-api.staging.pid` | |
cmd = `kill -QUIT #{pid}` | |
puts "Unicorn stopped." | |
end #stop | |
task :restart do | |
pid = `cat /var/run/unicorn/unicorn-api.staging.pid` | |
begin | |
cmd = `kill -USR2 #{pid}` | |
puts "Unicorn restarted." | |
rescue | |
puts puts "Unicorn failed to restart. Better see what's up." | |
end | |
end # restart | |
end # server | |
end | |
namespace :prod do | |
end | |
# Let's start raking! | |
# namespace :unicorn do | |
# task :start do | |
# begin | |
# if ENV['RACK_ENV'] == 'development' | |
# whoami = `whoami` | |
# cmd = `/Users/#{whoami.strip}/.rvm/gems/ruby-1.9.1-p376/bin/unicorn -c ./conf/unicorn.conf.rb -D -E #{ENV['RACK_ENV']}` | |
# elsif ENV['RACK_ENV'] == 'production' | |
# cmd = `/var/lib/gems/1.9.1/bin/unicorn -c ./conf/unicorn.conf.rb -D -E #{ENV['RACK_ENV']}` | |
# elsif ENV['RACK_ENV'] == 'staging' | |
# cmd = `/var/lib/gems/1.9.1/bin/unicorn -c ./conf/unicorn.conf.rb -D -E #{ENV['RACK_ENV']}` | |
# end | |
# | |
# puts "Unicorn started." | |
# rescue | |
# puts "Unicorn failed to start. Better see what's up." | |
# end | |
# end | |
# | |
# task :stop do | |
# pid = `cat /var/run/unicorn.pid` | |
# cmd = `kill -QUIT #{pid}` | |
# puts "Unicorn stopped." | |
# end | |
# | |
# task :restart do | |
# pid = `cat /var/run/unicorn.pid` | |
# | |
# begin | |
# cmd = `kill -USR2 #{pid}` | |
# puts "Unicorn restarted." | |
# rescue | |
# puts puts "Unicorn failed to restart. Better see what's up." | |
# end | |
# end | |
# end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment