pg_objects 0.4.2 → 0.4.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 785a95765bb30734a49ecab2a2e2c757015849ce52a86cf02d9f7a81664c6910
4
- data.tar.gz: f8835b55ff9bfef06706953710bbf09fa0de63e128a54cf52d55c36efaeaf8ef
3
+ metadata.gz: 1440d84714eee23457350728cd639e7e3a61e789290a6919090664f21a9d02dd
4
+ data.tar.gz: 6d2be5ba86e02703bb30c64d2a83ba02fc30b4b436ec940527ca96fe95d8edc2
5
5
  SHA512:
6
- metadata.gz: 6f6183aa49329e67e94e835d182888a1506821bbdd04eaae069dac571302a5b1d5505d32cc2008ffd0d294328bf2ebd96b7d5cbd2c9d66cc3fc6346745a345f2
7
- data.tar.gz: ccd6cc5112f0f9d1b88f34cd388dbd0cdeab3d624410951e08063630b467229856ea5b85fbc9e2f7574748c7ab159f116171735ea8bdba5300bbb95cf6c809ff
6
+ metadata.gz: 33fc09874bfe6313dd5fabd916cd41151a2ebe89ab6319fd93ccea96bedaae80fab7b7c2d150dcf2b9a31e3bcf0ce96f58f0b205d56cdc4d6e54112a06fd5fa7
7
+ data.tar.gz: f50fa9789f8d44891ebbe4a6f5d9a351a1407f2268b0d1b7a2e1df97ff6739b45be64d81adf88324f10105e4d5788c55982e02d7c27641f4059cb3559dbd8ec5
data/.travis.yml CHANGED
@@ -4,6 +4,7 @@ rvm:
4
4
  - 2.3.8
5
5
  - 2.4.5
6
6
  - 2.5.3
7
+ - 2.6.0
7
8
  before_install: gem install bundler -v 1.16.2
8
9
  script:
9
10
  - bundle exec rspec spec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pg_objects (0.4.2)
4
+ pg_objects (0.4.3)
5
5
  activerecord (>= 4, < 6)
6
6
  pg_query (~> 1)
7
7
  railties (>= 4, < 6)
@@ -10,26 +10,26 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actionpack (5.2.1)
14
- actionview (= 5.2.1)
15
- activesupport (= 5.2.1)
13
+ actionpack (5.2.2)
14
+ actionview (= 5.2.2)
15
+ activesupport (= 5.2.2)
16
16
  rack (~> 2.0)
17
17
  rack-test (>= 0.6.3)
18
18
  rails-dom-testing (~> 2.0)
19
19
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
20
- actionview (5.2.1)
21
- activesupport (= 5.2.1)
20
+ actionview (5.2.2)
21
+ activesupport (= 5.2.2)
22
22
  builder (~> 3.1)
23
23
  erubi (~> 1.4)
24
24
  rails-dom-testing (~> 2.0)
25
25
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
26
- activemodel (5.2.1)
27
- activesupport (= 5.2.1)
28
- activerecord (5.2.1)
29
- activemodel (= 5.2.1)
30
- activesupport (= 5.2.1)
26
+ activemodel (5.2.2)
27
+ activesupport (= 5.2.2)
28
+ activerecord (5.2.2)
29
+ activemodel (= 5.2.2)
30
+ activesupport (= 5.2.2)
31
31
  arel (>= 9.0)
32
- activesupport (5.2.1)
32
+ activesupport (5.2.2)
33
33
  concurrent-ruby (~> 1.0, >= 1.0.2)
34
34
  i18n (>= 0.7, < 2)
35
35
  minitest (~> 5.1)
@@ -38,21 +38,21 @@ GEM
38
38
  ast (2.4.0)
39
39
  builder (3.2.3)
40
40
  byebug (10.0.2)
41
- concurrent-ruby (1.1.3)
41
+ concurrent-ruby (1.1.4)
42
42
  crass (1.0.4)
43
43
  diff-lcs (1.3)
44
- erubi (1.7.1)
45
- i18n (1.1.1)
44
+ erubi (1.8.0)
45
+ i18n (1.3.0)
46
46
  concurrent-ruby (~> 1.0)
47
47
  jaro_winkler (1.5.1)
48
48
  loofah (2.2.3)
49
49
  crass (~> 1.0.2)
50
50
  nokogiri (>= 1.5.9)
51
- method_source (0.9.1)
52
- mini_portile2 (2.3.0)
51
+ method_source (0.9.2)
52
+ mini_portile2 (2.4.0)
53
53
  minitest (5.11.3)
54
- nokogiri (1.8.5)
55
- mini_portile2 (~> 2.3.0)
54
+ nokogiri (1.9.1)
55
+ mini_portile2 (~> 2.4.0)
56
56
  parallel (1.12.1)
57
57
  parser (2.5.3.0)
58
58
  ast (~> 2.4.0)
@@ -66,14 +66,14 @@ GEM
66
66
  nokogiri (>= 1.6)
67
67
  rails-html-sanitizer (1.0.4)
68
68
  loofah (~> 2.2, >= 2.2.2)
