Archive: ComponentOwl Rails app, DB backups, go redirect script

This commit is contained in:
EC2 Default User
2026-03-23 16:20:05 +00:00
commit 50037f386f
218 changed files with 14558 additions and 0 deletions

136
config/application.yml Normal file
View File

@@ -0,0 +1,136 @@
defaults: &defaults
app: "componentowl"
host: "elb.componentowl.com"
feedback_email: "support@componentowl.com"
internal_error_email: ["support@componentowl.com"]
license_key_error_email: "support@componentowl.com"
no_email: "no.email@componentowl.com"
notification_email: "support@componentowl.com"
featured_product: better-listview
featured_category: better-listview
whats_new_code: whats-new
editions_code: editions
features_code: features
screenshots_code: screenshots
releases_code: releases
story_code: story
pricing_code: pricing-licensing
documentation_code: documentation
quick_start_guide_code: quick-start-guide
class_reference_code: class-reference
support_request_origin_internal_error: internal-error
private_dir: private
api_token: sitHmenkae9coOLy75tabESAdsdorMYpadre83SmeLtaFt7piCnoGfUsed53wot0Dregs
unsubscribe_url: "http://elb.componentowl.com/unsubscribe/%s"
url_param_crypt:
password: jug6eBbEd
salt: vEsT67trIp
dextronet_url: http://elb.componentowl.com
stdl_url: http://www.dextronet.com/swift-to-do-list-software
stdl_download: http://www.dextronet.com/download/swift-to-do-list
better_splitbutton_buy_url: "https://secure.bmtmicro.com/servlets/Orders.ShoppingCart?CID=1830/12&PRODUCTID=18300075&CLR=0"
facebook_url: "https://www.facebook.com/ComponentOwl"
newsletter:
from: 'Component Owl <support@componentowl.com>'
batch_size: 300
rss:
posts: 8
home:
products: 6
blog_posts: 5
latest: 5
resources:
blog_posts: 5
featured_articles: 3
products:
testimonials: 10
product:
screenshots: 4
featured_testimonials: 2
order:
bmt_url: https://secure.bmtmicro.com/servlets/Orders.ShoppingCart
cid: 1830/12
clr: 0
activation_limits:
activations_18300042: 3
activations_18300043: 3
activations_18300044: 15
activations_18300045: 15
activations_18300046: 300
activations_18300047: 300
activations_18300048: 1000
activation_auth:
login: activations
password: pEePUbr6Castuprep4spe35trS6Eh
pad:
MASTER_PAD_VERSION: "3.11"
MASTER_PAD_EDITOR: "Dextronet PAD Generator"
MASTER_PAD_INFO: "Portable Application Description, or PAD for short, is a data set that is used by shareware authors to disseminate information to anyone interested in their software products. To find out more go to http://www.asp-shareware.org/pad"
Company_Name: "Component Owl"
Address_1: ""
Address_2: ""
City_Town: ""
State_Province: "CA"
Zip_Postal_Code: "93109"
Country: "Czech Republic"
Company_WebSite_URL: "http://www.componentowl.com"
Contact_First_Name: "Brian"
Contact_Last_Name: "Galura"
Contact_Email: "support@componentowl.com"
Author_First_Name: "Brian"
Author_Last_Name: "Galura"
Author_Email: "support@componentowl.com"
Sales_Email: "support@componentowl.com"
Support_Email: "support@componentowl.com"
General_Email: "support@componentowl.com"
ASP_FORM: "Y"
ASP_Member: "Y"
ASP_Member_Number: "6865"
NewsFeed_FORM: "Y"
NewsFeed_VERSION: "1.0"
NewsFeed_URL: "http://www.componentowl.com/feeds.rss"
NewsFeed_Type: "RSS 0.90"
NewsFeed_Language: "English"
NewsFeed_Purpose: "News"
NewsFeed_Author_Email: "support@componentowl.com"
NewsFeed_Author_First_Name: "Brian"
NewsFeed_Author_Last_Name: "Galura"
NewsFeed_DESCRIPTION: "Component Owl News and Updates"
Site_FORM: "Y"
Site_VERSION: "1.0"
Site_URL: "http://elb.componentowl.com"
Site_DESCRIPTION: "Better ListView .NET Component"
Site_Contact_Email: "support@componentowl.com"
Site_Contact_First_Name: "Brian"
Site_Contact_Last_Name: "Galura"
Program_Type: "Shareware"
Program_Release_Status: "New Release"
Program_Install_Support: "Install and Uninstall"
Program_OS_Support: "Win2000,Win7 x32,Win7 x64,WinServer,WinVista,WinVista x64,WinXP"
Program_Language: "English"
Program_System_Requirements: "None"
Has_Expire_Info: "N"
Expire_Count: ""
Expire_Based_On: ""
Expire_Other_Info: ""
Distribution_Permissions: "The original trial package can be distributed through internet and on CD-roms, as long as no money is being charged for the content itself."
development:
<<: *defaults
test:
<<: *defaults
preproduction:
<<: *defaults
uploadable_asset_host: "assets.componentowl.dev.netcreates.com"
download_host: "assets.componentowl.dev.netcreates.com"
production:
<<: *defaults
uploadable_asset_host: "assets.componentowl.com"
download_host: "download.componentowl.com"
feedback_email: ["support@componentowl.com"]
internal_error_email: ["support@componentowl.com"]
license_key_error_email: ["support@componentowl.com"]
notification_email: "support@componentowl.com"

36
config/asset_packages.yml Normal file
View File

