kt-paperclip 6.2.1 → 6.2.2
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 +4 -4
- data/lib/paperclip/storage/s3.rb +2 -2
- data/lib/paperclip/version.rb +1 -1
- data/spec/paperclip/storage/s3_spec.rb +53 -0
- data/spec/support/fixtures/aws_s3.yml +13 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 26488f18c8227a22bd86858d286924d003b61eb71dbc2353c1228fb11c04086f
|
|
4
|
+
data.tar.gz: 4ce23288e0c3dd39d5b4456aa1d1b62333e07732f1bbbd44e744d03e34e35805
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e2163ee366029e841dadf6d99b2cc2bab5309181e9df67faf926f20ce6e4c6da7bf93062dfe581c9aa6d42873b0571549458505bc9be43fdffb9913e9eb718e0
|
|
7
|
+
data.tar.gz: 46c31da4a29581501380c61b516498bf278fbc9dc7eab61a08122d21274079fc14f1e7cd43ea938547d59b9190b46683074364cc7660cddbe541efd6665334f2
|
data/lib/paperclip/storage/s3.rb
CHANGED
|
@@ -427,9 +427,9 @@ module Paperclip
|
|
|
427
427
|
def find_credentials(creds)
|
|
428
428
|
case creds
|
|
429
429
|
when File
|
|
430
|
-
YAML::safe_load(ERB.new(File.read(creds.path)).result)
|
|
430
|
+
YAML::safe_load(ERB.new(File.read(creds.path)).result, [], [], true)
|
|
431
431
|
when String, Pathname
|
|
432
|
-
YAML::safe_load(ERB.new(File.read(creds)).result)
|
|
432
|
+
YAML::safe_load(ERB.new(File.read(creds)).result, [], [], true)
|
|
433
433
|
when Hash
|
|
434
434
|
creds
|
|
435
435
|
when NilClass
|
data/lib/paperclip/version.rb
CHANGED
|
@@ -1439,6 +1439,32 @@ describe Paperclip::Storage::S3 do
|
|
|
1439
1439
|
end
|
|
1440
1440
|
end
|
|
1441
1441
|
|
|
1442
|
+
context "with S3 credentials supplied as Pathname and aliases being set" do
|
|
1443
|
+
before do
|
|
1444
|
+
ENV["S3_KEY"] = "pathname_key"
|
|
1445
|
+
ENV["S3_BUCKET"] = "pathname_bucket"
|
|
1446
|
+
ENV["S3_SECRET"] = "pathname_secret"
|
|
1447
|
+
|
|
1448
|
+
rails_env("test") do
|
|
1449
|
+
rebuild_model aws2_add_region.merge storage: :s3,
|
|
1450
|
+
s3_credentials: Pathname.new(fixture_file("aws_s3.yml"))
|
|
1451
|
+
|
|
1452
|
+
Dummy.delete_all
|
|
1453
|
+
@dummy = Dummy.new
|
|
1454
|
+
end
|
|
1455
|
+
end
|
|
1456
|
+
|
|
1457
|
+
it "parses the credentials" do
|
|
1458
|
+
assert_equal "pathname_bucket", @dummy.avatar.bucket_name
|
|
1459
|
+
|
|
1460
|
+
assert_equal "pathname_key",
|
|
1461
|
+
@dummy.avatar.s3_bucket.client.config.access_key_id
|
|
1462
|
+
|
|
1463
|
+
assert_equal "pathname_secret",
|
|
1464
|
+
@dummy.avatar.s3_bucket.client.config.secret_access_key
|
|
1465
|
+
end
|
|
1466
|
+
end
|
|
1467
|
+
|
|
1442
1468
|
context "with S3 credentials in a YAML file" do
|
|
1443
1469
|
before do
|
|
1444
1470
|
ENV["S3_KEY"] = "env_key"
|
|
@@ -1466,6 +1492,33 @@ describe Paperclip::Storage::S3 do
|
|
|
1466
1492
|
end
|
|
1467
1493
|
end
|
|
1468
1494
|
|
|
1495
|
+
context "with S3 credentials in a YAML file and aliases being set" do
|
|
1496
|
+
before do
|
|
1497
|
+
ENV["S3_KEY"] = "env_key"
|
|
1498
|
+
ENV["S3_BUCKET"] = "env_bucket"
|
|
1499
|
+
ENV["S3_SECRET"] = "env_secret"
|
|
1500
|
+
|
|
1501
|
+
rails_env("test") do
|
|
1502
|
+
rebuild_model aws2_add_region.merge storage: :s3,
|
|
1503
|
+
s3_credentials: File.new(fixture_file("aws_s3.yml"))
|
|
1504
|
+
|
|
1505
|
+
Dummy.delete_all
|
|
1506
|
+
|
|
1507
|
+
@dummy = Dummy.new
|
|
1508
|
+
end
|
|
1509
|
+
end
|
|
1510
|
+
|
|
1511
|
+
it "runs the file through ERB" do
|
|
1512
|
+
assert_equal "env_bucket", @dummy.avatar.bucket_name
|
|
1513
|
+
|
|
1514
|
+
assert_equal "env_key",
|
|
1515
|
+
@dummy.avatar.s3_bucket.client.config.access_key_id
|
|
1516
|
+
|
|
1517
|
+
assert_equal "env_secret",
|
|
1518
|
+
@dummy.avatar.s3_bucket.client.config.secret_access_key
|
|
1519
|
+
end
|
|
1520
|
+
end
|
|
1521
|
+
|
|
1469
1522
|
context "S3 Permissions" do
|
|
1470
1523
|
context "defaults to :public_read" do
|
|
1471
1524
|
before do
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
default: &default
|
|
2
|
+
acl: public-read
|
|
3
|
+
development:
|
|
4
|
+
<<: *default
|
|
5
|
+
key: 54321
|
|
6
|
+
production:
|
|
7
|
+
<<: *default
|
|
8
|
+
key: 12345
|
|
9
|
+
test:
|
|
10
|
+
<<: *default
|
|
11
|
+
bucket: <%= ENV['S3_BUCKET'] %>
|
|
12
|
+
access_key_id: <%= ENV['S3_KEY'] %>
|
|
13
|
+
secret_access_key: <%= ENV['S3_SECRET'] %>
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kt-paperclip
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.2.
|
|
4
|
+
version: 6.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Surendra Singhi
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-02-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activemodel
|
|
@@ -522,6 +522,7 @@ files:
|
|
|
522
522
|
- spec/support/fixtures/animated
|
|
523
523
|
- spec/support/fixtures/animated.gif
|
|
524
524
|
- spec/support/fixtures/animated.unknown
|
|
525
|
+
- spec/support/fixtures/aws_s3.yml
|
|
525
526
|
- spec/support/fixtures/bad.png
|
|
526
527
|
- spec/support/fixtures/empty.html
|
|
527
528
|
- spec/support/fixtures/empty.xlsx
|