ahnnotate 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c932b95899f0bc90dfe57b0481f976ed98aeb4981e61bce5e03d4efaf3cb8c07
4
- data.tar.gz: fcacaac6f5719affb613cd96028d77321bcc156fed75514c7414c5ba04002290
3
+ metadata.gz: d14bcad2d733058ad421c5e107460aed3db606df535cb805f8cc8637f475edee
4
+ data.tar.gz: e5dc4b278e7a2088d79dc21901558e81f4b028c58671c3dddff9957c1e36804c
5
5
  SHA512:
6
- metadata.gz: 5f44bb30bf66d538f3e2416b4013354b8512f651cef5c07f3950aeae71063666a02a9638ba3e7b8edf01a2ef841e127dcca7dd7384acee81e7d2a81415043ef5
7
- data.tar.gz: b81a860aa49609ee8942e3e9b17ede7891b75e5cbcb2938e64d231b3e8fb411acfb8d96f50109651f6c9123489d13354319024661efa2d16735ccf9ac7799fb2
6
+ metadata.gz: 6713b0fd862f104a971faf98e643806ed1860599caab15e26d925451a9b75f56f406a3208c382aabd995d8f9f9a12acc9d0c503b7460491bd3908ef1e1892c84
7
+ data.tar.gz: 132a919729c31aaaecd621fd981ea840ba00abf96478be13ea62402f4d2c5a539fb0bf5f07b63b2c23a9b32d4ad6c9bbd9e425d03f8e8755cc273c0b45b67c5f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ahnnotate (0.5.0)
4
+ ahnnotate (0.5.1)
5
5
  activerecord (>= 4.0.0)
6
6
  parser
7
7
 
@@ -10,8 +10,8 @@ module Ahnnotate
10
10
  map["character"] = "char"
11
11
  map["datetime"] = "timestamp"
12
12
  map["double precision"] = "double"
13
- map["time with time zone"] = "time"
14
- map["time without time zone"] = "timetz"
13
+ map["time with time zone"] = "timetz"
14
+ map["time without time zone"] = "time"
15
15
  map["timestamp with time zone"] = "timestamptz"
16
16
  map["timestamp without time zone"] = "timestamp"
17
17
  map
@@ -17,59 +17,66 @@ module Ahnnotate
17
17
  end
18
18
 
19
19
  @connection.public_send(data_sources_method_name).each do |table_name|
20
- primary_key = ActiveRecord::Base.get_primary_key(table_name)
20
+ begin
21
+ original_stderr = $stderr
22
+ $stderr = StringIO.new
21
23
 
22
- columns = @connection.columns(table_name).map do |c|
23
- is_primary_key =
24
- if primary_key.is_a?(Array)
25
- primary_key.include?(c.name)
26
- else
27
- primary_key == c.name
28
- end
24
+ primary_key = ActiveRecord::Base.get_primary_key(table_name)
29
25
 
30
- Column.new(
31
- name: c.name,
32
- sql_type: c.sql_type,
33
- nullable: c.null,
34
- primary_key: is_primary_key,
35
- default: c.default
36
- )
37
- end
26
+ columns = @connection.columns(table_name).map do |c|
27
+ is_primary_key =
28
+ if primary_key.is_a?(Array)
29
+ primary_key.include?(c.name)
30
+ else
31
+ primary_key == c.name
32
+ end
38
33
 
39
- indexes = @connection.indexes(table_name).map do |i|
40
- comment =
41
- if i.respond_to?(:comment)
42
- i.comment
43
- end
34
+ Column.new(
35
+ name: c.name,
36
+ sql_type: c.sql_type,
37
+ nullable: c.null,
38
+ primary_key: is_primary_key,
39
+ default: c.default
40
+ )
41
+ end
44
42
 
45
- Index.new(
46
- name: i.name,
47
- columns: i.columns,
48
- unique: i.unique,
49
- comment: comment
50
- )
51
- end
43
+ indexes = @connection.indexes(table_name).map do |i|
44
+ comment =
45
+ if i.respond_to?(:comment)
46
+ i.comment
47
+ end
52
48
 
53
- foreign_keys =
54
- if @abilities.foreign_key?
55
- @connection.foreign_keys(table_name).map do |fk|
56
- ForeignKey.new(
57
- name: fk.name,
58
- from_column: fk.column,
59
- to_table: fk.to_table,
60
- to_column: fk.primary_key
61
- )
62
- end
63
- else
64
- []
49
+ Index.new(
50
+ name: i.name,
51
+ columns: i.columns,
52
+ unique: i.unique,
53
+ comment: comment
54
+ )
65
55
  end
66
56
 
67
- yield Table.new(
68
- name: table_name,
69
- columns: columns,
70
- indexes: indexes,
71
- foreign_keys: foreign_keys,
72
- )
57
+ foreign_keys =
58
+ if @abilities.foreign_key?
59
+ @connection.foreign_keys(table_name).map do |fk|
60
+ ForeignKey.new(
61
+ name: fk.name,
62
+ from_column: fk.column,
63
+ to_table: fk.to_table,
64
+ to_column: fk.primary_key
65
+ )
66
+ end
67
+ else
68
+ []
69
+ end
70
+
71
+ yield Table.new(
72
+ name: table_name,
73
+ columns: columns,
74
+ indexes: indexes,
75
+ foreign_keys: foreign_keys,
76
+ )
77
+ ensure
78
+ $stderr = original_stderr
79
+ end
73
80
  end
74
81
  end
75
82
 
@@ -1,3 +1,3 @@
1
1
  module Ahnnotate
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ahnnotate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Ahn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-12 00:00:00.000000000 Z
11
+ date: 2019-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler