Skip to content

Instantly share code, notes, and snippets.

View snusnu's full-sized avatar

Martin Gamsjaeger snusnu

View GitHub Profile
#!/usr/bin/env ruby -Ku
# encoding: utf-8
require 'fileutils'
require 'pathname'
require 'addressable/uri'
require 'ruby-github' # TODO: replace ruby-github with something better maintained
--------------------------------------------------------------------------------
The datamapper ecosystem
--------------------------------------------------------------------------------
nr of members: 1593
nr of projects: 130
total watchers: 1524
total forkers: 278
total collaborators: 105
total contributors: 207
--------------------------------------------------------------------------------
/Users/nathan/Documents/myobie/clients/Bull_Head/mongo testing/vendor/cache/gems/activesupport-3.0.0.beta3/lib/active_support/hash_with_indifferent_ac
cess.rb:131:in `convert_value': undefined method `with_indifferent_access' for {}:Hash (NoMethodError)
from /Users/nathan/Documents/myobie/clients/Bull_Head/mongo testing/vendor/cache/gems/activesupport-3.0.0.beta3/lib/active_support/hash_with_i
ndifferent_access.rb:51:in `update'
from /Users/nathan/Documents/myobie/clients/Bull_Head/mongo testing/vendor/cache/gems/activesupport-3.0.0.beta3/lib/active_support/hash_with_i
ndifferent_access.rb:51:in `each_pair'
from /Users/nathan/Documents/myobie/clients/Bull_Head/mongo testing/vendor/cache/gems/activesupport-3.0.0.beta3/lib/active_support/hash_with_i
ndifferent_access.rb:51:in `update'
from /Users/nathan/Documents/myobie/clients/Bull_Head/mongo testing/vendor/cache/gems/activesupport-3.0.0.beta3/lib/active_support/hash_with_i
ndifferent_access.rb:14:in `initialize'
class Payment
include DataMapper::Resource
property :id, Serial
belongs_to :payee, 'User'
belongs_to :payer, 'User'
end
class User
require 'active_support/inflector'
# dm-core/spec/adapter.rb
module DataMapper
module Spec
module Adapters
def self.setup(adapter_name)
SpecAdapter.new(adapter_name)
end
@snusnu
snusnu / dm_gemfile_template.rb
Created April 16, 2010 01:59
This could serve as template for Gemfiles in all DM gems (that one in particular is from dm-core)
# If you're working on more than one datamapper gem at a time, then it's
# recommended to create a local Gemfile and use this instead of the git
# sources. This will make sure that you are developing against your
# other local datamapper sources that you currently work on. Gemfile.local
# will behave identically to the standard Gemfile apart from the fact that
# it fetches the gems from local paths. This means that you can use the
# same environment variables, like ADAPTER when running bundle commands.
# Gemfile.local is added to .gitignore, so you don't need to worry about
# accidentally checking local development paths into git.
#
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
desc "Support bundling from a typical datamapper dev checkout (allows BUNDLE_GEMFILE=Gemfile.local bundle exec foo)"
task :create_local_gemfile do |t|
datamapper = ENV['DATAMAPPER'] || File.expand_path('../..', __FILE__)
excluded_adapters = (ENV['EXCLUDED_ADAPTERS'] || '').split(',')
regex = /:git => \"#\{datamapper\}\/(.*?)(\.git|\")/
File.open(File.expand_path('../Gemfile.local', __FILE__), 'w') do |f|
File.open(File.expand_path('../Gemfile', __FILE__), 'r').each do |line|
#!/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 ..
#!/usr/bin/ruby
# rewrite_history.rb
# Jonathan D. Stott <[email protected]>
require 'fileutils'
adapters = %w{
mysql_adapter.rb
postgres_adapter.rb
sqlite3_adapter.rb
oracle_adapter.rb