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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d6af533fb779c519b48566103bd44ae088246218
4
- data.tar.gz: 12182c61344bb1907e4bb12329d051c2eb620a65
2
+ SHA256:
3
+ metadata.gz: 6eb53e5efae6c631fd91c02f884f1e25bba9be671aec8037b9ff80c567117862
4
+ data.tar.gz: e9ceaf3f6a6c05badf00465ebcf72cbf961f6479d03198c575f590943d95f57a
5
5
  SHA512:
6
- metadata.gz: 5730b910a229497f91e4a62ff173c7acfb55ced22c0e8f6ba0bd287513d48d8d401263720f72bca2894b7f90e920002078aad62dfc1d760793a8c34f43f27823
7
- data.tar.gz: b9bdf2eeebb5f82b9fdc497ddbbd2cb9fe01292e3e249706a2f5068aa4e48000b9130e92a9e0aac6584c875310710d3da3663bd09fde7c4aafbd82f4646b3e78
6
+ metadata.gz: 31241f4e27f952be8032de8c20a647fc3f35eec3c7f67b6db999521f8ccd0733c7c22a147410ff9ed748b2022b9e10dea1cfe86e621523b8ab36c889923260f4
7
+ data.tar.gz: 8d286e25cd66a42f46793add7ceae1cc09ca2b0a839226dd1dad6e240fdec4c00df02c1f774e0bd427ddf444a9eaa3b1f17460dba5eaf5a59c9fee940abc251c
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: '2.4'
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
@@ -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: ENV['LFS_CEPH_ENDPOINT'],
21
- access_key_id: ENV['AWS_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: true,
24
- region: 'us-east-1',
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
  )
@@ -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', '~> 2'
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.53.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' => obj.presigned_url(:get,
81
- expires_in: 86_400),
82
- 'expires_at' => expire_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' => obj.presigned_url(:put,
99
- acl: 'public-read',
100
- expires_in: 86_400),
101
- 'expires_at' => expire_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' => obj_json[:oid],
111
- 'size' => obj_json[:size],
112
- 'error' => {
113
- 'code' => error,
114
- 'message' => 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' => 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' => 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' => params[:oid],
210
- 'size' => object.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
  )
@@ -4,8 +4,8 @@ module GitLfsS3
4
4
  module AwsHelpers
5
5
  def s3
6
6
  @s3 ||= Aws::S3::Client.new({
7
- region: aws_region,
8
- access_key_id: aws_access_key_id,
7
+ region: aws_region,
8
+ access_key_id: aws_access_key_id,
9
9
  secret_access_key: aws_secret_access_key
10
10
  })
11
11
  end
@@ -13,7 +13,7 @@ module GitLfsS3
13
13
  {
14
14
  '_links' => {
15
15
  'upload' => {
16
- 'href' => upload_destination,
16
+ 'href' => upload_destination,
17
17
  'header' => upload_headers
18
18
  },
19
19
  'verify' => {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitLfsS3
4
- VERSION = '0.3.9'
4
+ VERSION = '0.3.10'
5
5
  end
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.9
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-03-10 00:00:00.000000000 Z
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: '2'
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: '2'
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.53.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.53.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.6.14
130
+ rubygems_version: 2.7.8
131
131
  signing_key:
132
132
  specification_version: 4
133
133
  summary: LSST's Git LFS server