@@ -0,0 +1,36 @@
---
javascripts:
- base:
- jquery
- jquery-ui
- jrails
- dextronet
- 'plugins/jquery.validation'
- simple:
- jquery
- jquery-ui
- jrails
- dextronet
- 'plugins/jquery.validation'
- 'plugins/jquery.fancybox'
- simple
- app:
- jquery
- jquery-ui
- jrails
- dextronet
- 'plugins/jquery.validation'
- 'plugins/jquery.fancybox'
- 'plugins/jquery.tools'
- application
stylesheets:
- base:
- jquery.fancybox
- base
- main
- headings
- simple:
- jquery.fancybox
- base
- simple
- headings

110
config/boot.rb Normal file
View File

@@ -0,0 +1,110 @@
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
def booted?
defined? Rails::Initializer
end
def pick_boot
(vendor_rails? ? VendorBoot : GemBoot).new
end
def vendor_rails?
File.exist?("#{RAILS_ROOT}/vendor/rails")
end
def preinitialize
load(preinitializer_path) if File.exist?(preinitializer_path)
end
def preinitializer_path
"#{RAILS_ROOT}/config/preinitializer.rb"
end
end
class Boot
def run
load_initializer
Rails::Initializer.run(:set_load_path)
end
end
class VendorBoot < Boot
def load_initializer
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
Rails::Initializer.run(:install_gem_spec_stubs)
Rails::GemDependency.add_frozen_gem_path
end
end
class GemBoot < Boot
def load_initializer
self.class.load_rubygems
load_rails_gem
require 'initializer'
end
def load_rails_gem
if version = self.class.gem_version
gem 'rails', version
else
gem 'rails'
end
rescue Gem::LoadError => load_error
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
exit 1
end
class << self
def rubygems_version
Gem::RubyGemsVersion rescue nil
end
def gem_version
if defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION
elsif ENV.include?('RAILS_GEM_VERSION')
ENV['RAILS_GEM_VERSION']
else
parse_gem_version(read_environment_rb)
end
end
def load_rubygems
require 'rubygems'
min_version = '1.3.1'
unless rubygems_version >= min_version
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
exit 1
end
rescue LoadError
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
exit 1
end
def parse_gem_version(text)
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
end
private
def read_environment_rb
File.read("#{RAILS_ROOT}/config/environment.rb")
end
end
end
end
# All that for this:
Rails.boot!

55
config/database.yml Normal file
View File

@@ -0,0 +1,55 @@
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql
# On Mac OS X:
# sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
# On Mac OS X Leopard:
# sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
# This sets the ARCHFLAGS environment variable to your native architecture
# On Windows:
# gem install mysql
# Choose the win32 build.
# Install MySQL and put its /bin directory on your path.
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql
encoding: utf8
database: componentowl_dev
username: foresth
password:
host: mysql.netcreates.com
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql
encoding: utf8
database: componentowl_test
username: root
password:
host: localhost
production:
adapter: mysql
encoding: utf8
database: componentowl
username: root
password: ddc601
#password: Ddc60111!
host: 127.0.0.1
#host: 10.5.20.6
blog:
adapter: mysql
encoding: utf8
database: componentowl_blog
username: root
password: ddc601
#password: Ddc60111!
#host: co.cluster-cn6jflmsfmae.us-east-1.rds.amazonaws.com
#host: 10.5.20.6
host: 127.0.0.1

View File

@@ -0,0 +1,42 @@
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql
# On Mac OS X:
# sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
# On Mac OS X Leopard:
# sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
# This sets the ARCHFLAGS environment variable to your native architecture
# On Windows:
# gem install mysql
# Choose the win32 build.
# Install MySQL and put its /bin directory on your path.
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql
encoding: utf8
database: dextronet_development
username: root
password:
host: localhost
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql
encoding: utf8
database: dextronet_test
username: root
password:
host: localhost
production:
adapter: mysql
encoding: utf8
database: dextronet_production
username: root
password:
host: localhost

89
config/deploy.rb Normal file
View File

@@ -0,0 +1,89 @@
set :stages, %w(production)
set :default_stage, "production"
require 'capistrano/ext/multistage'
rails_env = fetch(:rails_env, "production")
after "deploy", "deploy:cleanup"
after "deploy:migrations", "deploy:cleanup"
after "deploy:migrate", "deploy:restart"
after "deploy:update_code", "symlink_files", "symlink_database_yml", "symlink_blog"
after "deploy:update_code", "install_gems"
after "deploy:update_code", "db:insert_required_data"
task :symlink_files, :roles => [:app, :db] do
run "ln -nfs #{shared_path}/files #{release_path}/public/files"
end
task :symlink_blog, :roles => [:app, :db] do
run "ln -nfs #{shared_path}/blog #{release_path}/public/blog"
end
task :install_gems, :roles => [:app, :db] do
run "cd #{latest_release}; rake gems:install"
end
task :symlink_database_yml, :roles => [:app, :db] do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
task :symlink_htaccess, :roles => [:app, :db] do
run "ln -nfs #{shared_path}/config/.htaccess #{release_path}/public/.htaccess"
end
namespace :deploy do
desc "Restart app"
task :restart, :roles => :app do
run "cd #{current_path} && chmod 755 #{chmod755}"
run "kill -s USR2 `cat /tmp/componentowl.com.pid`"
end
desc "Update the crontab file"
task :update_crontab, :roles => :cron, :only => { :primary => true } do
run "cd #{current_path} && whenever --update-crontab #{application} --set 'environment=production&pwd=#{current_path}'"
end
desc "Recreate symlink"
task :resymlink, :roles => :app do
run "rm -f #{current_path} && ln -s #{release_path} #{current_path}"
end
desc "Upload assets to CloudFront"
task :assets do
rails_env = fetch(:rails_env, "production")
run "cd #{release_path} && rake RAILS_ENV=#{rails_env} dextronet_core:assets_to_cloudfront"
end
end
namespace :db do
desc "Dump DB"
task :dump, :roles => :db, :only => { :primary => true } do
run "cd #{latest_release}; rake iquest:db:dump OUTPUT_DIR=#{shared_path}/db RAILS_ENV=production"
end
desc "Insert required data"
task :insert_required_data, :roles => :db, :only => { :primary => true } do
rails_env = fetch(:rails_env, "production")
run "cd #{latest_release}; rake RAILS_ENV=#{rails_env} dextronet_core:import:all"
end
end
namespace :less do
desc 'Updates the stylesheets generated by LESS CSS'
task :update do
run "cd #{release_path} && rake less:update RAILS_ENV=#{rails_env}"
end
end
namespace :asset do
namespace :packager do
desc "Build all assets"
task :build_all do
run "cd #{release_path} && rake asset:packager:build_all"
end
end
end
after "deploy:update_code", "asset:packager:build_all"
before "asset:packager:build_all", "less:update"
#after "asset:packager:build_all", "deploy:assets"

