table_saw 2.7.0 → 2.10.0

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: d7ba43df3b9906b32dc2478f41c974ee5cca5036d5ec7f95fa0ba6f04ece6812
4
- data.tar.gz: d4775622ad45fc31d5a658d095807e925e4b0570a6a01eeb302546c5b5669540
3
+ metadata.gz: 2523b019080dccb116fed85c38ecb0a629cd6f8630abd65a1a30e2214c6a71b3
4
+ data.tar.gz: 03e53e17ef16f72e976772bc027ca4698ba8eaa7bf4498a2fae5ab7e7dfd3f7d
5
5
  SHA512:
6
- metadata.gz: 5833756a4f1746c2b54a9ddd27766f2ff3fe651455e2dcb8112938e2c0b06984a6c0c3b1d5990b1a8acfabe3e65cb2ef85807dbc2f6156f254e7c3cf794c0a17
7
- data.tar.gz: c620092fcdf65362c007c38ea4bbb3e66ed016d6a29a24d11e62e0f6d23fd5e70e2aa92c9c82b5b3cf7de16a6cf00e3c8574906d4a90630ad13b3483826e15a4
6
+ metadata.gz: ab502f4b52e5e5214cca044d4ca450b9c885e63595423161e4ad130f85da6a5eb28fca008c77e49d70b675448ebe54a63bf6dfba465db6f47572b5d9b7fddbf3
7
+ data.tar.gz: 63a25f77f34251c801ba0f21aa5649988e763c1e8516dc4c1d3fc7976c2bd97c5bbc50d4fe6085b24032780ea7c93203d27c856c1304d681f6d2065a9a60f2f3
@@ -7,9 +7,21 @@ jobs:
7
7
 
8
8
  runs-on: ubuntu-latest
9
9
 
10
+ strategy:
11
+ matrix:
12
+ ruby:
13
+ - '2.7.2'
14
+ - '3.0.0'
15
+ activerecord:
16
+ - '6.0.0'
17
+ - '6.1.0'
18
+
19
+ env:
20
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/activerecord_${{ matrix.activerecord }}.gemfile
21
+
10
22
  services:
11
23
  postgres:
12
- image: postgres:12.2
24
+ image: postgres:12.4
13
25
  env:
14
26
  POSTGRES_USER: postgres
15
27
  POSTGRES_PASSWORD: postgres
@@ -22,30 +34,18 @@ jobs:
22
34
  steps:
23
35
  - uses: actions/checkout@v2
24
36
 
25
- - name: Set up Ruby 2.6
26
- uses: actions/setup-ruby@v1
27
- with:
28
- ruby-version: 2.6.x
29
-
30
- - uses: actions/cache@v1
37
+ - name: Set up Ruby
38
+ uses: ruby/setup-ruby@v1
31
39
  with:
32
- path: vendor/bundle
33
- key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
34
- restore-keys: |
35
- ${{ runner.os }}-gems-
40
+ ruby-version: ${{ matrix.ruby }}
41
+ bundler-cache: true
36
42
 
37
43
  - name: Install PostgreSQL client
38
44
  run: |
39
45
  sudo apt-get -yqq install libpq-dev
40
46
 
41
- - name: Configure Bundler
42
- run: |
43
- gem install bundler -v 2.1.4 --no-document
44
- bundle config path 'vendor/bundle'
45
- bundle install --jobs 4 --retry 3
46
-
47
47
  - name: Run tests with RSpec
48
- uses: paambaati/codeclimate-action@v2.5.4
48
+ uses: paambaati/codeclimate-action@v2.7.5
49
49
  env:
50
50
  CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
51
51
  with:
data/.rubocop.yml CHANGED
@@ -1,7 +1,10 @@
1
1
  require: rubocop-rspec
2
2
 
3
3
  AllCops:
4
+ NewCops: enable
4
5
  TargetRubyVersion: 2.6
