Command Line
pry -r ./config/app_init_file.rb
- load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb
- load your rails into a pry session
Debugger
Command Line
pry -r ./config/app_init_file.rb
- load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb
- load your rails into a pry sessionDebugger
#!/usr/bin/env bash | |
# Bare minimum Gems that are needed to keep a Ruby development environment in sync. This assumes | |
# that you use bundler in your workflow to control the installation of all other gems. If you need | |
# to bump the bundler or rubygem version across your team, change that here, then run bundler and | |
# and keep going. | |
RVMRC=1.9.2@my_gem_set | |
RUBYGEM_VERSION="1.6.2" | |
BUNDLER_VERSION="1.0.15" |
# Stick the following in an initializer. | |
module Heroku | |
class StaticAssetsMiddleware | |
def cache_static_asset(reply) | |
return reply unless can_cache?(reply) | |
status, headers, response = reply | |
headers['Cache-Control'] = 'public, max-age=31556926' # 1 year |
def parse filename, content | |
offset = 0 | |
begin | |
FasterCSV.parse(content) do |row| | |
# do stuff | |
offset += row.to_s.size | |
end | |
rescue FasterCSV::MalformedCSVError => e | |
@file_offset ||= 0 | |
@file_offset += offset |
This code is no longer needed. Heroku has provided syslog drains for all users for free.
For better Heroku logging with Papertrail, check this out:
http://help.papertrailapp.com/kb/hosting-services/heroku#standalone
#as seen in https://github.com/mooktakim/heroku_deployment | |
class AppTemplatesController < ApplicationController | |
def app | |
render :inline => "SUCCESS", :layout => 'master' | |
end | |
def cms | |
render :inline => "SUCCESS", :layout => 'cms_admin' | |
end | |
end |
desc "cache assets" | |
task :cache_assets => :environment do | |
paths = ['public/javascripts/all.js', 'public/stylesheets/all.css'] | |
puts "-----> caching assets..." | |
paths.each do |path| | |
puts "-----> #{path}" | |
end |
## /config/initializers/dynamic_job.rb | |
require 'heroku' | |
# base class for all jobs that you wish to automatically scale and go down in Heroku | |
class DynamicJob | |
#set a cap on maximum number of users ever - just in case. | |
MAX_CONCURRENT_WORKERS = 100 | |
def initialize |
module Core | |
def self.included(mod) | |
url = ENV['CORE_URL'] ? URI.parse(ENV['CORE_URL']) : URI.parse('postgres://postgres@localhost/heroku') | |
mod.establish_connection( | |
:adapter => "postgresql", | |
:host => url.host, | |
:username => url.userinfo.split(':')[0], | |
:password => url.userinfo.split(':')[1], | |
:database => url.path[1..-1] | |
) |
/** | |
IMPORTANT: Requires this version of jquery | |
until 1.3.3 comes out http://gist.github.com/186325 | |
ALSO: This is very dirty still and has not been | |
abstracted for use. It is just solving our immediate problems. | |
Use cases that must pass (and should be tested someday): | |
* Clicking on links updates layout | |
* Click around a bit and then use back/forward buttons |