Skip to content

Commit

Permalink
make has_enumeration work with rails 3.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Dowling committed Apr 7, 2012
1 parent e880115 commit 7cae558
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Gemfile
@@ -1,6 +1,6 @@
source :rubygems

version = ENV['AR_VERSION'] || '3.0.x'
version = ENV['AR_VERSION'] || '3.2.x'

if version.end_with? 'x'
# fuzzy version support
Expand All @@ -10,7 +10,7 @@ else
gem 'activerecord', version, :require => 'active_record'
end

gem 'builder', '~> 2.1.2'
gem 'builder', '~> 3.0.0'

if version >= '3.0.0' && version < '3.1'
group :meta_where do
Expand Down
70 changes: 70 additions & 0 deletions has_enumeration.gemspec
@@ -0,0 +1,70 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = "has_enumeration"
s.version = "1.0.2"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Greg Spurrier"]
s.date = "2012-04-06"
s.description = "Extends ActiveRecord with the has_enumeration method allowing a symbolic\nenumeration to be stored in an ActiveRecord attribute. The enumeration is\nspecified as a mapping between symbols and their underlying representation\nin the database. Predicates are provided for each symbol in the enumeration\nand the symbols may be used in finder methods. When using ActiveRecord 3,\nthe symbols may also be used when interacting with the underlying Arel attribute\nfor the enumeration. has_enumeration has been tested with Ruby 1.8.7,\nRuby 1.9.2, JRuby 1.5.5, Rubinius 1.1.0, ActiveRecord 2.3.10, and ActiveRecord\n3.0.3.\n"
s.email = "greg@rujubu.com"
s.extra_rdoc_files = [
"LICENSE.txt",
"README.md"
]
s.files = [
"Gemfile",
"HISTORY.txt",
"LICENSE.txt",
"README.md",
"Rakefile",
"TODO.md",
"VERSION",
"all_tests.sh",
"features/arel_attributes.feature",
"features/explicitly_mapped_enumeration.feature",
"features/implicitly_mapped_enumeration.feature",
"features/meta_where_queries.feature",
"features/nonstandard_attribute_enumeration.feature",
"features/step_definitions/has_enumeration_steps.rb",
"features/support/env.rb",
"features/support/explicitly_mapped_model.rb",
"features/support/implicitly_mapped_model.rb",
"features/support/nonstandard_attribute_model.rb",
"install_gemsets.sh",
"lib/has_enumeration.rb",
"lib/has_enumeration/aggregate_conditions_override.rb",
"lib/has_enumeration/arel/table_extensions.rb",
"lib/has_enumeration/arel/table_extensions_arel_one.rb",
"lib/has_enumeration/class_methods.rb",
"spec/has_enumeration/has_enumeration_spec.rb",
"spec/spec_helper.rb"
]
s.homepage = "http://github.com/gregspurrier/has_enumeration"
s.require_paths = ["lib"]
s.rubygems_version = "1.8.19"
s.summary = "Support for symbol-based enumerations in ActiveRecord"

if s.respond_to? :specification_version then
s.specification_version = 3

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<activerecord>, ["~> 3.2.0"])
s.add_runtime_dependency(%q<builder>, ["~> 3.0.0"])
s.add_development_dependency(%q<jeweler>, [">= 0"])
else
s.add_dependency(%q<activerecord>, ["~> 3.2.0"])
s.add_dependency(%q<builder>, ["~> 3.0.0"])
s.add_dependency(%q<jeweler>, [">= 0"])
end
else
s.add_dependency(%q<activerecord>, ["~> 3.2.0"])

This comment has been minimized.

Copy link
@soulcutter

soulcutter Apr 10, 2012

All these AR dependencies need to be ">= 2.3.10" (or whatever the minimum-supported AR is)

s.add_dependency(%q<builder>, ["~> 3.0.0"])
s.add_dependency(%q<jeweler>, [">= 0"])
end
end

6 comments on commit 7cae558

@gregspurrier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you adding the gemspec file on purpose for some reason, or was that an oversight? I can't remember whether I had a good reason for not putting it under source control earlier....

@soulcutter
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW I prefer hand-crafting these gemspecs rather than generating them. The only pain point are the file lists, and you can use Dir.glob or something to marshall those. Just my 2 cents.

@evandowling
Copy link
Owner

@evandowling evandowling commented on 7cae558 Apr 10, 2012 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@soulcutter
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the relative complexity of has_enumeration's Gemfile (environment-specific if/else stuff), it's not generating an accurate gemspec anyway. There's no real way to express conditional dependencies with gemspecs (even if you put conditions into your gemspec file, the gem it generates does not carry over that metadata). Bleh.

@evandowling
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposal: Fix the gemspec to require ActiveRecord >= 2.3.10 and leave it as is while we figure out what to do about stuff like meta_where. In addition, set up the Gemfile so that it will automatically determine all gem versions except for the ActiveRecord version. This is probably reasonable for development purposes, and we can exercise more control by editing the gemspec when we release a new version of the gem. I'll add a commit to this effect, and you guys can critique.

@gregspurrier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds reasonable.

I think it also would be reasonable to bump the version number and drop support for older versions of Rails (certainly at least 2.x) rather than trying to keep up all the backward compatibility.

Please sign in to comment.