active_storage_db 0.1.3 → 1.1.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: 04f1f6b11bd4f309f70bba12b7bfbc853dfe16db12a32c69dab387ba7b3f4524
4
- data.tar.gz: 003e6eac89a1df52614d1317475c421a9a268a37bb4d7b32062375c7fd38d3de
3
+ metadata.gz: 23bbb0b9bf0759169020c1da8e4a8d5028938ffdb1b13dc4a356783da06eb868
4
+ data.tar.gz: 1e1e1146a363bba15efe440cd82fbc4926763596746995f8696c24ca9cb9789c
5
5
  SHA512:
6
- metadata.gz: c45de9074727370f3a9ddcf8a4df2a9abc4f76187319ff09aa608edc6adebcb4ac1e3b3e890067a00feea5771b98458f0c43965d41d828677514b4e3b41262ff
7
- data.tar.gz: 32de4a6b6e79af956df21fe811a7ea538e74801c17482a99d0e76df85e8575fd955628d6baab456c52d9c26a657e33b84b16fb2172e0b07c24ae3b749466be77
6
+ metadata.gz: cc1229568804d8a6c1a0912f8ddcf59895d12374a57b460a6f29c8bce1aac7216c936b6b8c255ea41563f39b22c748e34645bac787da24886d9c02bcd367adb3
7
+ data.tar.gz: b85e8f1b41dfc2e01cfb566efd561a44606959cd1cb6b3a9cf718e4618b396949aad3fa87f8037ba61eda0789425bf9b4cf1031805d370c4702d2c973a5dfe5b
data/README.md CHANGED
@@ -1,35 +1,57 @@
1
- # Active Storage DB [![Gem Version](https://badge.fury.io/rb/active_storage_db.svg)](https://badge.fury.io/rb/active_storage_db) [![CircleCI](https://circleci.com/gh/blocknotes/active_storage_db.svg?style=svg)](https://circleci.com/gh/blocknotes/active_storage_db)
1
+ # Active Storage DB
2
+
3
+ [![gem version](https://badge.fury.io/rb/active_storage_db.svg)](https://badge.fury.io/rb/active_storage_db)
4
+ [![linters](https://github.com/blocknotes/active_storage_db/actions/workflows/linters.yml/badge.svg)](https://github.com/blocknotes/active_storage_db/actions/workflows/linters.yml)
5
+ [![specs Postgres](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_postgres_70.yml/badge.svg)](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_postgres_70.yml)
6
+ [![Specs MySQL](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_mysql_70.yml/badge.svg)](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_mysql_70.yml)
7
+
2
8
  An Active Storage service upload/download plugin that stores files in a PostgreSQL or MySQL database.
3
9
 
4
10
  Main features:
11
+ - supports Rails _6.0_, _6.1_ and _7.0_;
5
12
  - all service methods implemented;
6
- - data is saved using a binary field (or blob);
7
- - RSpec tests.
13
+ - attachment data stored in a binary field (or blob).
8
14
 
9
15
  Useful also with platforms like Heroku (due to their ephemeral file system).
10
16
 
11
17
  ## Installation
18
+
12
19
  - Setup Active Storage in your Rails application
13
- - Add this line to your Gemfile: `gem 'active_storage_db'`
14
- - And execute: `bundle`
15
- - Install gem migrations: `bin/rails active_storage_db:install:migrations`
16
- - And execute: `bin/rails db:migrate`
20
+ - Add to your Gemfile `gem 'active_storage_db'` (and execute: `bundle`)
21
+ - Install the gem migrations: `bin/rails active_storage_db:install:migrations` (and execute: `bin/rails db:migrate`)
17
22
  - Add to your `config/routes.rb`: `mount ActiveStorageDB::Engine => '/active_storage_db'`
18
23
  - Change Active Storage service in *config/environments/development.rb* to: `config.active_storage.service = :db`
19
24
  - Add to *config/storage.yml*:
25
+
20
26
  ```
21
27
  db:
22
28
  service: DB
23
29
  ```
24
30
 
31
+ ## Misc
32
+
33
+ Some utility tasks are available:
34
+
35
+ ```sh
36
+ # list attachments ordered by blob id desc (with limit 100):
37
+ bin/rails 'asdb:list'
38
+ # search attachments by filename (or part of it)
39
+ bin/rails 'asdb:search[some_filename]'
40
+ # download attachment by blob id (retrieved with list or search tasks) - the second argument is the destination:
41
+ bin/rails 'asdb:download[123,/tmp]'
42
+ ```
43
+
25
44
  ## Do you like it? Star it!
45
+
26
46
  If you use this component just star it. A developer is more motivated to improve a project when there is some interest.
27
47
 
28
48
  Or consider offering me a coffee, it's a small thing but it is greatly appreciated: [about me](https://www.blocknot.es/about-me).
29
49
 
30
50
  ## Contributors
51
+
31
52
  - [Mattia Roccoberton](https://blocknot.es/): author
32
53
  - Inspired by [activestorage-database-service](https://github.com/TitovDigital/activestorage-database-service) project
33
54
 
34
55
  ## License
56
+
35
57
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -16,19 +16,23 @@ RDoc::Task.new(:rdoc) do |rdoc|
16
16
  rdoc.rdoc_files.include('lib/**/*.rb')
17
17
  end
18
18
 
19
- APP_RAKEFILE = File.expand_path('spec/dummy/Rakefile', __dir__)
19
+ app_ver = ENV.fetch('RAILS', '').tr('.', '')
20
+ APP_RAKEFILE = File.expand_path("spec/dummy#{app_ver}/Rakefile", __dir__)
20
21
  load 'rails/tasks/engine.rake'
21
22
 
22
23
  load 'rails/tasks/statistics.rake'
23
24
 
24
25
  require 'bundler/gem_tasks'
25
26
 
26
- require 'rake/testtask'
27
+ begin
28
+ require 'rspec/core/rake_task'
27
29
 
28
- Rake::TestTask.new(:test) do |t|
29
- t.libs << 'spec'
30
- t.pattern = 'spec/**/*_spec.rb'
31
- t.verbose = false
32
- end
30
+ RSpec::Core::RakeTask.new(:spec) do |t|
31
+ # t.ruby_opts = %w[-w]
32
+ t.rspec_opts = ['--color', '--format documentation']
33
+ end
33
34
 
34
- task default: :test
35
+ task default: :spec
36
+ rescue LoadError
37
+ puts '! LoadError: no RSpec available'
38
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveStorageDB
4
- class File < ApplicationRecord
4
+ class File < ActiveRecord::Base
5
5
  validates :ref,
6
6
  presence: true,
7
7
  allow_blank: false,
@@ -1,9 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_storage/service/db_service_rails60'
4
+ require 'active_storage/service/db_service_rails61'
5
+ require 'active_storage/service/db_service_rails70'
6
+
3
7
  module ActiveStorage
4
- class Service::DBService < Service # rubocop:disable Style/ClassAndModuleChildren
5
- def initialize(**_config)
8
+ # Wraps a DB table as an Active Storage service. See ActiveStorage::Service
9
+ # for the generic API documentation that applies to all services.
10
+ class Service::DBService < Service
11
+ if Rails::VERSION::MAJOR >= 7
12
+ include ActiveStorage::DBServiceRails70
13
+ elsif Rails::VERSION::MAJOR == 6 && Rails::VERSION::MINOR == 1
14
+ include ActiveStorage::DBServiceRails61
15
+ else
16
+ include ActiveStorage::DBServiceRails60
17
+ end
18
+
19
+ def initialize(public: false, **)
6
20
  @chunk_size = ENV.fetch('ASDB_CHUNK_SIZE') { 1.megabytes }
21
+ @public = public
7
22
  end
8
23
 
9
24
  def upload(key, io, checksum: nil, **)
@@ -22,7 +37,9 @@ module ActiveStorage
22
37
  else
23
38
  instrument :download, key: key do
24
39
  record = ::ActiveStorageDB::File.find_by(ref: key)
25
- record&.data || raise(ActiveStorage::FileNotFoundError)
40
+ raise(ActiveStorage::FileNotFoundError) unless record
41
+
42
+ record.data
26
43
  end
27
44
  end
28
45
  end
@@ -30,14 +47,17 @@ module ActiveStorage
30
47
  def download_chunk(key, range)
31
48
  instrument :download_chunk, key: key, range: range do
32
49
  chunk_select = "SUBSTRING(data FROM #{range.begin + 1} FOR #{range.size}) AS chunk"
33
- ::ActiveStorageDB::File.select(chunk_select).find_by(ref: key)&.chunk ||
34
- raise(ActiveStorage::FileNotFoundError)
50
+ record = ::ActiveStorageDB::File.select(chunk_select).find_by(ref: key)
51
+ raise(ActiveStorage::FileNotFoundError) unless record
52
+
53
+ record.chunk
35
54
  end
36
55
  end
37
56
 
38
57
  def delete(key)
39
58
  instrument :delete, key: key do
40
59
  ::ActiveStorageDB::File.find_by(ref: key)&.destroy
60
+ # Ignore files already deleted
41
61
  end
42
62
  end
43
63
 
@@ -55,53 +75,23 @@ module ActiveStorage
55
75
  end
56
76
  end
57
77
 
58
- def url(key, expires_in:, filename:, disposition:, content_type:)
59
- instrument :url, key: key do |payload|
60
- content_disposition = content_disposition_with(type: disposition, filename: filename)
61
- verified_key_with_expiration = ActiveStorage.verifier.generate(
62
- {
63
- key: key,
64
- disposition: content_disposition,
65
- content_type: content_type
66
- },
67
- expires_in: expires_in,
68
- purpose: :blob_key
69
- )
70
- current_uri = URI.parse(current_host)
71
- generated_url = url_helpers.service_url(
72
- verified_key_with_expiration,
73
- protocol: current_uri.scheme,
74
- host: current_uri.host,
75
- port: current_uri.port,
76
- disposition: content_disposition,
77
- content_type: content_type,
78
- filename: filename
79
- )
80
- payload[:url] = generated_url
81
-
82
- generated_url
83
- end
84
- end
85
-
86
- def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:)
78
+ def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:, custom_metadata: {})
87
79
  instrument :url, key: key do |payload|
88
80
  verified_token_with_expiration = ActiveStorage.verifier.generate(
89
81
  {
90
82
  key: key,
91
83
  content_type: content_type,
92
84
  content_length: content_length,
93
- checksum: checksum
85
+ checksum: checksum,
86
+ service_name: respond_to?(:name) ? name : 'db'
94
87
  },
95
88
  expires_in: expires_in,
96
89
  purpose: :blob_token
97
90
  )
98
- generated_url = url_helpers.update_service_url(
99
- verified_token_with_expiration,
100
- host: current_host
101
- )
102
- payload[:url] = generated_url
103
91
 
104
- generated_url
92
+ url_helpers.update_service_url(verified_token_with_expiration, url_options).tap do |generated_url|
93
+ payload[:url] = generated_url
94
+ end
105
95
  end
106
96
  end
107
97
 
@@ -111,8 +101,29 @@ module ActiveStorage
111
101
 
112
102
  private
113
103
 
114
- def current_host
115
- ActiveStorage::Current.host
104
+ def generate_url(key, expires_in:, filename:, content_type:, disposition:)
105
+ content_disposition = content_disposition_with(type: disposition, filename: filename)
106
+ verified_key_with_expiration = ActiveStorage.verifier.generate(
107
+ {
108
+ key: key,
109
+ disposition: content_disposition,
110
+ content_type: content_type,
111
+ service_name: respond_to?(:name) ? name : 'db'
112
+ },
113
+ expires_in: expires_in,
114
+ purpose: :blob_key
115
+ )
116
+
117
+ current_uri = URI.parse(current_host)
118
+ url_helpers.service_url(
119
+ verified_key_with_expiration,
120
+ protocol: current_uri.scheme,
121
+ host: current_uri.host,
122
+ port: current_uri.port,
123
+ disposition: content_disposition,
124
+ content_type: content_type,
125
+ filename: filename
126
+ )
116
127
  end
117
128
 
118
129
  def ensure_integrity_of(key, checksum)
@@ -128,7 +139,7 @@ module ActiveStorage
128
139
  ::ActiveStorageDB::File.select('OCTET_LENGTH(data) AS size').find_by(ref: key)&.size ||
129
140
  raise(ActiveStorage::FileNotFoundError)
130
141
  (size / @chunk_size.to_f).ceil.times.each do |i|
131
- range = (i * @chunk_size..(i + 1) * @chunk_size - 1)
142
+ range = (i * @chunk_size..((i + 1) * @chunk_size) - 1)
132
143
  yield download_chunk(key, range)
133
144
  end
134
145
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveStorage
4
+ module DBServiceRails60
5
+ def url(key, expires_in:, filename:, disposition:, content_type:)
6
+ instrument :url, key: key do |payload|
7
+ generate_url(key, expires_in: expires_in, filename: filename, content_type: content_type, disposition: disposition).tap do |generated_url|
8
+ payload[:url] = generated_url
9
+ end
10
+ end
11
+ end
12
+
13
+ private
14
+
15
+ def current_host
16
+ url_options[:host]
17
+ end
18
+
19
+ def url_options
20
+ {
21
+ host: ActiveStorage::Current.host
22
+ }
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveStorage
4
+ module DBServiceRails61
5
+ private
6
+
7
+ def current_host
8
+ url_options[:host]
9
+ end
10
+
11
+ def private_url(key, expires_in:, filename:, content_type:, disposition:, **)
12
+ generate_url(
13
+ key,
14
+ expires_in: expires_in,
15
+ filename: filename,
16
+ content_type: content_type,
17
+ disposition: disposition
18
+ )
19
+ end
20
+
21
+ def public_url(key, filename:, content_type: nil, disposition: :attachment, **)
22
+ generate_url(
23
+ key,
24
+ expires_in: nil,
25
+ filename: filename,
26
+ content_type: content_type,
27
+ disposition: disposition
28
+ )
29
+ end
30
+
31
+ def url_options
32
+ {
33
+ host: ActiveStorage::Current.host
34
+ }
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveStorage
4
+ module DBServiceRails70
5
+ def compose(source_keys, destination_key, **)
6
+ buffer = nil
7
+ source_keys.each do |source_key|
8
+ data = ::ActiveStorageDB::File.find_by!(ref: source_key).data
9
+ if buffer
10
+ buffer << data
11
+ else
12
+ buffer = data
13
+ end
14
+ end
15
+ ::ActiveStorageDB::File.create!(ref: destination_key, data: buffer) if buffer
16
+ end
17
+
18
+ private
19
+
20
+ def current_host
21
+ opts = url_options || {}
22
+ url = "#{opts[:protocol]}#{opts[:host]}"
23
+ url + ":#{opts[:port]}" if opts[:port]
24
+ end
25
+
26
+ def private_url(key, expires_in:, filename:, content_type:, disposition:, **)
27
+ generate_url(
28
+ key,
29
+ expires_in: expires_in,
30
+ filename: filename,
31
+ content_type: content_type,
32
+ disposition: disposition
33
+ )
34
+ end
35
+
36
+ def public_url(key, filename:, content_type: nil, disposition: :attachment, **)
37
+ generate_url(
38
+ key,
39
+ expires_in: nil,
40
+ filename: filename,
41
+ content_type: content_type,
42
+ disposition: disposition
43
+ )
44
+ end
45
+
46
+ def url_options
47
+ ActiveStorage::Current.url_options
48
+ end
49
+ end
50
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveStorageDB
4
- VERSION = '0.1.3'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -1,5 +1,64 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # desc 'ActiveStorageDB sync'
4
- # task :active_storage_db do
5
- # end
3
+ module ActiveStorage
4
+ module Tasks
5
+ module_function
6
+
7
+ def print_blob_header(digits: 0)
8
+ puts ['Size'.rjust(8), 'Date'.rjust(18), 'Id'.rjust(digits + 2), ' Filename'].join
9
+ end
10
+
11
+ def print_blob(blob, digits: 0)
12
+ size = (blob.byte_size / 1024).to_s.rjust(7)
13
+ date = blob.created_at.strftime('%Y-%m-%d %H:%M')
14
+ puts "#{size}K #{date} #{blob.id.to_s.rjust(digits)} #{blob.filename}"
15
+ end
16
+ end
17
+ end
18
+
19
+ namespace :asdb do
20
+ desc 'ActiveStorageDB: list attachments ordered by blob id desc'
21
+ task list: [:environment] do |_t, _args|
22
+ query = ::ActiveStorage::Blob.order(id: :desc).limit(100)
23
+ digits = Math.log(query.maximum(:id), 10).to_i + 1
24
+
25
+ ::ActiveStorage::Tasks.print_blob_header(digits: digits)
26
+ query.each do |blob|
27
+ ::ActiveStorage::Tasks.print_blob(blob, digits: digits)
28
+ end
29
+ end
30
+
31
+ desc 'ActiveStorageDB: download attachment by blob id'
32
+ task :download, [:blob_id, :destination] => [:environment] do |_t, args|
33
+ blob_id = args[:blob_id]&.strip
34
+ destination = args[:destination]&.strip || Dir.pwd
35
+ abort('Required arguments: source blob id, destination path') if blob_id.blank? || destination.blank?
36
+
37
+ blob = ::ActiveStorage::Blob.find_by(id: blob_id)
38
+ abort('Source file not found') unless blob
39
+
40
+ destination = "#{destination}/#{blob.filename}" if Dir.exist?(destination)
41
+ dir = File.dirname(destination)
42
+ abort("Can't write on path: #{dir}") unless File.writable?(dir)
43
+
44
+ ret = File.binwrite(destination, blob.download)
45
+ puts "#{ret} bytes written - #{destination}"
46
+ end
47
+
48
+ desc 'ActiveStorageDB: search attachment by filename (or part of it)'
49
+ task :search, [:filename] => [:environment] do |_t, args|
50
+ filename = args[:filename]&.strip
51
+ abort('Required arguments: filename') if filename.blank?
52
+
53
+ blobs = ::ActiveStorage::Blob.where('filename LIKE ?', "%#{filename}%").order(id: :desc)
54
+ if blobs.any?
55
+ digits = Math.log(blobs.first.id, 10).to_i + 1
56
+ ::ActiveStorage::Tasks.print_blob_header(digits: digits)
57
+ blobs.each do |blob|
58
+ ::ActiveStorage::Tasks.print_blob(blob, digits: digits)
59
+ end
60
+ else
61
+ puts 'No results'
62
+ end
63
+ end
64
+ end
metadata CHANGED
@@ -1,71 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_storage_db
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattia Roccoberton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-05 00:00:00.000000000 Z
11
+ date: 2022-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '6.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '6.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '6.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: capybara
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '3.33'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '3.33'
55
- - !ruby/object:Gem::Dependency
56
- name: database_cleaner-active_record
42
+ name: appraisal
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - "~>"
60
46
  - !ruby/object:Gem::Version
61
- version: '1.8'
47
+ version: '2.4'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: '1.8'
54
+ version: '2.4'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: factory_bot_rails
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -80,132 +66,6 @@ dependencies:
80
66
  - - "~>"
81
67
  - !ruby/object:Gem::Version
82
68
  version: '6.1'
83
- - !ruby/object:Gem::Dependency
84
- name: mysql2
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '0.5'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '0.5'
97
- - !ruby/object:Gem::Dependency
98
- name: pg
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '1.2'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '1.2'
111
- - !ruby/object:Gem::Dependency
112
- name: pry
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '0.13'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '0.13'
125
- - !ruby/object:Gem::Dependency
126
- name: rspec_junit_formatter
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '0.4'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '0.4'
139
- - !ruby/object:Gem::Dependency
140
- name: rspec-rails
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '4.0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '4.0'
153
- - !ruby/object:Gem::Dependency
154
- name: rubocop
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: '0.89'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
165
- - !ruby/object:Gem::Version
166
- version: '0.89'
167
- - !ruby/object:Gem::Dependency
168
- name: rubocop-rspec
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - "~>"
172
- - !ruby/object:Gem::Version
173
- version: '1.42'
174
- type: :development
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - "~>"
179
- - !ruby/object:Gem::Version
180
- version: '1.42'
181
- - !ruby/object:Gem::Dependency
182
- name: selenium-webdriver
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - "~>"
186
- - !ruby/object:Gem::Version
187
- version: '3.142'
188
- type: :development
189
- prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - "~>"
193
- - !ruby/object:Gem::Version
194
- version: '3.142'
195
- - !ruby/object:Gem::Dependency
196
- name: simplecov
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - "~>"
200
- - !ruby/object:Gem::Version
201
- version: '0.18'
202
- type: :development
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - "~>"
207
- - !ruby/object:Gem::Version
208
- version: '0.18'
209
69
  description: An ActiveStorage service plugin to store files in database.
210
70
  email:
211
71
  - mat@blocknot.es
@@ -217,12 +77,14 @@ files:
217
77
  - README.md
218
78
  - Rakefile
219
79
  - app/controllers/active_storage_db/files_controller.rb
220
- - app/models/active_storage_db/application_record.rb
221
80
  - app/models/active_storage_db/file.rb
222
81
  - config/initializers/inflections.rb
223
82
  - config/routes.rb
224
83
  - db/migrate/20200702202022_create_active_storage_db_files.rb
225
84
  - lib/active_storage/service/db_service.rb
85
+ - lib/active_storage/service/db_service_rails60.rb
86
+ - lib/active_storage/service/db_service_rails61.rb
87
+ - lib/active_storage/service/db_service_rails70.rb
226
88
  - lib/active_storage_db.rb
227
89
  - lib/active_storage_db/engine.rb
228
90
  - lib/active_storage_db/version.rb
@@ -230,7 +92,10 @@ files:
230
92
  homepage: https://github.com/blocknotes/active_storage_db
231
93
  licenses:
232
94
  - MIT
233
- metadata: {}
95
+ metadata:
96
+ homepage_uri: https://github.com/blocknotes/active_storage_db
97
+ source_code_uri: https://github.com/blocknotes/active_storage_db
98
+ rubygems_mfa_required: 'true'
234
99
  post_install_message:
235
100
  rdoc_options: []
236
101
  require_paths:
@@ -239,14 +104,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
239
104
  requirements:
240
105
  - - ">="
241
106
  - !ruby/object:Gem::Version
242
- version: '0'
107
+ version: 2.6.0
243
108
  required_rubygems_version: !ruby/object:Gem::Requirement
244
109
  requirements:
245
110
  - - ">="
246
111
  - !ruby/object:Gem::Version
247
112
  version: '0'
248
113
  requirements: []
249
- rubygems_version: 3.0.3
114
+ rubygems_version: 3.1.6
250
115
  signing_key:
251
116
  specification_version: 4
252
117
  summary: ActiveStorage DB Service
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActiveStorageDB
4
- class ApplicationRecord < ActiveRecord::Base
5
- self.abstract_class = true
6
- end
7
- end