pgdump_scrambler 0.4.0 → 0.4.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: '09085520af68283995aeb54b3ae886c303b2ec2a9123b7d76da9a201463bb0d9'
4
- data.tar.gz: e7ee185201e95a18b84fa9b9eaafce6e98b0f0187125af647044ff4eb4789058
3
+ metadata.gz: da5d3c9bc68d351090dfabdab28ad0bd216515554d61f8d4a06381eba5fc1ce4
4
+ data.tar.gz: 0e01334e4769d064ff9d3e2ebbca847f389ec12157b7ac299f8c89568937e2fc
5
5
  SHA512:
6
- metadata.gz: 45cf30192e04b4af8f30d90aa753cd52b410f9d51597fd9f9eefbf050a6b15f16abd5c2c6ee3241e8261a1f63c22b4207f88e064e240523c371bec9db2a638b2
7
- data.tar.gz: b7a5383078df617610d10eec93049f68194eea2aae21970752059dd632ff5b67b94e7a713a3701a57db3a8886991f86ec1c7d2a085b5d1a0ba97753fea99b52a
6
+ metadata.gz: 3b12790519c8980cc4b208f3e9ad6b137d83ab970acfc2d03cf21793893ed376a67e7d47c2f0d83afb4c675320ba6548125c22dc2d8e66050c70c1414fa76f89
7
+ data.tar.gz: 98f6af73aa1b377c4c31e365c65dcefa1b90cb8c6f3b1c69220270a519db0d9b55e0fb9440ba843c0dffb9819d3b0f63592935656feaf18d8fd438d8f314ed82
@@ -0,0 +1,40 @@
1
+ name: Ruby
2
+
3
+ on: [pull_request]
4
+
5
+ concurrency:
6
+ group: ${{ github.workflow }}-${{ github.ref }}
7
+ cancel-in-progress: true
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+
13
+ strategy:
14
+ matrix:
15
+ ruby-version:
16
+ - "3.2"
17
+ - "3.1"
18
+ - "3.0"
19
+ # - "3.3.0-preview2"
20
+
21
+ # services:
22
+ # postgres:
23
+ # image: postgres:14
24
+ # ports: ["5432:5432"]
25
+ # options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
26
+ # env:
27
+ # POSTGRES_USER: postgres
28
+ # POSTGRES_PASSWORD: postgres
29
+
30
+ steps:
31
+ - uses: actions/checkout@v4
32
+ - name: Set up Ruby ${{ matrix.ruby-version }}
33
+ uses: ruby/setup-ruby@v1
34
+ with:
35
+ ruby-version: ${{ matrix.ruby-version }}
36
+ bundler-cache: true
37
+ - name: rspec
38
+ run: bundle exec rspec
39
+ - name: rubocop
40
+ run: bundle exec rubocop
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ .ruby-version
data/.rubocop.yml CHANGED
@@ -1,2 +1,46 @@
1
- inherit_from: .rubocop_todo.yml
1
+ require: rubocop-rspec
2
2
 
3
+ AllCops:
4
+ TargetRubyVersion: 3.0
5
+ NewCops: enable
6
+
7
+ # https://docs.rubocop.org/rubocop/cops_layout.html#layoutargumentalignment
8
+ Layout/ArgumentAlignment:
9
+ EnforcedStyle: with_fixed_indentation
10
+
11
+ # https://docs.rubocop.org/rubocop/cops_layout.html#layoutmultilinemethodcallindentation
12
+ Layout/MultilineMethodCallIndentation:
13
+ EnforcedStyle: indented
14
+
15
+ Style/Documentation:
16
+ Enabled: false
17
+
18
+ Style/FormatString:
19
+ Enabled: false
20
+
21
+ Metrics/AbcSize:
22
+ Enabled: false
23
+
24
+ Metrics/ClassLength:
25
+ Enabled: false
26
+
27
+ Metrics/MethodLength:
28
+ Enabled: false
29
+
30
+ Metrics/BlockLength:
31
+ Enabled: false
32
+
33
+ Metrics/CyclomaticComplexity:
34
+ Enabled: false
35
+
36
+ Metrics/PerceivedComplexity:
37
+ Enabled: false
38
+
39
+ RSpec/ExampleLength:
40
+ Enabled: false
41
+
42
+ RSpec/DescribedClass:
43
+ Enabled: false
44
+
45
+ RSpec/MultipleExpectations:
46
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## [0.4.1] - 2023-10-19
2
+ - Fix S3 upload
3
+
1
4
  ## [0.4.0] - 2023-10-18
2
5
  - Add scramble functions
3
6
  - Support ARM64 Linux/Mac
data/Gemfile CHANGED
@@ -1,6 +1,17 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
6
 
5
7
  # Specify your gem's dependencies in pgdump_scrambler.gemspec
6
8
  gemspec
