s3_sign 0.2.0 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/cop.yml +21 -0
- data/.github/workflows/release.yml +56 -0
- data/.github/workflows/test.yml +21 -0
- data/.release-please-manifest.json +3 -0
- data/.rubocop.yml +24 -0
- data/CHANGELOG.md +125 -0
- data/Gemfile +11 -1
- data/README.md +21 -6
- data/Rakefile +15 -2
- data/bin/console +1 -0
- data/catalog-info.yaml +14 -0
- data/lib/s3_sign/helper.rb +11 -5
- data/lib/s3_sign/version.rb +3 -1
- data/lib/s3_sign.rb +13 -13
- data/release-please-config.json +15 -0
- data/s3_sign.gemspec +9 -9
- metadata +18 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 44cf2d020d6e84d18bc8f641b0ca4f4209312271aeeff3bcad4148a30dd4365d
|
4
|
+
data.tar.gz: d446208355525e695a7908fd83b2ecdcf7d6914447297b19b75e9464f2ce989f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69f8ecaad9bd8dd0b108fc7794faf9a1953ec7bc87fb01a391b61fb9e4f8c11ab9ed1d729fa54413fec8965dc1f311e81dd4419a7345d2e622da185fddc0c1c6
|
7
|
+
data.tar.gz: 9bc2367084561696c95070296b7890bfa2b72745770f9b44f1746cb24e7e3be77d1ffc6167f4a927804cbd9f9333923f879768b26d2c6c232c23b5f8dbf0eaf5
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: Static Analysis
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- main
|
6
|
+
pull_request:
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
ruby-version: ['3.0', '3.1', '3.2']
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v3
|
15
|
+
- name: Set up Ruby
|
16
|
+
uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby-version }}
|
19
|
+
bundler-cache: true
|
20
|
+
- name: Run RuboCop
|
21
|
+
run: bundle exec rubocop
|
@@ -0,0 +1,56 @@
|
|
1
|
+
name: release
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- main
|
8
|
+
|
9
|
+
permissions:
|
10
|
+
contents: write
|
11
|
+
pull-requests: write
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
release-please:
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
steps:
|
17
|
+
- name: Update Release PR
|
18
|
+
uses: googleapis/release-please-action@v4
|
19
|
+
id: release
|
20
|
+
with:
|
21
|
+
token: ${{ secrets.GHA_WRITE_TOKEN }}
|
22
|
+
- name: Checkout
|
23
|
+
uses: actions/checkout@v3
|
24
|
+
if: ${{ steps.release.outputs.release_created }}
|
25
|
+
- name: Set Up Ruby
|
26
|
+
uses: ruby/setup-ruby@v1
|
27
|
+
with:
|
28
|
+
bundle-cache: true
|
29
|
+
ruby-version: '3.0'
|
30
|
+
if: ${{ steps.release.outputs.release_created }}
|
31
|
+
- name: Bundle Install
|
32
|
+
run: bundle install
|
33
|
+
if: ${{ steps.release.outputs.release_created }}
|
34
|
+
- name: Publish to GitHub
|
35
|
+
run: |
|
36
|
+
mkdir -p $HOME/.gem
|
37
|
+
touch $HOME/.gem/credentials
|
38
|
+
chmod 0600 $HOME/.gem/credentials
|
39
|
+
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
40
|
+
gem build *.gemspec
|
41
|
+
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
|
42
|
+
env:
|
43
|
+
GEM_HOST_API_KEY: "Bearer ${{secrets.GHA_WRITE_TOKEN}}"
|
44
|
+
OWNER: ${{ github.repository_owner }}
|
45
|
+
if: ${{ steps.release.outputs.release_created }}
|
46
|
+
- name: Publish to RubyGems
|
47
|
+
run: |
|
48
|
+
mkdir -p $HOME/.gem
|
49
|
+
touch $HOME/.gem/credentials
|
50
|
+
chmod 0600 $HOME/.gem/credentials
|
51
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
52
|
+
gem build *.gemspec
|
53
|
+
gem push *.gem
|
54
|
+
env:
|
55
|
+
GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_AUTH_TOKEN }}"
|
56
|
+
if: ${{ steps.release.outputs.release_created }}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: Test
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- main
|
6
|
+
pull_request:
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
ruby-version: ['3.0', '3.1', '3.2']
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v3
|
15
|
+
- name: Set up Ruby
|
16
|
+
uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby-version }}
|
19
|
+
bundler-cache: true
|
20
|
+
- name: Run tests
|
21
|
+
run: bundle exec rake test
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rake
|
3
|
+
- rubocop-rspec # if using RSpec
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
TargetRubyVersion: 3.0 # specify your minimum Ruby version
|
7
|
+
NewCops: enable
|
8
|
+
SuggestExtensions: false
|
9
|
+
|
10
|
+
# Common gem settings
|
11
|
+
Gemspec/RequiredRubyVersion:
|
12
|
+
Enabled: true
|
13
|
+
|
14
|
+
Style/StringLiterals:
|
15
|
+
Enabled: true
|
16
|
+
EnforcedStyle: double_quotes
|
17
|
+
|
18
|
+
Layout/LineLength:
|
19
|
+
Max: 120
|
20
|
+
|
21
|
+
Metrics/BlockLength:
|
22
|
+
Exclude:
|
23
|
+
- "*.gemspec"
|
24
|
+
- "spec/**/*"
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [1.0.6](https://github.com/Kajabi/s3_sign/compare/s3_sign-v1.0.5...s3_sign/v1.0.6) (2025-01-02)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* add ruby-version for release ([18a4ffe](https://github.com/Kajabi/s3_sign/commit/18a4ffee0c3e410f1834948849cd46d27a7c357b))
|
9
|
+
* revert to v3 of release ([4711d9c](https://github.com/Kajabi/s3_sign/commit/4711d9c46c66a802d322b6e1e29c7247d88b895a))
|
10
|
+
|
11
|
+
|
12
|
+
### Reverts
|
13
|
+
|
14
|
+
* change to googleapi gha ([ff56199](https://github.com/Kajabi/s3_sign/commit/ff5619933a2a454543c1dba95bb42daa51053882))
|
15
|
+
|
16
|
+
## [1.0.6](https://github.com/Kajabi/s3_sign/compare/v1.0.5...v1.0.6) (2025-01-02)
|
17
|
+
|
18
|
+
|
19
|
+
### Miscellaneous
|
20
|
+
|
21
|
+
* **main:** release 1.0.6 ([5f07c43](https://github.com/Kajabi/s3_sign/commit/5f07c43ba79a7e7e2505b576af5b94031e109633))
|
22
|
+
* **main:** release 1.0.6 ([326c54c](https://github.com/Kajabi/s3_sign/commit/326c54c8f92d629c7ea49f19b57c018bbda0f26c))
|
23
|
+
* **main:** release 1.0.6 ([ae3db7a](https://github.com/Kajabi/s3_sign/commit/ae3db7acdf25545862d20940e88c2225c5b8959f))
|
24
|
+
* update readme ([41c621c](https://github.com/Kajabi/s3_sign/commit/41c621c58385648d622dd52e72248b98d0b762f6))
|
25
|
+
* update workflow gha for release-please ([998fde1](https://github.com/Kajabi/s3_sign/commit/998fde1c5a0b90405514c760690cefaa33e0a34f))
|
26
|
+
|
27
|
+
## [1.0.6](https://github.com/Kajabi/s3_sign/compare/v1.0.5...v1.0.6) (2025-01-02)
|
28
|
+
|
29
|
+
|
30
|
+
### Miscellaneous
|
31
|
+
|
32
|
+
* **main:** release 1.0.6 ([326c54c](https://github.com/Kajabi/s3_sign/commit/326c54c8f92d629c7ea49f19b57c018bbda0f26c))
|
33
|
+
* **main:** release 1.0.6 ([ae3db7a](https://github.com/Kajabi/s3_sign/commit/ae3db7acdf25545862d20940e88c2225c5b8959f))
|
34
|
+
* update readme ([41c621c](https://github.com/Kajabi/s3_sign/commit/41c621c58385648d622dd52e72248b98d0b762f6))
|
35
|
+
* update workflow gha for release-please ([998fde1](https://github.com/Kajabi/s3_sign/commit/998fde1c5a0b90405514c760690cefaa33e0a34f))
|
36
|
+
|
37
|
+
## [1.0.6](https://github.com/Kajabi/s3_sign/compare/v1.0.5...v1.0.6) (2025-01-02)
|
38
|
+
|
39
|
+
|
40
|
+
### Miscellaneous
|
41
|
+
|
42
|
+
* **main:** release 1.0.6 ([ae3db7a](https://github.com/Kajabi/s3_sign/commit/ae3db7acdf25545862d20940e88c2225c5b8959f))
|
43
|
+
* update readme ([41c621c](https://github.com/Kajabi/s3_sign/commit/41c621c58385648d622dd52e72248b98d0b762f6))
|
44
|
+
* update workflow gha for release-please ([998fde1](https://github.com/Kajabi/s3_sign/commit/998fde1c5a0b90405514c760690cefaa33e0a34f))
|
45
|
+
|
46
|
+
## [1.0.6](https://github.com/Kajabi/s3_sign/compare/v1.0.5...v1.0.6) (2025-01-02)
|
47
|
+
|
48
|
+
|
49
|
+
### Miscellaneous
|
50
|
+
|
51
|
+
* update readme ([41c621c](https://github.com/Kajabi/s3_sign/commit/41c621c58385648d622dd52e72248b98d0b762f6))
|
52
|
+
|
53
|
+
## [1.0.5](https://github.com/Kajabi/s3_sign/compare/v1.0.4...v1.0.5) (2025-01-02)
|
54
|
+
|
55
|
+
|
56
|
+
### Miscellaneous
|
57
|
+
|
58
|
+
* update keys ([d741afc](https://github.com/Kajabi/s3_sign/commit/d741afc5537d8f10b202ca1196e280ac61677fbe))
|
59
|
+
|
60
|
+
## [1.0.4](https://github.com/Kajabi/s3_sign/compare/v1.0.3...v1.0.4) (2025-01-02)
|
61
|
+
|
62
|
+
|
63
|
+
### Miscellaneous
|
64
|
+
|
65
|
+
* automating gem pushes ([fa1fb6c](https://github.com/Kajabi/s3_sign/commit/fa1fb6c46d6d48e8e17427659ec21cb10164280c))
|
66
|
+
* automating gem pushes ([a23b3ef](https://github.com/Kajabi/s3_sign/commit/a23b3ef60978686a40bb14caf1be3eb85c18f152))
|
67
|
+
|
68
|
+
## [1.0.3](https://github.com/Kajabi/s3_sign/compare/v1.0.2...v1.0.3) (2025-01-02)
|
69
|
+
|
70
|
+
|
71
|
+
### Bug Fixes
|
72
|
+
|
73
|
+
* add ruby-version for release ([18a4ffe](https://github.com/Kajabi/s3_sign/commit/18a4ffee0c3e410f1834948849cd46d27a7c357b))
|
74
|
+
|
75
|
+
## [1.0.2](https://github.com/Kajabi/s3_sign/compare/v1.0.1...v1.0.2) (2025-01-02)
|
76
|
+
|
77
|
+
|
78
|
+
### Miscellaneous
|
79
|
+
|
80
|
+
* automating gem pushes ([87d82f4](https://github.com/Kajabi/s3_sign/commit/87d82f489558527bd3194fd3153c5d514bb39926))
|
81
|
+
|
82
|
+
## [1.0.1](https://github.com/Kajabi/s3_sign/compare/v1.0.0...v1.0.1) (2025-01-02)
|
83
|
+
|
84
|
+
|
85
|
+
### Bug Fixes
|
86
|
+
|
87
|
+
* revert to v3 of release ([4711d9c](https://github.com/Kajabi/s3_sign/commit/4711d9c46c66a802d322b6e1e29c7247d88b895a))
|
88
|
+
|
89
|
+
|
90
|
+
### Miscellaneous
|
91
|
+
|
92
|
+
* add changelog ([a1a93f5](https://github.com/Kajabi/s3_sign/commit/a1a93f52901863ef22cb78ce63dad588ca28956d))
|
93
|
+
* add release support ([c901fca](https://github.com/Kajabi/s3_sign/commit/c901fca3d02f16b734ee32f9476e4957c1313a92))
|
94
|
+
* change token to a PAT from the service account ([4243835](https://github.com/Kajabi/s3_sign/commit/42438352ecb86fcf83425eb55f8a6dcff810b7ed))
|
95
|
+
|
96
|
+
## [Unreleased](https://github.com/Kajabi/s3_sign/tree/HEAD)
|
97
|
+
|
98
|
+
[Full Changelog](https://github.com/Kajabi/s3_sign/compare/v1.0.0...HEAD)
|
99
|
+
|
100
|
+
**Merged pull requests:**
|
101
|
+
|
102
|
+
- Adds catalog-info document for Radiator [\#6](https://github.com/Kajabi/s3_sign/pull/6) ([voodooGQ](https://github.com/voodooGQ))
|
103
|
+
|
104
|
+
## [v1.0.0](https://github.com/Kajabi/s3_sign/tree/v1.0.0) (2020-03-19)
|
105
|
+
|
106
|
+
[Full Changelog](https://github.com/Kajabi/s3_sign/compare/v0.2.0...v1.0.0)
|
107
|
+
|
108
|
+
**Merged pull requests:**
|
109
|
+
|
110
|
+
- Update version from 0.2.0 to 1.0.0 [\#5](https://github.com/Kajabi/s3_sign/pull/5) ([chongfun](https://github.com/chongfun))
|
111
|
+
- Update readme for aws-sdk-s3 [\#4](https://github.com/Kajabi/s3_sign/pull/4) ([chongfun](https://github.com/chongfun))
|
112
|
+
- Update aws-sdk dependency to aws-sdk-s3 [\#3](https://github.com/Kajabi/s3_sign/pull/3) ([chongfun](https://github.com/chongfun))
|
113
|
+
- Update rake development dependency to \>= 12.3.3 [\#2](https://github.com/Kajabi/s3_sign/pull/2) ([chongfun](https://github.com/chongfun))
|
114
|
+
|
115
|
+
## [v0.2.0](https://github.com/Kajabi/s3_sign/tree/v0.2.0) (2015-05-12)
|
116
|
+
|
117
|
+
[Full Changelog](https://github.com/Kajabi/s3_sign/compare/v0.1.0...v0.2.0)
|
118
|
+
|
119
|
+
**Merged pull requests:**
|
120
|
+
|
121
|
+
- Bem content dispostion option [\#1](https://github.com/Kajabi/s3_sign/pull/1) ([bemurphy](https://github.com/bemurphy))
|
122
|
+
|
123
|
+
## [v0.1.0](https://github.com/Kajabi/s3_sign/tree/v0.1.0) (2015-03-24)
|
124
|
+
|
125
|
+
[Full Changelog](https://github.com/Kajabi/s3_sign/compare/e378a158857c03619df28c653972d34edeab952a...v0.1.0)
|
data/Gemfile
CHANGED
@@ -1,4 +1,14 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# development dependencies
|
6
|
+
gem "nokogiri"
|
7
|
+
gem "rake", "~> 13.0"
|
8
|
+
gem "rspec", "~> 3.13"
|
9
|
+
gem "rubocop", "~> 1.69"
|
10
|
+
gem "rubocop-rake"
|
11
|
+
gem "rubocop-rspec"
|
2
12
|
|
3
13
|
# Specify your gem's dependencies in s3_sign.gemspec
|
4
14
|
gemspec
|
data/README.md
CHANGED
@@ -29,14 +29,13 @@ you might add an initializer for this.
|
|
29
29
|
S3Sign.bucket_name = "super_s3_bucket"
|
30
30
|
```
|
31
31
|
|
32
|
-
The gem assumes you already have AWS (via aws-sdk) configured globally,
|
32
|
+
The gem assumes you already have AWS (via aws-sdk) [configured globally](https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/setup-config.html),
|
33
33
|
something like this:
|
34
34
|
|
35
35
|
```ruby
|
36
|
-
|
37
|
-
:
|
38
|
-
|
39
|
-
)
|
36
|
+
Aws.config.update({
|
37
|
+
credentials: Aws::Credentials.new(AppConfig.aws.access_key, AppConfig.aws.secret_key)
|
38
|
+
})
|
40
39
|
```
|
41
40
|
|
42
41
|
### API
|
@@ -62,8 +61,24 @@ generating signatures that expire in the far future year 2036.
|
|
62
61
|
|
63
62
|
## Contributing
|
64
63
|
|
65
|
-
1. Fork it ( https://github.com/
|
64
|
+
1. Fork it ( https://github.com/Kajabi/s3_sign/fork )
|
66
65
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
67
66
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
68
67
|
4. Push to the branch (`git push origin my-new-feature`)
|
69
68
|
5. Create a new Pull Request
|
69
|
+
|
70
|
+
## Release
|
71
|
+
|
72
|
+
If you are looking to contribute in the gem you need to be aware that we are using the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) specification to release versions in this gem.
|
73
|
+
|
74
|
+
which means, when doing a contribution your commit message must have the following structure
|
75
|
+
|
76
|
+
```git
|
77
|
+
<type>[optional scope]: <description>
|
78
|
+
|
79
|
+
[optional body]
|
80
|
+
|
81
|
+
[optional footer(s)]
|
82
|
+
```
|
83
|
+
|
84
|
+
[here](https://www.conventionalcommits.org/en/v1.0.0/#examples) you can find some commit's examples.
|
data/Rakefile
CHANGED
@@ -1,6 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "bundler/gem_tasks"
|
2
|
-
require
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
require "rubocop/rake_task"
|
3
6
|
|
4
7
|
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
RuboCop::RakeTask.new do |task|
|
9
|
+
task.options = ["--display-cop-names"]
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "Run the default task (RSpec tests)"
|
13
|
+
task default: :spec
|
14
|
+
|
15
|
+
desc "Run all RSpec tests"
|
16
|
+
task test: :spec
|
5
17
|
|
6
|
-
|
18
|
+
desc "Run Rubocop code analysis"
|
19
|
+
task rubocop: :rubocop
|
data/bin/console
CHANGED
data/catalog-info.yaml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
apiVersion: backstage.io/v1alpha1
|
2
|
+
kind: Component
|
3
|
+
metadata:
|
4
|
+
name: s3-sign
|
5
|
+
description: |
|
6
|
+
S3Sign allows easy signing of already formatted s3 urls.
|
7
|
+
annotations:
|
8
|
+
backstage.io/source-location: url:https://github.com/Kajabi/s3_sign/tree/master/
|
9
|
+
github.com/project-slug: Kajabi/s3_sign
|
10
|
+
spec:
|
11
|
+
system: kajabi-products
|
12
|
+
type: gem
|
13
|
+
owner: standard-model
|
14
|
+
lifecycle: production
|
data/lib/s3_sign/helper.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "time"
|
4
|
+
|
1
5
|
module S3Sign
|
6
|
+
# The S3Sign::Helper module provides two methods for generating S3 signed URLs with different caching strategies,
|
7
|
+
# designed to be included in Rails controllers.
|
2
8
|
module Helper
|
3
9
|
def self.included(base)
|
4
10
|
if base.respond_to?(:helper_method)
|
@@ -6,10 +12,10 @@ module S3Sign
|
|
6
12
|
base.helper_method :s3_signed_url_for_key
|
7
13
|
end
|
8
14
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
15
|
+
return unless base.respond_to?(:hide_action)
|
16
|
+
|
17
|
+
base.hide_action :stable_s3_signed_url
|
18
|
+
base.hide_action :s3_signed_url_for_key
|
13
19
|
end
|
14
20
|
|
15
21
|
# A pure "time from now" signed s3 asset url. Good for non-visual elements
|
@@ -37,7 +43,7 @@ module S3Sign
|
|
37
43
|
def stable_s3_signed_url(url, options = {})
|
38
44
|
@stable_s3_expire_at ||= Time.parse("2036-1-1 00:00:00 UTC")
|
39
45
|
|
40
|
-
if reference_time = options.delete(:expires)
|
46
|
+
if (reference_time = options.delete(:expires))
|
41
47
|
# The time given but in the year 2036
|
42
48
|
year = @stable_s3_expire_at.year
|
43
49
|
expires_at = Time.parse(reference_time.utc.strftime("#{year}-%m-%d %T UTC"))
|
data/lib/s3_sign/version.rb
CHANGED
data/lib/s3_sign.rb
CHANGED
@@ -1,39 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "s3_sign/version"
|
2
4
|
require "s3_sign/helper"
|
3
|
-
require "aws"
|
5
|
+
require "aws-sdk-s3"
|
4
6
|
|
7
|
+
# The S3Sign module provides functionality to generate pre-signed URLs for S3 objects,
|
8
|
+
# allowing temporary access to private S3 resources.
|
5
9
|
module S3Sign
|
6
10
|
SEVEN_DAYS = 60 * 60 * 24 * 7
|
7
11
|
|
8
12
|
class << self
|
9
13
|
attr_writer :bucket_name
|
14
|
+
|
10
15
|
def bucket_name
|
11
16
|
@bucket_name or raise "No S3Sign.bucket_name is set"
|
12
17
|
end
|
13
18
|
end
|
14
19
|
|
15
20
|
def self.url(s3_url, options = {})
|
16
|
-
s3 =
|
17
|
-
bucket = s3.
|
18
|
-
|
21
|
+
s3 = Aws::S3::Resource.new
|
22
|
+
bucket = s3.bucket(bucket_name)
|
19
23
|
path = path_from_s3_url(s3_url)
|
20
|
-
|
21
|
-
|
24
|
+
obj = bucket.object(path)
|
25
|
+
obj.presigned_url(:get, **build_options(options))
|
22
26
|
end
|
23
27
|
|
24
|
-
protected
|
25
|
-
|
26
28
|
def self.build_options(options)
|
27
|
-
{
|
29
|
+
{ expires_in: options.fetch(:expires, SEVEN_DAYS).to_i }.tap do |o|
|
28
30
|
attachment_filename = options[:attachment_filename]
|
29
31
|
|
30
|
-
if attachment_filename
|
31
|
-
o[:response_content_disposition] = "attachment; filename=#{attachment_filename}"
|
32
|
-
end
|
32
|
+
o[:response_content_disposition] = "attachment; filename=#{attachment_filename}" if attachment_filename
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.path_from_s3_url(s3_url)
|
37
|
-
s3_url.sub(%r{^.+?/#{bucket_name}/},
|
37
|
+
s3_url.sub(%r{^.+?/#{bucket_name}/}, "")
|
38
38
|
end
|
39
39
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"packages": {
|
3
|
+
".": {
|
4
|
+
"package-name": "s3_sign",
|
5
|
+
"changelog-path": "CHANGELOG.md",
|
6
|
+
"release-type": "ruby",
|
7
|
+
"bump-minor-pre-major": false,
|
8
|
+
"bump-patch-for-minor-pre-major": false,
|
9
|
+
"draft": false,
|
10
|
+
"prerelease": false,
|
11
|
+
"version-file": "lib/s3_sign/version.rb"
|
12
|
+
}
|
13
|
+
},
|
14
|
+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
|
15
|
+
}
|
data/s3_sign.gemspec
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
5
|
+
require "s3_sign/version"
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
8
|
spec.name = "s3_sign"
|
@@ -9,8 +10,8 @@ Gem::Specification.new do |spec|
|
|
9
10
|
spec.authors = ["Brendon Murphy"]
|
10
11
|
spec.email = ["xternal1+github@gmail.com"]
|
11
12
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
13
|
+
spec.summary = "A quick a dirty way to s3 sign string s3 urls using the aws-sdk"
|
14
|
+
spec.description = "A quick a dirty way to s3 sign string s3 urls using the aws-sdk"
|
14
15
|
spec.homepage = "https://github.com/Kajabi/s3_sign"
|
15
16
|
spec.license = "MIT"
|
16
17
|
|
@@ -19,9 +20,8 @@ Gem::Specification.new do |spec|
|
|
19
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
21
|
spec.require_paths = ["lib"]
|
21
22
|
|
22
|
-
spec.
|
23
|
+
spec.required_ruby_version = "~> 3.0"
|
23
24
|
|
24
|
-
spec.
|
25
|
-
spec.
|
26
|
-
spec.add_development_dependency "rspec", "~> 3.2.0"
|
25
|
+
spec.add_dependency "aws-sdk-s3", "~> 1"
|
26
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
27
27
|
end
|
metadata
CHANGED
@@ -1,71 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: s3_sign
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brendon Murphy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: aws-sdk
|
14
|
+
name: aws-sdk-s3
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
19
|
+
version: '1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.8'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.8'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '10.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '10.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 3.2.0
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 3.2.0
|
26
|
+
version: '1'
|
69
27
|
description: A quick a dirty way to s3 sign string s3 urls using the aws-sdk
|
70
28
|
email:
|
71
29
|
- xternal1+github@gmail.com
|
@@ -73,38 +31,46 @@ executables: []
|
|
73
31
|
extensions: []
|
74
32
|
extra_rdoc_files: []
|
75
33
|
files:
|
34
|
+
- ".github/workflows/cop.yml"
|
35
|
+
- ".github/workflows/release.yml"
|
36
|
+
- ".github/workflows/test.yml"
|
76
37
|
- ".gitignore"
|
38
|
+
- ".release-please-manifest.json"
|
39
|
+
- ".rubocop.yml"
|
40
|
+
- CHANGELOG.md
|
77
41
|
- Gemfile
|
78
42
|
- LICENSE.txt
|
79
43
|
- README.md
|
80
44
|
- Rakefile
|
81
45
|
- bin/console
|
82
46
|
- bin/setup
|
47
|
+
- catalog-info.yaml
|
83
48
|
- lib/s3_sign.rb
|
84
49
|
- lib/s3_sign/helper.rb
|
85
50
|
- lib/s3_sign/version.rb
|
51
|
+
- release-please-config.json
|
86
52
|
- s3_sign.gemspec
|
87
53
|
homepage: https://github.com/Kajabi/s3_sign
|
88
54
|
licenses:
|
89
55
|
- MIT
|
90
|
-
metadata:
|
56
|
+
metadata:
|
57
|
+
rubygems_mfa_required: 'true'
|
91
58
|
post_install_message:
|
92
59
|
rdoc_options: []
|
93
60
|
require_paths:
|
94
61
|
- lib
|
95
62
|
required_ruby_version: !ruby/object:Gem::Requirement
|
96
63
|
requirements:
|
97
|
-
- - "
|
64
|
+
- - "~>"
|
98
65
|
- !ruby/object:Gem::Version
|
99
|
-
version: '0'
|
66
|
+
version: '3.0'
|
100
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
68
|
requirements:
|
102
69
|
- - ">="
|
103
70
|
- !ruby/object:Gem::Version
|
104
71
|
version: '0'
|
105
72
|
requirements: []
|
106
|
-
|
107
|
-
rubygems_version: 2.4.5
|
73
|
+
rubygems_version: 3.2.33
|
108
74
|
signing_key:
|
109
75
|
specification_version: 4
|
110
76
|
summary: A quick a dirty way to s3 sign string s3 urls using the aws-sdk
|