6
+ Exclude:
7
+ - gemfiles/*
5
8
 
6
9
  Layout/LineLength:
7
10
  Max: 120
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.6
1
+ 3.0.0
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.0.2
data/Appraisals ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ appraise 'activerecord-6.0.0' do
4
+ gem 'activerecord', '~> 6.0', '< 6.1'
5
+ end
6
+
7
+ appraise 'activerecord-6.1.0' do
8
+ gem 'activerecord', '~> 6.1', '< 6.2'
9
+ end
data/Gemfile CHANGED
@@ -4,3 +4,5 @@ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in table_saw.gemspec
6
6
  gemspec
7
+
8
+ gem 'appraisal'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- table_saw (2.7.0)
4
+ table_saw (2.10.0)
5
5
  activerecord (>= 5.2)
6
6
  pg
7
7
  thor
@@ -9,132 +9,147 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (6.0.2.2)
13
- actionview (= 6.0.2.2)
14
- activesupport (= 6.0.2.2)
15
- rack (~> 2.0, >= 2.0.8)
12
+ actionpack (6.1.4.1)
13
+ actionview (= 6.1.4.1)
14
+ activesupport (= 6.1.4.1)
15
+ rack (~> 2.0, >= 2.0.9)
16
16
  rack-test (>= 0.6.3)
17
17
  rails-dom-testing (~> 2.0)
18
18
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
19
- actionview (6.0.2.2)
20
- activesupport (= 6.0.2.2)
19
+ actionview (6.1.4.1)
20
+ activesupport (= 6.1.4.1)
21
21
  builder (~> 3.1)
22
22
  erubi (~> 1.4)
23
23
  rails-dom-testing (~> 2.0)
24
24
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
25
- activemodel (6.0.2.2)
26
- activesupport (= 6.0.2.2)
27
- activerecord (6.0.2.2)
28
- activemodel (= 6.0.2.2)
29
- activesupport (= 6.0.2.2)
30
- activesupport (6.0.2.2)
25
+ activemodel (6.1.4.1)
26
+ activesupport (= 6.1.4.1)
27
+ activerecord (6.1.4.1)
28
+ activemodel (= 6.1.4.1)
29
+ activesupport (= 6.1.4.1)
30
+ activesupport (6.1.4.1)
31
31
  concurrent-ruby (~> 1.0, >= 1.0.2)
32
- i18n (>= 0.7, < 2)
33
- minitest (~> 5.1)
34
- tzinfo (~> 1.1)
35
- zeitwerk (~> 2.2)
36
- ast (2.4.0)
32
+ i18n (>= 1.6, < 2)
33
+ minitest (>= 5.1)
34
+ tzinfo (~> 2.0)
35
+ zeitwerk (~> 2.3)
36
+ appraisal (2.4.0)
37
+ bundler
38
+ rake
39
+ thor (>= 0.14.0)
40
+ ast (2.4.2)
37
41
  builder (3.2.4)
38
- coderay (1.1.2)
39
- combustion (1.1.2)
42
+ coderay (1.1.3)
43
+ combustion (1.3.1)
40
44
  activesupport (>= 3.0.0)
41
45
  railties (>= 3.0.0)
42
46
  thor (>= 0.14.6)
43
- concurrent-ruby (1.1.6)
47
+ concurrent-ruby (1.1.9)
44
48
  crass (1.0.6)
45
- database_cleaner (1.7.0)
46
- diff-lcs (1.3)
47
- docile (1.3.1)
48
- erubi (1.9.0)
49
- i18n (1.8.2)
49
+ database_cleaner (2.0.1)
50
+ database_cleaner-active_record (~> 2.0.0)
51
+ database_cleaner-active_record (2.0.1)
52
+ activerecord (>= 5.a)
53
+ database_cleaner-core (~> 2.0.0)
54
+ database_cleaner-core (2.0.1)
55
+ diff-lcs (1.4.4)
56
+ docile (1.4.0)
57
+ erubi (1.10.0)
58
+ i18n (1.8.10)
50
59
  concurrent-ruby (~> 1.0)
51
- jaro_winkler (1.5.4)
52
- json (2.2.0)
53
- loofah (2.4.0)
60
+ loofah (2.12.0)
54
61
  crass (~> 1.0.2)
55
62
  nokogiri (>= 1.5.9)
56
- method_source (0.9.2)
57
- mini_portile2 (2.4.0)
58
- minitest (5.14.0)
59
- nokogiri (1.10.9)
60
- mini_portile2 (~> 2.4.0)
61
- parallel (1.19.1)
62
- parser (2.7.1.2)
63
- ast (~> 2.4.0)
63
+ method_source (1.0.0)
64
+ mini_portile2 (2.6.1)
65
+ minitest (5.14.4)
66
+ nokogiri (1.12.5)
67
+ mini_portile2 (~> 2.6.1)
68
+ racc (~> 1.4)
69
+ parallel (1.20.1)
70
+ parser (3.0.1.1)
71
+ ast (~> 2.4.1)
64
72
  pg (1.2.3)
65
- pry (0.12.2)
66
- coderay (~> 1.1.0)
67
- method_source (~> 0.9.0)
68
- rack (2.2.2)
73
+ pry (0.14.1)
74
+ coderay (~> 1.1)
75
+ method_source (~> 1.0)
76
+ racc (1.5.2)
77
+ rack (2.2.3)
69
78
  rack-test (1.1.0)
70
79
  rack (>= 1.0, < 3)
71
80
  rails-dom-testing (2.0.3)
72
81
  activesupport (>= 4.2.0)
73
82
  nokogiri (>= 1.6)
74
- rails-html-sanitizer (1.3.0)
83
+ rails-html-sanitizer (1.4.2)
75
84
  loofah (~> 2.3)
76
- railties (6.0.2.2)
77
- actionpack (= 6.0.2.2)
78
- activesupport (= 6.0.2.2)
85
+ railties (6.1.4.1)
86
+ actionpack (= 6.1.4.1)
87
+ activesupport (= 6.1.4.1)
79
88
  method_source
80
- rake (>= 0.8.7)
81
- thor (>= 0.20.3, < 2.0)
89
+ rake (>= 0.13)
90
+ thor (~> 1.0)
82
91
  rainbow (3.0.0)
83
- rake (13.0.1)
84
- rexml (3.2.4)
85
- rspec (3.9.0)
86
- rspec-core (~> 3.9.0)
87
- rspec-expectations (~> 3.9.0)
88
- rspec-mocks (~> 3.9.0)
89
- rspec-core (3.9.1)
90
- rspec-support (~> 3.9.1)
91
- rspec-expectations (3.9.0)
92
+ rake (13.0.3)
93
+ regexp_parser (2.1.1)
94
+ rexml (3.2.5)
95
+ rspec (3.10.0)
96
+ rspec-core (~> 3.10.0)
97
+ rspec-expectations (~> 3.10.0)
98
+ rspec-mocks (~> 3.10.0)
99
+ rspec-core (3.10.1)
100
+ rspec-support (~> 3.10.0)
101
+ rspec-expectations (3.10.1)
92
102
  diff-lcs (>= 1.2.0, < 2.0)
93
- rspec-support (~> 3.9.0)
94
- rspec-mocks (3.9.1)
103
+ rspec-support (~> 3.10.0)
104
+ rspec-mocks (3.10.2)
95
105
  diff-lcs (>= 1.2.0, < 2.0)
96
- rspec-support (~> 3.9.0)
97
- rspec-support (3.9.2)
98
- rubocop (0.82.0)
99
- jaro_winkler (~> 1.5.1)
106
+ rspec-support (~> 3.10.0)
107
+ rspec-support (3.10.2)
108
+ rubocop (1.14.0)
100
109
  parallel (~> 1.10)
101
- parser (>= 2.7.0.1)
110
+ parser (>= 3.0.0.0)
102
111
  rainbow (>= 2.2.2, < 4.0)
112
+ regexp_parser (>= 1.8, < 3.0)
103
113
  rexml
114
+ rubocop-ast (>= 1.5.0, < 2.0)
104
115
  ruby-progressbar (~> 1.7)
105
- unicode-display_width (>= 1.4.0, < 2.0)
106
- rubocop-rspec (1.33.0)
107
- rubocop (>= 0.60.0)
108
- ruby-progressbar (1.10.1)
109
- scenic (1.5.2)
116
+ unicode-display_width (>= 1.4.0, < 3.0)
117
+ rubocop-ast (1.5.0)
118
+ parser (>= 3.0.1.1)
119
+ rubocop-rspec (2.3.0)
120
+ rubocop (~> 1.0)
121
+ rubocop-ast (>= 1.1.0)
122
+ ruby-progressbar (1.11.0)
123
+ scenic (1.5.4)
110
124
  activerecord (>= 4.0.0)
111
125
  railties (>= 4.0.0)
112
- simplecov (0.16.1)
126
+ simplecov (0.21.2)
113
127
  docile (~> 1.1)
114
- json (>= 1.8, < 3)
115
- simplecov-html (~> 0.10.0)
116
- simplecov-html (0.10.2)
117
- thor (1.0.1)
118
- thread_safe (0.3.6)
119
- tzinfo (1.2.6)
120
- thread_safe (~> 0.1)
121
- unicode-display_width (1.7.0)
122
- zeitwerk (2.3.0)
128
+ simplecov-html (~> 0.11)
129
+ simplecov_json_formatter (~> 0.1)
130
+ simplecov-html (0.12.3)
131
+ simplecov_json_formatter (0.1.3)
132
+ thor (1.1.0)
133
+ tzinfo (2.0.4)
134
+ concurrent-ruby (~> 1.0)
135
+ unicode-display_width (2.0.0)
136
+ zeitwerk (2.4.2)
123
137
 
124
138
  PLATFORMS
125
139
  ruby
126
140
 
127
141
  DEPENDENCIES
142
+ appraisal
128
143
  bundler (~> 2.0)
129
- combustion (~> 1.1)
130
- database_cleaner (~> 1.7)
144
+ combustion (~> 1.3)
145
+ database_cleaner (~> 2)
131
146
  pry
132
- rake (~> 13.0)
147
+ rake (= 13.0.3)
133
148
  rspec (~> 3.0)
134
- rubocop-rspec (~> 1.33)
149
+ rubocop-rspec (~> 2.3)
135
150
  scenic (~> 1.5)
136
151
  simplecov (~> 0.16)
137
152
  table_saw!
138
153
 
139
154
  BUNDLED WITH
140
- 2.1.4
155
+ 2.2.22
data/exe/table-saw CHANGED
@@ -25,6 +25,8 @@ class CLI < Thor
25
25
  method_option :manifest, aliases: '-m', required: true
26
26
  method_option :output, aliases: '-o', default: 'output.dump'
27
27
  method_option :format, type: :hash, default: { 'type' => 'copy' }
28
+ method_option :variables, aliases: '-v', type: :hash, default: {},
29
+ desc: 'This option takes a hash to override variables provided in the manifest'
28
30
  def dump
29
31
  TableSaw.configure(options.to_hash)
30
32
  records = TableSaw::DependencyGraph::Build.new(TableSaw::Manifest.instance).call
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "activerecord", "~> 6.0", "< 6.1"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,159 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ table_saw (2.10.0)
5
+ activerecord (>= 5.2)
6
+ pg
7
+ thor
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actionpack (6.0.4.1)
13
+ actionview (= 6.0.4.1)
14
+ activesupport (= 6.0.4.1)
15
+ rack (~> 2.0, >= 2.0.8)
16
+ rack-test (>= 0.6.3)
17
+ rails-dom-testing (~> 2.0)
18
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
19
+ actionview (6.0.4.1)
20
+ activesupport (= 6.0.4.1)
21
+ builder (~> 3.1)
22
+ erubi (~> 1.4)
23
+ rails-dom-testing (~> 2.0)
24
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
25
+ activemodel (6.0.4.1)
26
+ activesupport (= 6.0.4.1)
27
+ activerecord (6.0.4.1)
28
+ activemodel (= 6.0.4.1)
29
+ activesupport (= 6.0.4.1)
30
+ activesupport (6.0.4.1)
31
+ concurrent-ruby (~> 1.0, >= 1.0.2)
32
+ i18n (>= 0.7, < 2)
33
+ minitest (~> 5.1)
34
+ tzinfo (~> 1.1)
35
+ zeitwerk (~> 2.2, >= 2.2.2)
36
+ appraisal (2.3.0)
37
+ bundler
38
+ rake
39
+ thor (>= 0.14.0)
40
+ ast (2.4.2)
41
+ builder (3.2.4)
42
+ coderay (1.1.3)
43
+ combustion (1.3.1)
44
+ activesupport (>= 3.0.0)
45
+ railties (>= 3.0.0)
46
+ thor (>= 0.14.6)
47
+ concurrent-ruby (1.1.9)
48
+ crass (1.0.6)
49
+ database_cleaner (2.0.1)
50
+ database_cleaner-active_record (~> 2.0.0)
51
+ database_cleaner-active_record (2.0.1)
52
+ activerecord (>= 5.a)
53
+ database_cleaner-core (~> 2.0.0)
54
+ database_cleaner-core (2.0.1)
55
+ diff-lcs (1.4.4)
56
+ docile (1.4.0)
57
+ erubi (1.10.0)
58
+ i18n (1.8.10)
59
+ concurrent-ruby (~> 1.0)
60
+ loofah (2.12.0)
61
+ crass (~> 1.0.2)
62
+ nokogiri (>= 1.5.9)
63
+ method_source (1.0.0)
64
+ minitest (5.14.4)
65
+ nokogiri (1.12.5-x86_64-darwin)
66
+ racc (~> 1.4)
67
+ nokogiri (1.12.5-x86_64-linux)
68
+ racc (~> 1.4)
69
+ parallel (1.20.1)
70
+ parser (3.0.1.1)
71
+ ast (~> 2.4.1)
72
+ pg (1.2.3)
73
+ pry (0.13.1)
74
+ coderay (~> 1.1)
75
+ method_source (~> 1.0)
76
+ racc (1.5.2)
77
+ rack (2.2.3)
78
+ rack-test (1.1.0)
79
+ rack (>= 1.0, < 3)
80
+ rails-dom-testing (2.0.3)
81
+ activesupport (>= 4.2.0)
82
+ nokogiri (>= 1.6)
83
+ rails-html-sanitizer (1.4.2)
84
+ loofah (~> 2.3)
85
+ railties (6.0.4.1)
86
+ actionpack (= 6.0.4.1)
87
+ activesupport (= 6.0.4.1)
88
+ method_source
89
+ rake (>= 0.8.7)
90
+ thor (>= 0.20.3, < 2.0)
91
+ rainbow (3.0.0)
92
+ rake (13.0.3)
93
+ regexp_parser (2.1.1)
94
+ rexml (3.2.5)
95
+ rspec (3.10.0)
96
+ rspec-core (~> 3.10.0)
97
+ rspec-expectations (~> 3.10.0)
98
+ rspec-mocks (~> 3.10.0)
99
+ rspec-core (3.10.1)
100
+ rspec-support (~> 3.10.0)
101
+ rspec-expectations (3.10.1)
102
+ diff-lcs (>= 1.2.0, < 2.0)
103
+ rspec-support (~> 3.10.0)
104
+ rspec-mocks (3.10.1)
105
+ diff-lcs (>= 1.2.0, < 2.0)
106
+ rspec-support (~> 3.10.0)
107
+ rspec-support (3.10.1)
108
+ rubocop (1.14.0)
109
+ parallel (~> 1.10)
110
+ parser (>= 3.0.0.0)
111
+ rainbow (>= 2.2.2, < 4.0)
112
+ regexp_parser (>= 1.8, < 3.0)
113
+ rexml
114
+ rubocop-ast (>= 1.5.0, < 2.0)
115
+ ruby-progressbar (~> 1.7)
116
+ unicode-display_width (>= 1.4.0, < 3.0)
117
+ rubocop-ast (1.5.0)
118
+ parser (>= 3.0.1.1)
119
+ rubocop-rspec (2.3.0)
120
+ rubocop (~> 1.0)
121
+ rubocop-ast (>= 1.1.0)
122
+ ruby-progressbar (1.11.0)
123
+ scenic (1.5.4)
124
+ activerecord (>= 4.0.0)
125
+ railties (>= 4.0.0)
126
+ simplecov (0.21.2)
127
+ docile (~> 1.1)
128
+ simplecov-html (~> 0.11)
129
+ simplecov_json_formatter (~> 0.1)
130
+ simplecov-html (0.12.3)
131
+ simplecov_json_formatter (0.1.3)
132
+ thor (1.1.0)
133
+ thread_safe (0.3.6)
134
+ tzinfo (1.2.9)
135
+ thread_safe (~> 0.1)
136
+ unicode-display_width (2.0.0)
137
+ zeitwerk (2.4.2)
138
+
139
+ PLATFORMS
140
+ x86_64-darwin-19
141
+ x86_64-darwin-20
142
+ x86_64-linux
143
+
144
+ DEPENDENCIES
145
+ activerecord (~> 6.0, < 6.1)
146
+ appraisal
147
+ bundler (~> 2.0)
148
+ combustion (~> 1.3)
149
+ database_cleaner (~> 2)
150
+ pry
151
+ rake (= 13.0.3)
152
+ rspec (~> 3.0)
153
+ rubocop-rspec (~> 2.3)
154
+ scenic (~> 1.5)
155
+ simplecov (~> 0.16)
156
+ table_saw!
157
+
158
+ BUNDLED WITH
159
+ 2.2.22
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "activerecord", "~> 6.1", "< 6.2"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,158 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ table_saw (2.10.0)
5
+ activerecord (>= 5.2)
6
+ pg
7
+ thor
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actionpack (6.1.4.1)
13
+ actionview (= 6.1.4.1)
14
+ activesupport (= 6.1.4.1)
15
+ rack (~> 2.0, >= 2.0.9)
16
+ rack-test (>= 0.6.3)
17
+ rails-dom-testing (~> 2.0)
18
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
19
+ actionview (6.1.4.1)
20
+ activesupport (= 6.1.4.1)
21
+ builder (~> 3.1)
22
+ erubi (~> 1.4)
23
+ rails-dom-testing (~> 2.0)
24
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
25
+ activemodel (6.1.4.1)
26
+ activesupport (= 6.1.4.1)
27
+ activerecord (6.1.4.1)
28
+ activemodel (= 6.1.4.1)
29
+ activesupport (= 6.1.4.1)
30
+ activesupport (6.1.4.1)
31
+ concurrent-ruby (~> 1.0, >= 1.0.2)
32
+ i18n (>= 1.6, < 2)
33
+ minitest (>= 5.1)
34
+ tzinfo (~> 2.0)
35
+ zeitwerk (~> 2.3)
36
+ appraisal (2.3.0)
37
+ bundler
38
+ rake
39
+ thor (>= 0.14.0)
40
+ ast (2.4.2)
41
+ builder (3.2.4)
42
+ coderay (1.1.3)
43
+ combustion (1.3.1)
44
+ activesupport (>= 3.0.0)
45
+ railties (>= 3.0.0)
46
+ thor (>= 0.14.6)
47
+ concurrent-ruby (1.1.9)
48
+ crass (1.0.6)
49
+ database_cleaner (2.0.1)
50
+ database_cleaner-active_record (~> 2.0.0)
51
+ database_cleaner-active_record (2.0.1)
52
+ activerecord (>= 5.a)
53
+ database_cleaner-core (~> 2.0.0)
54
+ database_cleaner-core (2.0.1)
55
+ diff-lcs (1.4.4)
56
+ docile (1.4.0)
57
+ erubi (1.10.0)
58
+ i18n (1.8.10)
59
+ concurrent-ruby (~> 1.0)
60
+ loofah (2.12.0)
61
+ crass (~> 1.0.2)
62
+ nokogiri (>= 1.5.9)
63
+ method_source (1.0.0)
64
+ minitest (5.14.4)
65
+ nokogiri (1.12.5-x86_64-darwin)
66
+ racc (~> 1.4)
67
+ nokogiri (1.12.5-x86_64-linux)
68
+ racc (~> 1.4)
69
+ parallel (1.20.1)
70
+ parser (3.0.1.1)
71
+ ast (~> 2.4.1)
72
+ pg (1.2.3)
73
+ pry (0.13.1)
74
+ coderay (~> 1.1)
75
+ method_source (~> 1.0)
76
+ racc (1.5.2)
77
+ rack (2.2.3)
78
+ rack-test (1.1.0)
79
+ rack (>= 1.0, < 3)
80
+ rails-dom-testing (2.0.3)
81
+ activesupport (>= 4.2.0)
82
+ nokogiri (>= 1.6)
83
+ rails-html-sanitizer (1.4.2)
84
+ loofah (~> 2.3)
85
+ railties (6.1.4.1)
86
+ actionpack (= 6.1.4.1)
87
+ activesupport (= 6.1.4.1)
88
+ method_source
89
+ rake (>= 0.13)
90
+ thor (~> 1.0)
91
+ rainbow (3.0.0)
92
+ rake (13.0.3)
93
+ regexp_parser (2.1.1)
94
+ rexml (3.2.5)
95
+ rspec (3.10.0)
96
+ rspec-core (~> 3.10.0)
97
+ rspec-expectations (~> 3.10.0)
98
+ rspec-mocks (~> 3.10.0)
99
+ rspec-core (3.10.1)
100
+ rspec-support (~> 3.10.0)
101
+ rspec-expectations (3.10.1)
102
+ diff-lcs (>= 1.2.0, < 2.0)
103
+ rspec-support (~> 3.10.0)
104
+ rspec-mocks (3.10.1)
105
+ diff-lcs (>= 1.2.0, < 2.0)
106
+ rspec-support (~> 3.10.0)
107
+ rspec-support (3.10.1)
108
+ rubocop (1.14.0)
109
+ parallel (~> 1.10)
110
+ parser (>= 3.0.0.0)
111
+ rainbow (>= 2.2.2, < 4.0)
112
+ regexp_parser (>= 1.8, < 3.0)
113
+ rexml
114
+ rubocop-ast (>= 1.5.0, < 2.0)
115
+ ruby-progressbar (~> 1.7)
116
+ unicode-display_width (>= 1.4.0, < 3.0)
117
+ rubocop-ast (1.5.0)
118
+ parser (>= 3.0.1.1)
119
+ rubocop-rspec (2.3.0)
120
+ rubocop (~> 1.0)
121
+ rubocop-ast (>= 1.1.0)
122
+ ruby-progressbar (1.11.0)
123
+ scenic (1.5.4)
124
+ activerecord (>= 4.0.0)
125
+ railties (>= 4.0.0)
126
+ simplecov (0.21.2)
127
+ docile (~> 1.1)
128
+ simplecov-html (~> 0.11)
129
+ simplecov_json_formatter (~> 0.1)
130
+ simplecov-html (0.12.3)
131
+ simplecov_json_formatter (0.1.3)
132
+ thor (1.1.0)
133
+ tzinfo (2.0.4)
134
+ concurrent-ruby (~> 1.0)
135
+ unicode-display_width (2.0.0)
136
+ zeitwerk (2.4.2)
137
+
138
+ PLATFORMS
139
+ x86_64-darwin-19
140
+ x86_64-darwin-20
141
+ x86_64-linux
142
+
143
+ DEPENDENCIES
144
+ activerecord (~> 6.1, < 6.2)
145
+ appraisal
146
+ bundler (~> 2.0)
147
+ combustion (~> 1.3)
148
+ database_cleaner (~> 2)
149
+ pry
150
+ rake (= 13.0.3)
151
+ rspec (~> 3.0)
152
+ rubocop-rspec (~> 2.3)
153
+ scenic (~> 1.5)
154
+ simplecov (~> 0.16)
155
+ table_saw!
156
+
157
+ BUNDLED WITH
158
+ 2.2.22
@@ -2,6 +2,7 @@
2
2
 
3
3
  module TableSaw
4
4
  class Configuration
5
+ attr_writer :variables
5
6
  attr_accessor :dbname, :host, :port, :user, :password, :manifest, :output, :format
6
7
 
7
8
  def connection
@@ -10,12 +11,16 @@ module TableSaw
10
11
 
11
12
  def url=(value)
12
13
  URI.parse(value).tap do |uri|
13
- self.dbname = uri.path[1..-1]
14
+ self.dbname = uri.path[1..]
14
15
  self.host = uri.host
15
16
  self.port = uri.port
16
17
  self.user = uri.user
17
18
  self.password = uri.password
18
19
  end
19
20
  end
21
+
22
+ def variables
23
+ @variables || {}
24
+ end
20
25
  end
21
26
  end
@@ -49,7 +49,7 @@ module TableSaw
49
49
 
50
50
  formatter = FORMATS.fetch(format.fetch('type', 'copy'), TableSaw::Formats::Copy).new(name, options: format)
51
51
 
52
- Array.wrap(formatter.header).each { |line| write_to_file(line) }
52
+ Array(formatter.header).each { |line| write_to_file(line) }
53
53
 
54
54
  TableSaw::Connection.with do |conn|
55
55
  conn.copy_data "COPY (#{table.copy_statement}) TO STDOUT", formatter.coder do
@@ -59,7 +59,7 @@ module TableSaw
59
59
  end
60
60
  end
61
61
 
62
- Array.wrap(formatter.footer).each { |line| write_to_file(line) }
62
+ Array(formatter.footer).each { |line| write_to_file(line) }
63
63
  end
64
64
 
65
65
  write_to_file 'COMMIT;'
@@ -6,7 +6,7 @@ module TableSaw
6
6
  attr_reader :table_name, :partial, :has_many
7
7
  attr_accessor :ids
8
8
 
9
- def initialize(table_name, ids: [], partial: true, has_many: [])
9
+ def initialize(table_name, ids: [], partial: true, has_many: {})
10
10
  @table_name = table_name
11
11
  @ids = ids
12
12
  @partial = partial
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TableSaw
4
+ module DependencyGraph
5
+ class BuildHasManyQuery
6
+ QUERY = <<~SQL.squish
7
+ select %{primary_key} from %{table} where %{clause} and %{polymorphic}
8
+ SQL
9
+
10
+ attr_reader :manifest, :directive, :foreign_key
11
+
12
+ def initialize(manifest, directive, foreign_key)
13
+ @manifest = manifest
14
+ @directive = directive
15
+ @foreign_key = foreign_key
16
+ end
17
+
18
+ def call
19
+ build_base_query
20
+ .then { |query| append_scope(query) }
21
+ .then { |query| append_limit(query) }
22
+ end
23
+
24
+ private
25
+
26
+ # rubocop:disable Metrics/AbcSize
27
+ def build_base_query
28
+ format(QUERY, primary_key: TableSaw.schema_cache.primary_keys(foreign_key.from_table),
29
+ table: foreign_key.from_table,
30
+ clause: TableSaw::Queries::SerializeSqlInClause.new(foreign_key.from_table,
31
+ foreign_key.column.primary_key,
32
+ directive.ids).call,
33
+ polymorphic: foreign_key.type_condition)
34
+ end
35
+ # rubocop:enable Metrics/AbcSize
36
+
37
+ def append_scope(query)
38
+ return query unless has_many&.scope
39
+
40
+ [query, has_many.scope].join(' and ')
41
+ end
42
+
43
+ def append_limit(query)
44
+ return query unless has_many&.limit
45
+
46
+ [query, "limit #{has_many.limit}"].join(' ')
47
+ end
48
+
49
+ def has_many
50
+ directive.has_many[foreign_key.from_table] ||
51
+ manifest.has_many.fetch(directive.table_name, {})[foreign_key.from_table]
52
+ end
53
+ end
54
+ end
55
+ end
@@ -3,10 +3,6 @@
3
3
  module TableSaw
4
4
  module DependencyGraph
5
5
  class HasManyDirectives
6
- QUERY = <<~SQL
7
- select %{primary_key} from %{table} where %{clause} and %{polymorphic}
8
- SQL
9
-
10
6
  attr_reader :manifest, :directive
11
7
 
12
8
  def initialize(manifest, directive)
@@ -34,25 +30,20 @@ module TableSaw
34
30
  def valid_associations
35
31
  associations.select do |fk|
36
32
  next false if directive.partial? && TableSaw.schema_cache.primary_keys(fk.from_table).nil?
37
- next true if directive.has_many.include?(fk.from_table)
33
+ next true if directive.has_many.key?(fk.from_table)
38
34
 
39
- manifest.has_many.fetch(directive.table_name, []).include?(fk.from_table)
35
+ manifest.has_many.fetch(directive.table_name, {}).key?(fk.from_table)
40
36
  end
41
37
  end
38
+ # rubocop:enable Metrics/AbcSize
42
39
 
43
40
  def query_result(foreign_key)
44
41
  return [] unless directive.selectable?
45
42
 
46
43
  TableSaw::Connection.exec(
47
- format(QUERY, primary_key: TableSaw.schema_cache.primary_keys(foreign_key.from_table),
48
- table: foreign_key.from_table,
49
- clause: TableSaw::Queries::SerializeSqlInClause.new(foreign_key.from_table,
50
- foreign_key.column.primary_key,
51
- directive.ids).call,
52
- polymorphic: foreign_key.type_condition)
44
+ TableSaw::DependencyGraph::BuildHasManyQuery.new(manifest, directive, foreign_key).call
53
45
  )
54
46
  end
55
- # rubocop:enable Metrics/AbcSize
56
47
  end
57
48
  end
58
49
  end
@@ -3,5 +3,6 @@
3
3
  require 'table_saw/dependency_graph/add_directive'
4
4
  require 'table_saw/dependency_graph/belongs_to_directives'
5
5
  require 'table_saw/dependency_graph/build'
6
+ require 'table_saw/dependency_graph/build_has_many_query'
6
7
  require 'table_saw/dependency_graph/dump_table'
7
8
  require 'table_saw/dependency_graph/has_many_directives'
@@ -36,7 +36,7 @@ module TableSaw
36
36
 
37
37
  attr_reader :name, :from_table, :from_column, :to_table, :to_column
38
38
 
39
- def initialize(name: nil, from_table:, from_column:, to_table:, to_column:)
39
+ def initialize(from_table:, from_column:, to_table:, to_column:, name: nil)
40
40
  @name = name
41
41
  @from_table = from_table
42
42
  @from_column = from_column
@@ -5,6 +5,35 @@ require 'table_saw/associations'
5
5
 
6
6
  module TableSaw
7
7
  class Manifest
8
+ class HasManyEntry
9
+ def self.build(config)
10
+ config.each_with_object({}) do |(table, options), memo|
11
+ case table
12
+ when String
13
+ memo[table] = new(table, options)
14
+ when Hash
15
+ table, options = table.first
16
+ memo[table] = new(table, options)
17
+ end
18
+ end
19
+ end
20
+
21
+ attr_reader :table, :options
22
+
23
+ def initialize(table, options)
24
+ @table = table
25
+ @options = options || {}
26
+ end
27
+
28
+ def scope
29
+ options['scope']
30
+ end
31
+
32
+ def limit
33
+ options['limit']
34
+ end
35
+ end
36
+
8
37
  class Table
9
38
  attr_reader :variables, :config
10
39
 
@@ -30,7 +59,7 @@ module TableSaw
30
59
  end
31
60
 
32
61
  def has_many
33
- config.fetch('has_many', [])
62
+ config.fetch('has_many', {}).then { |config| HasManyEntry.build(config) }
34
63
  end
35
64
  end
36
65
 
@@ -47,7 +76,8 @@ module TableSaw
47
76
  end
48
77
 
49
78
  def variables
50
- config.fetch('variables', {})
79
+ vars = config.fetch('variables', {})
80
+ vars.merge(TableSaw.configuration.variables.slice(*vars.keys))
51
81
  end
52
82
 
53
83
  def tables
@@ -57,7 +87,9 @@ module TableSaw
57
87
  end
58
88
 
59
89
  def has_many
60
- @has_many ||= config.fetch('has_many', {})
90
+ @has_many ||= config.fetch('has_many', {}).transform_values do |value|
91
+ HasManyEntry.build(value)
92
+ end
61
93
  end
62
94
 
63
95
  def foreign_keys
@@ -23,7 +23,7 @@ module TableSaw
23
23
  end
24
24
 
25
25
  def sql
26
- [prepare_statement, conflict_statement].compact.join(' ') + ';'
26
+ "#{[prepare_statement, conflict_statement].compact.join(' ')};"
27
27
  end
28
28
 
29
29
  def column_types
@@ -23,7 +23,7 @@ module TableSaw
23
23
 
24
24
  def serialized_values
25
25
  values.map do |value|
26
- connection.quote(connection.type_cast_from_column(db_column, value))
26
+ connection.quote_default_expression(value, db_column)
27
27
  end
28
28
  end
29
29
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TableSaw
4
- VERSION = '2.7.0'
4
+ VERSION = '2.10.0'
5
5
  end
data/table_saw.gemspec CHANGED
@@ -23,17 +23,19 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = ['table-saw']
24
24
  spec.require_paths = ['lib']
25
25
 
26
+ spec.required_ruby_version = '>= 2.6'
27
+
26
28
  spec.add_dependency 'activerecord', '>= 5.2'
27
29
  spec.add_dependency 'pg'
28
30
  spec.add_dependency 'thor'
29
31
 
30
32
  spec.add_development_dependency 'bundler', '~> 2.0'
31
- spec.add_development_dependency 'combustion', '~> 1.1'
32
- spec.add_development_dependency 'database_cleaner', '~> 1.7'
33
+ spec.add_development_dependency 'combustion', '~> 1.3'
34
+ spec.add_development_dependency 'database_cleaner', '~> 2'
33
35
  spec.add_development_dependency 'pry'
34
- spec.add_development_dependency 'rake', '~> 13.0'
36
+ spec.add_development_dependency 'rake', '13.0.3'
35
37
  spec.add_development_dependency 'rspec', '~> 3.0'
36
- spec.add_development_dependency 'rubocop-rspec', '~> 1.33'
38
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.3'
37
39
  spec.add_development_dependency 'scenic', '~> 1.5'
38
40
  spec.add_development_dependency 'simplecov', '~> 0.16'
39
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_saw
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hamed Asghari
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-05 00:00:00.000000000 Z
11
+ date: 2021-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -72,28 +72,28 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.1'
75
+ version: '1.3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.1'
82
+ version: '1.3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: database_cleaner
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.7'
89
+ version: '2'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '1.7'
96
+ version: '2'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -112,16 +112,16 @@ dependencies:
112
112
  name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: '13.0'
117
+ version: 13.0.3
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: '13.0'
124
+ version: 13.0.3
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rspec
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '1.33'
145
+ version: '2.3'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '1.33'
152
+ version: '2.3'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: scenic
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -178,7 +178,7 @@ dependencies:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0.16'
181
- description:
181
+ description:
182
182
  email:
183
183
  - hasghari@gmail.com
184
184
  executables:
@@ -192,6 +192,8 @@ files:
192
192
  - ".rubocop.yml"
193
193
  - ".ruby-gemset"
194
194
  - ".ruby-version"
195
+ - ".tool-versions"
196
+ - Appraisals
195
197
  - CODE_OF_CONDUCT.md
196
198
  - Gemfile
197
199
  - Gemfile.lock
@@ -201,6 +203,10 @@ files:
201
203
  - bin/console
202
204
  - bin/setup
203
205
  - exe/table-saw
206
+ - gemfiles/activerecord_6.0.0.gemfile
207
+ - gemfiles/activerecord_6.0.0.gemfile.lock
208
+ - gemfiles/activerecord_6.1.0.gemfile
209
+ - gemfiles/activerecord_6.1.0.gemfile.lock
204
210
  - lib/table_saw.rb
205
211
  - lib/table_saw/associations.rb
206
212
  - lib/table_saw/configuration.rb
@@ -210,6 +216,7 @@ files:
210
216
  - lib/table_saw/dependency_graph/add_directive.rb
211
217
  - lib/table_saw/dependency_graph/belongs_to_directives.rb
212
218
  - lib/table_saw/dependency_graph/build.rb
219
+ - lib/table_saw/dependency_graph/build_has_many_query.rb
213
220
  - lib/table_saw/dependency_graph/dump_table.rb
214
221
  - lib/table_saw/dependency_graph/has_many_directives.rb
215
222
  - lib/table_saw/foreign_key.rb
@@ -232,7 +239,7 @@ homepage: https://github.com/hasghari/table_saw
232
239
  licenses:
233
240
  - MIT
234
241
  metadata: {}
235
- post_install_message:
242
+ post_install_message:
236
243
  rdoc_options: []
237
244
  require_paths:
238
245
  - lib
@@ -240,15 +247,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
240
247
  requirements:
241
248
  - - ">="
242
249
  - !ruby/object:Gem::Version
243
- version: '0'
250
+ version: '2.6'
244
251
  required_rubygems_version: !ruby/object:Gem::Requirement
245
252
  requirements:
246
253
  - - ">="
247
254
  - !ruby/object:Gem::Version
248
255
  version: '0'
249
256
  requirements: []
250
- rubygems_version: 3.0.3
251
- signing_key:
257
+ rubygems_version: 3.2.22
258
+ signing_key:
252
259
  specification_version: 4
253
260
  summary: Create a postgres dump file from a subset of tables
254
261
  test_files: []