activestorage-cascade 0.1.1 → 0.2.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: b74b7f090547c24b157cfb5e6b0c501b725b9eafd94ac57e7237cb1a1d46d0aa
4
- data.tar.gz: 2f443585506df2132c0844a1dafcb3f65f1fcd052acc847c13e4fda26beb77e2
3
+ metadata.gz: bb9ebbc59ef1667185eb0ba91ca1929b325607c13bd33970481f51e3aa0b3acd
4
+ data.tar.gz: e1d6470c545ff615d58ad90b670f1edeb025eb6f1ad737976edffdc2f454c620
5
5
  SHA512:
6
- metadata.gz: d97531adc493dcf2c8e253f41cff2d82c1cd1bc8fa577111da8d7e21a04b2cfc13f29eaa91e20aa0689ee7b3ea3013de59ff9dc4bc51541daf4718b265cf2976
7
- data.tar.gz: a99bce3c49f21d88be46446a51f95981975117fe7da7179db691ab7788448b3ffcddd720e772d2f9dbe2fb1e1ef3329d0699736c5c922d0cd21e3c088f314044
6
+ metadata.gz: 586d21d2c087d0a1c6b5ab91161ec95a1c6a65d03fca496298858118d2c1c007f36a77ad83b999506458a70d8018ba1bbb270cd7b0b363e44ae2d51148e62c21
7
+ data.tar.gz: 764b06fa413b2b6cf46f5735530c47484acfa3cf2053d4932e54e6ff5ad532b73ed4000625aa730911ed14b70b12bf758b60e535c4938f701e14f113802af5fa
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "bundler"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "daily"
@@ -0,0 +1,22 @@
1
+ name: Publish Gem
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - "master"
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ - run: |
14
+ git config user.name github-actions
15
+ git config user.email github-actions@github.com
16
+
17
+ - name: Release Gem
18
+ uses: cadwallion/publish-rubygems-action@master
19
+ env:
20
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
21
+ RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
22
+ RELEASE_COMMAND: rake release
data/.gitignore CHANGED
@@ -6,3 +6,4 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ Gemfile.lock
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveStorage
4
4
  module Cascade
5
- VERSION = '0.1.1'
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
@@ -5,21 +5,21 @@ require 'active_support/core_ext/module/delegation'
5
5
  module ActiveStorage
6
6
  class Service
7
7
  class CascadeService < Service
8
- attr_reader :primary, :secondary
8
+ attr_reader :primary, :secondaries
9
9
 
10
10
  delegate :upload, :update_metadata, :delete, :delete_prefixed, :url_for_direct_upload, :headers_for_direct_upload,
11
11
  to: :primary
12
12
 
13
- def self.build(primary:, secondary:, configurator:, **_options) #:nodoc:
13
+ def self.build(primary:, secondaries:, configurator:, **_options) #:nodoc:
14
14
  new(
15
15
  primary: configurator.build(primary),
16
- secondary: configurator.build(secondary)
16
+ secondaries: configurator.build(secondaries)
17
17
  )
18
18
  end
19
19
 
20
- def initialize(primary:, secondary:)
20
+ def initialize(primary:, secondaries:)
21
21
  @primary = primary
22
- @secondary = secondary
22
+ @secondaries = secondaries
23
23
  end
24
24
 
25
25
  # Return the content of the file at the +key+.
@@ -34,7 +34,7 @@ module ActiveStorage
34
34
 
35
35
  # Return +true+ if a file exists at the +key+.
36
36
  def exist?(key)
37
- primary.exist?(key) || secondary.exist?(key)
37
+ [primary, *secondaries].any? { |svc| svc.exist?(key) }
38
38
  end
39
39
 
40
40
  # Returns a signed, temporary URL for the file at the +key+. The URL will be valid for the amount
@@ -60,7 +60,7 @@ module ActiveStorage
60
60
  private
61
61
 
62
62
  def service(key)
