solidus_product_attachments 0.0.6 → 0.0.7

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: 9f9245904df11f9851d99d8d1c7d248133d26d36fc12d703cfb1e37c0f96e2af
4
- data.tar.gz: f3c9531974458ea1a6a75ecdcb37aa990300f12dea50242d6a25ea7498208972
3
+ metadata.gz: a0932818f16b360d1e236aee75e547c0729902feb224057dbaed9d942606607a
4
+ data.tar.gz: 20d2eb504ea123cd5dd2282961a6e69a4519bef5bf6b51655fb67e59200ff2ce
5
5
  SHA512:
6
- metadata.gz: 74ee2055d19ff60089b84628295ae0e4b6407ade7e95967508512fd0fe0315aa3ff4d4efa66078df9596b5b53e1d5dbe71d6540b28504ab9e705d0051095ef62
7
- data.tar.gz: 3560e09f9db80776f7db128e1d7b2e13a5671e77578711312352712731c7e8ec366f61a4b01a26e141c92779215dfbca60cc2316962bbe7cd9b09d2976d8d232
6
+ metadata.gz: 5e3b7a1a208419ed487dd176852d022a3e5f25455af98ec10382b9f69047fb07c85bfce5a5d611cc225a723a3c3c88493022d83bc11e52e10c70952348d264b8
7
+ data.tar.gz: fcc9cb99f3f9dabf5537209268fe7156301cd7a2e426194dacf1b473844e02b8781ece63da5466d98390264e4de4720cdc0fcb3544f7935423822039a7241a99
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?
@@ -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.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renuo AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-06 00:00:00.000000000 Z
11
+ date: 2024-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
@@ -193,19 +193,19 @@ dependencies:
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  - !ruby/object:Gem::Dependency
196
- name: sqlite3
196
+ name: pg
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - '='
199
+ - - ">="
200
200
  - !ruby/object:Gem::Version
201
- version: 1.3.9
201
+ version: '0'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - '='
206
+ - - ">="
207
207
  - !ruby/object:Gem::Version
208
- version: 1.3.9
208
+ version: '0'
209
209
  description: A gem to attach files to a product / variant
210
210
  email: info@renuo.ch
211
211
  executables: []
@@ -271,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
271
  - !ruby/object:Gem::Version
272
272
  version: '0'
273
273
  requirements: []
274
- rubygems_version: 3.2.3
274
+ rubygems_version: 3.2.22
275
275
  signing_key:
276
276
  specification_version: 4
277
277
  summary: A gem to attach files to a product