Skip to content

Instantly share code, notes, and snippets.

View snusnu's full-sized avatar

Martin Gamsjaeger snusnu

View GitHub Profile
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|
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
@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 'active_support/inflector'
# dm-core/spec/adapter.rb
module DataMapper
module Spec
module Adapters
def self.setup(adapter_name)
SpecAdapter.new(adapter_name)
end
class Payment
include DataMapper::Resource
property :id, Serial
belongs_to :payee, 'User'
belongs_to :payer, 'User'
end
class User
/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'
--------------------------------------------------------------------------------
The datamapper ecosystem
--------------------------------------------------------------------------------
nr of members: 1593
nr of projects: 130
total watchers: 1524
total forkers: 278
total collaborators: 105
total contributors: 207
--------------------------------------------------------------------------------
#!/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
class ApplicationController < ActionController::Base
before_filter :compound_date_values
protected
def compound_date_values(h=params,prefix=[])
to_fix = {}
h.each do |k, v|
if v.is_a? Hash
require 'action_view'
require 'active_support'
require 'mustache'
class Mustache
# TODO - Think about allowing to overwrite layout methods in subclassing views
#
# http://github.com/defunkt/mustache/blob/master/lib/mustache/sinatra.rb#L79-82
# http://github.com/defunkt/mustache/blob/master/lib/mustache/sinatra.rb#L96-102