static_model 0.3.1 → 0.3.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/Rakefile +2 -2
- data/generators/static_model/static_model_generator.rb +10 -4
- data/lib/static_model/associations.rb +5 -5
- data/lib/static_model.rb +1 -1
- data/static_model.gemspec +40 -45
- metadata +7 -23
- data/.gitignore +0 -3
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@ begin
|
|
14
14
|
s.description = %q{StaticModel provides a Base class much like ActiveRecord which supports reading from a YAML file and basic associations to ActiveRecord}
|
15
15
|
s.rubyforge_project = %q{quirkey}
|
16
16
|
s.add_runtime_dependency(%q<activesupport>, ["~>2.3.8"])
|
17
|
-
s.add_runtime_dependency(%q<rubigen>, [">= 1.5.1"])
|
17
|
+
# s.add_runtime_dependency(%q<rubigen>, [">= 1.5.1"])
|
18
18
|
s.add_development_dependency(%q<Shoulda>, [">= 1.2.0"])
|
19
19
|
end
|
20
20
|
Jeweler::GemcutterTasks.new
|
@@ -30,4 +30,4 @@ end
|
|
30
30
|
|
31
31
|
Dir['tasks/**/*.rake'].each { |t| load t }
|
32
32
|
|
33
|
-
task :default => :test
|
33
|
+
task :default => :test
|
@@ -1,3 +1,9 @@
|
|
1
|
+
begin
|
2
|
+
require 'rubigen'
|
3
|
+
rescue => LoadError
|
4
|
+
warn "Please install rubigen"
|
5
|
+
end
|
6
|
+
|
1
7
|
class StaticModelGenerator < RubiGen::Base
|
2
8
|
|
3
9
|
default_options :author => nil
|
@@ -29,15 +35,15 @@ Creates a ...
|
|
29
35
|
USAGE: #{$0} #{spec.name} ModelName
|
30
36
|
EOS
|
31
37
|
end
|
32
|
-
|
38
|
+
|
33
39
|
def class_name
|
34
40
|
@name.classify
|
35
41
|
end
|
36
|
-
|
42
|
+
|
37
43
|
def table_name
|
38
44
|
@name.tableize
|
39
45
|
end
|
40
|
-
|
46
|
+
|
41
47
|
def add_options!(opts)
|
42
48
|
# opts.separator ''
|
43
49
|
# opts.separator 'Options:'
|
@@ -54,4 +60,4 @@ EOS
|
|
54
60
|
@lib_dir = options[:lib_dir] || File.join('app', 'models')
|
55
61
|
@data_dir = options[:data_dir] || File.join('config', 'data')
|
56
62
|
end
|
57
|
-
end
|
63
|
+
end
|
@@ -14,7 +14,7 @@ module StaticModel
|
|
14
14
|
def has_many(association_name, options = {})
|
15
15
|
self.associations[association_name.to_sym] = HasManyAssociation.new(self, association_name.to_sym, {:foreign_key => "#{self.to_s.foreign_key}"}.merge(options))
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def belongs_to(association_name, options = {})
|
19
19
|
self.associations[association_name.to_sym] = BelongsToAssociation.new(self, association_name.to_sym, {:foreign_key => "#{association_name.to_s.foreign_key}"}.merge(options))
|
20
20
|
end
|
@@ -33,10 +33,10 @@ module StaticModel
|
|
33
33
|
@foreign_key = @options[:foreign_key]
|
34
34
|
define_association_methods
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def reflection_klass
|
38
38
|
Object.const_get(@reflection_klass_name)
|
39
|
-
rescue
|
39
|
+
rescue
|
40
40
|
eval <<-EOT
|
41
41
|
class #{@reflection_klass_name}; end;
|
42
42
|
#{@reflection_klass_name}
|
@@ -68,7 +68,7 @@ module StaticModel
|
|
68
68
|
end
|
69
69
|
|
70
70
|
class BelongsToAssociation < Association
|
71
|
-
|
71
|
+
|
72
72
|
def define_association_methods
|
73
73
|
klass.module_eval <<-EOT
|
74
74
|
def #{name}
|
@@ -79,4 +79,4 @@ module StaticModel
|
|
79
79
|
end
|
80
80
|
|
81
81
|
end
|
82
|
-
end
|
82
|
+
end
|
data/lib/static_model.rb
CHANGED
data/static_model.gemspec
CHANGED
@@ -1,68 +1,66 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{static_model}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Aaron Quint"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2009-12-03}
|
13
13
|
s.description = %q{StaticModel provides a Base class much like ActiveRecord which supports reading from a YAML file and basic associations to ActiveRecord}
|
14
14
|
s.email = %q{aaron at quirkey dot com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.rdoc"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
|
-
".
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
"test/test_static_model_scope.rb"
|
19
|
+
"History.txt",
|
20
|
+
"License.txt",
|
21
|
+
"README.rdoc",
|
22
|
+
"Rakefile",
|
23
|
+
"generators/static_model/USAGE",
|
24
|
+
"generators/static_model/static_model_generator.rb",
|
25
|
+
"generators/static_model/templates/model.rb.erb",
|
26
|
+
"generators/static_model/templates/models.yml.erb",
|
27
|
+
"index.html",
|
28
|
+
"lib/static_model.rb",
|
29
|
+
"lib/static_model/active_record.rb",
|
30
|
+
"lib/static_model/associations.rb",
|
31
|
+
"lib/static_model/base.rb",
|
32
|
+
"lib/static_model/comparable.rb",
|
33
|
+
"lib/static_model/errors.rb",
|
34
|
+
"lib/static_model/rails.rb",
|
35
|
+
"lib/static_model/scope.rb",
|
36
|
+
"lib/static_model/version.rb",
|
37
|
+
"static_model.gemspec",
|
38
|
+
"test/data/authors.yml",
|
39
|
+
"test/data/books.yml",
|
40
|
+
"test/data/empty.yml",
|
41
|
+
"test/data/pages.yml",
|
42
|
+
"test/data/projects.yml",
|
43
|
+
"test/data/publishers.yml",
|
44
|
+
"test/data/stores.yml",
|
45
|
+
"test/test_generator_helper.rb",
|
46
|
+
"test/test_helper.rb",
|
47
|
+
"test/test_static_model.rb",
|
48
|
+
"test/test_static_model_associations.rb",
|
49
|
+
"test/test_static_model_generator.rb",
|
50
|
+
"test/test_static_model_scope.rb"
|
52
51
|
]
|
53
52
|
s.homepage = %q{http://github.com/quirkey/static_model}
|
54
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
55
53
|
s.require_paths = ["lib"]
|
56
54
|
s.rubyforge_project = %q{quirkey}
|
57
55
|
s.rubygems_version = %q{1.3.7}
|
58
56
|
s.summary = %q{ActiveRecord like functionalities for reading from YAML with a simple class implementation}
|
59
57
|
s.test_files = [
|
60
58
|
"test/test_generator_helper.rb",
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
59
|
+
"test/test_helper.rb",
|
60
|
+
"test/test_static_model.rb",
|
61
|
+
"test/test_static_model_associations.rb",
|
62
|
+
"test/test_static_model_generator.rb",
|
63
|
+
"test/test_static_model_scope.rb"
|
66
64
|
]
|
67
65
|
|
68
66
|
if s.respond_to? :specification_version then
|
@@ -71,16 +69,13 @@ Gem::Specification.new do |s|
|
|
71
69
|
|
72
70
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
73
71
|
s.add_runtime_dependency(%q<activesupport>, ["~> 2.3.8"])
|
74
|
-
s.add_runtime_dependency(%q<rubigen>, [">= 1.5.1"])
|
75
72
|
s.add_development_dependency(%q<Shoulda>, [">= 1.2.0"])
|
76
73
|
else
|
77
74
|
s.add_dependency(%q<activesupport>, ["~> 2.3.8"])
|
78
|
-
s.add_dependency(%q<rubigen>, [">= 1.5.1"])
|
79
75
|
s.add_dependency(%q<Shoulda>, [">= 1.2.0"])
|
80
76
|
end
|
81
77
|
else
|
82
78
|
s.add_dependency(%q<activesupport>, ["~> 2.3.8"])
|
83
|
-
s.add_dependency(%q<rubigen>, [">= 1.5.1"])
|
84
79
|
s.add_dependency(%q<Shoulda>, [">= 1.2.0"])
|
85
80
|
end
|
86
81
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 2
|
9
|
+
version: 0.3.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Aaron Quint
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2009-12-03 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -32,25 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.3.8
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rubigen
|
37
|
-
prerelease: false
|
38
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
segments:
|
44
|
-
- 1
|
45
|
-
- 5
|
46
|
-
- 1
|
47
|
-
version: 1.5.1
|
48
|
-
type: :runtime
|
49
|
-
version_requirements: *id002
|
50
35
|
- !ruby/object:Gem::Dependency
|
51
36
|
name: Shoulda
|
52
37
|
prerelease: false
|
53
|
-
requirement: &
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
54
39
|
none: false
|
55
40
|
requirements:
|
56
41
|
- - ">="
|
@@ -61,7 +46,7 @@ dependencies:
|
|
61
46
|
- 0
|
62
47
|
version: 1.2.0
|
63
48
|
type: :development
|
64
|
-
version_requirements: *
|
49
|
+
version_requirements: *id002
|
65
50
|
description: StaticModel provides a Base class much like ActiveRecord which supports reading from a YAML file and basic associations to ActiveRecord
|
66
51
|
email: aaron at quirkey dot com
|
67
52
|
executables: []
|
@@ -71,7 +56,6 @@ extensions: []
|
|
71
56
|
extra_rdoc_files:
|
72
57
|
- README.rdoc
|
73
58
|
files:
|
74
|
-
- .gitignore
|
75
59
|
- History.txt
|
76
60
|
- License.txt
|
77
61
|
- README.rdoc
|
@@ -109,8 +93,8 @@ homepage: http://github.com/quirkey/static_model
|
|
109
93
|
licenses: []
|
110
94
|
|
111
95
|
post_install_message:
|
112
|
-
rdoc_options:
|
113
|
-
|
96
|
+
rdoc_options: []
|
97
|
+
|
114
98
|
require_paths:
|
115
99
|
- lib
|
116
100
|
required_ruby_version: !ruby/object:Gem::Requirement
|
data/.gitignore
DELETED