table_saw 2.10.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- table_saw (2.10.0)
4
+ table_saw (3.0.0)
5
5
  activerecord (>= 5.2)
6
6
  pg
7
7
  thor
@@ -9,135 +9,139 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (6.1.4.1)
13
- actionview (= 6.1.4.1)
14
- activesupport (= 6.1.4.1)
12
+ actionpack (6.1.7.3)
13
+ actionview (= 6.1.7.3)
14
+ activesupport (= 6.1.7.3)
15
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.1.4.1)
20
- activesupport (= 6.1.4.1)
19
+ actionview (6.1.7.3)
20
+ activesupport (= 6.1.7.3)
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.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)
25
+ activemodel (6.1.7.3)
26
+ activesupport (= 6.1.7.3)
27
+ activerecord (6.1.7.3)
28
+ activemodel (= 6.1.7.3)
29
+ activesupport (= 6.1.7.3)
30
+ activesupport (6.1.7.3)
31
31
  concurrent-ruby (~> 1.0, >= 1.0.2)
32
32
  i18n (>= 1.6, < 2)
33
33
  minitest (>= 5.1)
34
34
  tzinfo (~> 2.0)
35
35
  zeitwerk (~> 2.3)
36
- appraisal (2.3.0)
36
+ appraisal (2.4.1)
37
37
  bundler
38
38
  rake
39
39
  thor (>= 0.14.0)
40
40
  ast (2.4.2)
41
41
  builder (3.2.4)
42
42
  coderay (1.1.3)
43
- combustion (1.3.1)
43
+ combustion (1.3.7)
44
44
  activesupport (>= 3.0.0)
45
45
  railties (>= 3.0.0)
46
46
  thor (>= 0.14.6)
47
- concurrent-ruby (1.1.9)
47
+ concurrent-ruby (1.2.2)
48
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)
49
+ database_cleaner (2.0.2)
50
+ database_cleaner-active_record (>= 2, < 3)
51
+ database_cleaner-active_record (2.1.0)
52
52
  activerecord (>= 5.a)
53
53
  database_cleaner-core (~> 2.0.0)
54
54
  database_cleaner-core (2.0.1)
55
- diff-lcs (1.4.4)
55
+ diff-lcs (1.5.0)
56
56
  docile (1.4.0)
57
- erubi (1.10.0)
58
- i18n (1.8.10)
57
+ erubi (1.12.0)
58
+ i18n (1.13.0)
59
59
  concurrent-ruby (~> 1.0)
60
- loofah (2.12.0)
60
+ json (2.6.3)
61
+ loofah (2.21.3)
61
62
  crass (~> 1.0.2)
62
- nokogiri (>= 1.5.9)
63
+ nokogiri (>= 1.12.0)
63
64
  method_source (1.0.0)
64
- minitest (5.14.4)
65
- nokogiri (1.12.5-x86_64-darwin)
65
+ minitest (5.18.0)
66
+ nokogiri (1.15.2-x86_64-darwin)
66
67
  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)
68
+ parallel (1.23.0)
69
+ parser (3.2.2.1)
71
70
  ast (~> 2.4.1)
72
- pg (1.2.3)
73
- pry (0.13.1)
71
+ pg (1.5.3)
72
+ pry (0.14.2)
74
73
  coderay (~> 1.1)
75
74
  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)
75
+ racc (1.6.2)
76
+ rack (2.2.7)
77
+ rack-test (2.1.0)
78
+ rack (>= 1.3)
80
79
  rails-dom-testing (2.0.3)
81
80
  activesupport (>= 4.2.0)
82
81
  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)
82
+ rails-html-sanitizer (1.5.0)
83
+ loofah (~> 2.19, >= 2.19.1)
84
+ railties (6.1.7.3)
85
+ actionpack (= 6.1.7.3)
86
+ activesupport (= 6.1.7.3)
88
87
  method_source
89
- rake (>= 0.13)
88
+ rake (>= 12.2)
90
89
  thor (~> 1.0)
91
- rainbow (3.0.0)
90
+ rainbow (3.1.1)
92
91
  rake (13.0.3)
93
- regexp_parser (2.1.1)
92
+ regexp_parser (2.8.0)
94
93
  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)
94
+ rspec (3.12.0)
95
+ rspec-core (~> 3.12.0)
96
+ rspec-expectations (~> 3.12.0)
97
+ rspec-mocks (~> 3.12.0)
98
+ rspec-core (3.12.2)
99
+ rspec-support (~> 3.12.0)
100
+ rspec-expectations (3.12.3)
102
101
  diff-lcs (>= 1.2.0, < 2.0)
