active_storage_base64 1.1.0 → 1.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
  SHA1:
3
- metadata.gz: b17bf224361116b0fe28122df341dc24e148255d
4
- data.tar.gz: 9b4b5af7995be883632ce2151451a562bcd0eb83
3
+ metadata.gz: 8467d90fdcbc07a9672049395a208a4a10d32391
4
+ data.tar.gz: 961a61666f9a74011ab564875c013ec6461e402e
5
5
  SHA512:
6
- metadata.gz: e5bc36b18b917e7a7963f0cb872d0b375c9ddb32c84479a0e3a6aaea6af3f982bb050335d1b462331e7ffcd6db258f40496f20d8319fefe382746b19d31dc6b5
7
- data.tar.gz: d191c2cef8ee7052bf389323c70e214ef0d2696ce1a1dd7b98a767f0d3c5dbe14a0723229ac8275080980ddf3d1735137350d6bbbc1691582c1a0755bdd2d3ec
6
+ metadata.gz: af92f7ff33c42eba9cc2fdecabd06c36adb967a672df2b77e4bc047ff2dd65d907bd9d6de08f801cb5c84e0f94cbe32fd4bd61b5db8ed9ed3e063ea49ebf7c9e
7
+ data.tar.gz: f5638f30bf22ff55b917f2ed816711d3c351c9c5810953b2b1d035486860f075af389ab6f72fcdf2db2bc2ab91bd3ab3308471678ef7b670743dfc3d4a17cd8b
@@ -5,12 +5,14 @@ module ActiveStorageSupport
5
5
  module SupportForBase64
6
6
  extend ActiveSupport::Concern
7
7
  class_methods do
8
- def has_one_base64_attached(name, dependent: :purge_later)
9
- has_one_attached name, dependent: dependent
8
+ def has_one_base64_attached(name, dependent: :purge_later, service: nil, strict_loading: false)
9
+ has_one_attached name, dependent: dependent, service: service, strict_loading: strict_loading
10
10
 
11
11
  generated_association_methods.class_eval <<-CODE, __FILE__, __LINE__ + 1
12
+ # frozen_string_literal: true
12
13
  def #{name}
