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 Payment | |
| include DataMapper::Resource | |
| property :id, Serial | |
| belongs_to :payee, 'User' | |
| belongs_to :payer, 'User' | |
| end | |
| class User |
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 File.expand_path(File.join(File.dirname(__FILE__), '../test_helper')) | |
| class MyProjectSpecifcUnitTest < MiniTest::Unit::TestCase | |
| def setup | |
| repository(:default) do |repository| | |
| transaction = DataMapper::Transaction.new(repository) | |
| transaction.begin | |
| repository.adapter.push_transaction(transaction) | |
| 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
| #!/bin/bash | |
| ADAPTER=$1 | |
| if [ ! -d dm-more ]; then | |
| echo "Cloning solnic's adapter" | |
| git clone git://github.com/solnic/dm-more.git | |
| cd dm-more | |
| git fetch | |
| git checkout -b adapters_import origin/adapters_import | |
| cd .. |
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/ruby | |
| # rewrite_history.rb | |
| # Jonathan D. Stott <jonathan.stott@gmail.com> | |
| require 'fileutils' | |
| adapters = %w{ | |
| mysql_adapter.rb | |
| postgres_adapter.rb | |
| sqlite3_adapter.rb | |
| oracle_adapter.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
| #!/bin/bash | |
| FROM=$1 | |
| TO=$2 | |
| echo "Spliting '$TO' from '$FROM'" | |
| git clone --no-hardlinks $FROM $TO | |
| cd $TO | |
| git filter-branch --subdirectory-filter $TO HEAD -- --all | |
| git reset --hard | |
| git gc --aggressive | |
| git prune |
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 ".bundle/environment" | |
| Bundler.setup | |
| require "action_controller/railtie" | |
| class FooController < ActionController::Base | |
| def bar | |
| self.response_body = "HELLO" | |
| 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
| class ShardingMiddleware | |
| def initialize(app) | |
| @app = app | |
| end | |
| def call(env) | |
| env['warden'].authenticate! | |
| repo_name = env['warden'].account.repository_name | |
| result = nil |
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
| #---------------------------------------------------------------------------- | |
| # Git Setup | |
| #---------------------------------------------------------------------------- | |
| file '.gitignore', <<-FILE | |
| .DS_Store | |
| log/*.log | |
| tmp/**/* | |
| config/database.yml | |
| db/*.sqlite3 | |
| public/uploads/* |
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
| development: | |
| adapter: master_slave | |
| master: | |
| adapter: mysql | |
| database: master | |
| host: master_server | |
| slave: | |
| adapter: mysql | |
| database: slave | |
| host: localhost |
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 'rubygems' | |
| require 'dm-core' | |
| DataMapper::Logger.new($stdout, :debug) | |
| DataMapper.setup(:default, 'sqlite3:memory:') | |
| class Quote | |
| include DataMapper::Resource | |
| property :id, Serial | |
| has 0..n, :billings, :through => Resource |