hobofields 0.8.7 → 0.8.8

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -22,9 +22,9 @@ Echoe.new('hobofields') do |p|
22
22
  p.project = "hobo"
23
23
 
24
24
  p.changelog = "CHANGES.txt"
25
- p.version = "0.8.7"
25
+ p.version = "0.8.8"
26
26
 
27
- p.dependencies = ['hobosupport =0.8.7', 'rails >=2.2.2']
27
+ p.dependencies = ['hobosupport =0.8.8', 'rails >=2.2.2']
28
28
  p.development_dependencies = []
29
29
  end
30
30
 
data/hobofields.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{hobofields}
5
- s.version = "0.8.7"
5
+ s.version = "0.8.8"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Tom Locke"]
9
- s.date = %q{2009-05-14}
9
+ s.date = %q{2009-06-24}
10
10
  s.description = %q{Rich field types and migration generator for Rails}
11
11
  s.email = %q{tom@tomlocke.com}
12
12
  s.extra_rdoc_files = ["lib/hobo_fields/email_address.rb", "lib/hobo_fields/enum_string.rb", "lib/hobo_fields/field_declaration_dsl.rb", "lib/hobo_fields/field_spec.rb", "lib/hobo_fields/fields_declaration.rb", "lib/hobo_fields/html_string.rb", "lib/hobo_fields/markdown_string.rb", "lib/hobo_fields/migration_generator.rb", "lib/hobo_fields/model_extensions.rb", "lib/hobo_fields/password_string.rb", "lib/hobo_fields/raw_html_string.rb", "lib/hobo_fields/raw_markdown_string.rb", "lib/hobo_fields/sanitize_html.rb", "lib/hobo_fields/serialized_object.rb", "lib/hobo_fields/text.rb", "lib/hobo_fields/textile_string.rb", "lib/hobo_fields.rb", "lib/hobofields.rb", "LICENSE.txt", "README.txt"]
@@ -25,14 +25,14 @@ Gem::Specification.new do |s|
25
25
  s.specification_version = 2
26
26
 
27
27
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
- s.add_runtime_dependency(%q<hobosupport>, ["= 0.8.7"])
28
+ s.add_runtime_dependency(%q<hobosupport>, ["= 0.8.8"])
29
29
  s.add_runtime_dependency(%q<rails>, [">= 2.2.2"])
30
30
  else
31
- s.add_dependency(%q<hobosupport>, ["= 0.8.7"])
31
+ s.add_dependency(%q<hobosupport>, ["= 0.8.8"])
32
32
  s.add_dependency(%q<rails>, [">= 2.2.2"])
33
33
  end
34
34
  else
35
- s.add_dependency(%q<hobosupport>, ["= 0.8.7"])
35
+ s.add_dependency(%q<hobosupport>, ["= 0.8.8"])
36
36
  s.add_dependency(%q<rails>, [">= 2.2.2"])
37
37
  end
38
38
  end
data/lib/hobo_fields.rb CHANGED
@@ -9,7 +9,7 @@ end
9
9
 
10
10
  module HoboFields
11
11
 
12
- VERSION = "0.8.7"
12
+ VERSION = "0.8.8"
13
13
 
14
14
  extend self
15
15
 
@@ -4,8 +4,10 @@ class HoboMigrationGenerator < Rails::Generator::Base
4
4
  def initialize(runtime_args, runtime_options = {})
5
5
  super
6
6
  @migration_name = runtime_args.first || begin
7
- i = Dir["#{RAILS_ROOT}/db/migrate/*hobo_migration*"].length
8
- "hobo_migration_#{i+1}"
7
+ existing = Dir["#{RAILS_ROOT}/db/migrate/*hobo_migration*"]
8
+ max = existing.grep(/([0-9]+)\.rb$/) { $1.to_i }.max
9
+ n = max ? max + 1 : 1
10
+ "hobo_migration_#{n}"
9
11
  end
10
12
  end
11
13
 
@@ -109,6 +109,7 @@ The full set of available symbolic names is
109
109
 
110
110
  * `:integer`
111
111
  * `:float`
112
+ * `:decimal`
112
113
  * `:string`
113
114
  * `:text`
114
115
  * `:boolean`
@@ -56,9 +56,9 @@ This class defines the methods `to_html` to customize the way the type is render
56
56
  # Loud text always renderd in caps.
57
57
  # It's rude to shout too much so it's not allowed to be
58
58
  # longer than 100 characters
59
- class LoudText < String
59
+ class LoudText < DelegateClass(String)
60
60
 
61
- COLUMN_TYPE = :string
61
+ COLUMN_TYPE = :string
62
62
 
63
63
  HoboFields.register_type(:loud, self)
64
64
 
@@ -74,6 +74,13 @@ This class defines the methods `to_html` to customize the way the type is render
74
74
 
75
75
  That's all there is to it. Defining `to_html` and `validate` are optional, defining `COLUMN_TYPE` and calling `HoboFields.register_type` are not.
76
76
 
77
+ We use `DelegateClass` so that we can act like a string without actually being a string.
78
+
79
+ You can use `LoudText` in your model with
80
+
81
+ fields do
82
+ shout :loud
83
+ end
77
84
 
78
85
  ## Bundled types
79
86
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hobofields
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.7
4
+ version: 0.8.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Locke
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-14 00:00:00 +01:00
12
+ date: 2009-06-24 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.8.7
23
+ version: 0.8.8
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rails