103
- rspec-support (~> 3.10.0)
104
- rspec-mocks (3.10.1)
102
+ rspec-support (~> 3.12.0)
103
+ rspec-mocks (3.12.5)
105
104
  diff-lcs (>= 1.2.0, < 2.0)
106
- rspec-support (~> 3.10.0)
107
- rspec-support (3.10.1)
108
- rubocop (1.14.0)
105
+ rspec-support (~> 3.12.0)
106
+ rspec-support (3.12.0)
107
+ rubocop (1.51.0)
108
+ json (~> 2.3)
109
109
  parallel (~> 1.10)
110
- parser (>= 3.0.0.0)
110
+ parser (>= 3.2.0.0)
111
111
  rainbow (>= 2.2.2, < 4.0)
112
112
  regexp_parser (>= 1.8, < 3.0)
113
- rexml
114
- rubocop-ast (>= 1.5.0, < 2.0)
113
+ rexml (>= 3.2.5, < 4.0)
114
+ rubocop-ast (>= 1.28.0, < 2.0)
115
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)
116
+ unicode-display_width (>= 2.4.0, < 3.0)
117
+ rubocop-ast (1.28.1)
118
+ parser (>= 3.2.1.0)
119
+ rubocop-capybara (2.18.0)
120
+ rubocop (~> 1.41)
121
+ rubocop-factory_bot (2.23.1)
122
+ rubocop (~> 1.33)
123
+ rubocop-rspec (2.22.0)
124
+ rubocop (~> 1.33)
125
+ rubocop-capybara (~> 2.17)
126
+ rubocop-factory_bot (~> 2.22)
127
+ ruby-progressbar (1.13.0)
128
+ scenic (1.7.0)
124
129
  activerecord (>= 4.0.0)
125
130
  railties (>= 4.0.0)
126
- simplecov (0.21.2)
131
+ simplecov (0.22.0)
127
132
  docile (~> 1.1)
128
133
  simplecov-html (~> 0.11)
129
134
  simplecov_json_formatter (~> 0.1)
130
135
  simplecov-html (0.12.3)
131
- simplecov_json_formatter (0.1.3)
132
- thor (1.1.0)
133
- tzinfo (2.0.4)
136
+ simplecov_json_formatter (0.1.4)
137
+ thor (1.2.2)
138
+ tzinfo (2.0.6)
134
139
  concurrent-ruby (~> 1.0)
135
- unicode-display_width (2.0.0)
136
- zeitwerk (2.4.2)
140
+ unicode-display_width (2.4.2)
141
+ zeitwerk (2.6.8)
137
142
 
138
143
  PLATFORMS
139
- x86_64-darwin-19
140
- x86_64-darwin-20
144
+ x86_64-darwin-22
141
145
  x86_64-linux
142
146
 
143
147
  DEPENDENCIES
@@ -155,4 +159,4 @@ DEPENDENCIES
155
159
  table_saw!
156
160
 
157
161
  BUNDLED WITH
