Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Commit

Permalink
Adds active_support/extlib compatibility and a Gemfile
Browse files Browse the repository at this point in the history
  • Loading branch information
snusnu committed Mar 22, 2010
1 parent 193f1ac commit 4e14c59
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 13 deletions.
83 changes: 83 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
source 'http://rubygems.org'

group :runtime do

# We bundle both AS and extlib while extlib compatibility needs to be kept around.
# require 'dm-core' will ensure that only one is activated at any time though.
# This is done by trying to require AS components and fallback to requiring
# extlib in case a LoadError was rescued when requiring AS code.
#
# Due to bundle exec activating all groups in the Gemfile, it's recommended to run
#
# bundle install --without quality
#
# to have a development environment that is able to run the specs. The problem is that
# metric_fu activates active_support=2.2.3 if we comment out the gem 'activesupport'
# declaration - have a look below for why we would want to do that (and a bit later, for
# why that's actually not *strictly* necessary, but recommended)
#
# To run the specs using AS, leave this Gemfile as it is and just run
#
# bundle install --without qality
# ADAPTERS=sqlite3 bundle exec rake spec # or whatever adapter
#
# To run the specs using extlib, comment out the: gem 'activesupport' line and run
#
# bundle install --without quality
# ADAPTERS=sqlite3 bundle exec rake spec # or whatever adapter
#
# If you want to run the quality tasks as provided by metric_fu and related gems,
# you have to run
#
# bundle install
# bundle exec rake metrics:all
#
# Switch back to a bundle without quality gems before trying to run the specs again
#
# bundle install --without quality
# ADAPTERS=sqlite3 bundle exec rake spec # or whatever adapter
#
# It was mentioned above that all this is not *strictly* necessary, and this is true.
# Currently dm-core does the following as the first require when checking for AS
#
# require 'active_support/core_ext/object/singleton_class'
#
# Because this method is not present in activesupport <= 3.0.0.beta, dm-core's feature
# detection will actually do the "right thing" and fall back to extlib. However, since
# this is not the case for all dm-more gems as well, the safest thing to do is to respect
# the more tedious workflow for now, as it will at least be guaranteed to work the same
# for both dm-core and dm-more.
#
# Note that this won't be an issue anymore once we dropped support for extlib completely,
# or bundler folks decide to support something like "bundle exec --without=foo rake spec"
# (which probably is not going to happen anytime soon).
#

if ENV['EXTLIB']
gem 'extlib', '~> 0.9.15', :git => 'git://github.com/datamapper/extlib.git'
else
gem 'activesupport', '~> 3.0.0.beta1', :git => 'git://github.com/rails/rails.git', :require => nil
end
gem 'dm-core', '~> 0.10.3', :git => 'git://github.com/datamapper/dm-core.git', :branch => 'next'

end

group :development do
gem 'rake', '~> 0.8.7'
gem 'rspec', '~> 1.3'
gem 'yard', '~> 0.5'
gem 'rcov', '~> 0.9.7'
gem 'jeweler', '~> 1.4'
gem 'data_objects', '~> 0.10.1'
gem 'do_sqlite3', '~> 0.10.1'
gem 'do_mysql', '~> 0.10.1'
gem 'do_postgres', '~> 0.10.1'
gem 'dm-validations', '~> 0.10.3', :git => 'git://github.com/datamapper/dm-more.git', :branch => 'next'
end

group :quality do
gem 'yardstick', '~> 0.1'
gem 'metric_fu', '~> 1.3'
gem 'reek', '~> 1.2.7'
gem 'roodi', '~> 2.1'
end
8 changes: 4 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ begin

gem.rubyforge_project = 'datamapper'

gem.add_dependency 'dm-core', '~> 0.10.3'
gem.add_dependency 'dm-validations', '~> 0.10.3'
gem.add_dependency 'dm-core', '~> 0.10.3'

gem.add_development_dependency 'rspec', '~> 1.3'
gem.add_development_dependency 'yard', '~> 0.5'
gem.add_development_dependency 'rspec', '~> 1.3'
gem.add_development_dependency 'yard', '~> 0.5'
gem.add_development_dependency 'dm-validations', '~> 0.10.3'
end

Jeweler::GemcutterTasks.new
Expand Down
10 changes: 5 additions & 5 deletions dm-tags.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Bobby Calderwood"]
s.date = %q{2010-01-27}
s.date = %q{2010-03-20}
s.description = %q{This package brings tagging to DataMapper. It is inspired by Acts As Taggable On by Michael Bleigh, github's mbleigh. Props to him for the contextual tagging based on Acts As Taggable on Steroids.}
s.email = %q{bobby_calderwood [a] me [d] com}
s.extra_rdoc_files = [
Expand Down Expand Up @@ -45,7 +45,7 @@ Gem::Specification.new do |s|
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{datamapper}
s.rubygems_version = %q{1.3.5}
s.rubygems_version = %q{1.3.6}
s.summary = %q{This package brings tagging to DataMapper. It is inspired by Acts As Taggable On by Michael Bleigh, github's mbleigh. Props to him for the contextual tagging based on Acts As Taggable on Steroids.}

if s.respond_to? :specification_version then
Expand All @@ -54,20 +54,20 @@ Gem::Specification.new do |s|

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<dm-core>, ["~> 0.10.3"])
s.add_runtime_dependency(%q<dm-validations>, ["~> 0.10.3"])
s.add_development_dependency(%q<rspec>, ["~> 1.3"])
s.add_development_dependency(%q<yard>, ["~> 0.5"])
s.add_development_dependency(%q<dm-validations>, ["~> 0.10.3"])
else
s.add_dependency(%q<dm-core>, ["~> 0.10.3"])
s.add_dependency(%q<dm-validations>, ["~> 0.10.3"])
s.add_dependency(%q<rspec>, ["~> 1.3"])
s.add_dependency(%q<yard>, ["~> 0.5"])
s.add_dependency(%q<dm-validations>, ["~> 0.10.3"])
end
else
s.add_dependency(%q<dm-core>, ["~> 0.10.3"])
s.add_dependency(%q<dm-validations>, ["~> 0.10.3"])
s.add_dependency(%q<rspec>, ["~> 1.3"])
s.add_dependency(%q<yard>, ["~> 0.5"])
s.add_dependency(%q<dm-validations>, ["~> 0.10.3"])
end
end

2 changes: 1 addition & 1 deletion lib/dm-tags/dm_tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def destroy_taggings

associations.each do |association|
association = association.to_s
singular = association.singular
singular = association.singularize

class_eval <<-RUBY, __FILE__, __LINE__ + 1
property :frozen_#{singular}_list, Text
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Use local dm-validations if running from a typical dev checkout.
lib = File.join('..', 'dm-validations', 'lib')
$LOAD_PATH.unshift(lib) if File.directory?(lib)
require 'dm-validations'

# Support running specs with 'rake spec' and 'spec'
$LOAD_PATH.unshift('lib') unless $LOAD_PATH.include?('lib')
Expand Down
3 changes: 0 additions & 3 deletions tasks/spec.rake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,4 @@ rescue LoadError
end
end

task :spec => :check_dependencies
task :rcov => :check_dependencies

task :default => :spec

0 comments on commit 4e14c59

Please sign in to comment.