9
+
10
+ gem 'rails', '~> 7.0'
11
+
12
+ gem 'rake', '~> 13.0'
13
+
14
+ gem 'rspec', '~> 3.12'
15
+
16
+ gem 'rubocop', '1.57.1'
17
+ gem 'rubocop-rspec', '2.24.1'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pgdump_scrambler (0.4.0)
4
+ pgdump_scrambler (0.4.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -72,6 +72,7 @@ GEM
72
72
  minitest (>= 5.1)
73
73
  tzinfo (~> 2.0)
74
74
  ast (2.4.2)
75
+ base64 (0.1.1)
75
76
  builder (3.2.4)
76
77
  concurrent-ruby (1.2.2)
77
78
  crass (1.0.6)
@@ -83,6 +84,7 @@ GEM
83
84
  i18n (1.12.0)
84
85
  concurrent-ruby (~> 1.0)
85
86
  json (2.6.3)
87
+ language_server-protocol (3.17.0.3)
86
88
  loofah (2.20.0)
87
89
  crass (~> 1.0.2)
88
90
  nokogiri (>= 1.5.9)
@@ -107,9 +109,10 @@ GEM
107
109
  nio4r (2.5.9)
108
110
  nokogiri (1.14.3-x86_64-linux)
109
111
  racc (~> 1.4)
110
- parallel (1.22.1)
111
- parser (3.2.2.0)
112
+ parallel (1.23.0)
113
+ parser (3.2.2.4)
112
114
  ast (~> 2.4.1)
115
+ racc
113
116
  racc (1.6.2)
114
117
  rack (2.2.6.4)
115
118
  rack-test (2.1.0)
@@ -142,8 +145,8 @@ GEM
142
145
  zeitwerk (~> 2.5)
143
146
  rainbow (3.1.1)
144
147
  rake (13.0.6)
145
- regexp_parser (2.7.0)
146
- rexml (3.2.5)
148
+ regexp_parser (2.8.2)
149
+ rexml (3.2.6)
147
150
  rspec (3.12.0)
148
151
  rspec-core (~> 3.12.0)
149
152
  rspec-expectations (~> 3.12.0)
@@ -157,24 +160,34 @@ GEM
157
160
  diff-lcs (>= 1.2.0, < 2.0)
158
161
  rspec-support (~> 3.12.0)
159
162
  rspec-support (3.12.0)
160
- rubocop (1.50.1)
163
+ rubocop (1.57.1)
164
+ base64 (~> 0.1.1)
161
165
  json (~> 2.3)
166
+ language_server-protocol (>= 3.17.0)
162
167
  parallel (~> 1.10)
163
- parser (>= 3.2.0.0)
168
+ parser (>= 3.2.2.4)
164
169
  rainbow (>= 2.2.2, < 4.0)
165
170
  regexp_parser (>= 1.8, < 3.0)
166
171
  rexml (>= 3.2.5, < 4.0)
167
- rubocop-ast (>= 1.28.0, < 2.0)
172
+ rubocop-ast (>= 1.28.1, < 2.0)
168
173
  ruby-progressbar (~> 1.7)
169
174
  unicode-display_width (>= 2.4.0, < 3.0)
170
- rubocop-ast (1.28.0)
175
+ rubocop-ast (1.29.0)
171
176
  parser (>= 3.2.1.0)
177
+ rubocop-capybara (2.19.0)
178
+ rubocop (~> 1.41)
179
+ rubocop-factory_bot (2.24.0)
180
+ rubocop (~> 1.33)
181
+ rubocop-rspec (2.24.1)
182
+ rubocop (~> 1.33)
183
+ rubocop-capybara (~> 2.17)
184
+ rubocop-factory_bot (~> 2.22)
172
185
  ruby-progressbar (1.13.0)
173
186
  thor (1.2.1)
174
187
  timeout (0.3.2)
175
188
  tzinfo (2.0.6)
176
189
  concurrent-ruby (~> 1.0)
177
- unicode-display_width (2.4.2)
190
+ unicode-display_width (2.5.0)
178
191
  websocket-driver (0.7.5)
179
192
  websocket-extensions (>= 0.1.0)
180
193
  websocket-extensions (0.1.5)
@@ -188,7 +201,8 @@ DEPENDENCIES
188
201
  rails (~> 7.0)
189
202
  rake (~> 13.0)
190
203
  rspec (~> 3.12)
191
- rubocop
204
+ rubocop (= 1.57.1)
205
+ rubocop-rspec (= 2.24.1)
192
206
 
193
207
  BUNDLED WITH
194
- 2.4.12
208
+ 2.4.20
data/README.md CHANGED
@@ -7,7 +7,7 @@ Generate scrambled potgresql dump for rails application.
7
7
  Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'pgdump_scrambler', github: 'shunichi/pgdump_scrambler'
10
+ gem 'pgdump_scrambler'
11
11
  ```
12
12
 
13
13
  And then execute:
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
data/bin/console CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "pgdump_scrambler"
4
+ require 'bundler/setup'
5
+ require 'pgdump_scrambler'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "pgdump_scrambler"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start(__FILE__)
@@ -1,7 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'English'
2
5
  require 'shellwords'
3
6
 
4
- arch = case RUBY_PLATFORM
7
+ arch =
8
+ case RUBY_PLATFORM
5
9
  when /aarch64-linux/
6
10
  'linux-arm64'
7
11
  when /x86_64-linux/
@@ -12,8 +16,8 @@ arch = case RUBY_PLATFORM
12
16
  'darwin-arm64'
13
17
  else
14
18
  raise "Unsupported platform: #{RUBY_PLATFORM}"
15
- end
19
+ end
16
20
 
17
21
  cmd = File.expand_path "#{File.dirname(__FILE__)}/../libexec/pgdump-obfuscator-#{arch}"
18
22
 
19
- exec "#{cmd} #{Shellwords.join($*)}"
23
+ exec "#{cmd} #{Shellwords.join($ARGV)}"
data/lib/config/table.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module PgdumpScrambler
3
4
  class Config
4
5
  class Table
@@ -6,7 +7,7 @@ module PgdumpScrambler
6
7
 
7
8
  def initialize(name, columns)
8
9
  @name = name
9
- @column_hash = columns.sort_by(&:name).map { |column| [column.name, column] }.to_h
10
+ @column_hash = columns.sort_by(&:name).to_h { |column| [column.name, column] }
10
11
  end
11
12
 
12
13
  def columns
@@ -39,29 +40,26 @@ module PgdumpScrambler
39
40
  SCRAMBLE_CONST_REGEXP = /\Aconst\[.+\]\z/
40
41
  NOP_METHODS = %w[unspecified nop].freeze
41
42
  UNSPECIFIED = 'unspecified'
42
- attr_reader :name
43
+ attr_reader :name, :scramble_method
43
44
 
44
45
  def initialize(name, scramble_method = UNSPECIFIED)
45
46
  unless self.class.valid_scramble_method?(scramble_method)
46
47
  raise ArgumentError, "invalid scramble_method: #{scramble_method}"
47
48
  end
49
+
48
50
  @name = name
49
51
  @scramble_method = scramble_method
50
52
  end
51
53
 
52
- def scramble_method
53
- @scramble_method
54
- end
55
-
56
54
  def unspecifiled?
57
55
  @scramble_method == UNSPECIFIED
58
56
  end
59
57
 
60
58
  def option
61
- unless NOP_METHODS.member?(@scramble_method)
62
- m = Shellwords.escape(scramble_method)
63
- "#{@name}:#{m}"
64
- end
59
+ return if NOP_METHODS.member?(@scramble_method)
60
+
61
+ m = Shellwords.escape(scramble_method)
62
+ "#{@name}:#{m}"
65
63
  end
66
64
 
67
65
  class << self
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'yaml'
3
4
  require 'erb'
4
5
  require 'set'
@@ -19,14 +20,14 @@ module PgdumpScrambler
19
20
  'prefix' => 'YOUR_S3_PATH_PREFIX',
20
21
  'access_key_id' => "<%= ENV['AWS_ACCESS_KEY_ID'] %>",
21
22
  'secret_key' => "<%= ENV['AWS_SECRET_KEY'] %>"
22
- }
23
+ }.freeze
23
24
  attr_reader :dump_path, :s3, :resolved_s3, :exclude_tables, :pgdump_args
24
25
 
25
- def initialize(tables, dump_path, s3, exclude_tables, pgdump_args)
26
- @table_hash = tables.sort_by(&:name).map { |table| [table.name, table] }.to_h
26
+ def initialize(tables, dump_path, s3, exclude_tables, pgdump_args) # rubocop:disable Naming/MethodParameterName
27
+ @table_hash = tables.sort_by(&:name).to_h { |table| [table.name, table] }
27
28
  @dump_path = dump_path
28
29
  @s3 = s3
29
- @resolved_s3 = s3.map { |k, v| [k, ERB.new(v).result] }.to_h if s3
30
+ @resolved_s3 = s3.transform_values { |v| ERB.new(v).result } if s3
30
31
  @exclude_tables = exclude_tables
31
32
  @pgdump_args = pgdump_args
32
33
  end
@@ -45,7 +46,7 @@ module PgdumpScrambler
45
46
 
46
47
  def update_with(other)
47
48
  new_tables = @table_hash.map do |_, table|
48
- if other_table = other.table(table.name)
49
+ if (other_table = other.table(table.name))
49
50
  table.update_with(other_table)
50
51
  else
51
52
  table
@@ -66,15 +67,15 @@ module PgdumpScrambler
66
67
  yml = {}
67
68
  yml[KEY_DUMP_PATH] = @dump_path
68
69
  yml[KEY_S3] = @s3 if @s3
69
- yml[KEY_EXCLUDE_TABLES] = @exclude_tables if @exclude_tables.size > 0
70
+ yml[KEY_EXCLUDE_TABLES] = @exclude_tables if @exclude_tables.size.positive?
70
71
  yml[KEY_TABLES] = @table_hash.map do |_, table|
71
72
  columns = table.columns
72
- unless columns.empty?
73
- [
74
- table.name,
75
- columns.map { |column| [column.name, column.scramble_method] }.to_h,
76
- ]
77
- end
73
+ next if columns.empty?
74
+
75
+ [
76
+ table.name,
77
+ columns.to_h { |column| [column.name, column.scramble_method] }
78
+ ]
78
79
  end.compact.to_h
79
80
  YAML.dump(yml, io)
80
81
  end
@@ -92,21 +93,22 @@ module PgdumpScrambler
92
93
  class << self
93
94
  def read(io)
94
95
  yml = YAML.safe_load(io, permitted_classes: [], permitted_symbols: [], aliases: true)
95
- if yml[KEY_TABLES]
96
- tables = yml[KEY_TABLES].map do |table_name, columns|
97
- Table.new(
98
- table_name,
99
- columns.map { |name, scramble_method| Column.new(name, scramble_method) }
100
- )
96
+ tables =
97
+ if yml[KEY_TABLES]
98
+ yml[KEY_TABLES].map do |table_name, columns|
99
+ Table.new(
100
+ table_name,
101
+ columns.map { |name, scramble_method| Column.new(name, scramble_method) }
102
+ )
103
+ end
104
+ else
105
+ []
101
106
  end
102
- else
103
- tables = []
104
- end
105
107
  Config.new(tables, yml[KEY_DUMP_PATH], yml[KEY_S3], yml[KEY_EXCLUDE_TABLES] || [], yml[KEY_PGDUMP_ARGS])
106
108
  end
107
109
 
108
110
  def read_file(path)
109
- open(path, 'r') do |f|
111
+ File.open(path, 'r') do |f|
110
112
  read(f)
111
113
  end
112
114
  end
@@ -118,18 +120,17 @@ module PgdumpScrambler
118
120
  else
119
121
  Rails.application.eager_load!
120
122
  end
121
- klasses_by_table = ActiveRecord::Base.descendants.map { |klass| [klass.table_name, klass] }.to_h
123
+ klasses_by_table = ActiveRecord::Base.descendants.to_h { |klass| [klass.table_name, klass] }
122
124
  table_names = ActiveRecord::Base.connection.tables.sort - IGNORED_ACTIVE_RECORD_TABLES
123
125
  tables = table_names.map do |table_name|
124
126
  klass = klasses_by_table[table_name]
125
- if klass
126
- columns = klass.columns.map(&:name).reject do |name|
127
- IGNORED_ACTIVE_RECORD_COLUMNS.member?(name)
128
- end.map do |name|
129
- Column.new(name)
130
- end
131
- Table.new(table_name, columns)
127
+ next unless klass
128
+
129
+ column_names = klass.columns.map(&:name).reject do |name|
130
+ IGNORED_ACTIVE_RECORD_COLUMNS.member?(name)
132
131
  end
132
+ columns = column_names.map { |name| Column.new(name) }
133
+ Table.new(table_name, columns)
133
134
  end.compact
134
135
  Config.new(tables, 'scrambled.dump.gz', Config::DEFAULT_S3_PROPERTIES, [], nil)
135
136
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'open3'
3
4
  module PgdumpScrambler
4
5
  class Dumper
@@ -9,13 +10,11 @@ module PgdumpScrambler
9
10
  end
10
11
 
11
12
  def run
12
- puts "executing pg_dump..."
13
+ puts 'Executing pg_dump...'
13
14
  puts full_command
14
- if system(full_command)
15
- puts "done!"
16
- else
17
- raise "pg_dump failed!"
18
- end
15
+ raise 'pg_dump failed!' unless system(full_command)
16
+
17
+ puts 'Done!'
19
18
  end
20
19
 
21
20
  private
@@ -25,10 +24,10 @@ module PgdumpScrambler
25
24
  end
26
25
 
27
26
  def obfuscator_command
28
- if options = @config.obfuscator_options
29
- command = File.expand_path('../../../bin/pgdump-obfuscator', __FILE__)
30
- "#{command} #{options}"
31
- end
27
+ return unless (options = @config.obfuscator_options)
28
+
29
+ command = File.expand_path('../../bin/pgdump-obfuscator', __dir__)
30
+ "#{command} #{options}"
32
31
  end
33
32
 
34
33
  def pgdump_command
@@ -39,18 +38,25 @@ module PgdumpScrambler
39
38
  command << "--username=#{Shellwords.escape(@db_config['username'])}" if @db_config['username']
40
39
  command << "--host='#{@db_config['host']}'" if @db_config['host']
41
40
  command << "--port='#{@db_config['port']}'" if @db_config['port']
42
- command << @config.exclude_tables.map { |exclude_table| "--exclude-table-data=#{exclude_table}" }.join(' ') if @config.exclude_tables.present?
41
+ if @config.exclude_tables.present?
42
+ command << @config.exclude_tables.map do |exclude_table|
43
+ "--exclude-table-data=#{exclude_table}"
44
+ end.join(' ')
45
+ end
43
46
  command << @db_config['database']
44
47
  command.join(' ')
45
48
  end
46
49
 
47
50
  def load_database_yml
48
- if defined?(Rails)
49
- db_config = open(Rails.root.join('config', 'database.yml'), 'r') do |f|
50
- YAML.safe_load(f, permitted_classes: [], permitted_symbols: [], aliases: true)
51
- end
52
- db_config[Rails.env]
53
- end
51
+ return unless defined?(Rails)
52
+
53
+ db_config = YAML.safe_load_file(
54
+ Rails.root.join('config', 'database.yml'),
55
+ permitted_classes: [],
56
+ permitted_symbols: [],
57
+ aliases: true
58
+ )
59
+ db_config[Rails.env]
54
60
  end
55
61
  end
56
62
  end
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module PgdumpScrambler
3
4
  class Railtie < ::Rails::Railtie
4
5
  rake_tasks do
5
- load File.expand_path('../../tasks/pgdump_scrambler_tasks.rake', __FILE__)
6
+ load File.expand_path('../tasks/pgdump_scrambler_tasks.rake', __dir__)
6
7
  end
7
8
  end
8
9
  end
@@ -1,11 +1,12 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'uri'
3
4
  require 'digest'
4
5
  require 'openssl'
5
6
 
6
7
  module PgdumpScrambler
7
8
  class S3Request
8
- def initialize(s3_path:, verb:, region:, bucket:, access_key_id:, secret_key:, time: nil)
9
+ def initialize(s3_path:, verb:, region:, bucket:, access_key_id:, secret_key:, time: nil) # rubocop:disable Metrics/ParameterLists
9
10
  @s3_path = s3_path.start_with?('/') ? s3_path : "/#{s3_path}"
10
11
  @verb = verb
11
12
  @time = time || Time.now.utc
@@ -18,7 +19,7 @@ module PgdumpScrambler
18
19
  def canonical_request
19
20
  [
20
21
  @verb,
21
- URI.encode(@s3_path),
22
+ self.class.uri_encode(@s3_path),
22
23
  canonical_query_string,
23
24
  "host:#{@bucket}.s3.amazonaws.com\n", # canonical headers
24
25
  'host', # signed headers
@@ -38,13 +39,15 @@ module PgdumpScrambler
38
39
  end
39
40
 
40
41
  def url
41
- File.join("https://#{@bucket}.s3.amazonaws.com/", "#{@s3_path}?#{canonical_query_string}&X-Amz-Signature=#{signature}")
42
+ encoded_path = self.class.uri_encode(@s3_path)
43
+ File.join("https://#{@bucket}.s3.amazonaws.com/",
44
+ "#{encoded_path}?#{canonical_query_string}&X-Amz-Signature=#{signature}")
42
45
  end
43
46
 
44
47
  private
45
48
 
46
49
  def iso_time
47
- @time.strftime("%Y%m%dT%H%M%SZ")
50
+ @time.strftime('%Y%m%dT%H%M%SZ')
48
51
  end
49
52
 
50
53
  def iso_date
@@ -52,15 +55,17 @@ module PgdumpScrambler
52
55
  end
53
56
 
54
57
  def hmac_sha256(key, message)
55
- OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, key, message)
58
+ OpenSSL::HMAC.digest(OpenSSL::Digest.new('SHA256'), key, message)
56
59
  end
57
60
 
58
61
  def hmac_sha256_hex(key, message)
59
- OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA256.new, key, message)
62
+ OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('SHA256'), key, message)
60
63
  end
61
64
 
62
65
  def canonical_query_string
66
+ # rubocop:disable Layout/LineLength
63
67
  "X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=#{@access_key_id}%2F#{iso_date}%2F#{@region}%2Fs3%2Faws4_request&X-Amz-Date=#{iso_time}&X-Amz-Expires=86400&X-Amz-SignedHeaders=host"
68
+ # rubocop:enable Layout/LineLength
64
69
  end
65
70
 
66
71
  def string_to_sign
@@ -68,39 +73,29 @@ module PgdumpScrambler
68
73
  'AWS4-HMAC-SHA256',
69
74
  iso_time,
70
75
  "#{iso_date}/#{@region}/s3/aws4_request",
71
- Digest::SHA256.hexdigest(canonical_request),
76
+ Digest::SHA256.hexdigest(canonical_request)
72
77
  ].join("\n")
73
78
  end
74
- end
75
- end
76
-
77
- if $0 == __FILE__
78
- # https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html
79
- require "minitest/autorun"
80
- class TestS3Request < Minitest::Test
81
- def setup
82
- @s3_request = PgdumpScrambler::S3Request.new(verb: 'GET', s3_path: '/test.txt', region: 'us-east-1', bucket: 'examplebucket', access_key_id: 'AKIAIOSFODNN7EXAMPLE', secret_key: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY', time: Time.utc(2013, 5, 24, 0, 0, 0))
83
- end
84
-
85
- def test_canonical_request
86
- assert_equal <<~EOS.chomp, @s3_request.canonical_request
87
- GET
88
- /test.txt
89
- X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20130524%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20130524T000000Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host
90
- host:examplebucket.s3.amazonaws.com
91
-
92
- host
93
- UNSIGNED-PAYLOAD
94
- EOS
95
- end
96
-
97
- def test_signature
98
- assert_equal 'aeeed9bbccd4d02ee5c0109b86d86835f995330da4c265957d157751f604d404', @s3_request.signature
99
- end
100
79
 
101
- def test_url
102
- exected_url = 'https://examplebucket.s3.amazonaws.com/test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20130524%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20130524T000000Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=aeeed9bbccd4d02ee5c0109b86d86835f995330da4c265957d157751f604d404'
103
- assert_equal exected_url, @s3_request.url
80
+ class << self
81
+ # https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html
82
+ # * URI encode every byte except the unreserved characters: 'A'-'Z', 'a'-'z', '0'-'9', '-', '.', '_', and '~'.
83
+ # * The space character is a reserved character and must be encoded as "%20" (and not as "+").
84
+ # * Each URI encoded byte is formed by a '%' and the two-digit hexadecimal value of the byte.
85
+ # * Letters in the hexadecimal value must be uppercase, for example "%1A".
86
+ # * Encode the forward slash character, '/', everywhere except in the object key name.
87
+ # For example, if the object key name is photos/Jan/sample.jpg,
88
+ # the forward slash in the key name is not encoded.
89
+ def uri_encode(str)
90
+ str.gsub(%r{[^A-Za-z0-9\-._~/]}) do
91
+ us = Regexp.last_match(0)
92
+ tmp = +''
93
+ us.each_byte do |uc|
94
+ tmp << sprintf('%%%02X', uc)
95
+ end
96
+ tmp
97
+ end.force_encoding(Encoding::US_ASCII)
98
+ end
104
99
  end
105
100
  end
106
101
  end
@@ -1,11 +1,13 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'net/http'
3
4
  require 'uri'
4
- require_relative './s3_request'
5
+ require_relative 's3_request'
5
6
 
6
7
  module PgdumpScrambler
7
8
  class S3UploadError < StandardError
8
9
  attr_reader :response
10
+
9
11
  def initialize(response)
10
12
  @response = response
11
13
  super "S3 upload failed: #{response.body}"
@@ -13,17 +15,25 @@ module PgdumpScrambler
13
15
  end
14
16
 
15
17
  class S3Uploader
16
- def initialize(s3_path:, local_path:, region:, bucket:, access_key_id:, secret_key:)
18
+ def initialize(s3_path:, local_path:, region:, bucket:, access_key_id:, secret_key:) # rubocop:disable Metrics/ParameterLists
17
19
  raise 'missing access_key_id' if access_key_id.nil? || access_key_id.empty?
18
20
  raise 'missing secret_key' if secret_key.nil? || secret_key.empty?
19
- @s3_request = S3Request.new(s3_path: s3_path, verb: 'PUT', region: region, bucket: bucket, access_key_id: access_key_id, secret_key: secret_key)
21
+
22
+ @s3_request = S3Request.new(
23
+ s3_path: s3_path,
24
+ verb: 'PUT',
25
+ region: region,
26
+ bucket: bucket,
27
+ access_key_id: access_key_id,
28
+ secret_key: secret_key
29
+ )
20
30
  @local_path = local_path
21
31
  end
22
32
 
23
33
  def run
24
34
  uri = URI.parse(@s3_request.url)
25
- puts "upload #{@local_path} to #{uri.host}#{uri.path}"
26
- open(@local_path, 'r') do |io|
35
+ puts "Uploading #{@local_path} to #{uri.host}#{uri.path}"
36
+ File.open(@local_path, 'r') do |io|
27
37
  uri_path = uri.path
28
38
  uri_path += "?#{uri.query}" if uri.query
29
39
  req = Net::HTTP::Put.new(uri_path)
@@ -33,10 +43,9 @@ module PgdumpScrambler
33
43
  http = Net::HTTP.new(uri.host, uri.port)
34
44
  http.use_ssl = true
35
45
  res = http.request(req)
36
- if res.code != '200'
37
- raise S3UploadError.new(res)
38
- end
46
+ raise S3UploadError, res if res.code != '200'
39
47
  end
48
+ puts 'Done.'
40
49
  end
41
50
  end
42
51
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module PgdumpScrambler
3
- VERSION = "0.4.0"
4
+ VERSION = '0.4.1'
4
5
  end
@@ -1,11 +1,10 @@
1
1
  # frozen_string_literal: true
2
- require "pgdump_scrambler/version"
3
- require "pgdump_scrambler/config"
4
- require "pgdump_scrambler/dumper"
5
- require "pgdump_scrambler/s3_uploader"
6
- if defined?(Rails)
7
- require 'pgdump_scrambler/railtie'
8
- end
2
+
3
+ require 'pgdump_scrambler/version'
4
+ require 'pgdump_scrambler/config'
5
+ require 'pgdump_scrambler/dumper'
6
+ require 'pgdump_scrambler/s3_uploader'
7
+ require 'pgdump_scrambler/railtie' if defined?(Rails)
9
8
 
10
9
  module PgdumpScrambler
11
10
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  namespace :pgdump_scrambler do
3
4
  default_config_path = ENV['SCRAMBLER_CONFIG_PATH'] || 'config/pgdump_scrambler.yml'
4
5
 
@@ -6,15 +7,16 @@ namespace :pgdump_scrambler do
6
7
  task config_from_db: :environment do
7
8
  config =
8
9
  if File.exist?(default_config_path)
9
- puts "#{default_config_path} found!\nmerge existing config with config from database"
10
+ puts "#{default_config_path} found!\nMerging existing config with config from database"
10
11
  PgdumpScrambler::Config
11
12
  .read_file(default_config_path)
12
13
  .update_with(PgdumpScrambler::Config.from_db)
13
14
  else
14
- puts "craete config from database"
15
+ puts 'Creating a config file from database'
15
16
  PgdumpScrambler::Config.from_db
16
17
  end
17
18
  config.write_file(default_config_path)
19
+ puts "Wrote to #{default_config_path}"
18
20
  end
19
21
 
20
22
  desc 'check if new columns exist'
@@ -24,7 +26,7 @@ namespace :pgdump_scrambler do
24
26
  .update_with(PgdumpScrambler::Config.from_db)
25
27
  unspecified_columns = config.unspecified_columns
26
28
  count = unspecified_columns.sum { |_, columns| columns.size }
27
- if count > 0
29
+ if count.positive?
28
30
  unspecified_columns.each_key do |table_name|
29
31
  puts "#{table_name}:"
30
32
  unspecified_columns[table_name].each do |column_name|
@@ -34,7 +36,7 @@ namespace :pgdump_scrambler do
34
36
  puts "#{count} unspecified columns found!"
35
37
  exit 1
36
38
  else
37
- puts "No unspecified columns found."
39
+ puts 'No unspecified columns found.'
38
40
  end
39
41
  end
40
42
 
@@ -47,7 +49,7 @@ namespace :pgdump_scrambler do
47
49
  desc 'create scrambled dump'
48
50
  task clear_dump: :environment do
49
51
  config = PgdumpScrambler::Config.read_file(default_config_path)
50
- if File.exists? config.dump_path
52
+ if File.exist? config.dump_path
51
53
  File.delete(config.dump_path)
52
54
  puts "Dump file #{config.dump_path} has been deleted."
53
55
  end
@@ -57,7 +59,7 @@ namespace :pgdump_scrambler do
57
59
  task s3_upload: :environment do
58
60
  config = PgdumpScrambler::Config.read_file(default_config_path)
59
61
  uploader = PgdumpScrambler::S3Uploader.new(
60
- s3_path: File.join(config.resolved_s3['prefix'], File::basename(config.dump_path)),
62
+ s3_path: File.join(config.resolved_s3['prefix'], File.basename(config.dump_path)),
61
63
  local_path: config.dump_path,
62
64
  region: config.resolved_s3['region'],
63
65
  bucket: config.resolved_s3['bucket'],
@@ -1,37 +1,30 @@
1
+ # frozen_string_literal: true
1
2
 
2
- lib = File.expand_path("../lib", __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "pgdump_scrambler/version"
5
+ require 'pgdump_scrambler/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "pgdump_scrambler"
8
+ spec.name = 'pgdump_scrambler'
8
9
  spec.version = PgdumpScrambler::VERSION
9
- spec.authors = ["Shunichi Ikegami"]
10
- spec.email = ["sike.tm@gmail.com"]
10
+ spec.authors = ['Shunichi Ikegami']
11
+ spec.email = ['sike.tm@gmail.com']
11
12
 
12
- spec.summary = %q{scramble pg_dump columns}
13
- spec.description = %q{scramble pg_dump columns.}
13
+ spec.summary = 'Scramble pg_dump columns'
14
+ spec.description = 'Scramble pg_dump columns.'
14
15
  spec.homepage = 'https://github.com/shunichi/pgdump_scrambler'
15
- spec.license = "MIT"
16
+ spec.license = 'MIT'
17
+ spec.required_ruby_version = '>= 3.0'
16
18
 
17
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
- # to allow pushing to a single host or delete this section to allow pushing to any host.
19
- if spec.respond_to?(:metadata)
20
- spec.metadata["allowed_push_host"] = 'https://rubygems.org'
21
- else
22
- raise "RubyGems 2.0 or newer is required to protect against " \
23
- "public gem pushes."
24
- end
19
+ spec.metadata['homepage_uri'] = spec.homepage
20
+ spec.metadata['source_code_uri'] = 'https://github.com/shunichi/pgdump_scrambler'
21
+ spec.metadata['changelog_uri'] = 'https://github.com/shunichi/pgdump_scrambler/blob/main/CHANGELOG.md'
22
+ spec.metadata['rubygems_mfa_required'] = 'true'
25
23
 
26
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
24
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
25
  f.match(%r{^(test|spec|features)/})
28
26
  end
29
- spec.bindir = "exe"
27
+ spec.bindir = 'exe'
30
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
- spec.require_paths = ["lib"]
32
-
33
- spec.add_development_dependency "rake", "~> 13.0"
34
- spec.add_development_dependency "rspec", "~> 3.12"
35
- spec.add_development_dependency "rails", "~> 7.0"
36
- spec.add_development_dependency "rubocop"
29
+ spec.require_paths = ['lib']
37
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgdump_scrambler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shunichi Ikegami
@@ -9,76 +9,18 @@ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
11
  date: 2023-10-19 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rake
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '13.0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '13.0'
27
- - !ruby/object:Gem::Dependency
28
- name: rspec
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '3.12'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '3.12'
41
- - !ruby/object:Gem::Dependency
42
- name: rails
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '7.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '7.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- description: scramble pg_dump columns.
12
+ dependencies: []
13
+ description: Scramble pg_dump columns.
70
14
  email:
71
15
  - sike.tm@gmail.com
72
16
  executables: []
73
17
  extensions: []
74
18
  extra_rdoc_files: []
75
19
  files:
20
+ - ".github/workflows/main.yml"
76
21
  - ".gitignore"
77
22
  - ".rspec"
78
23
  - ".rubocop.yml"
79
- - ".rubocop_todo.yml"
80
- - ".ruby-version"
81
- - ".travis.yml"
82
24
  - ".vscode/tasks.json"
83
25
  - CHANGELOG.md
84
26
  - Gemfile
@@ -107,7 +49,10 @@ homepage: https://github.com/shunichi/pgdump_scrambler
107
49
  licenses:
108
50
  - MIT
109
51
  metadata:
110
- allowed_push_host: https://rubygems.org
52
+ homepage_uri: https://github.com/shunichi/pgdump_scrambler
53
+ source_code_uri: https://github.com/shunichi/pgdump_scrambler
54
+ changelog_uri: https://github.com/shunichi/pgdump_scrambler/blob/main/CHANGELOG.md
55
+ rubygems_mfa_required: 'true'
111
56
  post_install_message:
112
57
  rdoc_options: []
113
58
  require_paths:
@@ -116,15 +61,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
116
61
  requirements:
117
62
  - - ">="
118
63
  - !ruby/object:Gem::Version
119
- version: '0'
64
+ version: '3.0'
120
65
  required_rubygems_version: !ruby/object:Gem::Requirement
121
66
  requirements:
122
67
  - - ">="
123
68
  - !ruby/object:Gem::Version
124
69
  version: '0'
125
70
  requirements: []
126
- rubygems_version: 3.3.26
71
+ rubygems_version: 3.4.10
127
72
  signing_key:
128
73
  specification_version: 4
129
- summary: scramble pg_dump columns
74
+ summary: Scramble pg_dump columns
130
75
  test_files: []
data/.rubocop_todo.yml DELETED
@@ -1,173 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2018-03-08 00:50:23 +0900 using RuboCop version 0.52.1.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 1
10
- # Cop supports --auto-correct.
11
- # Configuration parameters: Include, TreatCommentsAsGroupSeparators.
12
- # Include: **/*.gemspec
13
- Gemspec/OrderedDependencies:
14
- Exclude:
15
- - 'pgdump_scrambler.gemspec'
16
-
17
- # Offense count: 5
18
- # Cop supports --auto-correct.
19
- Layout/EmptyLineAfterMagicComment:
20
- Exclude:
21
- - 'lib/pgdump_scrambler.rb'
22
- - 'lib/pgdump_scrambler/railtie.rb'
23
- - 'lib/pgdump_scrambler/table.rb'
24
- - 'lib/pgdump_scrambler/version.rb'
25
- - 'lib/tasks/pgdump_scrambler_tasks.rake'
26
-
27
- # Offense count: 1
28
- # Cop supports --auto-correct.
29
- # Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
30
- Layout/ExtraSpacing:
31
- Exclude:
32
- - 'pgdump_scrambler.gemspec'
33
-
34
- # Offense count: 1
35
- # Cop supports --auto-correct.
36
- # Configuration parameters: EnforcedStyle.
37
- # SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
38
- Layout/IndentHeredoc:
39
- Exclude:
40
- - 'spec/pgdump_scrambler_spec.rb'
41
-
42
- # Offense count: 1
43
- # Cop supports --auto-correct.
44
- # Configuration parameters: AllowForAlignment.
45
- Layout/SpaceAroundOperators:
46
- Exclude:
47
- - 'pgdump_scrambler.gemspec'
48
-
49
- # Offense count: 1
50
- # Cop supports --auto-correct.
51
- # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
52
- # SupportedStyles: space, no_space
53
- # SupportedStylesForEmptyBraces: space, no_space
54
- Layout/SpaceInsideBlockBraces:
55
- Exclude:
56
- - 'Gemfile'
57
-
58
- # Offense count: 2
59
- # Cop supports --auto-correct.
60
- # Configuration parameters: EnforcedStyle.
61
- # SupportedStyles: final_newline, final_blank_line
62
- Layout/TrailingBlankLines:
63
- Exclude:
64
- - 'lib/pgdump_scrambler/table.rb'
65
- - 'lib/tasks/pgdump_scrambler_tasks.rake'
66
-
67
- # Offense count: 4
68
- # Cop supports --auto-correct.
69
- Layout/TrailingWhitespace:
70
- Exclude:
71
- - 'lib/pgdump_scrambler/table.rb'
72
-
73
- # Offense count: 1
74
- # Configuration parameters: AllowSafeAssignment.
75
- Lint/AssignmentInCondition:
76
- Exclude:
77
- - 'lib/pgdump_scrambler/table.rb'
78
-
79
- # Offense count: 1
80
- # Cop supports --auto-correct.
81
- # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
82
- Lint/UnusedBlockArgument:
83
- Exclude:
84
- - 'lib/pgdump_scrambler/table.rb'
85
-
86
- # Offense count: 1
87
- # Cop supports --auto-correct.
88
- Security/YAMLLoad:
89
- Exclude:
90
- - 'lib/pgdump_scrambler/table.rb'
91
-
92
- # Offense count: 5
93
- Style/Documentation:
94
- Exclude:
95
- - 'spec/**/*'
96
- - 'test/**/*'
97
- - 'lib/pgdump_scrambler.rb'
98
- - 'lib/pgdump_scrambler/railtie.rb'
99
- - 'lib/pgdump_scrambler/table.rb'
100
-
101
- # Offense count: 6
102
- # Cop supports --auto-correct.
103
- # Configuration parameters: EnforcedStyle.
104
- # SupportedStyles: when_needed, always, never
105
- Style/FrozenStringLiteralComment:
106
- Exclude:
107
- - 'Gemfile'
108
- - 'Rakefile'
109
- - 'bin/console'
110
- - 'pgdump_scrambler.gemspec'
111
- - 'spec/pgdump_scrambler_spec.rb'
112
- - 'spec/spec_helper.rb'
113
-
114
- # Offense count: 1
115
- # Cop supports --auto-correct.
116
- # Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
117
- # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
118
- Style/HashSyntax:
119
- Exclude:
120
- - 'Rakefile'
121
-
122
- # Offense count: 1
123
- # Cop supports --auto-correct.
124
- Style/IfUnlessModifier:
125
- Exclude:
126
- - 'lib/pgdump_scrambler.rb'
127
-
128
- # Offense count: 2
129
- # Cop supports --auto-correct.
130
- # Configuration parameters: PreferredDelimiters.
131
- Style/PercentLiteralDelimiters:
132
- Exclude:
133
- - 'pgdump_scrambler.gemspec'
134
-
135
- # Offense count: 1
136
- # Cop supports --auto-correct.
137
- Style/RescueModifier:
138
- Exclude:
139
- - 'lib/pgdump_scrambler/table.rb'
140
-
141
- # Offense count: 32
142
- # Cop supports --auto-correct.
143
- # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
144
- # SupportedStyles: single_quotes, double_quotes
145
- Style/StringLiterals:
146
- Exclude:
147
- - 'Gemfile'
148
- - 'Rakefile'
149
- - 'bin/console'
150
- - 'lib/pgdump_scrambler.rb'
151
- - 'lib/pgdump_scrambler/version.rb'
152
- - 'pgdump_scrambler.gemspec'
153
- - 'spec/spec_helper.rb'
154
-
155
- # Offense count: 1
156
- # Cop supports --auto-correct.
157
- # Configuration parameters: EnforcedStyleForMultiline.
158
- # SupportedStylesForMultiline: comma, consistent_comma, no_comma
159
- Style/TrailingCommaInLiteral:
160
- Exclude:
161
- - 'lib/pgdump_scrambler/table.rb'
162
-
163
- # Offense count: 2
164
- # Cop supports --auto-correct.
165
- Style/UnneededPercentQ:
166
- Exclude:
167
- - 'pgdump_scrambler.gemspec'
168
-
169
- # Offense count: 11
170
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
171
- # URISchemes: http, https
172
- Metrics/LineLength:
173
- Max: 96
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.1.3
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.0
5
- before_install: gem install bundler -v 1.16.1