hobofields 0.9.103 → 0.9.104
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 +3 -2
- data/lib/hobo_fields/migration_generator.rb +3 -1
- data/lib/hobo_fields.rb +9 -7
- data/rails/init.rb +9 -0
- data/test/hobofields.rdoctest +3 -3
- data/test/hobofields_api.rdoctest +1 -0
- data/test/migration_generator.rdoctest +3 -2
- data/test/migration_generator_primary_key.rdoctest +1 -0
- data/test/rich_types.rdoctest +1 -0
- metadata +4 -4
- data/init.rb +0 -4
data/Rakefile
CHANGED
|
@@ -3,7 +3,7 @@ require 'active_record'
|
|
|
3
3
|
ActiveRecord::ActiveRecordError # hack for https://rails.lighthouseapp.com/projects/8994/tickets/2577-when-using-activerecordassociations-outside-of-rails-a-nameerror-is-thrown
|
|
4
4
|
|
|
5
5
|
RUBY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']).sub(/.*\s.*/m, '"\&"')
|
|
6
|
-
RUBYDOCTEST = ENV['RUBYDOCTEST'] || "#{RUBY}
|
|
6
|
+
RUBYDOCTEST = ENV['RUBYDOCTEST'] || "#{RUBY} -S rubydoctest"
|
|
7
7
|
|
|
8
8
|
$:.unshift File.join(File.expand_path(File.dirname(__FILE__)), '/../hobofields/lib')
|
|
9
9
|
$:.unshift File.join(File.expand_path(File.dirname(__FILE__)), '/../hobosupport/lib')
|
|
@@ -13,7 +13,8 @@ require 'hobofields'
|
|
|
13
13
|
namespace "test" do
|
|
14
14
|
desc "Run the doctests"
|
|
15
15
|
task :doctest do |t|
|
|
16
|
-
|
|
16
|
+
files=Dir['test/*.rdoctest'].map {|f| File.expand_path(f)}.join(' ')
|
|
17
|
+
exit(1) if !system("#{RUBYDOCTEST} #{files}")
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
desc "Run the unit tests"
|
|
@@ -375,7 +375,9 @@ module HoboFields
|
|
|
375
375
|
end
|
|
376
376
|
|
|
377
377
|
def drop_index(table, name)
|
|
378
|
-
|
|
378
|
+
# see https://hobo.lighthouseapp.com/projects/8324/tickets/566
|
|
379
|
+
# for why the rescue exists
|
|
380
|
+
"remove_index :#{table}, :name => :#{name} rescue ActiveRecord::StatementInvalid"
|
|
379
381
|
end
|
|
380
382
|
|
|
381
383
|
def format_options(options, type, changing=false)
|
data/lib/hobo_fields.rb
CHANGED
|
@@ -9,7 +9,7 @@ end
|
|
|
9
9
|
|
|
10
10
|
module HoboFields
|
|
11
11
|
|
|
12
|
-
VERSION = "0.9.
|
|
12
|
+
VERSION = "0.9.104"
|
|
13
13
|
|
|
14
14
|
extend self
|
|
15
15
|
|
|
@@ -103,10 +103,15 @@ module HoboFields
|
|
|
103
103
|
# automatically load other rich types from app/rich_types/*.rb
|
|
104
104
|
# don't assume we're in a Rails app
|
|
105
105
|
if defined?(::Rails)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
plugins = Rails.configuration.plugin_loader.new(HoboFields.rails_initializer).plugins
|
|
107
|
+
([::Rails.root] + plugins.map(&:directory)).each do |dir|
|
|
108
|
+
ActiveSupport::Dependencies.load_paths << File.join(dir, 'app', 'rich_types')
|
|
109
|
+
Dir[File.join(dir, 'app', 'rich_types', '*.rb')].each do |f|
|
|
110
|
+
# TODO: should we complain if field_types doesn't get a new value? Might be useful to warn people if they're missing a register_type
|
|
111
|
+
require_dependency f
|
|
112
|
+
end
|
|
109
113
|
end
|
|
114
|
+
|
|
110
115
|
end
|
|
111
116
|
|
|
112
117
|
# Monkey patch ActiveRecord so that the attribute read & write methods
|
|
@@ -155,6 +160,3 @@ module HoboFields
|
|
|
155
160
|
end
|
|
156
161
|
|
|
157
162
|
end
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
HoboFields.enable if defined? ActiveRecord
|
data/rails/init.rb
ADDED
data/test/hobofields.rdoctest
CHANGED
|
@@ -62,9 +62,9 @@ The source lives on GitHub as part of the main Hobo repo:
|
|
|
62
62
|
|
|
63
63
|
- [http://github.com/tablatom/hobo](http://github.com/tablatom/hobo)
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
To use hobofields as a plugin is not as simple as it should be. You
|
|
66
|
+
will have to clone `git://github.com/tablatom/hobo` and then copy the
|
|
67
|
+
`hobofields` subdirectory into `/vendors/plugins`
|
|
68
68
|
|
|
69
69
|
## Rich Types
|
|
70
70
|
|
|
@@ -39,6 +39,7 @@ And we'll require:
|
|
|
39
39
|
|
|
40
40
|
>> require 'hobosupport'
|
|
41
41
|
>> require 'hobofields'
|
|
42
|
+
>> HoboFields.enable
|
|
42
43
|
|
|
43
44
|
## The migration generator -- introduction
|
|
44
45
|
|
|
@@ -275,7 +276,7 @@ foreign-key field. It also generates an index on the field.
|
|
|
275
276
|
=>
|
|
276
277
|
"remove_column :adverts, :category_id
|
|
277
278
|
|
|
278
|
-
remove_index :adverts, :name => :index_adverts_on_category_id"
|
|
279
|
+
remove_index :adverts, :name => :index_adverts_on_category_id rescue ActiveRecord::StatementInvalid"
|
|
279
280
|
|
|
280
281
|
Cleanup:
|
|
281
282
|
{.hidden}
|
|
@@ -571,7 +572,7 @@ Adding a subclass or two should introduce the 'type' column and no other changes
|
|
|
571
572
|
=>
|
|
572
573
|
"remove_column :adverts, :type
|
|
573
574
|
|
|
574
|
-
remove_index :adverts, :name => :index_adverts_on_type"
|
|
575
|
+
remove_index :adverts, :name => :index_adverts_on_type rescue ActiveRecord::StatementInvalid"
|
|
575
576
|
|
|
576
577
|
Cleanup
|
|
577
578
|
{.hidden}
|
data/test/rich_types.rdoctest
CHANGED
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.9.
|
|
4
|
+
version: 0.9.104
|
|
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:
|
|
12
|
+
date: 2010-01-21 00:00:00 -05:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -30,7 +30,7 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.9.
|
|
33
|
+
version: 0.9.104
|
|
34
34
|
version:
|
|
35
35
|
description:
|
|
36
36
|
email: tom@tomlocke.com
|
|
@@ -45,7 +45,6 @@ files:
|
|
|
45
45
|
- LICENSE.txt
|
|
46
46
|
- README.txt
|
|
47
47
|
- Rakefile
|
|
48
|
-
- init.rb
|
|
49
48
|
- lib/hobo_fields.rb
|
|
50
49
|
- lib/hobo_fields/email_address.rb
|
|
51
50
|
- lib/hobo_fields/enum_string.rb
|
|
@@ -66,6 +65,7 @@ files:
|
|
|
66
65
|
- lib/hobo_fields/text.rb
|
|
67
66
|
- lib/hobo_fields/textile_string.rb
|
|
68
67
|
- lib/hobofields.rb
|
|
68
|
+
- rails/init.rb
|
|
69
69
|
- rails_generators/hobo_migration/USAGE
|
|
70
70
|
- rails_generators/hobo_migration/hobo_migration_generator.rb
|
|
71
71
|
- rails_generators/hobo_migration/templates/migration.rb
|
data/init.rb
DELETED