activestorage-dummy 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 70066b41e5c3e530edf8ab89985d528ab0035c39c86cf80a9361b01b8d1c5bf2
4
+ data.tar.gz: 3348c73b58285a04521b678a7b86082b6ad3c9beaa970dd010aec723210d1f87
5
+ SHA512:
6
+ metadata.gz: da32236af66b34d10229bfb029bfc9c685cce37a006204d0a003695bdfeb8ff97f2dba3d291de869c187ebcaeed656a2db893f61912a3d0c6885293025758013
7
+ data.tar.gz: 549af9dd826205143b2c4e8568f16df58cdea3b2065594d1afd33c70b6cc55ee5ffe178d1a94aa25716e638c536212dd407e79ede3035b1f2494ebf8b3d7b219
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.1.0
2
+
3
+ - First release.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # ActiveStorage Dummy Service
2
+
3
+ Dummy placeholders as an Active Storage service.
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/activestorage-dummy.svg)](https://badge.fury.io/rb/activestorage-dummy)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'activestorage-dummy'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ ```bash
18
+ $ bundle install
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ config/storage.yml
24
+
25
+ ```yml
26
+ production:
27
+ service: Dummy
28
+ urls:
29
+ - https://imgplaceholder.com/500x500/ff7f7f/333333/fa-image
30
+ - https://imgplaceholder.com/500x500/ff7f7f/333333/fa-fire
31
+ - https://imgplaceholder.com/500x500/ff7f7f/333333/fa-star
32
+ ```
33
+
34
+ One url will be randomly picked if more than one.
35
+
36
+ ## Limitation
37
+
38
+ - Does not support any kind of upload.
39
+
40
+ ## License
41
+
42
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+ module ActiveStorage
3
+ class Service::DummyService < Service
4
+ def initialize(**config)
5
+ @config = config
6
+ end
7
+
8
+ def exist?(key)
9
+ instrument :exist, key: key do |payload|
10
+ true
11
+ end
12
+ end
13
+
14
+ def url(key, expires_in:, filename: nil, content_type:, disposition:, params: {})
15
+ instrument :url, key: key do |payload|
16
+ urls.sample
17
+ end
18
+ end
19
+
20
+ private
21
+ attr_reader :config
22
+
23
+ def urls
24
+ config.fetch(:urls)
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,4 @@
1
+ module ActiveStorageDummy
2
+ class Railtie < ::Rails::Railtie
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module ActiveStorageDummy
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,5 @@
1
+ # require "active_storage_dummy/railtie"
2
+
3
+ module ActiveStorageDummy
4
+ # Your code goes here...
5
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activestorage-dummy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Quentin Rousseau
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-11-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.2'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 5.2.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '5.2'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 5.2.0
33
+ description: Dummy placeholders as an Active Storage service.
34
+ email: contact@quent.in
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - CHANGELOG.md
40
+ - README.md
41
+ - lib/active_storage/service/dummy_service.rb
42
+ - lib/active_storage_dummy/railtie.rb
43
+ - lib/active_storage_dummy/version.rb
44
+ - lib/activestorage-dummy.rb
45
+ homepage: https://github.com/huacnlee/activestorage-dummy
46
+ licenses:
47
+ - MIT
48
+ metadata: {}
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubyforge_project:
65
+ rubygems_version: 2.7.6
66
+ signing_key:
67
+ specification_version: 4
68
+ summary: Dummy placeholders as an Active Storage service
69
+ test_files: []