View File

@@ -0,0 +1,36 @@
set :user, "rulor_com"
set :rails_env, "preproduction"
set :chmod755, "app config db lib public vendor script script/runner script/process/reaper tmp"
set :use_sudo, false
set :runner, "rulor_com"
set :application, "componentowl.dev.netcreates.com"
set :repository, "ssh://rulor_com@netcreates.com/~/git/componentowl"
# scm
set :deploy_to, "/home/#{user}/componentowl.dev.netcreates.com"
set :deply_via, :remote_cache
set :scm, :git
set :branch, "dev"
# roles
role :app, "netcreates.com"
role :web, "netcreates.com"
role :db, "netcreates.com", :primary => true
role :cron, "netcreates.com", :primary => true
# run options
default_run_options[:pty] = true
after "deploy:remigrate", "deploy:restart"
# custom tasks
namespace :deploy do
desc "Drop and recreate database, run migrations and load fixtures"
task :remigrate, :roles => [:app, :db] do
rails_env = fetch(:rails_env, "preproduction")
run "cd #{latest_release}; rake RAILS_ENV=#{rails_env} iquest:db:remigrate"
end
end

View File

@@ -0,0 +1,32 @@
set :user, "dextronet"
set :chmod755, "app config db lib public vendor script script/runner script/process/reaper tmp"
set :use_sudo, false
set :runner, "dextronet"
set :application, "www.componentowl.com"
set :repository, "git@bitbucket.org:dextronet/componentowl.com.git"
# scm
set :deploy_to, "/srv/www/componentowl.com"
set :deply_via, :remote_cache
set :scm, :git
set :repository_cache, "git_cache"
set :branch, "master"
set :ssh_options, { :forward_agent => true }
# roles
role :app, "dextronet.com"
role :web, "dextronet.com"
role :db, "dextronet.com", :primary => true
role :cron, "dextronet.com", :primary => true
#dump prod migraci pouze na produkcnim serveru
before "deploy:migrate", "db:dump"
#before "deploy:update_code", "db:dump"
after "deploy:create_symlink", "deploy:update_crontab"
after "deploy:rollback:cleanup", "deploy:update_crontab"
# run options
default_run_options[:pty] = true
default_run_options[:shell] = '/bin/bash --login'

62
config/environment.rb Normal file
View File

@@ -0,0 +1,62 @@
# Be sure to restart your server when you modify this file
#ENV['GEM_PATH'] = '/home/rulor_com/.gems:/home/jirinovotny/.gems:/usr/lib/ruby/gems/1.8'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{RAILS_ROOT}/extras )
# Specify gems that this application depends on and have them installed with rake gems:install
# config.gem "bj"
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
# config.gem "sqlite3-ruby", :lib => "sqlite3"
# config.gem "aws-s3", :lib => "aws/s3"
config.gem 'mysql'
config.gem 'fastercsv'
config.gem 'searchlogic', :version => '~> 2.4.25'
config.gem 'authlogic', :version => '2.1.6'
config.gem 'less', :version => '~> 1.2.21'
config.gem 'settingslogic'
config.gem 'exception_notification', :version => '2.3.3.0'
config.gem 'twitter4r', :lib => 'twitter', :version => '~> 0.5.1'
config.gem 'httparty'
config.gem "ezcrypto", :version => '~> 0.7.2'
config.gem 'will_paginate', :version => '~> 2.3.12'
config.gem "aws-s3", :lib => "aws/s3"
config.gem "db2s3", :source => "http://gemcutter.org"
config.gem "foresth-cloudfront_asset_host", :lib => "cloudfront_asset_host", :version => '>= 1.0.6.3'
config.gem 'nokogiri', :version => '~> 1.4.3.1'
config.gem 'foresth-ar_mailer', :lib => 'action_mailer/ar_mailer', :version => '~> 2.1.8'
config.gem 'unicorn'
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Skip frameworks you're not going to use. To use Rails without a database,
# you must remove the Active Record framework.
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names.
# config.time_zone = 'UTC'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
config.i18n.default_locale = :en
config.action_controller.page_cache_directory = "#{Rails.root}/public/cache"
end