63
- primary.exist?(key) ? primary : secondary
63
+ [primary, *secondaries].find { |svc| svc.exist?(key) }
64
64
  end
65
65
  end
66
66
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activestorage-cascade
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikko Kokkonen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-13 00:00:00.000000000 Z
11
+ date: 2020-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage
@@ -31,9 +31,10 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - ".github/dependabot.yml"
35
+ - ".github/workflows/publish.yml"
34
36
  - ".gitignore"
35
37
  - Gemfile
36
- - Gemfile.lock
37
38
  - LICENSE.txt
38
39
  - README.md
39
40
  - Rakefile
@@ -64,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
65
  - !ruby/object:Gem::Version
65
66
  version: '0'
66
67
  requirements: []
67
- rubygems_version: 3.1.2
68
+ rubygems_version: 3.0.3
68
69
  signing_key:
69
70
  specification_version: 4
70
71
  summary: Cascading Service Support for ActiveStorage
@@ -1,83 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- activestorage-cascade (0.1.0)
5
- activestorage (> 5.2.2)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- actionpack (6.0.2.2)
11
- actionview (= 6.0.2.2)
12
- activesupport (= 6.0.2.2)
13
- rack (~> 2.0, >= 2.0.8)
14
- rack-test (>= 0.6.3)
15
- rails-dom-testing (~> 2.0)
16
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
17
- actionview (6.0.2.2)
18
- activesupport (= 6.0.2.2)
19
- builder (~> 3.1)
20
- erubi (~> 1.4)
21
- rails-dom-testing (~> 2.0)
22
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
23
- activejob (6.0.2.2)
24
- activesupport (= 6.0.2.2)
25
- globalid (>= 0.3.6)
26
- activemodel (6.0.2.2)
27
- activesupport (= 6.0.2.2)
28
- activerecord (6.0.2.2)
29
- activemodel (= 6.0.2.2)
30
- activesupport (= 6.0.2.2)
31
- activestorage (6.0.2.2)
32
- actionpack (= 6.0.2.2)
33
- activejob (= 6.0.2.2)
34
- activerecord (= 6.0.2.2)
35
- marcel (~> 0.3.1)
36
- activesupport (6.0.2.2)
37
- concurrent-ruby (~> 1.0, >= 1.0.2)
38
- i18n (>= 0.7, < 2)
39
- minitest (~> 5.1)
40
- tzinfo (~> 1.1)
41
- zeitwerk (~> 2.2)
42
- builder (3.2.4)
43
- concurrent-ruby (1.1.6)
44
- crass (1.0.6)
45
- erubi (1.9.0)
46
- globalid (0.4.2)
47
- activesupport (>= 4.2.0)
48
- i18n (1.8.2)
49
- concurrent-ruby (~> 1.0)
50
- loofah (2.5.0)
51
- crass (~> 1.0.2)
52
- nokogiri (>= 1.5.9)
53
- marcel (0.3.3)
54
- mimemagic (~> 0.3.2)
55
- mimemagic (0.3.4)
56
- mini_portile2 (2.4.0)
57
- minitest (5.14.0)
58
- nokogiri (1.10.9)
59
- mini_portile2 (~> 2.4.0)
60
- rack (2.2.2)
61
- rack-test (1.1.0)
62
- rack (>= 1.0, < 3)
63
- rails-dom-testing (2.0.3)
64
- activesupport (>= 4.2.0)
65
- nokogiri (>= 1.6)
66
- rails-html-sanitizer (1.3.0)
67
- loofah (~> 2.3)
68
- rake (12.3.3)
69
- thread_safe (0.3.6)
70
- tzinfo (1.2.7)
71
- thread_safe (~> 0.1)
72
- zeitwerk (2.3.0)
73
-
74
- PLATFORMS
75
- ruby
76
-
77
- DEPENDENCIES
78
- activestorage-cascade!
79
- minitest (~> 5.0)
80
- rake (~> 12.0)
81
-
82
- BUNDLED WITH
83
- 2.1.4