pg_comment 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjI1NzkwMjU1OTMzZGJhOTZlMDdmNjUxZGVhNDM3OGMyMzg1ODQ4Mw==
4
+ NGMxNWZlYjYzM2FhOTkyYjQyYmVjMjk4NDM3NTQyY2EyMWJmODFmZg==
5
5
  data.tar.gz: !binary |-
6
- MmNjZTE3M2ExY2Q4NzFmZTQ5NzQ3YTJjYTQ0MTBjZTRjMGZmMDNiOQ==
6
+ NzY1MDg5OGMxOTVhOTBkMDk4MzZkZmVjNjlkYTk5ZDQ4NzdiNmI3ZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MDFjYzM4OTk2YTRjMjQxYTkzOTE2OTk0ZWQwNjYyZjljOWU2MTYxMzM4YjE5
10
- MWQ3NWM3YzY3ODgwY2ExYmYyYzBlMmFjNTMyOGEyZmVhMDVkMGJhNmFmNTUx
11
- ZDc5YmU2MDk4ZWJiYzU4Mzc3MGQ1NmI3NTliMWI3NGM1ZDU2YjA=
9
+ YmEyYWMwZWViNmI5ZTYxYzk1MDY2ZTRmMzFlYzk4YmY0ZDM1ODNkMjljMjg0
10
+ ZjNjZjdiZTcxMmQ3NjU0MWFiOWQ0YzM4MWU3YjljMjEzMTRmYjYyYWU3YWVj
11
+ ZmFjY2FlNjAzYzFhZDY1MmRjZGM0NmZiMTQ3ZTBmOTZhNjc1MTQ=
12
12
  data.tar.gz: !binary |-
13
- ZmY2NDg4NTEyNzRiNTJjZTI1M2E1NDFhNGRiMGIyMzc4MGIwZDJkM2VmMDgx
14
- YjI4Y2UyZWEzN2Y0NDM5YjdiYWRjODFjM2RmYjFkZDg2NjU2N2NkYTRmYTRh
15
- MGZkNDM2YTBiZDRkMTJlOThjNTUyZjQ2NGQzYzc1YzU0MDRkMjE=
13
+ NDkwYzc3NGU1YzEwNTNhNDA4NDZhYjRkZjY0ZmRjNTY3MGViYjNjNjE1MTAw
14
+ MTVkYzI0YWExYjJjNjE4Mjc2NzJhYjAxZmM3NTY1N2FkNGVkYzI0N2Q3ODk3
15
+ Yzc3Y2ZlMTdmMTc5MjViZTBlMzM2ZmJiNDJkZTYwYzNhYjA3Zjk=
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ before_script:
3
+ - psql -c "create database pg_comment_dummy_test;" -U postgres
4
+ - 'bundle exec rake -T'
5
+ script: 'bundle exec rake spec --trace'
6
+ rvm:
7
+ - 1.9.3
data/Gemfile CHANGED
@@ -3,6 +3,8 @@ source "http://rubygems.org"
3
3
  # Specify your gem's dependencies in pg_comment.gemspec
4
4
  gemspec
5
5
 
6
+ gem 'rspec-rails'
7
+
6
8
  group :test do
7
9
  gem 'simplecov', :require => false
8
10
  end
data/README.markdown CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  https://github.com/albertosaurus/pg_comment
4
4
 
5
+ [![Build Status](https://travis-ci.org/albertosaurus/pg_comment.png)](https://travis-ci.org/albertosaurus/pg_comment)
6
+ [![Code Climate](https://codeclimate.com/github/albertosaurus/pg_comment.png)](https://codeclimate.com/github/albertosaurus/pg_comment)
7
+
5
8
  In any PostgreSQL database where the Rails app is not the only consumer, it is very helpful to have comments
6
9
  on the various elements of the schema. PgComment extends the migrations DSL with methods to set and remove
7
10
  comments on columns, tables and indexes. It also dumps those comments into your schema.rb.
@@ -100,4 +103,4 @@ end
100
103
 
101
104
  Copyright (c) 2011-2013 Arthur Shagall, Mindflight, Inc.
102
105
 
103
- Released under the MIT License. See LICENSE for details.
106
+ Released under the MIT License. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,6 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
3
  APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
4
+ puts "Loading app rakefile at #{APP_RAKEFILE}"
4
5
  load 'rails/tasks/engine.rake'
5
6
 
6
7
  desc 'Run specs'
@@ -75,6 +75,7 @@ SELECT c.relname AS index_name, d.description AS comment
75
75
  FROM pg_description d
76
76
  JOIN pg_class c ON c.oid = d.objoid
77
77
  WHERE c.relkind = 'i'
78
+ ORDER BY index_name
78
79
  }
79
80
  com.inject({}) do |hash, row|
80
81
  hash[row['index_name']] = row['comment']
@@ -11,6 +11,12 @@ module PgComment
11
11
  @connection.tables.sort.each do |table_name|
12
12
  dump_comments(table_name, stream)
13
13
  end
14
+
15
+ unless (index_comments = @connection.index_comments).empty?
16
+ index_comments.each_pair do |index_name, comment|
17
+ stream.puts " set_index_comment '#{index_name}', '#{comment.gsub(/'/, "\\\\'")}'"
18
+ end
19
+ end
14
20
  end
15
21
 
16
22
  def dump_comments(table_name, stream)
@@ -29,12 +35,6 @@ module PgComment
29
35
  stream.puts comment_statements.join("\n")
30
36
  stream.puts
31
37
  end
32
-
33
- unless (index_comments = @connection.index_comments).empty?
34
- index_comments.each_pair do |index_name, comment|
35
- stream.puts " set_index_comment '#{index_name}', '#{comment.gsub(/'/, "\\\\'")}'"
36
- end
37
- end
38
38
  end
39
39
  private :dump_comments
40
40
  end
@@ -1,3 +1,3 @@
1
1
  module PgComment
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
@@ -21,7 +21,6 @@ ActiveRecord::Schema.define(:version => 20130502030557) do
21
21
 
22
22
  add_index "vegetables", ["name"], :name => "index_vegetables_on_name", :unique => true
23
23
 
24
- set_index_comment 'index_vegetables_on_name', 'Comment on index'
25
24
  set_table_comment 'vegetables', 'Healthy and delicious'
26
25
  set_column_comment 'vegetables', 'name', 'The name of the vegetable'
27
26
  set_column_comment 'vegetables', 'price', 'vegetable cost'
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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arthur Shagall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-02 00:00:00.000000000 Z
11
+ date: 2013-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -76,6 +76,7 @@ extra_rdoc_files: []
76
76
  files:
77
77
  - .gitignore
78
78
  - .rspec
79
+ - .travis.yml
79
80
  - Gemfile
80
81
  - LICENSE
81
82
  - README.markdown