View File

@@ -0,0 +1,2 @@
# Use for database backup with "db2s3:backup:full RAILS_ENV=blog"
# so that the "blog" database from database.yml is used

View File

@@ -0,0 +1,17 @@
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true
config.action_view.debug_rjs = true
config.action_controller.perform_caching = true
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false

View File

@@ -0,0 +1,28 @@
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_view.cache_template_loading = true
# See everything in the log (default is :info)
# config.log_level = :debug
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!

View File

@@ -0,0 +1,28 @@
# Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_view.cache_template_loading = true
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql

View File

@@ -0,0 +1,14 @@
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.emailsrvr.com",
:port => 587,
:domain => "dextronet.com",
:authentication => :login,
:user_name => "mailer@dextronet.com",
:password => "5hB9MYMe"
}
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.default_charset = "utf-8"

View File

@@ -0,0 +1 @@
Synthesis::AssetPackage.merge_environments = ["production", "preproduction"]

View File

@@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
# Rails.backtrace_cleaner.remove_silencers!

View File

@@ -0,0 +1,13 @@
CloudfrontAssetHost.configure do |config|
if Rails.env.production?
config.bucket = "componentowl-assets"
config.cname = "http://assets%d.componentowl.com"
else
config.bucket = "componentowl-assets-dev"
config.cname = "http://assets%d.componentowl.dev.netcreates.com"
end
config.plain_prefix = "s"
#config.enabled = true if Rails.env.production? || Rails.env.preproduction?
end

View File

@@ -0,0 +1,7 @@
DB2S3::Config.instance_eval do
S3 = {
:access_key_id => 'AKIAJO5TCO43GDBNG3ZQ',
:secret_access_key => 'AadKou++JNS9LleLzjaSyMpjVHGCgSPN2RvN5JuO',
:bucket => 'componentowl-db-backup'
}
end

View File

@@ -0,0 +1,10 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end

View File

@@ -0,0 +1,6 @@
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
Mime::Type.register "text/plain", :txt

View File

@@ -0,0 +1,19 @@
# Be sure to restart your server when you modify this file.
# These settings change the behavior of Rails 2 apps and will be defaults
# for Rails 3. You can remove this initializer when Rails 3 is released.
if defined?(ActiveRecord)
# Include Active Record class name as root for JSON serialized output.
ActiveRecord::Base.include_root_in_json = true
# Store the full class name (including module namespace) in STI type column.
ActiveRecord::Base.store_full_sti_class = true
end
# Use ISO 8601 format for JSON serialized times and dates.
ActiveSupport.use_standard_json_time_format = true
# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
# if you're including raw json in an HTML page.
ActiveSupport.escape_html_entities_in_json = false

View File

@@ -0,0 +1,16 @@
Paperclip.interpolates(:product_code) do |attachment, style|
attachment.instance.product.code
end
Paperclip.interpolates(:size) do |attachment, style|
attachment.instance.size
end
Paperclip.interpolates(:timestamp) do |attachment, style|
attachment.instance_read(:updated_at).in_time_zone(7).strftime("%s")
end
Paperclip.interpolates(:s3_url) do |attachment, style|
path = attachment.path(style)
"#{attachment.s3_protocol}://#{Settings.uploadable_asset_host % (path.hash % 4)}/#{path.gsub(%r{^/}, "")}"
end

View File

@@ -0,0 +1,21 @@
# Be sure to restart your server when you modify this file.
# Your secret key for verifying cookie session data integrity.
# If you change this key, all old sessions will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
ActionController::Base.session = {
:key => '_dextronet_session',
:secret => 'c088c1cac65e99187c3af8316642155f96a998348b94dd2b9a3ca99b0f2da8e3297f3d18c34c4a142debf9dc6352539187f2398d5ae7b3690d73ef78b69c0b15'
}
ActionController::Dispatcher.middleware.insert_before(
ActionController::Session::CookieStore,
FlashSessionCookieMiddleware,
ActionController::Base.session_options[:key]
)
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rake db:sessions:create")
# ActionController::Base.session_store = :active_record_store

View File

@@ -0,0 +1,11 @@
#ExceptionNotifier.configure_exception_notifier do |config|
# config[:app_name] = "[ComponentOwl]"
# config[:sender_address] = %("ComponentOwl - Application Error" <error@componentowl.com>)
# config[:exception_recipients] = "zabojnik@dextronet.com"
# config[:subject_prepend] = "[ComponentOwl - ERROR] "
# config[:skip_local_notification] = false
# config[:view_path] = 'app/views/error'
# #config[:send_email_error_codes] = %w( 400 404 405 500 503 )
#end
ExceptionNotification::Notifier.exception_recipients = %w(bgalura+co@gmail.com)

View File

@@ -0,0 +1,7 @@
Twitter::Client.configure do |conf|
conf.oauth_consumer_token = 'ezZAVdpWuCtIZL4WXhb7w'
conf.oauth_consumer_secret = 'qT3yAQYhfBwgQw4IUCDOVYt3rIY5rXJEM1aCDu0fo4Q'
end
TWITTER_LOGIN = 'ComponentOwl'
TWITTER_ACCESS_KEY = '175738067-n3o76BAf3r2Ud3t6v9oxWYWPjFz3FTNojT1r8RZL'
TWITTER_ACCESS_SECRET = 'bZBPkbQqWrqnEWCBU1zOAtVqqkEFOI7VT4aRf4JpQ'

409
config/locales/en.yml Normal file
View File

