Heroku introduced a major update today to the platform. In addition to the press release and blog post, here is a list of all updated content:
Devcenter.heroku.com
# Rails developers have long had bad experiences with fixtures for | |
# several reasons, including misuse. | |
# | |
# Misuse of fixtures is characterized by having a huge number of them, | |
# requiring the developer to maintain a lot of data and creating dependencies | |
# between tests. In my experience working (and rescuing) many applications, 80% | |
# of fixtures are only used by 20% of tests. | |
# | |
# An example of such tests is one assuring that a given SQL query with | |
# GROUP BY and ORDER BY conditions returns the correct result set. As expected, |
# Do something like: puts "ROCK".blink.bright.cyan | |
class String | |
def red | |
"\e[31m#{self}\e[0m" | |
end | |
def blue | |
"\e[34m#{self}\e[0m" | |
end |
# Offering alternative Chef + Vagrant Riak cluster setup to the following blog post at basho: | |
# http://blog.basho.com/2011/02/04/creating-a-local-riak-cluster-with-vagrant-and-chef/ | |
# Assumes Vagrant 0.7.0+ and VirtualBox 4.0+ | |
# Now you should be able to launch your X (where X=4 in this case) vagrant VMs with the following: | |
# % vagrant up db1 | |
# % vagrant up db2 | |
# % vagrant up db3 | |
# % vagrant up db4 |
$ git branch -r --merged | | |
grep origin | | |
grep -v '>' | | |
grep -v master | | |
xargs -L1 | | |
awk '{sub(/origin\//,"");print}' | | |
xargs git push origin --delete |
Heroku introduced a major update today to the platform. In addition to the press release and blog post, here is a list of all updated content:
Devcenter.heroku.com
~/$ lein new ring-on-heroku | |
Created new project in: /home/jim/Development/ring-on-heroku | |
~/$ cd ring-on-heroku | |
~/ring-on-heroku$ echo 'web: lein run -m ring-on-heroku.core' > Procfile | |
~/ring-on-heroku$ cat > src/ring_on_heroku/core.clj | |
(ns ring-on-heroku.core | |
(:use ring.util.response | |
ring.adapter.jetty)) | |
(defn app [req] |
Most of the time simple output statements using warn
, raise
, or a logger will help you find your issue. But sometimes you need the big guns, and that means ruby-debug
.
The ruby-debug
package has had some rocky times during the transition from Ruby 1.8.7 to 1.9.2 and beyond. But now, finally, the debugger is reliable and usable.
#!/bin/bash -x | |
source ~/.bash_profile | |
rvm use ree@appgemset | |
bundle install | |
bundle exec rake db:migrate | |
bundle exec rake spec | |
cap deploy |
Your API does REST, but can it SLEEP?
SLEEP (Syncable Lightweight Event Emitting Persistence) is an emerging standard for distributed data sync using HTTP and JSON. A generalized version of CouchDB's much lauded built-in replication, SLEEP extends the REST architecture to define a way in which databases can offer syncable JSON APIs that foster open data innovation by allowing developers to replicate entire databases over the net.
SLEEP comes from the Apache CouchDB project which is now widely known for it's multi-master streaming HTTP + JSON replication. This is possible in part because of the CouchDB _changes feed, which is a particular API that lets you see if there have been any changes made to the database since last time you synchronized. CouchDB can efficiently implement the _changes feed because of one subtle difference between it and most other databases: it stores a history of all changes that happen to the database, including deletes.
If you synchronize data from a remote source and then the
desc "Create about and revision files." | |
task :rev_deployment, :roles => [:app, :web] do | |
require 'grit' | |
require 'chronic' | |
# include Grit | |
work_dir = File.join(File.dirname(__FILE__), '../../') | |
g = Grit::Repo.new(work_dir) | |
since = Chronic.parse('last week friday') | |
msg = "\n" | |
rev_file = File.join(File.dirname(__FILE__), '../../','tmp/revision.txt') |