solidus_product_attachments 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f9245904df11f9851d99d8d1c7d248133d26d36fc12d703cfb1e37c0f96e2af
4
- data.tar.gz: f3c9531974458ea1a6a75ecdcb37aa990300f12dea50242d6a25ea7498208972
3
+ metadata.gz: 1b7f4437281edead779f645aff8690b8daa234dcc890e277d4f69bd696e1a1bd
4
+ data.tar.gz: 0ef0310617063f3e75b3d5b39c3f9ffdfebb03da3aeda8d2f942c1368a135dfb
5
5
  SHA512:
6
- metadata.gz: 74ee2055d19ff60089b84628295ae0e4b6407ade7e95967508512fd0fe0315aa3ff4d4efa66078df9596b5b53e1d5dbe71d6540b28504ab9e705d0051095ef62
7
- data.tar.gz: 3560e09f9db80776f7db128e1d7b2e13a5671e77578711312352712731c7e8ec366f61a4b01a26e141c92779215dfbca60cc2316962bbe7cd9b09d2976d8d232
6
+ metadata.gz: a397e96495fa07d9d275c75863b4d0ffce3988625347a64dd84e30bf43b00ba667f9028424a81f243b2243925f49eb187c910233a4e38fc0945240a6df0ca072
7
+ data.tar.gz: a143e46422cedefaea831552e5bb4a47b7287211e6bda209863488796ecbd11ec2908c4ee6ea5d2f8f227cf1b635cbdc1e25216b7808d197153a1884c7e2a40e
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2019 [name of plugin creator]
1
+ Copyright (c) 2024 Renuo AG
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification,
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Solidus Product Attachments
2
2
 
3
- This Solidus extension allows the administrator to upload PDF files to a product or to a variant.
3
+ This Solidus extension allows the administrator to upload files to a product or to a variant.
4
4
 
5
5
  [![Build Status](https://semaphoreci.com/api/v1/projects/c5f055f7-da80-440c-9f7b-c9c6c4a87bfa/2535219/shields_badge.svg)](https://semaphoreci.com/renuo/solidus_product_attachments)
6
6
  [![Gem Version](https://badge.fury.io/rb/solidus_product_attachments.svg)](https://badge.fury.io/rb/solidus_product_attachments)
@@ -71,4 +71,4 @@ require 'solidus_product_attachments/testing_support/factories'
71
71
 
72
72
  ## Copyright
73
73
 
74
- Copyright (c) 2019 [Renuo AG](https://www.renuo.ch/en), released under the New BSD License.
74
+ Copyright (c) 2024 [Renuo AG](https://www.renuo.ch/en), released under the New BSD License.
data/Rakefile CHANGED
@@ -28,5 +28,6 @@ end
28
28
  desc 'Generates a dummy app for testing'
29
29
  task :test_app do
30
30
  ENV['LIB_NAME'] = 'solidus_product_attachments'
31
+ ENV['DB'] = 'postgres'
31
32
  Rake::Task['extension:test_app'].invoke
32
33
  end
@@ -3,13 +3,14 @@ module Spree
3
3
  ATTACHMENT_ATTRIBUTES = %i[alt attachment_content_type attachment_file_name
4
4
  attachment_updated_at id position type].freeze
5
5
  PERMITTED_ATTACHMENT_ATTRIBUTES = %i[alt attachment position viewable_id viewable_type].freeze
6
+ ALLOWED_CONTENT_TYPES = %w[application/pdf text/plain].freeze
6
7
 
7
8
  has_attached_file :attachment,
8
9
  url: '/spree/attachments/:id/:basename.:extension',
9
10
  path: 'spree/attachments/:id/:basename.:extension'
10
11
 
11
12
  validate :no_attachment_errors
12
- validates_attachment :attachment, content_type: { content_type: 'application/pdf' }
13
+ validates_attachment :attachment, content_type: { content_type: ALLOWED_CONTENT_TYPES }
13
14
 
14
15
  def no_attachment_errors
15
16
  errors.add :attachment, "Paperclip returned errors for file #{attachment_file_name}" if attachment.errors.any?
@@ -9,6 +9,11 @@ module SolidusProductAttachments
9
9
  g.test_framework :rspec
10
10
  end
11
11
 
12
+ initializer 'solidus_product_attachments.autoloader' do
13
+ overrides_path = root.join('app/overrides')
14
+ Rails.autoloaders.main.ignore(overrides_path) if overrides_path.exist?
15
+ end
16
+
12
17
  def self.activate
13
18
  Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
14
19
  Rails.configuration.cache_classes ? require(c) : load(c)
@@ -3,5 +3,9 @@ require_relative '../support/assets'
3
3
  FactoryBot.define do
4
4
  factory :attachment, class: Spree::Attachment do
5
5
  attachment { fake_attachment }
6
+
7
+ trait :txt do
8
+ attachment { Rack::Test::UploadedFile.new(File.open('spec/fixtures/sample.txt')) }
9
+ end
6
10
  end
7
11
  end
@@ -1,3 +1,3 @@
1
1
  module SolidusProductAttachments
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_product_attachments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renuo AG
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2021-05-06 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: deface
@@ -193,19 +192,19 @@ dependencies:
193
192
  - !ruby/object:Gem::Version
194
193
  version: '0'
195
194
  - !ruby/object:Gem::Dependency
196
- name: sqlite3
195
+ name: pg
197
196
  requirement: !ruby/object:Gem::Requirement
198
197
  requirements:
199
- - - '='
198
+ - - ">="
200
199
  - !ruby/object:Gem::Version
201
- version: 1.3.9
200
+ version: '0'
202
201
  type: :development
203
202
  prerelease: false
204
203
  version_requirements: !ruby/object:Gem::Requirement
205
204
  requirements:
206
- - - '='
205
+ - - ">="
207
206
  - !ruby/object:Gem::Version
208
- version: 1.3.9
207
+ version: '0'
209
208
  description: A gem to attach files to a product / variant
210
209
  email: info@renuo.ch
211
210
  executables: []
@@ -256,7 +255,6 @@ homepage: https://www.renuo.ch
256
255
  licenses:
257
256
  - BSD-3-Clause
258
257
  metadata: {}
259
- post_install_message:
260
258
  rdoc_options: []
261
259
  require_paths:
262
260
  - lib
@@ -271,8 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
269
  - !ruby/object:Gem::Version
272
270
  version: '0'
273
271
  requirements: []
274
- rubygems_version: 3.2.3
275
- signing_key:
272
+ rubygems_version: 3.6.9
276
273
  specification_version: 4
277
274
  summary: A gem to attach files to a product
278
275
  test_files: []