158
- 2.2.22
162
+ 2.4.13
@@ -0,0 +1,17 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "bundler", "~> 2.0"
7
+ gem "combustion", "~> 1.3"
8
+ gem "database_cleaner", "~> 2"
9
+ gem "pry"
10
+ gem "rake", "13.0.3"
11
+ gem "rspec", "~> 3.0"
12
+ gem "rubocop-rspec", "~> 2.3"
13
+ gem "scenic", "~> 1.5"
14
+ gem "simplecov", "~> 0.16"
15
+ gem "activerecord", "~> 7.0", "< 7.1"
16
+
17
+ gemspec path: "../"
@@ -0,0 +1,162 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ table_saw (3.0.0)
5
+ activerecord (>= 5.2)
6
+ pg
7
+ thor
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actionpack (7.0.5)
13
+ actionview (= 7.0.5)
14
+ activesupport (= 7.0.5)
15
+ rack (~> 2.0, >= 2.2.4)
16
+ rack-test (>= 0.6.3)
17
+ rails-dom-testing (~> 2.0)
18
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
19
+ actionview (7.0.5)
20
+ activesupport (= 7.0.5)
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 (7.0.5)
26
+ activesupport (= 7.0.5)
27
+ activerecord (7.0.5)
28
+ activemodel (= 7.0.5)
29
+ activesupport (= 7.0.5)
30
+ activesupport (7.0.5)
31
+ concurrent-ruby (~> 1.0, >= 1.0.2)
32
+ i18n (>= 1.6, < 2)
33
+ minitest (>= 5.1)
34
+ tzinfo (~> 2.0)
35
+ appraisal (2.4.1)
36
+ bundler
37
+ rake
38
+ thor (>= 0.14.0)
39
+ ast (2.4.2)
40
+ builder (3.2.4)
41
+ coderay (1.1.3)
42
+ combustion (1.3.7)
43
+ activesupport (>= 3.0.0)
44
+ railties (>= 3.0.0)
45
+ thor (>= 0.14.6)
46
+ concurrent-ruby (1.2.2)
47
+ crass (1.0.6)
48
+ database_cleaner (2.0.2)
49
+ database_cleaner-active_record (>= 2, < 3)
50
+ database_cleaner-active_record (2.1.0)
51
+ activerecord (>= 5.a)
52
+ database_cleaner-core (~> 2.0.0)
53
+ database_cleaner-core (2.0.1)
54
+ diff-lcs (1.5.0)
55
+ docile (1.4.0)
56
+ erubi (1.12.0)
57
+ i18n (1.13.0)
58
+ concurrent-ruby (~> 1.0)
59
+ json (2.6.3)
60
+ loofah (2.21.3)
61
+ crass (~> 1.0.2)
62
+ nokogiri (>= 1.12.0)
63
+ method_source (1.0.0)
64
+ minitest (5.18.0)
65
+ nokogiri (1.15.2-x86_64-darwin)
66
+ racc (~> 1.4)
67
+ parallel (1.23.0)
68
+ parser (3.2.2.1)
69
+ ast (~> 2.4.1)
70
+ pg (1.5.3)
71
+ pry (0.14.2)
72
+ coderay (~> 1.1)
73
+ method_source (~> 1.0)
74
+ racc (1.6.2)
75
+ rack (2.2.7)
76
+ rack-test (2.1.0)
77
+ rack (>= 1.3)
78
+ rails-dom-testing (2.0.3)
79
+ activesupport (>= 4.2.0)
80
+ nokogiri (>= 1.6)
81
+ rails-html-sanitizer (1.5.0)
82
+ loofah (~> 2.19, >= 2.19.1)
83
+ railties (7.0.5)
84
+ actionpack (= 7.0.5)
85
+ activesupport (= 7.0.5)
86
+ method_source
87
+ rake (>= 12.2)
88
+ thor (~> 1.0)
89
+ zeitwerk (~> 2.5)
90
+ rainbow (3.1.1)
91
+ rake (13.0.3)
92
+ regexp_parser (2.8.0)
93
+ rexml (3.2.5)
94
+ rspec (3.12.0)
95
+ rspec-core (~> 3.12.0)
96
+ rspec-expectations (~> 3.12.0)
97
+ rspec-mocks (~> 3.12.0)
98
+ rspec-core (3.12.2)
99
+ rspec-support (~> 3.12.0)
100
+ rspec-expectations (3.12.3)
101
+ diff-lcs (>= 1.2.0, < 2.0)
102
+ rspec-support (~> 3.12.0)
103
+ rspec-mocks (3.12.5)
104
+ diff-lcs (>= 1.2.0, < 2.0)
105
+ rspec-support (~> 3.12.0)
106
+ rspec-support (3.12.0)
107
+ rubocop (1.51.0)
108
+ json (~> 2.3)
109
+ parallel (~> 1.10)
110
+ parser (>= 3.2.0.0)
111
+ rainbow (>= 2.2.2, < 4.0)
112
+ regexp_parser (>= 1.8, < 3.0)
113
+ rexml (>= 3.2.5, < 4.0)
114
+ rubocop-ast (>= 1.28.0, < 2.0)
115
+ ruby-progressbar (~> 1.7)
116
+ unicode-display_width (>= 2.4.0, < 3.0)
117
+ rubocop-ast (1.28.1)
118
+ parser (>= 3.2.1.0)
119
+ rubocop-capybara (2.18.0)
120
+ rubocop (~> 1.41)
121
+ rubocop-factory_bot (2.23.1)
122
+ rubocop (~> 1.33)
123
+ rubocop-rspec (2.22.0)
124
+ rubocop (~> 1.33)
125
+ rubocop-capybara (~> 2.17)
126
+ rubocop-factory_bot (~> 2.22)
127
+ ruby-progressbar (1.13.0)
128
+ scenic (1.7.0)
129
+ activerecord (>= 4.0.0)
130
+ railties (>= 4.0.0)
131
+ simplecov (0.22.0)
132
+ docile (~> 1.1)
133
+ simplecov-html (~> 0.11)
134
+ simplecov_json_formatter (~> 0.1)
135
+ simplecov-html (0.12.3)
136
+ simplecov_json_formatter (0.1.4)
137
+ thor (1.2.2)
138
+ tzinfo (2.0.6)
139
+ concurrent-ruby (~> 1.0)
140
+ unicode-display_width (2.4.2)
141
+ zeitwerk (2.6.8)
142
+
143
+ PLATFORMS
144
+ x86_64-darwin-22
145
+ x86_64-linux
146
+
147
+ DEPENDENCIES
148
+ activerecord (~> 7.0, < 7.1)
149
+ appraisal
150
+ bundler (~> 2.0)
151
+ combustion (~> 1.3)
152
+ database_cleaner (~> 2)
153
+ pry
154
+ rake (= 13.0.3)
155
+ rspec (~> 3.0)
156
+ rubocop-rspec (~> 2.3)
157
+ scenic (~> 1.5)
158
+ simplecov (~> 0.16)
159
+ table_saw!
160
+
161
+ BUNDLED WITH
162
+ 2.4.13
@@ -19,7 +19,7 @@ module TableSaw
19
19
 
