lsst-git-lfs-s3 0.3.9 → 0.3.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +5 -1
- data/bin/git-lfs-s3 +4 -4
- data/git-lfs-s3.gemspec +2 -3
- data/lib/git-lfs-s3/application.rb +19 -17
- data/lib/git-lfs-s3/aws.rb +2 -2
- data/lib/git-lfs-s3/services/upload/upload_required.rb +1 -1
- data/lib/git-lfs-s3/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6eb53e5efae6c631fd91c02f884f1e25bba9be671aec8037b9ff80c567117862
|
4
|
+
data.tar.gz: e9ceaf3f6a6c05badf00465ebcf72cbf961f6479d03198c575f590943d95f57a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31241f4e27f952be8032de8c20a647fc3f35eec3c7f67b6db999521f8ccd0733c7c22a147410ff9ed748b2022b9e10dea1cfe86e621523b8ab36c889923260f4
|
7
|
+
data.tar.gz: 8d286e25cd66a42f46793add7ceae1cc09ca2b0a839226dd1dad6e240fdec4c00df02c1f774e0bd427ddf444a9eaa3b1f17460dba5eaf5a59c9fee940abc251c
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: '2.
|
2
|
+
TargetRubyVersion: '2.5'
|
3
3
|
|
4
4
|
Metrics/BlockLength:
|
5
5
|
Enabled: false
|
@@ -42,3 +42,7 @@ Lint/HandleExceptions:
|
|
42
42
|
Enabled: false
|
43
43
|
Lint/RescueException:
|
44
44
|
Enabled: false
|
45
|
+
|
46
|
+
Layout/AlignHash:
|
47
|
+
EnforcedHashRocketStyle: table
|
48
|
+
EnforcedColonStyle: table
|
data/bin/git-lfs-s3
CHANGED
@@ -17,11 +17,11 @@ GitLfsS3::Application.set :logger, Logger.new(STDOUT)
|
|
17
17
|
|
18
18
|
if GitLfsS3::Application.settings.ceph_s3
|
19
19
|
Aws.config.update(
|
20
|
-
endpoint:
|
21
|
-
access_key_id:
|
20
|
+
endpoint: ENV['LFS_CEPH_ENDPOINT'],
|
21
|
+
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
|
22
22
|
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
|
23
|
-
force_path_style:
|
24
|
-
region:
|
23
|
+
force_path_style: true,
|
24
|
+
region: 'us-east-1',
|
25
25
|
# ssl_ca_bundle: '/usr/local/etc/openssl/cert.pem' # Required for brew
|
26
26
|
# install on a mac.
|
27
27
|
)
|
data/git-lfs-s3.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
lib = File.expand_path('lib', __dir__)
|
@@ -22,8 +21,8 @@ Gem::Specification.new do |gem|
|
|
22
21
|
|
23
22
|
gem.add_dependency 'aws-sdk', '~> 2'
|
24
23
|
gem.add_dependency 'multi_json', '~> 1'
|
25
|
-
gem.add_dependency 'sinatra', '
|
24
|
+
gem.add_dependency 'sinatra', '>= 2.0.2'
|
26
25
|
|
27
26
|
gem.add_development_dependency 'rake', '~> 10'
|
28
|
-
gem.add_development_dependency 'rubocop', '~> 0.
|
27
|
+
gem.add_development_dependency 'rubocop', '~> 0.61.1'
|
29
28
|
end
|
@@ -46,6 +46,7 @@ module GitLfsS3
|
|
46
46
|
|
47
47
|
def protected!
|
48
48
|
return unless authorized?
|
49
|
+
|
49
50
|
response['WWW-Authenticate'] = %(Basic realm="Restricted Area")
|
50
51
|
throw(:halt, [401, 'Invalid username or password'])
|
51
52
|
end
|
@@ -58,6 +59,7 @@ module GitLfsS3
|
|
58
59
|
# Validate that size >= 0 and oid is a SHA256 hash.
|
59
60
|
oid = obj[:oid]
|
60
61
|
return unless obj[:size] >= 0
|
62
|
+
|
61
63
|
(oid.hex.size <= 32) && (oid.size == 64) && (oid =~ /^[0-9a-f]+$/)
|
62
64
|
# XXX what exception needs to be ignored here?
|
63
65
|
rescue Exception
|
@@ -77,9 +79,9 @@ module GitLfsS3
|
|
77
79
|
'authenticated' => authenticated,
|
78
80
|
'actions' => {
|
79
81
|
'download' => {
|
80
|
-
'href'
|
81
|
-
|
82
|
-
'expires_at'
|
82
|
+
'href' => obj.presigned_url(:get,
|
83
|
+
expires_in: 86_400),
|
84
|
+
'expires_at' => expire_at,
|
83
85
|
},
|
84
86
|
},
|
85
87
|
}
|
@@ -95,10 +97,10 @@ module GitLfsS3
|
|
95
97
|
'authenticated' => authenticated,
|
96
98
|
'actions' => {
|
97
99
|
'upload' => {
|
98
|
-
'href'
|
99
|
-
|
100
|
-
|
101
|
-
'expires_at'
|
100
|
+
'href' => obj.presigned_url(:put,
|
101
|
+
acl: 'public-read',
|
102
|
+
expires_in: 86_400),
|
103
|
+
'expires_at' => expire_at,
|
102
104
|
},
|
103
105
|
},
|
104
106
|
}
|
@@ -107,11 +109,11 @@ module GitLfsS3
|
|
107
109
|
def obj_error(error, message, obj_json)
|
108
110
|
# Format a single error object.
|
109
111
|
{
|
110
|
-
'oid'
|
111
|
-
'size'
|
112
|
-
'error'
|
113
|
-
'code'
|
114
|
-
'message'
|
112
|
+
'oid' => obj_json[:oid],
|
113
|
+
'size' => obj_json[:size],
|
114
|
+
'error' => {
|
115
|
+
'code' => error,
|
116
|
+
'message' => message,
|
115
117
|
},
|
116
118
|
}
|
117
119
|
end
|
@@ -159,7 +161,7 @@ module GitLfsS3
|
|
159
161
|
status(200)
|
160
162
|
resp = {
|
161
163
|
'transfer' => 'basic',
|
162
|
-
'objects'
|
164
|
+
'objects' => objects
|
163
165
|
}
|
164
166
|
body MultiJson.dump(resp)
|
165
167
|
end
|
@@ -168,7 +170,7 @@ module GitLfsS3
|
|
168
170
|
# Error git-lfs batch response.
|
169
171
|
status(status_code)
|
170
172
|
resp = {
|
171
|
-
'message'
|
173
|
+
'message' => message,
|
172
174
|
'request_id' => SecureRandom.uuid
|
173
175
|
}
|
174
176
|
body MultiJson.dump(resp)
|
@@ -206,10 +208,10 @@ module GitLfsS3
|
|
206
208
|
if object.exists?
|
207
209
|
status 200
|
208
210
|
resp = {
|
209
|
-
'oid'
|
210
|
-
'size'
|
211
|
+
'oid' => params[:oid],
|
212
|
+
'size' => object.size,
|
211
213
|
'_links' => {
|
212
|
-
'self'
|
214
|
+
'self' => {
|
213
215
|
'href' => File.join(
|
214
216
|
settings.server_url, 'objects', params[:oid]
|
215
217
|
)
|
data/lib/git-lfs-s3/aws.rb
CHANGED
data/lib/git-lfs-s3/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lsst-git-lfs-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan LeFevre
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-12-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|
@@ -43,16 +43,16 @@ dependencies:
|
|
43
43
|
name: sinatra
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: 2.0.2
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - "
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 2.0.2
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rake
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,14 +73,14 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: 0.
|
76
|
+
version: 0.61.1
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 0.
|
83
|
+
version: 0.61.1
|
84
84
|
description: LSST's Git LFS server
|
85
85
|
email:
|
86
86
|
- meltingice8917@gmail.com
|
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
version: '0'
|
128
128
|
requirements: []
|
129
129
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.
|
130
|
+
rubygems_version: 2.7.8
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: LSST's Git LFS server
|