modalfields 1.1.10 → 1.1.11

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.10
1
+ 1.1.11
data/lib/modalfields.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'modalfields/modalfields'
2
2
  require 'modalfields/standardfields'
3
3
 
4
- if defined?(Rails)
4
+ if defined?(Rails) && Rails.respond_to?(:version)
5
5
  if Rails.version.split('.').first.to_i > 2
6
6
  class BackupTask < Rails::Railtie
7
7
  rake_tasks do
@@ -18,14 +18,10 @@ module ModalFields
18
18
  SPECIFIERS = [:indexed, :unique, :required]
19
19
  COMMON_ATTRIBUTES = {:default=>nil, :null=>true}
20
20
 
21
- if defined?(ActiveSupport::BasicObject) && ActiveSupport::BasicObject.instance_methods.map(&:to_sym).include?(:instance_eval)
22
- DslBase = ActiveSupport::BasicObject
23
- elsif defined?(BasicObject) && BasicObject.instance_methods.map(&:to_sym).include?(:instance_eval)
24
- DslBase = BasicObject
25
- else
26
- class DslBase
27
- instance_methods.each { |m| undef_method m unless m =~ /^(__|instance_eval)/ }
28
- end
21
+ # We'll use a somewhat conservative kind of 'blank slate' base for DSLs. that
22
+ # works on Ruby 1.9 & 1.8
23
+ class DslBase
24
+ instance_methods.each { |m| undef_method m unless m =~ /^(__|instance_)/ }
29
25
  end
30
26
 
31
27
  class FieldDeclaration < Struct.new(:name, :type, :specifiers, :attributes)
@@ -70,14 +66,14 @@ module ModalFields
70
66
 
71
67
  class DefinitionsDsl < DslBase
72
68
  def field(name, attributes={})
73
- ::ModalFields.definitions[name.to_sym] = COMMON_ATTRIBUTES.merge(attributes)
69
+ ModalFields.definitions[name.to_sym] = COMMON_ATTRIBUTES.merge(attributes)
74
70
  end
75
71
  def method_missing(name, *args)
76
72
  field(name, *args)
77
73
  end
78
74
  end
79
75
 
80
- class HooksDsl
76
+ class HooksDsl < DslBase
81
77
  def field_type(type, &blk)
82
78
  ModalFields.hooks[type.to_sym] = lambda{|model, column_declaration|
83
79
  blk[model, column_declaration]
@@ -92,7 +88,7 @@ module ModalFields
92
88
  end
93
89
  end
94
90
 
95
- class DeclarationsDsl
91
+ class DeclarationsDsl < DslBase
96
92
  def initialize(model)
97
93
  @model = model.base_class
98
94
  end
@@ -290,7 +286,7 @@ module ModalFields
290
286
 
291
287
  def validate(declaration)
292
288
  definition = definitions[declaration.type.to_sym]
293
- raise "Field type #{declaration.type} not defined" unless definition
289
+ raise "Field type #{declaration.type} not defined (#{declaration.inspect})" unless definition
294
290
  # TODO: validate declaration.specifiers
295
291
  # TODO: validate declaration.attributes with definition
296
292
  true
data/modalfields.gemspec CHANGED
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = "modalfields"
8
- s.version = "1.1.10"
7
+ s.name = %q{modalfields}
8
+ s.version = "1.1.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Javier Goizueta"]
12
- s.date = "2012-08-10"
13
- s.description = "ModelFields is a Rails plugin that adds fields declarations to your models."
14
- s.email = "jgoizueta@gmail.com"
12
+ s.date = %q{2012-09-04}
13
+ s.description = %q{ModelFields is a Rails plugin that adds fields declarations to your models.}
14
+ s.email = %q{jgoizueta@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
17
  "README.rdoc",
@@ -54,13 +54,14 @@ Gem::Specification.new do |s|
54
54
  "test/test_diff.rb",
55
55
  "test/test_update.rb"
56
56
  ]
