This file contains hidden or 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
class Bookmark | |
include DataMapper::Resource | |
# ... | |
class Collection | |
# .. collection specific methods .. | |
end | |
end |
This file contains hidden or 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
rcov \ | |
--callsites \ | |
--xrefs \ | |
--exclude spec,lib \ | |
--include-file lib/dm-core/collection.rb \ | |
spec/*/collection_spec.rb |
This file contains hidden or 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
#!/usr/bin/env ruby | |
# git pre-commit hook | |
# | |
# This will ensure 100% code coverage and all specs passing before allowing a commit | |
# to the git repo. | |
# | |
# Place the file at .git/hooks/pre-commit and use chmod a+x to make it executable. | |
system('rake clean >/dev/null 2>&1') |
This file contains hidden or 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
# Output from LiveHTTPHeaders | |
# | |
# NOTE: it looks like it's "forgetting" the Content-Type | |
http://localhost:4000/ | |
GET / HTTP/1.1 | |
Host: localhost:4000 | |
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.3) Gecko/2008092414 Firefox/3.0.3 | |
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 |
This file contains hidden or 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
require 'rack/cache' | |
# use HTTP caching | |
use Rack::Cache do | |
import 'rack/cache/config/default' | |
import 'rack/cache/config/no-cache' | |
import 'rack/cache/config/busters' | |
# log cache hit/miss/pass when in development mode | |
set :verbose, Merb.environment == 'development' |
This file contains hidden or 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
# Rspec Template | |
# -------------- | |
# 1) Setup the subject. Only really possible when the same object is being | |
# used for multiple tests. Sometimes the subject will vary based on | |
# the describe blocks, in which case the subject block will be defined | |
# inside it. | |
subject { @string = '' } | |
This file contains hidden or 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
# Setup Rubyforge gem | |
#rubyforge setup # set up username/password | |
rubyforge login # test username/password | |
rubyforge config # sync up projects | |
# Uninstall previous versions of dm-core, dm-more, data objects and extlib | |
# (From: http://gist.github.com/31187) | |
gem list '\A(?:(?:d[mo])[_-]|data_?(?:mapper|objects)|extlib)' --no-versions \ |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'pathname' | |
# files and extensions to process | |
FILES = %w[ capfile Capfile Dockerfile Gemfile Gemfile.devtools Gemfile.lock Guardfile CHANGELOG LICENSE Manifest README README.rdoc README_FOR_APP RUNNING_UNIT_TESTS Rakefile RUBY-STYLE SPECS TODO USAGE Vagrantfile .autotest .gitattributes .gitignore .htaccess .rspec .rcov .rvmrc .travis.yml .vimrc ].freeze | |
EXTENSIONS = %w[ builder cabal cgi coffee conf css deface deploy erb example fcgi feature handlebars haml hs htc htm html jinja js json key markdown md opts pem php rabl rake ratom rb rcsv rdf rdoc reek rhtml rip rjs rpdf ru rxml sake sass scss sh sls smil sql svg thor txt vcf xml yml ].freeze | |
paths = ARGV.flat_map(&Pathname.method(:glob)) | |
paths.each do |path_in| |
This file contains hidden or 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
# Embedded Value for DataMapper (http://martinfowler.com/eaaCatalog/embeddedValue.html) | |
class Address | |
include DataMapper::EmbeddedValue | |
property :street, String | |
property :location, String | |
property :region, String | |
property :country, String | |
end |
This file contains hidden or 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
gem list '\A(?:(?:d[mo])[_-]|data_?(?:mapper|objects)|extlib)' --no-versions \ | |
| xargs gem uninstall -aIx |