kt-paperclip 6.2.1 → 6.2.2

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: 6981df212ba253f2970136208abac5c794af1a1a22853696856434a1b2c148e7
4
- data.tar.gz: d148b7f289e7727aa2c90bde50d0ffe73c7ebe5ff08f65308c21ee0406790b25
3
+ metadata.gz: 26488f18c8227a22bd86858d286924d003b61eb71dbc2353c1228fb11c04086f
4
+ data.tar.gz: 4ce23288e0c3dd39d5b4456aa1d1b62333e07732f1bbbd44e744d03e34e35805
5
5
  SHA512:
6
- metadata.gz: edd98c0ef9912be1929def4849458b7840aa7ce69cadf82550937edd8cf7d1f0ba3296ae1c171957925b7b070fe61e9477a454fb0d8df5aef3df90aeb425552c
7
- data.tar.gz: 4e0636c9840daebc737c62eb555eabe30230d1ffe818a9d7b6a5a646ecf4881bd2b8425805cd2f9af49b1156d6fc5f74dabc88d53ff0381ab70f23b376d81b57
6
+ metadata.gz: e2163ee366029e841dadf6d99b2cc2bab5309181e9df67faf926f20ce6e4c6da7bf93062dfe581c9aa6d42873b0571549458505bc9be43fdffb9913e9eb718e0
7
+ data.tar.gz: 46c31da4a29581501380c61b516498bf278fbc9dc7eab61a08122d21274079fc14f1e7cd43ea938547d59b9190b46683074364cc7660cddbe541efd6665334f2
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Paperclip
2
- VERSION = "6.2.1" unless defined?(Paperclip::VERSION)
2
+ VERSION = "6.2.2" unless defined?(Paperclip::VERSION)
3
3
  end
@@ -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.1
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-01-30 00:00:00.000000000 Z
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