pg_comment 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.gitignore +2 -1
- data/.rspec +4 -2
- data/Gemfile +5 -0
- data/README.markdown +22 -0
- data/Rakefile +4 -5
- data/lib/pg_comment.rb +18 -14
- data/lib/pg_comment/connection_adapters/abstract/schema_definitions.rb +3 -2
- data/lib/pg_comment/connection_adapters/abstract/schema_statements.rb +4 -2
- data/lib/pg_comment/connection_adapters/postgresql_adapter.rb +64 -9
- data/lib/pg_comment/engine.rb +12 -3
- data/lib/pg_comment/migration/command_recorder.rb +16 -8
- data/lib/pg_comment/schema_dumper.rb +11 -2
- data/lib/pg_comment/version.rb +2 -1
- data/pg_comment.gemspec +3 -3
- data/spec/lib/pg_comment/connection_adapters/abstract/schema_statements_spec.rb +3 -3
- data/spec/lib/pg_comment/connection_adapters/postgresql_adapter_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -1
- metadata +15 -14
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
YmEyYWMwZWViNmI5ZTYxYzk1MDY2ZTRmMzFlYzk4YmY0ZDM1ODNkMjljMjg0
|
10
|
-
ZjNjZjdiZTcxMmQ3NjU0MWFiOWQ0YzM4MWU3YjljMjEzMTRmYjYyYWU3YWVj
|
11
|
-
ZmFjY2FlNjAzYzFhZDY1MmRjZGM0NmZiMTQ3ZTBmOTZhNjc1MTQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NDkwYzc3NGU1YzEwNTNhNDA4NDZhYjRkZjY0ZmRjNTY3MGViYjNjNjE1MTAw
|
14
|
-
MTVkYzI0YWExYjJjNjE4Mjc2NzJhYjAxZmM3NTY1N2FkNGVkYzI0N2Q3ODk3
|
15
|
-
Yzc3Y2ZlMTdmMTc5MjViZTBlMzM2ZmJiNDJkZTYwYzNhYjA3Zjk=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2cd7ec32d81c13b03d5ca3a04aa42bbe7b2f3990
|
4
|
+
data.tar.gz: 365f10c5ed8754eaf6c5f2ac660fb3c0a246ae75
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d5982039c216c0035c73c8f23247c305a7085d5acc0055500b15148d7a1707f8e847fa9c3b6c873a03c9f422f1edb523daf185e11b0b67f352f83268aedefc00
|
7
|
+
data.tar.gz: 9ad813903ea33a6aedfd39d7065e3ec6f8c8b5f20275b5fa7156e4ab537269d5d29d102c8e627431ca378398489ee4af45d923d0a5bfc6aa248d0ed61adac75f
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/Gemfile
CHANGED
@@ -3,8 +3,13 @@ source "http://rubygems.org"
|
|
3
3
|
# Specify your gem's dependencies in pg_comment.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
+
# Necessary, otherwise Travis:CI gets confused.
|
6
7
|
gem 'rspec-rails'
|
7
8
|
|
9
|
+
group :development do
|
10
|
+
gem 'yard'
|
11
|
+
end
|
12
|
+
|
8
13
|
group :test do
|
9
14
|
gem 'simplecov', :require => false
|
10
15
|
end
|
data/README.markdown
CHANGED
@@ -99,6 +99,28 @@ change_table :phone_numbers do |t|
|
|
99
99
|
end
|
100
100
|
```
|
101
101
|
|
102
|
+
## Testing
|
103
|
+
|
104
|
+
Install the development dependencies (you will need to compile the native dependencies
|
105
|
+
for Postgres, so make sure your development environment is set up)
|
106
|
+
|
107
|
+
bundle install
|
108
|
+
|
109
|
+
Modify the credentials in `spec/dummy/config/database.yml` as needed, then run specs.
|
110
|
+
|
111
|
+
bundle exec rake spec
|
112
|
+
|
113
|
+
Test coverage (as measured by SimpleCov) should be 100%
|
114
|
+
|
115
|
+
## Contributions
|
116
|
+
|
117
|
+
Contributions are welcome and appreciated. However, before you submit your pull request, please be sure to do the
|
118
|
+
following:
|
119
|
+
|
120
|
+
* Make sure all specs pass.
|
121
|
+
* Make sure you have test coverage for any new features; run `bundle exec rake spec`
|
122
|
+
* Make sure any new code has RDoc comments; run `bundle exec yard stats --list-undoc`
|
123
|
+
|
102
124
|
## License
|
103
125
|
|
104
126
|
Copyright (c) 2011-2013 Arthur Shagall, Mindflight, Inc.
|
data/Rakefile
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
2
|
|
3
|
-
APP_RAKEFILE = File.expand_path(
|
4
|
-
puts "Loading app rakefile at #{APP_RAKEFILE}"
|
3
|
+
APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
|
5
4
|
load 'rails/tasks/engine.rake'
|
6
5
|
|
7
6
|
desc 'Run specs'
|
8
|
-
task 'spec' => ['db:drop', 'db:create', 'db:migrate', 'app:spec']
|
7
|
+
task 'spec' => ['db:drop', 'db:create', 'db:migrate', 'app:db:test:load', 'app:spec']
|
9
8
|
task :default => :spec
|
10
9
|
|
11
10
|
def gemspec
|
@@ -34,7 +33,7 @@ namespace :git do
|
|
34
33
|
sh "git tag -a #{gem_version_tag} -m \"Version #{gem_version}\""
|
35
34
|
end
|
36
35
|
|
37
|
-
desc
|
36
|
+
desc 'Push git tag to GitHub'
|
38
37
|
task :push_tags do
|
39
38
|
sh 'git push --tags'
|
40
39
|
end
|
data/lib/pg_comment.rb
CHANGED
@@ -1,23 +1,27 @@
|
|
1
|
-
require
|
1
|
+
require 'rails'
|
2
|
+
require 'pg_comment/version'
|
2
3
|
require 'active_support/all'
|
3
4
|
|
5
|
+
# In any PostgreSQL database where the Rails app is not the only consumer, it
|
6
|
+
# is very helpful to have comments on the various elements of the schema.
|
7
|
+
# PgComment extends the migrations DSL with methods to set and remove comments
|
8
|
+
# on columns, tables and indexes. It also dumps those comments into your
|
9
|
+
# schema.rb.
|
4
10
|
module PgComment
|
5
|
-
extend ActiveSupport::Autoload
|
6
|
-
autoload :Adapter
|
7
|
-
autoload :SchemaDumper
|
8
11
|
|
9
|
-
module ConnectionAdapters
|
10
|
-
extend ActiveSupport::Autoload
|
11
|
-
|
12
|
-
autoload_under 'abstract' do
|
13
|
-
autoload :SchemaDefinitions
|
14
|
-
autoload :SchemaStatements
|
15
|
-
end
|
12
|
+
module ConnectionAdapters # :nodoc:
|
16
13
|
end
|
17
14
|
|
18
|
-
module Migration
|
19
|
-
autoload :CommandRecorder, 'pg_comment/migration/command_recorder'
|
15
|
+
module Migration # :nodoc:
|
20
16
|
end
|
21
17
|
end
|
22
18
|
|
23
|
-
|
19
|
+
if defined?(Rails)
|
20
|
+
require 'pg_comment/schema_dumper'
|
21
|
+
require 'pg_comment/migration/command_recorder'
|
22
|
+
require 'pg_comment/connection_adapters/abstract/schema_definitions'
|
23
|
+
require 'pg_comment/connection_adapters/abstract/schema_statements'
|
24
|
+
require 'pg_comment/connection_adapters/postgresql_adapter'
|
25
|
+
|
26
|
+
require 'pg_comment/engine'
|
27
|
+
end
|
@@ -1,13 +1,14 @@
|
|
1
1
|
module PgComment
|
2
2
|
module ConnectionAdapters
|
3
|
-
module SchemaDefinitions
|
4
|
-
def self.included(base)
|
3
|
+
module SchemaDefinitions # :nodoc:
|
4
|
+
def self.included(base) # :nodoc:
|
5
5
|
base::Table.class_eval do
|
6
6
|
include PgComment::ConnectionAdapters::Table
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
+
# Extensions to ActiveRecord::ConnectionAdapters::Table
|
11
12
|
module Table
|
12
13
|
extend ActiveSupport::Concern
|
13
14
|
|
@@ -1,15 +1,17 @@
|
|
1
1
|
module PgComment
|
2
2
|
module ConnectionAdapters
|
3
|
-
module SchemaStatements
|
4
|
-
def self.included(base)
|
3
|
+
module SchemaStatements # :nodoc:
|
4
|
+
def self.included(base) # :nodoc:
|
5
5
|
base::AbstractAdapter.class_eval do
|
6
6
|
include PgComment::ConnectionAdapters::AbstractAdapter
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
+
# PgComment method stubs for the abstract connection adapter
|
11
12
|
module AbstractAdapter
|
12
13
|
|
14
|
+
# Returns false (default use case)
|
13
15
|
def supports_comments?
|
14
16
|
false
|
15
17
|
end
|
@@ -1,47 +1,107 @@
|
|
1
1
|
module PgComment
|
2
2
|
module ConnectionAdapters
|
3
|
+
|
4
|
+
# Implementation of the comment methods
|
3
5
|
module PostgreSQLAdapter
|
6
|
+
|
7
|
+
# Returns +true+, Postgres supports comments
|
4
8
|
def supports_comments?
|
5
9
|
true
|
6
10
|
end
|
7
11
|
|
12
|
+
# Sets a comment on the given table.
|
13
|
+
#
|
14
|
+
# ===== Example
|
15
|
+
# ====== Creating a comment on phone_numbers table
|
16
|
+
# set_table_comment :phone_numbers, 'This table stores phone numbers that conform to the North American Numbering Plan.'
|
17
|
+
#
|
18
|
+
# @param [String, Symbol] table_name
|
19
|
+
# @param [String, Symbol] comment
|
8
20
|
def set_table_comment(table_name, comment)
|
9
21
|
sql = "COMMENT ON TABLE #{quote_table_name(table_name)} IS $$#{comment}$$;"
|
10
22
|
execute sql
|
11
23
|
end
|
12
24
|
|
25
|
+
# Sets a comment on a given column of a given table.
|
26
|
+
#
|
27
|
+
# ===== Example
|
28
|
+
# ====== Creating a comment on npa column of table phone_numbers
|
29
|
+
# set_column_comment :phone_numbers, :npa, 'Numbering Plan Area Code - Allowed ranges: [2-9] for first digit, [0-9] for second and third digit.'
|
30
|
+
#
|
31
|
+
# @param [String, Symbol] table_name
|
32
|
+
# @param [String, Symbol] column_name
|
33
|
+
# @param [String, Symbol] comment
|
13
34
|
def set_column_comment(table_name, column_name, comment)
|
14
35
|
sql = "COMMENT ON COLUMN #{quote_table_name(table_name)}.#{quote_column_name(column_name)} IS $$#{comment}$$;"
|
15
36
|
execute sql
|
16
37
|
end
|
17
38
|
|
39
|
+
# Sets comments on multiple columns. 'comments' is a hash of column_name => comment pairs.
|
40
|
+
#
|
41
|
+
# ===== Example
|
42
|
+
# ====== Setting comments on the columns of the phone_numbers table
|
43
|
+
# set_column_comments :phone_numbers, :npa => 'Numbering Plan Area Code - Allowed ranges: [2-9] for first digit, [0-9] for second and third digit.',
|
44
|
+
# :nxx => 'Central Office Number'
|
45
|
+
#
|
46
|
+
# @param [String, Symbol] table_name
|
47
|
+
# @param [Hash<Symbol, String>] comments
|
18
48
|
def set_column_comments(table_name, comments)
|
19
49
|
comments.each_pair do |column_name, comment|
|
20
50
|
set_column_comment table_name, column_name, comment
|
21
51
|
end
|
22
52
|
end
|
23
53
|
|
54
|
+
# Removes any comment from the given table.
|
55
|
+
#
|
56
|
+
# ===== Example
|
57
|
+
# ====== Removing comment from phone numbers table
|
58
|
+
# remove_table_comment :phone_numbers
|
59
|
+
#
|
60
|
+
# @param [String, Symbol] table_name
|
24
61
|
def remove_table_comment(table_name)
|
25
62
|
sql = "COMMENT ON TABLE #{quote_table_name(table_name)} IS NULL;"
|
26
63
|
execute sql
|
27
64
|
end
|
28
65
|
|
66
|
+
# Removes any comment from the given column of a given table.
|
67
|
+
#
|
68
|
+
# ===== Example
|
69
|
+
# ====== Removing comment from the npa column of table phone_numbers
|
70
|
+
# remove_column_comment :phone_numbers, :npa
|
71
|
+
#
|
72
|
+
# @param [String, Symbol] table_name
|
73
|
+
# @param [String, Symbol] column_name
|
29
74
|
def remove_column_comment(table_name, column_name)
|
30
75
|
sql = "COMMENT ON COLUMN #{quote_table_name(table_name)}.#{quote_column_name(column_name)} IS NULL;"
|
31
76
|
execute sql
|
32
77
|
end
|
33
78
|
|
79
|
+
# Removes any comment from the given columns of a given table.
|
80
|
+
#
|
81
|
+
# ===== Example
|
82
|
+
# ====== Removing comment from the npa and nxx columns of table phone_numbers
|
83
|
+
# remove_column_comments :phone_numbers, :npa, :nxx
|
84
|
+
#
|
85
|
+
# @param [String, Symbol] table_name
|
86
|
+
# @param [*String] column_names
|
34
87
|
def remove_column_comments(table_name, *column_names)
|
35
88
|
column_names.each do |column_name|
|
36
89
|
remove_column_comment table_name, column_name
|
37
90
|
end
|
38
91
|
end
|
39
92
|
|
93
|
+
# Sets the comment on the given index
|
94
|
+
#
|
95
|
+
# @param [String, Symbol] index_name
|
96
|
+
# @param [String, Symbol] comment
|
40
97
|
def set_index_comment(index_name, comment)
|
41
98
|
sql = "COMMENT ON INDEX #{quote_string(index_name)} IS $$#{comment}$$;"
|
42
99
|
execute sql
|
43
100
|
end
|
44
101
|
|
102
|
+
# Removes the comment from the given index
|
103
|
+
#
|
104
|
+
# @param [String, Symbol] index_name
|
45
105
|
def remove_index_comment(index_name)
|
46
106
|
sql = "COMMENT ON INDEX #{quote_string(index_name)} IS NULL;"
|
47
107
|
execute sql
|
@@ -56,6 +116,9 @@ LEFT OUTER JOIN pg_attribute a ON c.oid = a.attrelid AND a.attnum = d.objsubid
|
|
56
116
|
WHERE c.relkind = 'r'
|
57
117
|
ORDER BY c.relname
|
58
118
|
=end
|
119
|
+
|
120
|
+
# Loads the comments for the given table from the database
|
121
|
+
# @param [String, Symbol] table_name
|
59
122
|
def comments(table_name)
|
60
123
|
com = select_all %{
|
61
124
|
SELECT a.attname AS column_name, d.description AS comment
|
@@ -69,6 +132,7 @@ WHERE c.relkind = 'r' AND c.relname = '#{table_name}'
|
|
69
132
|
end
|
70
133
|
end
|
71
134
|
|
135
|
+
# Loads index comments from the database
|
72
136
|
def index_comments
|
73
137
|
com = select_all %{
|
74
138
|
SELECT c.relname AS index_name, d.description AS comment
|
@@ -85,12 +149,3 @@ ORDER BY index_name
|
|
85
149
|
end
|
86
150
|
end
|
87
151
|
end
|
88
|
-
|
89
|
-
[:PostgreSQLAdapter, :JdbcAdapter].each do |adapter|
|
90
|
-
begin
|
91
|
-
ActiveRecord::ConnectionAdapters.const_get(adapter).class_eval do
|
92
|
-
include PgComment::ConnectionAdapters::PostgreSQLAdapter
|
93
|
-
end
|
94
|
-
rescue
|
95
|
-
end
|
96
|
-
end
|
data/lib/pg_comment/engine.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
module PgComment
|
2
|
+
|
3
|
+
# PgComment engine. See docs on Rails engines.
|
2
4
|
class Engine < Rails::Engine
|
3
5
|
initializer 'pg_comment.load_adapter' do
|
4
6
|
ActiveSupport.on_load :active_record do
|
@@ -18,10 +20,17 @@ module PgComment
|
|
18
20
|
end
|
19
21
|
|
20
22
|
conf_name = ActiveRecord::Base.connection_pool.spec.config[:adapter]
|
21
|
-
if conf_name == 'postgresql'
|
22
|
-
|
23
|
+
if conf_name == 'postgresql' || conf_name == "postgis"
|
24
|
+
["PostGISAdapter::MainAdapter", "PostgreSQLAdapter", "JdbcAdapter"].each do |adapter|
|
25
|
+
begin
|
26
|
+
::ActiveRecord::ConnectionAdapters.const_get(adapter).class_eval do
|
27
|
+
include ::PgComment::ConnectionAdapters::PostgreSQLAdapter
|
28
|
+
end
|
29
|
+
rescue
|
30
|
+
end
|
31
|
+
end
|
23
32
|
end
|
24
33
|
end
|
25
34
|
end
|
26
35
|
end
|
27
|
-
end
|
36
|
+
end
|
@@ -1,54 +1,62 @@
|
|
1
1
|
module PgComment
|
2
2
|
module Migration
|
3
|
+
|
4
|
+
# PgComment methods for the migration command recorder. This allows
|
5
|
+
# comment methods to be used in "change" type migrations.
|
3
6
|
module CommandRecorder
|
4
|
-
|
7
|
+
|
8
|
+
def set_table_comment(*args) # :nodoc:
|
5
9
|
record(:set_table_comment, args)
|
6
10
|
end
|
7
11
|
|
8
|
-
def remove_table_comment(*args)
|
12
|
+
def remove_table_comment(*args) # :nodoc:
|
9
13
|
record(:remove_table_comment, args)
|
10
14
|
end
|
11
15
|
|
12
|
-
def set_column_comment(*args)
|
16
|
+
def set_column_comment(*args) # :nodoc:
|
13
17
|
record(:set_column_comment, args)
|
14
18
|
end
|
15
19
|
|
16
|
-
def set_column_comments(*args)
|
20
|
+
def set_column_comments(*args) # :nodoc:
|
17
21
|
record(:set_column_comments, args)
|
18
22
|
end
|
19
23
|
|
20
|
-
def remove_column_comment(*args)
|
24
|
+
def remove_column_comment(*args) # :nodoc:
|
21
25
|
record(:remove_column_comment, args)
|
22
26
|
end
|
23
27
|
|
24
|
-
def remove_column_comments(*args)
|
28
|
+
def remove_column_comments(*args) # :nodoc:
|
25
29
|
record(:remove_column_comments, args)
|
26
30
|
end
|
27
31
|
|
28
|
-
def set_index_comment(*args)
|
32
|
+
def set_index_comment(*args) # :nodoc:
|
29
33
|
record(:set_index_comment, args)
|
30
34
|
end
|
31
35
|
|
32
|
-
def remove_index_comment(*args)
|
36
|
+
def remove_index_comment(*args) # :nodoc:
|
33
37
|
record(:remove_index_comment, args)
|
34
38
|
end
|
35
39
|
|
40
|
+
# remove_table_comment
|
36
41
|
def invert_set_table_comment(args)
|
37
42
|
table_name = args.first
|
38
43
|
[:remove_table_comment, [table_name]]
|
39
44
|
end
|
40
45
|
|
46
|
+
# remove_column_comment
|
41
47
|
def invert_set_column_comment(args)
|
42
48
|
table_name = args[0]
|
43
49
|
column_name = args[1]
|
44
50
|
[:remove_column_comment, [table_name, column_name]]
|
45
51
|
end
|
46
52
|
|
53
|
+
# remove_column_comments
|
47
54
|
def invert_set_column_comments(args)
|
48
55
|
i_args = [args[0]] + args[1].collect{|name, _| name }
|
49
56
|
[:remove_column_comments, i_args]
|
50
57
|
end
|
51
58
|
|
59
|
+
# remove_index_comment
|
52
60
|
def invert_set_index_comment(args)
|
53
61
|
index_name = args.first
|
54
62
|
[:remove_index_comment, [index_name]]
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module PgComment
|
2
|
+
# Extensions to the Rails schema dumper
|
2
3
|
module SchemaDumper
|
3
4
|
extend ActiveSupport::Concern
|
4
5
|
|
@@ -6,6 +7,7 @@ module PgComment
|
|
6
7
|
alias_method_chain :tables, :comments
|
7
8
|
end
|
8
9
|
|
10
|
+
# Support for dumping comments
|
9
11
|
def tables_with_comments(stream)
|
10
12
|
tables_without_comments(stream)
|
11
13
|
@connection.tables.sort.each do |table_name|
|
@@ -14,16 +16,17 @@ module PgComment
|
|
14
16
|
|
15
17
|
unless (index_comments = @connection.index_comments).empty?
|
16
18
|
index_comments.each_pair do |index_name, comment|
|
17
|
-
stream.puts " set_index_comment '#{index_name}', '#{comment
|
19
|
+
stream.puts " set_index_comment '#{index_name}', '#{format_comment(comment)}'"
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
24
|
+
# Dumps the comments on a particular table to the stream.
|
22
25
|
def dump_comments(table_name, stream)
|
23
26
|
unless (comments = @connection.comments(table_name)).empty?
|
24
27
|
comment_statements = comments.map do |row|
|
25
28
|
column_name = row[0]
|
26
|
-
comment = row[1]
|
29
|
+
comment = format_comment(row[1])
|
27
30
|
if column_name
|
28
31
|
" set_column_comment '#{table_name}', '#{column_name}', '#{comment}'"
|
29
32
|
else
|
@@ -37,5 +40,11 @@ module PgComment
|
|
37
40
|
end
|
38
41
|
end
|
39
42
|
private :dump_comments
|
43
|
+
|
44
|
+
# Escape out single quotes from comments
|
45
|
+
def format_comment(comment)
|
46
|
+
comment.gsub(/'/, "\\\\'")
|
47
|
+
end
|
48
|
+
private :format_comment
|
40
49
|
end
|
41
50
|
end
|
data/lib/pg_comment/version.rb
CHANGED
data/pg_comment.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.email = ["arthur.shagall@gmail.com"]
|
10
10
|
s.homepage = "https://github.com/albertosaurus/pg_comment"
|
11
11
|
s.summary = 'Postgres Comments for Rails'
|
12
|
-
s.description = 'Extends Rails migrations to support setting column and table comments.
|
12
|
+
s.description = 'Extends Rails migrations to support setting column and table comments. Pulls out comments into schema.rb'
|
13
13
|
|
14
14
|
s.rubyforge_project = "pg_comment"
|
15
15
|
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
21
|
s.add_dependency('activerecord', '~> 3.0')
|
22
|
-
s.
|
22
|
+
s.add_dependency('rails', '~> 3.2')
|
23
23
|
s.add_development_dependency('pg')
|
24
|
-
s.add_development_dependency('rspec-rails')
|
24
|
+
s.add_development_dependency('rspec-rails', '~> 3.4')
|
25
25
|
end
|
@@ -9,7 +9,7 @@ describe PgComment::ConnectionAdapters::AbstractAdapter do
|
|
9
9
|
let(:adapter_stub){ AbstractAdapterStub.new }
|
10
10
|
|
11
11
|
it 'should not support comments by default' do
|
12
|
-
adapter_stub.supports_comments
|
12
|
+
expect(adapter_stub.supports_comments?).to eq(false)
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'should define method stubs for comment methods' do
|
@@ -20,6 +20,6 @@ describe PgComment::ConnectionAdapters::AbstractAdapter do
|
|
20
20
|
:remove_column_comment,
|
21
21
|
:remove_column_comments,
|
22
22
|
:set_index_comment,
|
23
|
-
:remove_index_comment ].each { |method_name| adapter_stub.respond_to?(method_name).
|
23
|
+
:remove_index_comment ].each { |method_name| expect(adapter_stub.respond_to?(method_name)).to eq(true) }
|
24
24
|
end
|
25
|
-
end
|
25
|
+
end
|
@@ -16,7 +16,7 @@ describe PgComment::ConnectionAdapters::PostgreSQLAdapter do
|
|
16
16
|
let(:connection){ ConnectionStub.new }
|
17
17
|
|
18
18
|
it 'should support comments' do
|
19
|
-
connection.supports_comments
|
19
|
+
expect(connection.supports_comments?).to eq(true)
|
20
20
|
end
|
21
21
|
|
22
22
|
context 'comment methods' do
|
@@ -60,4 +60,4 @@ describe PgComment::ConnectionAdapters::PostgreSQLAdapter do
|
|
60
60
|
connection.remove_index_comment :foo
|
61
61
|
end
|
62
62
|
end
|
63
|
-
end
|
63
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -7,8 +7,9 @@ unless ENV['TRAVIS']
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
require File.expand_path("../dummy/config/environment
|
10
|
+
require File.expand_path("../dummy/config/environment", __FILE__)
|
11
11
|
require 'rspec/rails'
|
12
|
+
require 'pg_comment'
|
12
13
|
|
13
14
|
RSpec.configure do |config|
|
14
15
|
config.mock_with :rspec
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_comment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arthur Shagall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.2'
|
34
|
-
type: :
|
34
|
+
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
@@ -42,32 +42,32 @@ dependencies:
|
|
42
42
|
name: pg
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec-rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '3.4'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
69
|
-
description: Extends Rails migrations to support setting column and table comments.
|
70
|
-
out comments into schema.rb
|
68
|
+
version: '3.4'
|
69
|
+
description: Extends Rails migrations to support setting column and table comments.
|
70
|
+
Pulls out comments into schema.rb
|
71
71
|
email:
|
72
72
|
- arthur.shagall@gmail.com
|
73
73
|
executables: []
|
@@ -139,18 +139,19 @@ require_paths:
|
|
139
139
|
- lib
|
140
140
|
required_ruby_version: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
|
-
- -
|
142
|
+
- - '>='
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
146
|
requirements:
|
147
|
-
- -
|
147
|
+
- - '>='
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
151
|
rubyforge_project: pg_comment
|
152
|
-
rubygems_version: 2.
|
152
|
+
rubygems_version: 2.2.2
|
153
153
|
signing_key:
|
154
154
|
specification_version: 4
|
155
155
|
summary: Postgres Comments for Rails
|
156
156
|
test_files: []
|
157
|
+
has_rdoc:
|