@@ -0,0 +1,409 @@
# Sample localization file for English. Add more files in this directory for other locales.
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
time:
formats:
default: "%m/%d/%Y %I:%M %p"
medium: "%m/%d/%Y %I:%M %p"
date_only: "%m/%d/%Y"
cute: "%b %d, %Y"
cute_long: "%A, %d %B %Y"
date:
formats:
default: "%m/%d/%Y"
cute: "%b %d, %Y"
cute_long_month: "%B %d, %Y"
cute_with_dayname: "%A, %b %d, %Y"
news: "%d<span>%b</span>"
iso: "%Y-%m-%d"
license_generator: "%Y-%m-%d"
activerecord:
errors:
messages:
not_in_past: "is not in the past."
models:
article:
one: "Article"
other: "Articles"
contact:
one: "Contact"
other: "Contacts"
faq:
one: "FAQ"
other: "FAQ"
faq_category:
one: "FAQ Category"
other: "FAQ Categories"
latest:
one: "News"
other: "News"
meta_tag:
one: "Meta Tag"
other: "Meta Tags"
pad_value:
one: "PAD File Value"
other: "PAD File Values"
page_include:
one: "Google Analytics"
other: "Google Analytics"
press_release:
one: "Press Release"
other: "Press Releases"
product:
one: "Product"
other: "Products"
product_category:
one: "Product Category"
other: "Product Categories"
product_description:
one: "Product Description"
other: "Product Descriptions"
product_description_type:
one: "Description Type"
other: "Description Types"
product_edition:
one: "Product Edition"
other: "Product Editions"
product_icon:
one: "Product Icon"
other: "Product Icons"
product_image:
one: "Product Image"
other: "Product Images"
product_offer:
one: "Product Offer"
other: "Product Offers"
product_page:
one: "Product Page"
other: "Product Pages"
product_url_param:
one: "Product Url Parameter"
other: "Product Url Parameters"
promotion:
one: "Promotion"
other: "Promotions"
release:
one: "Release"
other: "Releases"
screenshot:
one: "Screenshot"
other: "Screenshots"
sitemap_title:
one: "Sitemap Title"
other: "Sitemap Titles"
static_page:
one: "Static Page"
other: "Static Pages"
subscription:
one: "Subscription"
other: "Subscriptions"
subtemplate:
one: "Subtemplate"
other: "Subtemplates"
subscription_list:
one: "Subscription List"
other: "Subscription Lists"
subscription_list_type:
one: "Subscription List Type"
other: "Subscription List Types"
support_request:
one: "Support Request"
other: "Support Requests"
survey:
one: "Survey"
other: "Surveys"
testimonial:
one: "Testimonial"
other: "Testimonials"
testimonial_location:
one: "Testimonial Location"
other: "Testimonial Locations"
testimonial_position:
one: "Testimonial Position"
other: "Testimonial Positions"
url_destination:
one: "Url Destination"
other: "Url Destinations"
user:
one: "User"
other: "Users"
volume_discount:
one: "Volume Discount"
other: "Volume Discounts"
attributes:
survey:
full_name: "Full name:"
company_name: "Company name (optional):"
purchase_email1: "Email address used to purchase the product:"
current_email: "Current email address:"
railties:
scaffold:
:true: "Yes"
:false: "No"
destroy_confirmation: "Destroy '%{record}'?"
unsubscribe_confirmation: "Unsubscribe '%{contact}' from '%{list}'?"
authlogic:
attributes:
user_session:
login: "Username"
password: "Password"
authentication:
page: "Component Owl Admin Area"
login: "Login"
logged_in: "You've successfuly logged in."
logged_out: "You've successfuly logged out."
admin:
icons_and_images: "Icons and Images"
txt:
componentowl: "Component Owl"
componentowl_long: "Component Owl - .NET controls for WinForms"
rss_description: "Component Owl Feed: Latest releases, news and tips &amp; tricks from our blog"
comics_rss_description: "Component Owl's Comics: Latest comic strips for developers by Libor Tinka"
antispam: "capek-rulz"
activation:
success: "Activation successful. Please rebuild your solution."
invalid_serial_key: "Invalid serial key. Please check that you are entering it exactly, use clipboard to copy it from the original message that you've received from us. You can contact us at support@componentowl.com for assistance."
limit_reached: "You've reached the maximum number of activations. Please purchase additional licenses, or contact us at support@componentowl.com if you need assistance."
other_error_missing_attributes: "Internal error (missing attributes). Please contact us at support@componentowl.com."
other_error_generator_error: "Internal error (generator error). Please contact us at support@componentowl.com."
javascript:
antispam: "capek-rulz"
download_in_progress: "Your download should be in progress..."
your_full_name: "your full name"
purchase_email: "valid purchase email"
current_email: "valid current email"
valid_email: "a valid email"
required: "required"
message: "message"
thank_you: "Thank you!"
thanks_for_why_uninstall: 'Thank you very much for your feedback!'
thanks_for_message: 'Thank you very much for your message!<br /><a href="#" onclick="send_another(); return false;">Send Another Message</a>'
order_thanks_for_message: '<div class="sent-saved-notice">Thank you very much for your message!<br /><button type="button" onclick="close_fancybox();">Close</button>'
thanks_for_subscription: '<div class="sent-saved-notice">Thank You for your subscription!<br /><button type="button" onclick="close_fancybox();">Close</button>'
common:
whats_new: "What's new"
see_whats_new: "See what's new"
or: "or"
any: "Any"
download: "Download"
free_download: "Free Download"
start_download: "Start Download"
buy_now: "Buy Now"
home: "Home"
products: "Products"
more_info: "More&nbsp;Info"
details: "details"
read_more: "read&nbsp;more..."
see_more: "see&nbsp;more..."
more: "more"
show_me_more: "Show&nbsp;Me&nbsp;More"
your_name: "Your Name"
your_email: "Your Email"
first_name: "First Name"
first_name_optional: "First Name (Optional)"
last_name_optional: "Last Name (Optional)"
message: "Message"
required: "(Required)"
subscribe: "Subscribe"
not_applicable: "Not Applicable"
please_type_or_select: "(Please type in or select)"
footer:
copy: "Copyright &copy; %{year} ComponentOwl.com, Dextronet.com. All rights reserved. Read our %{eula}, %{disclaimer} and %{privacy_policy}."
disclaimer: "Disclaimer"
privacy_policy: "Privacy Policy"
eula: "EULA"
feedback: "Contact Us (Feedback)"
rss: "RSS"
twitter: "Twitter"
sitemap: "Sitemap"
subscribe: "Subscribe to Our Newsletter"
subsribe_info: "Receive updates, tips &amp; tricks and more."
your_email: "Your Email"
menu:
home: "Home"
products: "Products"
buy: "Buy"
support: "Support"
blog: "Blog"
about: "About Us"
affiliate: "Affiliate"
comics: "Comics"
home:
stdl: "Swift To-Do List 7 - The number one to-do list software for Windows. Being organized feels great and it has never been so easy!"
screenshot_title: "Swift To-Do List 7 - Main Window"
for_windows: "For Windows 7 (Seven), Windows Vista, Windows XP, Windows 2000"
free_download: "Download Free Trial - With sample projects"
buy_now: "Buy Now From %{from}"
pricing: "See licensing &amp; pricing"
other_software: "Other Software From Us"
latest_from_blog: "Latest From Our Blog"
news: "News"
blog_post_info: "%{on}"
see_all_software: "See all software"
see_other_posts: "See more posts &raquo;"
new_release: "%{product} %{version} released!"
download_latest_release: "Download latest release"
subscribe_to_rss: "Subscribe to our RSS"
follow_on_twitter: "Follow us on twitter"
follow_on_facebook: "Follow us on facebook"
see_comparison_table: "See comparison table - why Better ListView is the ideal replacement component for .NET ListView"
products:
buy_now_from: "See Pricing &amp; Licensing"
buy_professional: "<strong>Buy Professional</strong> <span><b>(%{price})</b></span>"
buy_standard: "<strong>Buy Standard</strong> <span><b>(%{price})</b></span>"
learn_more: "Learn More - Features &amp; Screenshots"
testimonials: "Testimonials"
compatibility_note: "Compatibility"
compatibility_note_info: "Our software is compatible with Windows 7, Windows Vista, Windows XP and Windows 2000 with both 32 and 64 bit operating systems."
product:
any_questions: "Any questions? We'd love to answer them!"
version: "Version %{version} / %{date}"
more_screenshots: "More Screenshots"
compatibility_note: "Seamless integration with .NET 2.0 and higher"
receive_updates: "Receive Component Owl updates<br />and news via email:"
receive_product_updates: "Receive product updates<br />and news via email:"
receive_stdl_updates: "Receive Swift To-Do List updates and news via email:"
send_also: "Send me also %{newsletter}"
contact: "Contact"
sharethis: "Share this page if you like it:"
order:
header_contact_us: "Contact Us (Help)"
steps_1: "Make Your Selection"
steps_2: "Secured Payment"
steps_3: "Your License Code"
select_quantity: "Please select the number of licenses and click \"Proceed To Checkout\" below."
quantity: "Licenses"
price: "Price (USD)"
volume_discounts: "Volume Discounts"
volume_discounts_info: "Discounts apply for total price."
licensing: "Licensing"
licensing_info: "One license is for <strong>one computer</strong> only. You need additional licenses for more computers."
whats_included: "What's Included"
whats_included_items: ["Free technical support", "Free minor updates", "90-Day Money back guarantee", "Instant delivery", "Encrypted and secured order"]
any_questions: "Any Questions?"
any_questions_info: "We would love to answer them. Please %{contact}. You can also read our %{faq}."
contact_us: "contact us"
ordering_faq: "ordering FAQ"
money_back: "Unconditional 90-day<br />money back guarantee"
instant_delivery: "Instant email delivery"
get_discount: "Get extra discount"
get_discount_info: "Buy 2+ licenses of the same product and get 20%+ volume discount!"
secured_order: "Secured order"
secured_order_info: "All orders are secured with strong 128-bit SSL encryption. Your information is absolutely safe. Orders are processed via our <a href=\"http://www.bmtmicro-info.com/\">BMT Micro, Inc.</a> ecommerce partner based in North Carolina, USA."
accepted_payment: "Accepted payment methods:</strong> Credit and debit cards, PayPal, mail/fax orders, wire transfers."
special_offers: "You might also be interested in these special offers:"
discount_percent: "%{discount}% off"
from_to_licenses: "%{from}-%{to} licenses"
from_licenses: "From %{from} licenses"
back_to_home: "&laquo; Go Back"
order_another_product: "Buy Different Software"
stdl_editions_difference: "What's the difference between Standard and Professional?"
donation: "Add $1 to my order as a donation to WWF"
all_software: "Show all software"
support:
help_support: "Help &amp; Support"
faqs: "Frequently Asked Questions (FAQ)"
search_help: "Search Frequently Asked Questions"
search_help_button: "Search"
see_more_faqs: "Read More FAQ"
contact_tech_support: "Contact Us"
contact_info_1: "You can contact us at <span class=\"emil\">support (at) componentowl (dot) com</span> or use the form below."
contact_info_2: "We will answer you as soon as possible, usually in 24 hours."
# ↓ below the contact form
contact_info_3: "Please make sure that our reply will not be marked as spam by your filter (eg. add <span class=\"emil\">support (at) componentowl (dot) com</span> to your white list) and that you typed your email address correctly, otherwise we will not be able to reply."
subject_product: "%{product} Contact"
subject_no_nothing: "Component Owl Contact Form"
subject_subject: "%{subject}"
subject_subject_product: "%{product} - %{subject}"
undelivered_message: "We are sorry! The message couldn't be delivered.\n\nPlease try it again later or contact us at support@componentowl.com."
unsaved_subscription: "We are sorry! The subscription couldn't be saved\n\nPlease try it again later or contact us at support@componentowl.com."
faqs:
faqs: "FAQ"
search_breadcrumb: "Search FAQ"
general: "General"
general_faqs: "General FAQ"
other_faqs: "Other FAQ"
cant_find: "Cant find what youre looking for?"
try_search: "Try <a href=\"/support\">searching our FAQ database</a>."
contact_us: "You can also <a href=\"/support\">contact us</a> with any question or feedback."
search_results: "FAQ Search Results"
no_search_results: "We are very sorry! We couldn't find any match in our Help &amp; FAQ database."
try_different_search: "Try different search"
faq_in: "In %{link}"
releases:
whats_new: "What's New in %{product} %{version}"
whats_new_since: "What's New in %{product} since version %{version}"
back: "&laquo; Back to the product overview"
changes_since: "Show changes since:"
changes_in_version: "Changes in version %{version} (%{date})"
download:
thanks_general: "Thank you for downloading"
started: "Your download has started..."
newsletter: "Thank you for downloading our software.<br /><strong>You can sign up below to receive important updates via email.</strong><br />We 100% respect your privacy and will never share your email."
newsletter_general: "Component Owl News &amp; Updates</strong>"
newsletter_product: "%{product} News &amp; Updates</strong>"
trouble: "Trouble with download? Try this %{link}."
direct_link: "direct link"
download_page:
meta_title: "Download %{product} %{version}"
meta_description: "%{product} download"
meta_keywords: "%{product} download"
thanks: "Thank you for downloading <strong>%{product} %{version}</strong>!"
start: "Your download should begin shortly..."
info: "If the download doesn't start automatically in a few seconds, please use this button:"
newsletter_general: "Receive <strong>Component Owl News &amp; Updates</strong> via email!"
newsletter_product: "Receive <strong>%{product} News &amp; Updates</strong> via email!"
quote_text: "The thing always happens that you really believe in; and the belief in a thing makes it happen."
quote_author: "Frank Loyd Wright"
not_found:
so_sorry: "So Sorry!"
not_found: "We're sorry! The page you are looking for has been moved or does not exist."
visit_instead: "You can visit our <a href=\"%{url}\">homepage</a> or one of our software pages instead:"
rss:
title: "Component Owl"
comics_title: "Component Owl's Comics"
description: "Component Owl News & Updates"
comics_description: "Owl's Components - comic strips for developers by Libor Tinka"
release_description: "See <a href=\"%{whats_new_url}\">what's new</a> or <a href=\"%{download_url}\">download latest release</a>."
comics:
title: "Component Owl's Comics: %{name}"
uninstall:
heading: "We are sorry to see you go!"
why_uninstall: "Why Uninstall"
issue: "The main issue"
comments: "Comments"
your_email: "Your email address"
survey:
purchase_email_stdl: "Email address used<br />to purchase Swift To-Do List:"
email_subject: "Survey"
recommend_email_subject: "Your friend %{name} recommends you Swift To-Do List"
free_upgrade_email_subject: "Free Upgrade Request"
free_upgrade_request_sent: "Thank you. We have received your request and we will reply in 48 hours."
blog:
stdl: "The ultimate to-do list and notes software for Windows."
download: "Download"
resources:
published_on: "Published on %{date}"
articles:
meta_title: "%{title}"
meta_title_with_keyword: "%{title} - %{keyword}"
alt:
about: "About Component Owl"
not_found: "404 Not Found"
support: "Help and Support"
disclaimer: "Disclaimer"
privacy_policy: "Privacy Policy"
money_back: "Money back gaurantee"
instant_delivery: "Instant delivery"
order: "Secure Software Store"
products: "Our Software"
press_resources: "Press Resources"

