schema_comments 0.1.4 → 0.2.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +23 -0
- data/Gemfile.lock +125 -0
- data/README.rdoc +9 -10
- data/Rakefile +31 -37
- data/VERSION +1 -1
- data/lib/annotate_models.rb +27 -25
- data/lib/hash_key_orderable.rb +1 -1
- data/lib/schema_comments/base.rb +9 -9
- data/lib/schema_comments/connection_adapters.rb +13 -8
- data/lib/schema_comments/migration.rb +2 -2
- data/lib/schema_comments/migrator.rb +2 -2
- data/lib/schema_comments/schema.rb +1 -1
- data/lib/schema_comments/schema_comment.rb +10 -10
- data/lib/schema_comments/schema_dumper.rb +15 -15
- data/lib/schema_comments.rb +9 -7
- data/schema_comments.gemspec +94 -98
- data/spec/annotate_models_spec.rb +3 -3
- data/spec/fake_app.rb +17 -0
- data/spec/hash_key_orderable_spec.rb +1 -1
- data/spec/i18n_export_spec.rb +7 -7
- data/spec/migrations/valid/001_create_products.rb +1 -1
- data/spec/schema_comments/connection_adapters_spec.rb +7 -7
- data/spec/schema_comments/schema_comment_spec.rb +4 -4
- data/spec/schema_comments/schema_comments.yml +3 -2
- data/spec/schema_comments/schema_dumper_spec.rb +11 -9
- data/spec/spec_helper.rb +27 -38
- data/spec/yaml_export_spec.rb +10 -10
- metadata +134 -52
- data/.gitignore +0 -5
data/spec/spec_helper.rb
CHANGED
@@ -1,51 +1,40 @@
|
|
1
|
-
$
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
require 'action_view'
|
18
|
-
require 'initializer'
|
19
|
-
|
20
|
-
require 'yaml'
|
21
|
-
begin
|
22
|
-
require 'yaml_waml'
|
23
|
-
rescue
|
24
|
-
$stderr.puts "yaml_waml not found. You should [sudo] gem install yaml_waml"
|
25
|
-
end
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
|
4
|
+
require 'rails'
|
5
|
+
require 'schema_comments'
|
6
|
+
# require 'database_cleaner'
|
7
|
+
|
8
|
+
# Ensure we use 'syck' instead of 'psych' in 1.9.2
|
9
|
+
# RubyGems >= 1.5.0 uses 'psych' on 1.9.2, but
|
10
|
+
# Psych does not yet support YAML 1.1 merge keys.
|
11
|
+
# Merge keys is often used in mongoid.yml
|
12
|
+
# See: http://redmine.ruby-lang.org/issues/show/4300
|
13
|
+
if RUBY_VERSION >= '1.9.2'
|
14
|
+
YAML::ENGINE.yamler = 'syck'
|
15
|
+
end
|
16
|
+
require 'yaml_waml'
|
26
17
|
|
27
|
-
|
28
|
-
ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), 'debug.log'))
|
29
|
-
ActionController::Base.logger = ActiveRecord::Base.logger
|
30
|
-
ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'sqlite3'])
|
18
|
+
require 'fake_app'
|
31
19
|
|
20
|
+
require 'rspec/rails'
|
32
21
|
|
33
|
-
|
22
|
+
# Requires supporting files with custom matchers and macros, etc,
|
23
|
+
# in ./support/ and its subdirectories.
|
24
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
25
|
+
|
26
|
+
RSpec.configure do |config|
|
34
27
|
|
35
28
|
%w(resources/models).each do |path|
|
36
29
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), path)
|
37
|
-
ActiveSupport::Dependencies.
|
30
|
+
ActiveSupport::Dependencies.autoload_paths << File.join(File.dirname(__FILE__), path)
|
38
31
|
end
|
39
32
|
Dir.glob("resources/**/*.rb") do |filename|
|
40
33
|
require filename
|
41
34
|
end
|
42
35
|
|
43
|
-
|
44
|
-
require File.join(File.dirname(__FILE__), '..', 'init')
|
45
|
-
|
46
|
-
|
47
|
-
MIGRATIONS_ROOT = File.join(File.dirname(__FILE__), 'migrations')
|
48
|
-
|
49
|
-
IGNORED_TABLES = %w(schema_migrations)
|
36
|
+
SchemaComments.setup
|
50
37
|
end
|
51
38
|
|
39
|
+
MIGRATIONS_ROOT = File.join(File.dirname(__FILE__), 'migrations')
|
40
|
+
|
data/spec/yaml_export_spec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require File.join(File.dirname(__FILE__), 'spec_helper')
|
3
3
|
|
4
4
|
describe SchemaComments::SchemaComment do
|
5
|
-
|
5
|
+
|
6
6
|
before(:each) do
|
7
7
|
SchemaComments.yaml_path = File.join(File.dirname(__FILE__), 'human_readable_schema_comments.yml')
|
8
8
|
FileUtils.rm(SchemaComments.yaml_path, :verbose => true) if File.exist?(SchemaComments.yaml_path)
|
@@ -19,7 +19,7 @@ describe SchemaComments::SchemaComment do
|
|
19
19
|
create_table(:person, :comment => '人') do |t|
|
20
20
|
t.string :name, :comment => '名前'
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
create_table(:addresses, :comment => '住所') do |t|
|
24
24
|
t.integer :person_id, :comment => '人'
|
25
25
|
t.text :descriptions, :comment => '記述'
|
@@ -30,23 +30,23 @@ describe SchemaComments::SchemaComment do
|
|
30
30
|
t.string :address, :comment => 'アドレス'
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
File.read(SchemaComments.yaml_path).split(/$/).map(&:strip).should == %{
|
35
|
-
---
|
36
|
-
table_comments:
|
35
|
+
---
|
36
|
+
table_comments:
|
37
37
|
addresses: "住所"
|
38
38
|
emails: "メール"
|
39
39
|
person: "人"
|
40
|
-
column_comments:
|
41
|
-
addresses:
|
40
|
+
column_comments:
|
41
|
+
addresses:
|
42
42
|
person_id: "人"
|
43
43
|
descriptions: "記述"
|
44
|
-
emails:
|
44
|
+
emails:
|
45
45
|
person_id: "人"
|
46
46
|
address: "アドレス"
|
47
|
-
person:
|
47
|
+
person:
|
48
48
|
name: "名前"
|
49
49
|
}.split(/$/).map(&:strip)
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
end
|
metadata
CHANGED
@@ -1,47 +1,126 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: schema_comments
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 4
|
9
|
-
version: 0.1.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0.alpha1
|
5
|
+
prerelease: 6
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- akimatter
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
date: 2012-04-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: &2168469280 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.1.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2168469280
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: activerecord
|
27
|
+
requirement: &2168468800 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.1.0
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2168468800
|
36
|
+
- !ruby/object:Gem::Dependency
|
21
37
|
name: rspec
|
38
|
+
requirement: &2168468320 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.8.0
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2168468320
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec-rails
|
49
|
+
requirement: &2168484960 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.8.1
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2168484960
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: yard
|
60
|
+
requirement: &2168484480 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0.7'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2168484480
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rdoc
|
71
|
+
requirement: &2168484000 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '3.12'
|
77
|
+
type: :development
|
22
78
|
prerelease: false
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
version: 1.
|
79
|
+
version_requirements: *2168484000
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: bundler
|
82
|
+
requirement: &2168483520 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 1.0.0
|
32
88
|
type: :development
|
33
|
-
|
34
|
-
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *2168483520
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: jeweler
|
93
|
+
requirement: &2168483040 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ~>
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 1.8.3
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *2168483040
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: simplecov
|
104
|
+
requirement: &2168482560 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *2168482560
|
113
|
+
description: schema_comments generates extra methods dynamically for attribute which
|
114
|
+
has options
|
35
115
|
email: akm2000@gmail.com
|
36
116
|
executables: []
|
37
|
-
|
38
117
|
extensions: []
|
39
|
-
|
40
|
-
extra_rdoc_files:
|
118
|
+
extra_rdoc_files:
|
41
119
|
- LICENSE.txt
|
42
120
|
- README.rdoc
|
43
|
-
files:
|
44
|
-
-
|
121
|
+
files:
|
122
|
+
- Gemfile
|
123
|
+
- Gemfile.lock
|
45
124
|
- LICENSE.txt
|
46
125
|
- README.rdoc
|
47
126
|
- Rakefile
|
@@ -63,6 +142,7 @@ files:
|
|
63
142
|
- spec/.gitignore
|
64
143
|
- spec/annotate_models_spec.rb
|
65
144
|
- spec/database.yml
|
145
|
+
- spec/fake_app.rb
|
66
146
|
- spec/fixtures/.gitignore
|
67
147
|
- spec/hash_key_orderable_spec.rb
|
68
148
|
- spec/i18n_export_spec.rb
|
@@ -92,38 +172,40 @@ files:
|
|
92
172
|
- spec/yaml_export_spec.rb
|
93
173
|
- tasks/annotate_models_tasks.rake
|
94
174
|
- tasks/schema_comments.rake
|
95
|
-
|
175
|
+
- spec/human_readable_schema_comments.yml
|
176
|
+
- spec/schema_comments/schema_comments.yml
|
177
|
+
- spec/schema_comments.yml
|
96
178
|
homepage: http://github.com/akm/schema_comments
|
97
|
-
licenses:
|
98
|
-
|
179
|
+
licenses:
|
180
|
+
- Ruby License
|
99
181
|
post_install_message:
|
100
|
-
rdoc_options:
|
101
|
-
|
102
|
-
require_paths:
|
182
|
+
rdoc_options: []
|
183
|
+
require_paths:
|
103
184
|
- lib
|
104
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
-
requirements:
|
113
|
-
- - ">="
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
segments:
|
185
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
187
|
+
requirements:
|
188
|
+
- - ! '>='
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
191
|
+
segments:
|
116
192
|
- 0
|
117
|
-
|
193
|
+
hash: 1307889187071139456
|
194
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
|
+
none: false
|
196
|
+
requirements:
|
197
|
+
- - ! '>'
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: 1.3.1
|
118
200
|
requirements: []
|
119
|
-
|
120
201
|
rubyforge_project:
|
121
|
-
rubygems_version: 1.
|
202
|
+
rubygems_version: 1.8.15
|
122
203
|
signing_key:
|
123
204
|
specification_version: 3
|
124
205
|
summary: schema_comments generates extra methods dynamically
|
125
|
-
test_files:
|
206
|
+
test_files:
|
126
207
|
- spec/annotate_models_spec.rb
|
208
|
+
- spec/fake_app.rb
|
127
209
|
- spec/hash_key_orderable_spec.rb
|
128
210
|
- spec/i18n_export_spec.rb
|
129
211
|
- spec/migration_spec.rb
|