natural_key 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'http://rubygems.org'
2
+ gemspec
data/Rakefile CHANGED
@@ -1,15 +1,3 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'echoe'
4
- require 'lib/natural_key'
5
-
6
- Echoe.new('natural_key', NaturalKey::VERSION) do |p|
7
- p.description = "ActiveRecord.create_or_update based on a user-defined natural-key"
8
- p.url = "http://github.com/sjain/natural_key"
9
- p.author = "Sharad Jain"
10
- p.email = "shaanjain@gmail.com"
11
- p.ignore_pattern = ["tmp/*", "script/*", "nbproject/**/*"]
12
- p.development_dependencies = []
13
- end
14
-
15
- Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ #require "test/unit"
@@ -2,7 +2,7 @@ require 'active_record'
2
2
 
3
3
  module ActiveRecord
4
4
  class Base
5
- class_inheritable_accessor :key_attributes
5
+ class_attribute :key_attributes
6
6
  class << self
7
7
  def natural_key(*key_attributes)
8
8
  # TODO validate the supplied key_attributes are subset of all attributes
@@ -0,0 +1,3 @@
1
+ module NaturalKey
2
+ VERSION = "0.2.2"
3
+ end
data/lib/natural_key.rb CHANGED
@@ -1,9 +1,7 @@
1
- $:.unshift(File.dirname(__FILE__)) unless
2
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
1
+ require 'natural_key/version'
3
2
 
4
3
  module NaturalKey
5
- version = YAML.load_file(File.dirname(__FILE__) + "/../VERSION.yml")
6
- VERSION = "#{version[:major]}.#{version[:minor]}.#{version[:patch]}"
4
+ # Your code goes here...
7
5
  end
8
6
 
9
7
  require 'natural_key/base'
data/natural_key.gemspec CHANGED
@@ -1,31 +1,52 @@
1
- # -*- encoding: utf-8 -*-
1
+ require File.expand_path('../lib/natural_key/version', __FILE__)
2
2
 