13
- @active_storage_attached_#{name} ||= ActiveStorageSupport::Base64One.new("#{name}", self)
14
+ @active_storage_attached ||= {}
15
+ @active_storage_attached[:#{name}] ||= ActiveStorageSupport::Base64One.new("#{name}", self)
14
16
  end
15
17
  def #{name}=(attachable)
16
18
  attachment_changes["#{name}"] =
@@ -25,12 +27,14 @@ module ActiveStorageSupport
25
27
  CODE
26
28
  end
27
29
 
28
- def has_many_base64_attached(name, dependent: :purge_later)
29
- has_many_attached name, dependent: dependent
30
+ def has_many_base64_attached(name, dependent: :purge_later, service: nil, strict_loading: false)
31
+ has_many_attached name, dependent: dependent, service: service, strict_loading: strict_loading
30
32
 
31
33
  generated_association_methods.class_eval <<-CODE, __FILE__, __LINE__ + 1
34
+ # frozen_string_literal: true
32
35
  def #{name}
33
- @active_storage_attached_#{name} ||= ActiveStorageSupport::Base64Many.new("#{name}", self)
36
+ @active_storage_attached ||= {}
37
+ @active_storage_attached[:#{name}] ||= ActiveStorageSupport::Base64Many.new("#{name}", self)
34
38
  end
35
39
  def #{name}=(attachables)
36
40
  if ActiveStorage.replace_on_assign_to_many
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_storage_base64
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Cortio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-04 00:00:00.000000000 Z
11
+ date: 2020-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '6.0'
19
+ version: '6.1'
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
- version: '6.0'
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry-rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 0.17.1
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 0.17.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: sqlite3
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -114,19 +114,8 @@ executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
- - ".gitignore"
118
- - ".reek.yml"
119
- - ".rspec"
120
- - ".rubocop.yml"
121
- - ".travis.yml"
122
- - CODE_OF_CONDUCT.md
123
- - CONTRIBUTING.md
124
- - Gemfile
125
117
  - LICENSE.txt
126
118
  - README.md
127
- - Rakefile
128
- - active_storage_base64.gemspec
129
- - gemfiles/RailsHeadGemfile
130
119
  - lib/active_storage_base64.rb
131
120
  - lib/active_storage_support/base64_attach.rb
132
121
  - lib/active_storage_support/base64_many.rb
@@ -144,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
133
  requirements:
145
134
  - - ">="
146
135
  - !ruby/object:Gem::Version
147
- version: 2.2.2
136
+ version: 2.5.0
148
137
  required_rubygems_version: !ruby/object:Gem::Requirement
149
138
  requirements:
150
139
  - - ">="
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- Gemfile.lock
2
- spec/dummy/log
3
- spec/dummy/db/**.sqlite3
4
- /coverage/
data/.reek.yml DELETED
@@ -1,127 +0,0 @@
1
- detectors:
2
- Attribute:
3
- enabled: false
4
- exclude: []
5
- BooleanParameter:
6
- enabled: true
7
- exclude: []
8
- ClassVariable:
9
- enabled: false
10
- exclude: []
11
- ControlParameter:
12
- enabled: true
13
- exclude: []
14
- DataClump:
15
- enabled: true
16
- exclude: []
17
- max_copies: 2
18
- min_clump_size: 2
19
- DuplicateMethodCall:
20
- enabled: true
21
- exclude: []
22
- max_calls: 1
23
- allow_calls: []
24
- FeatureEnvy:
25
- enabled: true
26
- exclude: []
27
- InstanceVariableAssumption:
28
- enabled: false
29
- IrresponsibleModule:
30
- enabled: false
31
- exclude: []
32
- LongParameterList:
33
- enabled: true
34
- exclude: []
35
- max_params: 4
36
- overrides:
37
- initialize:
38
- max_params: 5
39
- LongYieldList:
40
- enabled: true
41
- exclude: []
42
- max_params: 3
43
- ManualDispatch:
44
- enabled: true
45
- exclude: []
46
- MissingSafeMethod:
47
- enabled: false
48
- exclude: []
49
- ModuleInitialize:
50
- enabled: true
51
- exclude: []
52
- NestedIterators:
53
- enabled: true
54
- exclude: []
55
- max_allowed_nesting: 2
56
- ignore_iterators: []
57
- NilCheck:
58
- enabled: false
59
- exclude: []
60
- RepeatedConditional:
61
- enabled: true
62
- exclude: []
63
- max_ifs: 3
64
- SubclassedFromCoreClass:
65
- enabled: true
66
- exclude: []
67
- TooManyConstants:
68
- enabled: true
69
- exclude: []
70
- max_constants: 5
71
- TooManyInstanceVariables:
72
- enabled: true
73
- exclude: []
74
- max_instance_variables: 9
75
- TooManyMethods:
76
- enabled: true
77
- exclude: []
78
- max_methods: 25
79
- TooManyStatements:
80
- enabled: true
81
- exclude:
82
- - initialize
83
- max_statements: 12
84
- UncommunicativeMethodName:
85
- enabled: true
86
- exclude:
87
- - "ActiveStorageSupport::Base64Many#self.from_base64"
88
- - "ActiveStorageSupport::Base64One#self.from_base64"
89
- reject:
90
- - "/^[a-z]$/"
91
- - "/[0-9]$/"
92
- - "/[A-Z]/"
93
- accept: []
94
- UncommunicativeModuleName:
95
- enabled: true
96
- exclude:
97
- - "ActiveStorageSupport::SupportForBase64"
98
- reject:
99
- - "/^.$/"
100
- - "/[0-9]$/"
101
- accept:
102
- - Inline::C
103
- - "/V[0-9]/"
104
- UncommunicativeParameterName:
105
- enabled: true
106
- exclude: []
107
- reject:
108
- - "/^.$/"
109
- - "/[0-9]$/"
110
- - "/[A-Z]/"
111
- accept: []
112
- UncommunicativeVariableName:
113
- enabled: true
114
- exclude: []
115
- reject:
116
- - "/^.$/"
117
- - "/[0-9]$/"
118
- - "/[A-Z]/"
119
- accept:
120
- - _
121
- UnusedParameters:
122
- enabled: true
123
- exclude: []
124
- UnusedPrivateMethod:
125
- enabled: false
126
- UtilityFunction:
127
- enabled: false
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --format d
@@ -1,69 +0,0 @@
1
- Documentation:
2
- Enabled: false
3
-
4
- Layout/SpaceBeforeFirstArg:
5
- Exclude:
6
-
7
- Lint/AmbiguousBlockAssociation:
8
- Exclude:
9
- - spec/**/*
10
-
11
- Metrics/AbcSize:
12
- # The ABC size is a calculated magnitude, so this number can be an Integer or
13
- # a Float.
14
- Max: 15
15
-
16
- Metrics/BlockLength:
17
- CountComments: false # count full line comments?
18
- Max: 25
19
- Exclude:
20
- - config/**/*
21
- - spec/**/*
22
- ExcludedMethods:
23
- - class_methods
24
-
25
- Metrics/BlockNesting:
26
- Max: 4
27
-
28
- Metrics/ClassLength:
29
- CountComments: false # count full line comments?
30
- Max: 200
31
-
32
- # Avoid complex methods.
33
- Metrics/CyclomaticComplexity:
34
- Max: 7
35
-
36
- Metrics/MethodLength:
37
- CountComments: false # count full line comments?
38
- Max: 24
39
-
40
- Metrics/ModuleLength:
41
- CountComments: false # count full line comments?
42
- Max: 200
43
-
44
- Metrics/LineLength:
45
- Max: 100
46
- # To make it possible to copy or click on URIs in the code, we allow lines
47
- # containing a URI to be longer than Max.
48
- AllowURI: true
49
- URISchemes:
50
- - http
51
- - https
52
- Exclude:
53
- - spec/dummy/db/schema.rb
54
-
55
- Metrics/ParameterLists:
56
- Max: 5
57
- CountKeywordArgs: true
58
-
59
- Metrics/PerceivedComplexity:
60
- Max: 12
61
-
62
- Style/FrozenStringLiteralComment:
63
- Enabled: false
64
-
65
- Style/ModuleFunction:
66
- Enabled: false
67
-
68
- Naming/PredicateName:
69
- Enabled: false
@@ -1,31 +0,0 @@
1
- language: ruby
2
-
3
- before_install:
4
- - gem install bundler -v "~> 1.17"
5
-
6
- rvm:
7
- - 2.5.0
8
- - 2.6.0
9
- - ruby-head
10
-
11
- matrix:
12
- allow_failures:
13
- - rvm: ruby-head
14
-
15
- sudo: false
16
-
17
- env:
18
- global:
19
- - CC_TEST_REPORTER_ID=7196b4aa257fde33f24463218af32db6a6efd23d9148204822f757fa614a093e
20
-
21
- before_script:
22
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
23
- - chmod +x ./cc-test-reporter
24
- - ./cc-test-reporter before-build
25
-
26
- script:
27
- - bundle exec rake code_analysis
28
- - bundle exec rspec
29
-
30
- after_script:
31
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
@@ -1,78 +0,0 @@
1
- Contributor Covenant Code of Conduct
2
-
3
- Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, sex characteristics, gender identity and expression,
9
- level of experience, education, socio-economic status, nationality, personal
10
- appearance, race, religion, or sexual identity and orientation.
11
-
12
- Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
-
18
- * Using welcoming and inclusive language
19
- * Being respectful of differing viewpoints and experiences
20
- * Gracefully accepting constructive criticism
21
- * Focusing on what is best for the community
22
- * Showing empathy towards other community members
23
-
24
-
25
- Examples of unacceptable behavior by participants include:
26
-
27
-
28
- * The use of sexualized language or imagery and unwelcome sexual attention or
29
- advances
30
- * Trolling, insulting/derogatory comments, and personal or political attacks
31
- * Public or private harassment
32
- * Publishing others’ private information, such as a physical or electronic
33
- address, without explicit permission
34
- * Other conduct which could reasonably be considered inappropriate in a
35
- professional setting
36
-
37
-
38
- Our Responsibilities
39
-
40
- Project maintainers are responsible for clarifying the standards of acceptable
41
- behavior and are expected to take appropriate and fair corrective action in
42
- response to any instances of unacceptable behavior.
43
-
44
- Project maintainers have the right and responsibility to remove, edit, or
45
- reject comments, commits, code, wiki edits, issues, and other contributions
46
- that are not aligned to this Code of Conduct, or to ban temporarily or
47
- permanently any contributor for other behaviors that they deem inappropriate,
48
- threatening, offensive, or harmful.
49
-
50
- Scope
51
-
52
- This Code of Conduct applies both within project spaces and in public spaces
53
- when an individual is representing the project or its community. Examples of
54
- representing a project or community include using an official project e-mail
55
- address, posting via an official social media account, or acting as an appointed
56
- representative at an online or offline event. Representation of a project may be
57
- further defined and clarified by project maintainers.
58
-
59
- Enforcement
60
-
61
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
- reported by contacting the project team at ricardo@rootstrap.com. All
63
- complaints will be reviewed and investigated and will result in a response that
64
- is deemed necessary and appropriate to the circumstances. The project team is
65
- obligated to maintain confidentiality with regard to the reporter of an incident.
66
- Further details of specific enforcement policies may be posted separately.
67
-
68
- Project maintainers who do not follow or enforce the Code of Conduct in good
69
- faith may face temporary or permanent repercussions as determined by other
70
- members of the project’s leadership.
71
-
72
- Attribution
73
-
74
- This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
75
- available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
76
-
77
- For answers to common questions about this code of conduct, see
78
- https://www.contributor-covenant.org/faq
@@ -1,42 +0,0 @@
1
- ## Contributing ##
2
-
3
- You can contribute to this repo if you have an issue, found a bug or think there's some functionality required that would add value to the gem. To do so, please check if there's not already an [issue](https://github.com/rootstrap/active-storage-base64/issues) for that, if you find there's not, create a new one with as much detail as possible.
4
-
5
- If you want to contribute with code as well, please follow the next steps:
6
-
7
- 1. Read, understand and agree to our [code of conduct](https://github.com/rootstrap/active-storage-base64/blob/master/CODE_OF_CONDUCT.md)
8
- 2. [Fork the repo](https://help.github.com/articles/about-forks/)
9
- 3. Clone the project into your machine:
10
- `$ git clone git@github.com:[YOUR GITHUB USERNAME]/active-storage-base64.git`
11
- 4. Access the repo:
12
- `$ cd active-storage-base64`
13
- 5. Create your feature/bugfix branch:
14
- `$ git checkout -b your_new_feature`
15
- or
16
- `$ git checkout -b fix/your_fix` in case of a bug fix
17
- (if your PR is to address an existing issue, it would be good to name the branch after the issue, for example: if you are trying to solve issue 182, then a good idea for the branch name would be `182_your_new_feature`)
18
- 6. Write tests for your changes (feature/bug)
19
- 7. Code your (feature/bugfix)
20
- 8. Run the code analysis tool by doing:
21
- `$ rake code_analysis`
22
- 9. Run the tests:
23
- `$ bundle exec rspec`
24
- All tests must pass. If all tests (both code analysis and rspec) do pass, then you are ready to go to the next step:
25
- 10. Commit your changes:
26
- `$ git commit -m 'Your feature or bugfix title'`
27
- 11. Push to the branch `$ git push origin your_new_feature`
28
- 12. Create a new [pull request](https://help.github.com/articles/creating-a-pull-request/)
29
-
30
- Some helpful guides that will help you know how we work:
31
- 1. [Code review](https://github.com/rootstrap/tech-guides/tree/master/code-review)
32
- 2. [GIT workflow](https://github.com/rootstrap/tech-guides/tree/master/git)
33
- 3. [Ruby style guide](https://github.com/rootstrap/tech-guides/tree/master/ruby)
34
- 4. [Rails style guide](https://github.com/rootstrap/tech-guides/blob/master/ruby/rails.md)
35
- 5. [RSpec style guide](https://github.com/rootstrap/tech-guides/blob/master/ruby/rspec/README.md)
36
-
37
- For more information or guides like the ones mentioned above, please check our [tech guides](https://github.com/rootstrap/tech-guides). Keep in mind that the more you know about these guides, the easier it will be for your code to get approved and merged.
38
-
39
- Note: We work with one commit per pull request, so if you make your commit and realize you were missing something or want to add something more to it, don't create a new commit with the changes, but use `$ git commit --amend` instead. This same principle also applies for when changes are requested on an open pull request.
40
-
41
-
42
- Thank you very much for your time and for considering helping in this project.
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
data/Rakefile DELETED
@@ -1,4 +0,0 @@
1
- task :code_analysis do
2
- sh 'bundle exec rubocop lib spec'
3
- sh 'bundle exec reek lib'
4
- end
@@ -1,29 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = 'active_storage_base64'
3
- s.version = '1.1.0'
4
- s.summary = 'Base64 support for ActiveStorage'
5
- s.description = s.summary
6
-
7
- s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
8
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
9
- end
10
-
11
- s.require_paths = ['lib']
12
- s.authors = ['Ricardo Cortio']
13
- s.license = 'MIT'
14
- s.homepage = 'https://github.com/rootstrap/active-storage-base64'
15
- s.email = 'ricardo@rootstrap.com'
16
-
17
- s.required_ruby_version = '>= 2.2.2'
18
-
19
- # Dependencies
20
- s.add_dependency 'rails', '~> 6.0'
21
-
22
- # Development dependencies
23
- s.add_development_dependency 'pry-rails', '~> 0.3.6'
24
- s.add_development_dependency 'reek', '~> 5.5.0'
25
- s.add_development_dependency 'rspec-rails', '~> 3.8.0'
26
- s.add_development_dependency 'rubocop', '~> 0.56.0'
27
- s.add_development_dependency 'simplecov'
28
- s.add_development_dependency 'sqlite3', '1.4.1'
29
- end
@@ -1,13 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- git_source(:github) { |repo| "https://github.com/#{repo}.git" }
4
-
5
- gem "rails", github: "rails/rails", branch: "master", require: false
6
-
7
- group :test do
8
- gem 'rubocop', '~> 0.56.0'
9
- gem 'reek', '~> 4.8.1'
10
- gem 'rspec-rails', '~> 3.8.0'
11
- gem 'sqlite3', '1.3.13'
12
- gem 'pry-rails', '~> 0.3.6'
13
- end