filepond-rails 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -8
- data/app/assets/javascripts/filepond-rails.js +1 -1
- data/app/controllers/filepond/rails/ingress_controller.rb +15 -12
- data/lib/filepond/rails/version.rb +1 -1
- metadata +71 -12
- data/app/helpers/filepond/rails/application_helper.rb +0 -6
- data/app/jobs/filepond/rails/application_job.rb +0 -6
- data/app/mailers/filepond/rails/application_mailer.rb +0 -8
- data/app/models/filepond/rails/application_record.rb +0 -7
- data/app/views/layouts/filepond/rails/application.html.erb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3371b4f31b36a228ececa27ed2d98c2a5a1db0464ef699ee04f8d33024fa6c66
|
4
|
+
data.tar.gz: cf05bcc5c842119fefa32ccb135fe04470182f141f7ea141c98d1e0fb6922188
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a147658ff35f3fdac1827daa0d7a25e9ca7d4a3186f8ef4a262a9b76e806fbebd1542ee8d3e2c0a42a7d5da58fd3b686af46276f4d91b60d0b916de618450c38
|
7
|
+
data.tar.gz: df0bfab28be9c3dbca0ae60c8099650bf598a03cdc6133ade8077929f1f7c6d56530b45ffaaedb057b4144f062eae5ba139c864b65b4b9e1fd667f953fc0f1cf
|
data/README.md
CHANGED
@@ -1,28 +1,26 @@
|
|
1
1
|
# filepond-rails
|
2
2
|
|
3
|
+
![example workflow](https://github.com/Code-With-Rails/filepond-rails/actions/workflows/ci.yml/badge.svg)
|
4
|
+
|
5
|
+
|
3
6
|
This gem allows you to quickly integrate [FilePond](https://github.com/pqina/filepond) with your Ruby on Rails app.
|
4
7
|
|
5
8
|
## Requirements
|
6
9
|
* Rails 7.0.x and above
|
7
|
-
* Use of [importmap-rails](https://github.com/rails/importmap-rails)
|
10
|
+
* Use of [importmap-rails](https://github.com/rails/importmap-rails)
|
8
11
|
|
9
12
|
## Installation
|
10
13
|
Add this line to your application's Gemfile:
|
11
14
|
|
12
15
|
```ruby
|
13
|
-
gem
|
16
|
+
gem 'filepond-rails'
|
14
17
|
```
|
15
18
|
|
16
|
-
And then
|
19
|
+
And then run:
|
17
20
|
```bash
|
18
21
|
$ bundle
|
19
22
|
```
|
20
23
|
|
21
|
-
Or install it yourself as:
|
22
|
-
```bash
|
23
|
-
$ gem install filepond-rails
|
24
|
-
```
|
25
|
-
|
26
24
|
Add the following to your `application.css`:
|
27
25
|
```css
|
28
26
|
*= require 'filepond'
|
@@ -77,5 +75,33 @@ The gem's JavaScript provide two available exports:
|
|
77
75
|
1. `FilePond` (which corresponds to the original FilePond library)
|
78
76
|
2. `FilePondRails` (which is a convenience helper that integrates and sets up FilePond to work with our `FilePond::Rails::IngressController`
|
79
77
|
|
78
|
+
## Development
|
79
|
+
|
80
|
+
filepond-rails is configured with Docker to help developer-contributors be able to easily work on this gem locally.
|
81
|
+
|
82
|
+
To get started:
|
83
|
+
|
84
|
+
1. Fork this repository
|
85
|
+
2. git clone it to your local machine and cd into it
|
86
|
+
3. Run `docker compose build`
|
87
|
+
|
88
|
+
To run the gem through the "dummy" app, run:
|
89
|
+
|
90
|
+
```bash
|
91
|
+
docker compose up
|
92
|
+
```
|
93
|
+
|
94
|
+
To enter the development environment where you can run `bin/rails g controller` and other commands:
|
95
|
+
|
96
|
+
```bash
|
97
|
+
docker compose run app bash
|
98
|
+
```
|
99
|
+
|
100
|
+
You should now be able to run tests locally within this bash container:
|
101
|
+
|
102
|
+
```bash
|
103
|
+
bin/rails test
|
104
|
+
```
|
105
|
+
|
80
106
|
## License
|
81
107
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -13,20 +13,24 @@ module Filepond
|
|
13
13
|
# The alternative way would be to directly proxy the request to
|
14
14
|
# the URL where the file is originally hosted.
|
15
15
|
def fetch
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
begin
|
17
|
+
# We explicitly declare this for clarity of what is in the
|
18
|
+
# raw_post value as sent by FilePond
|
19
|
+
uri = URI.parse(raw_post)
|
20
|
+
url = uri.to_s
|
21
|
+
|
22
|
+
blob = ActiveStorage::Blob.create_and_upload!(
|
23
|
+
io: URI.open(uri),
|
24
|
+
filename: URI.parse(url).path.parameterize
|
25
|
+
)
|
26
|
+
|
25
27
|
redirect_to ::Rails.application.routes.url_helpers.rails_service_blob_path(
|
26
28
|
blob.signed_id,
|
27
29
|
blob.filename
|
28
30
|
)
|
29
|
-
|
31
|
+
# Why we casting such a wide net with StandardError (TL;DR: too many errors to catch):
|
32
|
+
# See https://stackoverflow.com/a/46979718/20551849
|
33
|
+
rescue StandardError
|
30
34
|
head :unprocessable_entity
|
31
35
|
end
|
32
36
|
end
|
@@ -39,8 +43,7 @@ module Filepond
|
|
39
43
|
signed_id = raw_post
|
40
44
|
|
41
45
|
blob = ActiveStorage::Blob.find_signed(signed_id)
|
42
|
-
if blob
|
43
|
-
blob.purge
|
46
|
+
if blob && blob.purge
|
44
47
|
head :ok
|
45
48
|
else
|
46
49
|
# If we cannot find the blob, then we'll just return 404
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filepond-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Chiu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
11
|
+
date: 2022-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,6 +30,20 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '8'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: puma
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '6.0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '6.0'
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
name: rubocop
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -37,9 +51,6 @@ dependencies:
|
|
37
51
|
- - "~>"
|
38
52
|
- !ruby/object:Gem::Version
|
39
53
|
version: '1.1'
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: 1.1.4
|
43
54
|
type: :development
|
44
55
|
prerelease: false
|
45
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -47,9 +58,62 @@ dependencies:
|
|
47
58
|
- - "~>"
|
48
59
|
- !ruby/object:Gem::Version
|
49
60
|
version: '1.1'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: webmock
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '3.18'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '3.18'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: capybara
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: dropybara
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: selenium-webdriver
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
50
114
|
- - ">="
|
51
115
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
116
|
+
version: '0'
|
53
117
|
description: Add FilePond server endpoints and form helpers for Rails
|
54
118
|
email:
|
55
119
|
- simon@furvur.com
|
@@ -66,11 +130,6 @@ files:
|
|
66
130
|
- app/assets/stylesheets/filepond.min.css
|
67
131
|
- app/controllers/filepond/rails/application_controller.rb
|
68
132
|
- app/controllers/filepond/rails/ingress_controller.rb
|
69
|
-
- app/helpers/filepond/rails/application_helper.rb
|
70
|
-
- app/jobs/filepond/rails/application_job.rb
|
71
|
-
- app/mailers/filepond/rails/application_mailer.rb
|
72
|
-
- app/models/filepond/rails/application_record.rb
|
73
|
-
- app/views/layouts/filepond/rails/application.html.erb
|
74
133
|
- config/importmap.rb
|
75
134
|
- config/routes.rb
|
76
135
|
- lib/filepond/rails.rb
|
@@ -100,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
159
|
- !ruby/object:Gem::Version
|
101
160
|
version: '0'
|
102
161
|
requirements: []
|
103
|
-
rubygems_version: 3.
|
162
|
+
rubygems_version: 3.4.1
|
104
163
|
signing_key:
|
105
164
|
specification_version: 4
|
106
165
|
summary: FilePond integration for Rails
|