57
- s.homepage = "http://github.com/jgoizueta/modalfields"
57
+ s.homepage = %q{http://github.com/jgoizueta/modalfields}
58
58
  s.licenses = ["MIT"]
59
59
  s.require_paths = ["lib"]
60
- s.rubygems_version = "1.8.23"
61
- s.summary = "Model annotator with Ruby (Hobo-like) syntax and hooks."
60
+ s.rubygems_version = %q{1.3.7}
61
+ s.summary = %q{Model annotator with Ruby (Hobo-like) syntax and hooks.}
62
62
 
63
63
  if s.respond_to? :specification_version then
64
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
64
65
  s.specification_version = 3
65
66
 
66
67
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
metadata CHANGED
@@ -1,169 +1,159 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: modalfields
3
- version: !ruby/object:Gem::Version
4
- version: 1.1.10
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 1
8
+ - 11
9
+ version: 1.1.11
6
10
  platform: ruby
7
- authors:
11
+ authors:
8
12
  - Javier Goizueta
9
13
  autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
- date: 2012-08-10 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
16
+
17
+ date: 2012-09-04 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: activesupport
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 2
29
+ - 3
30
+ - 5
21
31
  version: 2.3.5
22
32
  type: :runtime
23
33
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: 2.3.5
30
- - !ruby/object:Gem::Dependency
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
31
36
  name: activerecord
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 2
44
+ - 3
45
+ - 5
37
46
  version: 2.3.5
38
47
  type: :runtime
39
48
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: 2.3.5
46
- - !ruby/object:Gem::Dependency
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
47
51
  name: shoulda
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 0
59
+ version: "0"
54
60
  type: :development
55
61
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
63
64
  name: rdoc
64
- requirement: !ruby/object:Gem::Requirement
65
+ requirement: &id004 !ruby/object:Gem::Requirement
65
66
  none: false
66
- requirements:
67
+ requirements:
67
68
  - - ~>
68
- - !ruby/object:Gem::Version
69
- version: '3.12'
69
+ - !ruby/object:Gem::Version
70
+ segments:
71
+ - 3
72
+ - 12
73
+ version: "3.12"
70
74
  type: :development
71
75
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- version: '3.12'
78
- - !ruby/object:Gem::Dependency
76
+ version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
79
78
  name: bundler
80
- requirement: !ruby/object:Gem::Requirement
79
+ requirement: &id005 !ruby/object:Gem::Requirement
81
80
  none: false
82
- requirements:
81
+ requirements:
83
82
  - - ~>
84
- - !ruby/object:Gem::Version
85
- version: '1'
83
+ - !ruby/object:Gem::Version
84
+ segments:
85
+ - 1
86
+ version: "1"
86
87
  type: :development
87
88
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ~>
92
- - !ruby/object:Gem::Version
93
- version: '1'
94
- - !ruby/object:Gem::Dependency
89
+ version_requirements: *id005
90
+ - !ruby/object:Gem::Dependency
95
91
  name: jeweler
96
- requirement: !ruby/object:Gem::Requirement
92
+ requirement: &id006 !ruby/object:Gem::Requirement
97
93
  none: false
98
- requirements:
94
+ requirements:
99
95
  - - ~>
100
- - !ruby/object:Gem::Version
96
+ - !ruby/object:Gem::Version
97
+ segments:
98
+ - 1
99
+ - 8
100
+ - 3
101
101
  version: 1.8.3
102
102
  type: :development
103
103
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ~>
108
- - !ruby/object:Gem::Version
109
- version: 1.8.3
110
- - !ruby/object:Gem::Dependency
104
+ version_requirements: *id006
105
+ - !ruby/object:Gem::Dependency
111
106
  name: sqlite3
112
- requirement: !ruby/object:Gem::Requirement
113
- none: false
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
107
+ requirement: &id007 !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ segments:
113
+ - 0
114
+ version: "0"
118
115
  type: :development
119
116
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
126
- - !ruby/object:Gem::Dependency
117
+ version_requirements: *id007
118
+ - !ruby/object:Gem::Dependency
127
119
  name: pg
128
- requirement: !ruby/object:Gem::Requirement
129
- none: false
130
- requirements:
131
- - - ! '>='
132
- - !ruby/object:Gem::Version
133
- version: '0'
120
+ requirement: &id008 !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ segments:
126
+ - 0
127
+ version: "0"
134
128
  type: :development
135
129
  prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
139
- - - ! '>='
140
- - !ruby/object:Gem::Version
141
- version: '0'
142
- - !ruby/object:Gem::Dependency
130
+ version_requirements: *id008
131
+ - !ruby/object:Gem::Dependency
143
132
  name: rails
144
- requirement: !ruby/object:Gem::Requirement
145
- none: false
146
- requirements:
147
- - - ! '>='
148
- - !ruby/object:Gem::Version
133
+ requirement: &id009 !ruby/object:Gem::Requirement
134
+ none: false
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ segments:
139
+ - 2
140
+ - 3
141
+ - 0
149
142
  version: 2.3.0
150
143
  type: :runtime
151
144
  prerelease: false
152
- version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
- requirements:
155
- - - ! '>='
156
- - !ruby/object:Gem::Version
157
- version: 2.3.0
145
+ version_requirements: *id009
158
146
  description: ModelFields is a Rails plugin that adds fields declarations to your models.
159
147
  email: jgoizueta@gmail.com
160
148
  executables: []
149
+
161
150
  extensions: []
162
- extra_rdoc_files:
151
+
152
+ extra_rdoc_files:
163
153
  - LICENSE.txt
164
154
  - README.rdoc
165
155
  - TODO
166
- files:
156
+ files:
167
157
  - .document
168
158
  - Gemfile
169
159
  - Gemfile.lock
@@ -199,32 +189,38 @@ files:
199
189
  - test/schema.rb
200
190
  - test/test_diff.rb
201
191
  - test/test_update.rb
192
+ has_rdoc: true
202
193
  homepage: http://github.com/jgoizueta/modalfields
203
- licenses:
194
+ licenses:
204
195
  - MIT
205
196
  post_install_message:
206
197
  rdoc_options: []
207
- require_paths:
198
+
199
+ require_paths:
208
200
  - lib
209
- required_ruby_version: !ruby/object:Gem::Requirement
201
+ required_ruby_version: !ruby/object:Gem::Requirement
210
202
  none: false
211
- requirements:
212
- - - ! '>='
213
- - !ruby/object:Gem::Version
214
- version: '0'
215
- segments:
203
+ requirements:
204
+ - - ">="
205
+ - !ruby/object:Gem::Version
206
+ hash: 1020436365
207
+ segments:
216
208
  - 0
217
- hash: 147065444603111565
218
- required_rubygems_version: !ruby/object:Gem::Requirement
209
+ version: "0"
210
+ required_rubygems_version: !ruby/object:Gem::Requirement
219
211
  none: false
220
- requirements:
221
- - - ! '>='
222
- - !ruby/object:Gem::Version
223
- version: '0'
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ segments:
216
+ - 0
217
+ version: "0"
224
218
  requirements: []
219
+
225
220
  rubyforge_project:
226
- rubygems_version: 1.8.23
221
+ rubygems_version: 1.3.7
227
222
  signing_key:
228
223
  specification_version: 3
229
224
  summary: Model annotator with Ruby (Hobo-like) syntax and hooks.
230
225
  test_files: []
226
+