69
- railties (5.2.1)
70
- actionpack (= 5.2.1)
71
- activesupport (= 5.2.1)
69
+ railties (5.2.2)
70
+ actionpack (= 5.2.2)
71
+ activesupport (= 5.2.2)
72
72
  method_source
73
73
  rake (>= 0.8.7)
74
74
  thor (>= 0.19.0, < 2.0)
75
75
  rainbow (3.0.0)
76
- rake (10.5.0)
76
+ rake (12.3.2)
77
77
  rake-hooks (1.2.3)
78
78
  rake
79
79
  rspec (3.8.0)
@@ -89,7 +89,7 @@ GEM
89
89
  diff-lcs (>= 1.2.0, < 2.0)
90
90
  rspec-support (~> 3.8.0)
91
91
  rspec-support (3.8.0)
92
- rubocop (0.60.0)
92
+ rubocop (0.61.1)
93
93
  jaro_winkler (~> 1.5.1)
94
94
  parallel (~> 1.10)
95
95
  parser (>= 2.5, != 2.5.1.1)
@@ -100,11 +100,11 @@ GEM
100
100
  rubocop-rspec (1.30.1)
101
101
  rubocop (>= 0.60.0)
102
102
  ruby-progressbar (1.10.0)
103
- thor (0.20.0)
103
+ thor (0.20.3)
104
104
  thread_safe (0.3.6)
105
105
  tzinfo (1.2.5)
106
106
  thread_safe (~> 0.1)
107
- unicode-display_width (1.4.0)
107
+ unicode-display_width (1.4.1)
108
108
 
109
109
  PLATFORMS
110
110
  ruby
@@ -119,4 +119,4 @@ DEPENDENCIES
119
119
  rubocop-rspec
120
120
 
121
121
  BUNDLED WITH
122
- 1.17.1
122
+ 1.17.2
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+ [![Gem Version](https://badge.fury.io/rb/pg_objects.svg)](https://badge.fury.io/rb/pg_objects)
1
2
  [![Build Status](https://travis-ci.org/marinazzio/pg_objects.svg?branch=master)](https://travis-ci.org/marinazzio/pg_objects)
2
3
  [![Maintainability](https://api.codeclimate.com/v1/badges/935cd23d8f899b6d8057/maintainability)](https://codeclimate.com/github/marinazzio/pg_objects/maintainability)
3
4
 
@@ -16,14 +16,9 @@ module PgObjects
16
16
 
17
17
  directives = Parser.fetch_directives @sql_query
18
18
  @dependencies = directives[:depends_on]
19
- @multistatement = directives[:multistatement]
20
19
  @object_name = Parser.fetch_object_name @sql_query
21
20
 
22
21
  @status = :pending
23
22
  end
24
-
25
- def multistatement?
26
- @multistatement
27
- end
28
23
  end
29
24
  end
@@ -48,16 +48,11 @@ module PgObjects
48
48
  create_dependencies(obj.dependencies)
49
49
 
50
50
  log.write("creating #{obj.name}")
51
- execute_query(obj)
51
+ ActiveRecord::Base.connection.execute obj.sql_query
52
52
 
53
53
  obj.status = :done
54
54
  end
55
55
 
56
- def execute_query(obj)
57
- exec_method = obj.multistatement? ? :execute : :exec_query
58
- ActiveRecord::Base.connection.send exec_method, obj.sql_query
59
- end
60
-
61
56
  def create_dependencies(dependencies)
62
57
  dependencies.each { |dep_name| create_object find_object(dep_name) }
63
58
  end
@@ -8,9 +8,6 @@ module PgObjects
8
8
  #
9
9
  # name_of_dependency: short or full name of object as well as object_name
10
10
  #
11
- # --!multistatement
12
- #
13
- # use when there are more than one SQL command in object file
14
11
  class Parser
15
12
  ROUTES = [
16
13
  ['DefineStmt', 'defnames', 0, 'String', 'str'],
@@ -27,8 +24,7 @@ module PgObjects
27
24
  class << self
28
25
  def fetch_directives(text)
29
26
  {
30
- depends_on: fetch_dependencies(text),
31
- multistatement: fetch_multistatement(text)
27
+ depends_on: fetch_dependencies(text)
32
28
  }
33
29
  end
34
30
 
@@ -44,10 +40,6 @@ module PgObjects
44
40
  def fetch_dependencies(text)
45
41
  text.split("\n").select { |ln| ln =~ /^(--|#)!/ }.map { |ln| ln.split(' ')[1] if ln =~ /!depends_on/ }.compact
46
42
  end
47
-
48
- def fetch_multistatement(text)
49
- text.split("\n").select { |ln| ln =~ /^(--|#)!/ }.select { |ln| ln =~ /!multistatement/ }.present?
50
- end
51
43
  end
52
44
  end
53
45
  end
@@ -1,3 +1,3 @@
1
1
  module PgObjects
2
- VERSION = '0.4.2'.freeze
2
+ VERSION = '0.4.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_objects
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Kiselyov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-09 00:00:00.000000000 Z
11
+ date: 2018-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord