Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

convert to using Gemfile/gemspec -- also update for use with activere…

…cord 3.2.X.
  • Loading branch information...
commit b37bed27980400bdc1d3ecc21b2c9254473d5d8b 1 parent 1a83b48
@sjain authored
View
18 .gitignore
@@ -1,3 +1,17 @@
-pkg/*
*.gem
-
+*.rbc
+.bundle
+.config
+.yardoc
+Gemfile.lock
+InstalledFiles
+_yardoc
+coverage
+doc/
+lib/bundler/man
+pkg
+rdoc
+spec/reports
+test/tmp
+test/version_tmp
+tmp
View
8 CHANGELOG
@@ -1,8 +0,0 @@
-== 0.1.0 2009-01-07
-* fixed to accept hash with string keys in addition to symbols
-* cleaned up unnecessary files
-* using Echoe instead of newgem for gem generation
-* github updated
-
-== 0.0.1 2009-01-07
-* initial release
View
2  Gemfile
@@ -0,0 +1,2 @@
+source 'http://rubygems.org'
+gemspec
View
14 Manifest
@@ -1,14 +0,0 @@
-CHANGELOG
-Manifest
-README.rdoc
-Rakefile
-VERSION.yml
-lib/natural_key.rb
-lib/natural_key/base.rb
-natural_key.gemspec
-test/database.yml
-test/fixtures/schema.rb
-test/lib/activerecord_test_case.rb
-test/lib/activerecord_test_connector.rb
-test/test_helper.rb
-test/test_natural_key.rb
View
18 Rakefile
@@ -1,15 +1,3 @@
-require 'rubygems'
-require 'rake'
-require 'echoe'
-require 'lib/natural_key'
-
-Echoe.new('natural_key', NaturalKey::VERSION) do |p|
- p.description = "ActiveRecord.create_or_update based on a user-defined natural-key"
- p.url = "http://github.com/sjain/natural_key"
- p.author = "Sharad Jain"
- p.email = "shaanjain@gmail.com"
- p.ignore_pattern = ["tmp/*", "script/*", "nbproject/**/*"]
- p.development_dependencies = []
-end
-
-Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
+#!/usr/bin/env rake
+require "bundler/gem_tasks"
+#require "test/unit"
View
4 VERSION.yml
@@ -1,4 +0,0 @@
----
-:major: 0
-:minor: 2
-:patch: 1
View
6 lib/natural_key.rb
@@ -1,9 +1,7 @@
-$:.unshift(File.dirname(__FILE__)) unless
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
+require 'natural_key/version'
module NaturalKey
- version = YAML.load_file(File.dirname(__FILE__) + "/../VERSION.yml")
- VERSION = "#{version[:major]}.#{version[:minor]}.#{version[:patch]}"
+ # Your code goes here...
end
require 'natural_key/base'
View
2  lib/natural_key/base.rb
@@ -2,7 +2,7 @@
module ActiveRecord
class Base
- class_inheritable_accessor :key_attributes
+ class_attribute :key_attributes
class << self
def natural_key(*key_attributes)
# TODO validate the supplied key_attributes are subset of all attributes
View
3  lib/natural_key/version.rb
@@ -0,0 +1,3 @@
+module NaturalKey
+ VERSION = "0.2.2"
+end
View
75 natural_key.gemspec
@@ -1,31 +1,52 @@
-# -*- encoding: utf-8 -*-
+require File.expand_path('../lib/natural_key/version', __FILE__)
-Gem::Specification.new do |s|
- s.name = %q{natural_key}
- s.version = "0.2.1"
+Gem::Specification.new do |gem|
+ gem.authors = ["Sharad Jain"]
+ gem.email = ["shaanjain@gmail.com"]
+ gem.description = %q{ActiveRecord.create_or_update based on a user-defined natural-key}
+ gem.summary = %q{ActiveRecord.create_or_update based on a user-defined natural-key}
+ gem.homepage = %q{http://github.com/sjain/natural_key}
- s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
- s.authors = ["Sharad Jain"]
- s.date = %q{2010-02-26}
- s.description = %q{ActiveRecord.create_or_update based on a user-defined natural-key}
- s.email = %q{shaanjain@gmail.com}
- s.extra_rdoc_files = ["CHANGELOG", "README.rdoc", "lib/natural_key.rb", "lib/natural_key/base.rb"]
- s.files = ["CHANGELOG", "Manifest", "README.rdoc", "Rakefile", "VERSION.yml", "lib/natural_key.rb", "lib/natural_key/base.rb", "natural_key.gemspec", "test/database.yml", "test/fixtures/schema.rb", "test/lib/activerecord_test_case.rb", "test/lib/activerecord_test_connector.rb", "test/test_helper.rb", "test/test_natural_key.rb"]
- s.homepage = %q{http://github.com/sjain/natural_key}
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Natural_key", "--main", "README.rdoc"]
- s.require_paths = ["lib"]
- s.rubyforge_project = %q{natural_key}
- s.rubygems_version = %q{1.3.5}
- s.summary = %q{ActiveRecord.create_or_update based on a user-defined natural-key}
- s.test_files = ["test/test_helper.rb", "test/test_natural_key.rb"]
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ gem.files = `git ls-files`.split("\n")
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ gem.name = "natural_key"
+ gem.require_paths = ["lib"]
+ gem.version = NaturalKey::VERSION
+ gem.add_dependency "activerecord", "~> 3.2.0"
+ gem.add_development_dependency "rake", "~> 0.9.2.2"
+ gem.add_development_dependency "minitest", "~> 3.0.0"
+end
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
- else
- end
- else
- end
-end
+# -*- encoding: utf-8 -*-
+
+#Gem::Specification.new do |s|
+ #s.name = %q{natural_key}
+ #s.version = NaturalKey::VERSION
+
+ #s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
+ #s.authors = ["Sharad Jain"]
+ #s.date = %q{2010-02-26}
+ #s.description = %q{ActiveRecord.create_or_update based on a user-defined natural-key}
+ #s.email = %q{shaanjain@gmail.com}
+ #s.extra_rdoc_files = ["CHANGELOG", "README.rdoc", "lib/natural_key.rb", "lib/natural_key/base.rb"]
+ #s.files = ["CHANGELOG", "Manifest", "README.rdoc", "Rakefile", "VERSION.yml", "lib/natural_key.rb", "lib/natural_key/base.rb", "natural_key.gemspec", "test/database.yml", "test/fixtures/schema.rb", "test/lib/activerecord_test_case.rb", "test/lib/activerecord_test_connector.rb", "test/test_helper.rb", "test/test_natural_key.rb"]
+ #s.homepage = %q{http://github.com/sjain/natural_key}
+ #s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Natural_key", "--main", "README.rdoc"]
+ #s.require_paths = ["lib"]
+ #s.rubyforge_project = %q{natural_key}
+ #s.rubygems_version = %q{1.3.5}
+ #s.summary = %q{ActiveRecord.create_or_update based on a user-defined natural-key}
+ #s.test_files = ["test/test_helper.rb", "test/test_natural_key.rb"]
+
+ #if s.respond_to? :specification_version then
+ # current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ # s.specification_version = 3
+ #
+ # if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+ # else
+ # end
+ #else
+ #end
+#end
View
6 test/test_helper.rb
@@ -1,7 +1,9 @@
+$:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
+
require 'stringio'
-require 'test/unit'
+#require 'test/unit'
require 'lib/activerecord_test_case'
-require File.dirname(__FILE__) + '/../lib/natural_key'
+#require File.dirname(__FILE__) + '/../lib/natural_key'
# gem install redgreen for colored test output
#begin require 'redgreen'; rescue LoadError; end
Please sign in to comment.
Something went wrong with that request. Please try again.