3
- Gem::Specification.new do |s|
4
- s.name = %q{natural_key}
5
- s.version = "0.2.1"
3
+ Gem::Specification.new do |gem|
4
+ gem.authors = ["Sharad Jain"]
5
+ gem.email = ["shaanjain@gmail.com"]
6
+ gem.description = %q{ActiveRecord.create_or_update based on a user-defined natural-key}
7
+ gem.summary = %q{ActiveRecord.create_or_update based on a user-defined natural-key}
8
+ gem.homepage = %q{http://github.com/sjain/natural_key}
6
9
 
7
- s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Sharad Jain"]
9
- s.date = %q{2010-02-26}
10
- s.description = %q{ActiveRecord.create_or_update based on a user-defined natural-key}
11
- s.email = %q{shaanjain@gmail.com}
12
- s.extra_rdoc_files = ["CHANGELOG", "README.rdoc", "lib/natural_key.rb", "lib/natural_key/base.rb"]
13
- 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"]
14
- s.homepage = %q{http://github.com/sjain/natural_key}
15
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Natural_key", "--main", "README.rdoc"]
16
- s.require_paths = ["lib"]
17
- s.rubyforge_project = %q{natural_key}
18
- s.rubygems_version = %q{1.3.5}
19
- s.summary = %q{ActiveRecord.create_or_update based on a user-defined natural-key}
20
- s.test_files = ["test/test_helper.rb", "test/test_natural_key.rb"]
10
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
11
+ gem.files = `git ls-files`.split("\n")
12
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
13
+ gem.name = "natural_key"
14
+ gem.require_paths = ["lib"]
15
+ gem.version = NaturalKey::VERSION
16
+ gem.add_dependency "activerecord", "~> 3.2.0"
17
+ gem.add_development_dependency "rake", "~> 0.9.2.2"
18
+ gem.add_development_dependency "minitest", "~> 3.0.0"
19
+ end
21
20
 
22
- if s.respond_to? :specification_version then
23
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
- s.specification_version = 3
25
21
 
26
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
- else
28
- end
29
- else
30
- end
31
- end
22
+ # -*- encoding: utf-8 -*-
23
+
24
+ #Gem::Specification.new do |s|
25
+ #s.name = %q{natural_key}
26
+ #s.version = NaturalKey::VERSION
27
+
28
+ #s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
29
+ #s.authors = ["Sharad Jain"]
30
+ #s.date = %q{2010-02-26}
31
+ #s.description = %q{ActiveRecord.create_or_update based on a user-defined natural-key}
32
+ #s.email = %q{shaanjain@gmail.com}
33
+ #s.extra_rdoc_files = ["CHANGELOG", "README.rdoc", "lib/natural_key.rb", "lib/natural_key/base.rb"]
34
+ #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"]
35
+ #s.homepage = %q{http://github.com/sjain/natural_key}
36
+ #s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Natural_key", "--main", "README.rdoc"]
37
+ #s.require_paths = ["lib"]
38
+ #s.rubyforge_project = %q{natural_key}
39
+ #s.rubygems_version = %q{1.3.5}
40
+ #s.summary = %q{ActiveRecord.create_or_update based on a user-defined natural-key}
41
+ #s.test_files = ["test/test_helper.rb", "test/test_natural_key.rb"]
42
+
43
+ #if s.respond_to? :specification_version then
44
+ # current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
45
+ # s.specification_version = 3
46
+ #
47
+ # if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
48
+ # else
49
+ # end
50
+ #else
51
+ #end
52
+ #end
data/script/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/natural_key.rb'}"
9
+ puts "Loading natural_key gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
@@ -0,0 +1 @@
1
+ @ruby script/console %*
data/test/test_helper.rb CHANGED
@@ -1,7 +1,9 @@
1
+ $:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
2
+
1
3
  require 'stringio'
2
- require 'test/unit'
4
+ #require 'test/unit'
3
5
  require 'lib/activerecord_test_case'
4
- require File.dirname(__FILE__) + '/../lib/natural_key'
6
+ #require File.dirname(__FILE__) + '/../lib/natural_key'
5
7
 
6
8
  # gem install redgreen for colored test output
7
9
  #begin require 'redgreen'; rescue LoadError; end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: natural_key
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ hash: 19
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 2
10
+ version: 0.2.2
5
11
  platform: ruby
6
12
  authors:
7
13
  - Sharad Jain
@@ -9,69 +15,120 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-02-26 00:00:00 -06:00
13
- default_executable:
14
- dependencies: []
15
-
18
+ date: 2012-05-10 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ hash: 15
27
+ segments:
28
+ - 3
29
+ - 2
30
+ - 0
31
+ version: 3.2.0
32
+ prerelease: false
33
+ requirement: *id001
34
+ type: :runtime
35
+ name: activerecord
36
+ - !ruby/object:Gem::Dependency
37
+ version_requirements: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ hash: 11
43
+ segments:
44
+ - 0
45
+ - 9
46
+ - 2
47
+ - 2
48
+ version: 0.9.2.2
49
+ prerelease: false
50
+ requirement: *id002
51
+ type: :development
52
+ name: rake
53
+ - !ruby/object:Gem::Dependency
54
+ version_requirements: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ hash: 7
60
+ segments:
61
+ - 3
62
+ - 0
63
+ - 0
64
+ version: 3.0.0
65
+ prerelease: false
66
+ requirement: *id003
67
+ type: :development
68
+ name: minitest
16
69
  description: ActiveRecord.create_or_update based on a user-defined natural-key
17
- email: shaanjain@gmail.com
70
+ email:
71
+ - shaanjain@gmail.com
18
72
  executables: []
19
73
 
20
74
  extensions: []
21
75
 
22
- extra_rdoc_files:
23
- - CHANGELOG
24
- - README.rdoc
25
- - lib/natural_key.rb
26
- - lib/natural_key/base.rb
76
+ extra_rdoc_files: []
77
+
27
78
  files:
28
- - CHANGELOG
29
- - Manifest
79
+ - .gitignore
80
+ - Gemfile
30
81
  - README.rdoc
31
82
  - Rakefile
32
- - VERSION.yml
33
83
  - lib/natural_key.rb
34
84
  - lib/natural_key/base.rb
85
+ - lib/natural_key/version.rb
35
86
  - natural_key.gemspec
87
+ - script/console
88
+ - script/console.cmd
36
89
  - test/database.yml
37
90
  - test/fixtures/schema.rb
38
91
  - test/lib/activerecord_test_case.rb
39
92
  - test/lib/activerecord_test_connector.rb
40
93
  - test/test_helper.rb
41
94
  - test/test_natural_key.rb
42
- has_rdoc: true
43
95
  homepage: http://github.com/sjain/natural_key
44
96
  licenses: []
45
97
 
46
98
  post_install_message:
47
- rdoc_options:
48
- - --line-numbers
49
- - --inline-source
50
- - --title
51
- - Natural_key
52
- - --main
53
- - README.rdoc
99
+ rdoc_options: []
100
+
54
101
  require_paths:
55
102
  - lib
56
103
  required_ruby_version: !ruby/object:Gem::Requirement
104
+ none: false
57
105
  requirements:
58
106
  - - ">="
59
107
  - !ruby/object:Gem::Version
108
+ hash: 3
109
+ segments:
110
+ - 0
60
111
  version: "0"
61
- version:
62
112
  required_rubygems_version: !ruby/object:Gem::Requirement
113
+ none: false
63
114
  requirements:
64
115
  - - ">="
65
116
  - !ruby/object:Gem::Version
66
- version: "1.2"
67
- version:
117
+ hash: 3
118
+ segments:
119
+ - 0
120
+ version: "0"
68
121
  requirements: []
69
122
 
70
- rubyforge_project: natural_key
71
- rubygems_version: 1.3.5
123
+ rubyforge_project:
124
+ rubygems_version: 1.8.11
72
125
  signing_key:
73
126
  specification_version: 3
74
127
  summary: ActiveRecord.create_or_update based on a user-defined natural-key
75
128
  test_files:
129
+ - test/database.yml
130
+ - test/fixtures/schema.rb
131
+ - test/lib/activerecord_test_case.rb
132
+ - test/lib/activerecord_test_connector.rb
76
133
  - test/test_helper.rb
77
134
  - test/test_natural_key.rb
data/CHANGELOG DELETED
@@ -1,8 +0,0 @@
1
- == 0.1.0 2009-01-07
2
- * fixed to accept hash with string keys in addition to symbols
3
- * cleaned up unnecessary files
4
- * using Echoe instead of newgem for gem generation
5
- * github updated
6
-
7
- == 0.0.1 2009-01-07
8
- * initial release
data/Manifest DELETED
@@ -1,14 +0,0 @@
1
- CHANGELOG
2
- Manifest
3
- README.rdoc
4
- Rakefile
5
- VERSION.yml
6
- lib/natural_key.rb
7
- lib/natural_key/base.rb
8
- natural_key.gemspec
9
- test/database.yml
10
- test/fixtures/schema.rb
11
- test/lib/activerecord_test_case.rb
12
- test/lib/activerecord_test_connector.rb
13
- test/test_helper.rb
14
- test/test_natural_key.rb
data/VERSION.yml DELETED
@@ -1,4 +0,0 @@
1
- ---
2
- :major: 0
3
- :minor: 2
4
- :patch: 1