70
config/routes.rb Normal file
View File

@@ -0,0 +1,70 @@
ActionController::Routing::Routes.draw do |map|
map.namespace :bmt do |bmt|
bmt.resources :orders, :only => :create
end
map.landing_page "/lp/:id", :controller => "landing_pages", :action => "show"
map.resources :activations, :only => :create
map.resources :comics, :only => [:index, :show]
# resources section
#map.resources_page '/resources', :controller => 'resources', :action => 'index'
map.resources :articles, :only => [:index, :show]
map.resources :orders, :as => 'pricing-licensing'
map.connect '/products/generate_license', :controller => 'products', :action => 'generate_license'
map.eula "/eula", :controller => 'support', :action => 'eula'
map.customer_service "/customer-service", :controller => 'support', :action => 'customer_service'
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# map.resources :products
# Sample resource route with options:
# map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
# Sample resource route with sub-resources:
# map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
# Sample resource route with more complex sub-resources
# map.resources :products do |products|
# products.resources :comments
# products.resources :sales, :collection => { :recent => :get }
# end
# Sample resource route within a namespace:
# map.namespace :admin do |admin|
# # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
# admin.resources :products
# end
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
map.root :controller => "home"
map.connect '/cron/:action', :controller => 'cron', :action => ':action'
map.connect ':id', :controller => 'products', :action => 'show'
map.connect ':id/:detail', :controller => 'products', :action => 'show'
# See how all your routes lay out with "rake routes"
# Install the default routes as the lowest priority.
# Note: These default routes make all actions in every controller accessible via GET requests. You should
# consider removing the them or commenting them out if you're using named routes and resources.
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end