20
20
  # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
21
21
  def call
22
- File.delete(file) if File.exist?(file)
22
+ FileUtils.rm_f(file)
23
23
  FileUtils.mkdir_p(File.dirname(file))
24
24
 
25
25
  alter_constraints_deferrability
@@ -3,7 +3,7 @@
3
3
  module TableSaw
4
4
  class ForeignKey
5
5
  class Column
6
- REGEX = /(\w+)(?::(\w+)\((\w+)\))?/.freeze
6
+ REGEX = /(\w+)(?::(\w+)\((\w+)\))?/
7
7
 
8
8
  attr_reader :value
9
9
 
@@ -77,7 +77,7 @@ module TableSaw
77
77
 
78
78
  def variables
79
79
  vars = config.fetch('variables', {})
80
- vars.merge(TableSaw.configuration.variables.slice(*vars.keys))
80
+ VariableInterpolation.call(vars.merge(TableSaw.configuration.variables.slice(*vars.keys)))
81
81
  end
82
82
 
83
83
  def tables
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TableSaw
4
+ class VariableInterpolation
5
+ def self.call(variables)
6
+ new(variables).call
7
+ end
8
+
9
+ attr_reader :input
10
+
11
+ def initialize(input)
12
+ @input = input
13
+ end
14
+
15
+ def call
16
+ input.transform_values do |value|
17
+ next value unless value.is_a?(String)
18
+
19
+ interpolate_variables(value, input)
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def interpolate_variables(string, variables)
26
+ string.gsub(/%{(\w+)}/) do |match|
27
+ variable_name = ::Regexp.last_match(1)
28
+ if variables.key?(variable_name)
29
+ nested_value = interpolate_variables(variables[variable_name], variables)
30
+ interpolate_variables(nested_value, variables)
31
+ else
32
+ match
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TableSaw
4
- VERSION = '2.10.0'
4
+ VERSION = '3.0.0'
5
5
  end
data/lib/table_saw.rb CHANGED
@@ -7,6 +7,7 @@ require 'table_saw/information_schema'
7
7
  require 'table_saw/manifest'
8
8
  require 'table_saw/queries'
9
9
  require 'table_saw/formats'
10
+ require 'table_saw/variable_interpolation'
10
11
 
11
12
  module TableSaw
12
13
  def self.configuration
data/table_saw.gemspec CHANGED
@@ -23,19 +23,10 @@ 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'
26
+ spec.required_ruby_version = '>= 3.0'
27
+ spec.metadata['rubygems_mfa_required'] = 'true'
27
28
 
28
29
  spec.add_dependency 'activerecord', '>= 5.2'
29
30
  spec.add_dependency 'pg'
30
31
  spec.add_dependency 'thor'
31
-
32
- spec.add_development_dependency 'bundler', '~> 2.0'
33
- spec.add_development_dependency 'combustion', '~> 1.3'
34
- spec.add_development_dependency 'database_cleaner', '~> 2'
35
- spec.add_development_dependency 'pry'
36
- spec.add_development_dependency 'rake', '13.0.3'
37
- spec.add_development_dependency 'rspec', '~> 3.0'
38
- spec.add_development_dependency 'rubocop-rspec', '~> 2.3'
39
- spec.add_development_dependency 'scenic', '~> 1.5'
40
- spec.add_development_dependency 'simplecov', '~> 0.16'
41
32
  end