8
config/s3.yml Normal file
View File

@@ -0,0 +1,8 @@
production:
access_key_id: 'AKIAJO5TCO43GDBNG3ZQ'
secret_access_key: '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'
bucket: 'componentowl-assets'
development:
access_key_id: 'AKIAJO5TCO43GDBNG3ZQ'
secret_access_key: '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'
bucket: 'componentowl-assets-dev'

40
config/schedule.rb Normal file
View File

@@ -0,0 +1,40 @@
# Use this file to easily define all of your cron jobs.
#
# It's helpful, but not entirely necessary to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
# Example:
#
# set :output, "/path/to/my/cron_log.log"
#
# every 2.hours do
# command "/usr/bin/some_great_command"
# runner "MyModel.some_method"
# rake "some:great:rake:task"
# end
#
# every 4.days do
# runner "AnotherModel.prune_old_records"
# end
# Learn more: http://github.com/javan/whenever
set :pwd, Dir.pwd unless :pwd
set :environment, "production" unless :environment
set :log_file, "#{pwd}/log/cron.log"
env :MAILTO, "bgalura+co@gmail.com"
every '30 * * * *' do
command "cd #{pwd}; ./script/runner -e #{environment} 'notifiable { Cron.resend_support_requests }' >>#{log_file} 2>&1"
command "cd #{pwd}; ./script/runner -e #{environment} 'notifiable { Cron.send_autoresponders }' >>#{log_file} 2>&1"
end
every 1.day, :at => '4:30 am' do
rake "db2s3:backup:full RAILS_ENV=#{environment}"
rake "db2s3:backup:full RAILS_ENV=blog"
end
every 4.days, :at => '4:30 am' do
rake "db2s3:backup:clean RAILS_ENV=#{environment}"
rake "db2s3:backup:clean RAILS_ENV=blog"
end

15
config/smtp_settings.yml Normal file
View File

@@ -0,0 +1,15 @@
address: email-smtp.us-east-1.amazonaws.com
port: 587
domain: email-smtp.us-east-1.amazonaws.com
authentication: login
user_name: AKIAIZJ2J2TBG553MDHQ
password: Aihjxq+3MTqELK8iFcSTS8QpWtPicD8vMHTnoBb3OSnI
enable_starttls_auto: true
tls: true
#address: mail.dextronetnews.com
#port: 587
#domain: dextronetnews.com
#authentication: login
#user_name: news@dextronetnews.com
#password: 60-DE-48-4B-FD-01
#tls: false

View File

@@ -0,0 +1,3 @@
# unicorn_rails -c ./config/unicorn/development.rb -E development
worker_processes 2
listen 5001

View File

@@ -0,0 +1,65 @@
# unicorn_rails -c ./config/unicorn/production.rb -E production -D
APP_DIR = "/srv/www/componentowl.com/current"
worker_processes 2
# Help ensure your application will always spawn in the symlinked
# "current" directory that Capistrano sets up.
working_directory APP_DIR
# This loads the application in the master process before forking
# worker processes
# Read more about it here:
# http://unicorn.bogomips.org/Unicorn/Configurator.html
preload_app true
# This is where we specify the socket.
# We will point the upstream Nginx module to this socket later on
listen "/tmp/componentowl.sock", :backlog => 64
# Optionally listen to a tcp port.
#listen 5000, :tcp_nopush => true
pid "/tmp/componentowl.com.pid"
# Temp fix for the setup file uploading (should be handled
# by node.js in future).
timeout 5 * 60
# By default, the Unicorn logger will write to stderr.
# Additionally, ome applications/frameworks log to stderr or stdout,
# so prevent them from going to /dev/null when daemonized here:
stderr_path "#{APP_DIR}/log/unicorn.stderr.log"
stdout_path "#{APP_DIR}/log/unicorn.stdout.log"
before_fork do |server, worker|
# This option works in together with preload_app true setting
# What is does is prevent the master process from holding
# the database connection
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
# When sent a USR2, Unicorn will suffix its pidfile with .oldbin and
# immediately start loading up a new version of itself (loaded with a new
# version of our app). When this new Unicorn is completely loaded
# it will begin spawning workers. The first worker spawned will check to
# see if an .oldbin pidfile exists. If so, this means we've just booted up
# a new Unicorn and need to tell the old one that it can now die. To do so
# we send it a QUIT.
#
# Using this method we get 0 downtime deploys.
old_pid = "/tmp/componentowl.com.pid.oldbin"
if File.exists?(old_pid) && server.pid != old_pid
begin
Process.kill("QUIT", File.read(old_pid).to_i)
rescue Errno::ENOENT, Errno::ESRCH
# someone else did our job for us
end
end
end
after_fork do |server, worker|
# Here we are establishing the connection after forking worker
# processes
defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
end