bankrupt 2.0.1 → 3.0.0
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/.github/workflows/default.yml +23 -0
- data/.github/workflows/publish.yml +33 -0
- data/.rubocop.yml +17 -4
- data/.ruby-version +1 -0
- data/CHANGELOG.md +22 -0
- data/README.md +21 -3
- data/bankrupt.gemspec +2 -1
- data/lib/bankrupt.rb +68 -16
- data/lib/bankrupt/tasks.rb +43 -17
- data/lib/bankrupt/util.rb +4 -4
- data/lib/bankrupt/version.rb +2 -2
- metadata +21 -5
- data/.travis.yml +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7605a8034097043298a51ba0cea61725c7befef7e7c1456c5dfa80cdeb500a6
|
4
|
+
data.tar.gz: cde2061f0af7b265d5d7cf347318598c2ea8145d566d9fcfed48b4cf4814f492
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d392a244a8aebfbd509e9af128b14795aaf241d6c75b10db9794579f5bb2cbd18e6664b248ac82b39f77d972503438dbbe9d56285e10adbc42c01df5ac2f48c4
|
7
|
+
data.tar.gz: bfba6c8fd639df3b8a5f9dcf3a80f3e62893a1dea003e0087ebda7ed7feff1b308935880ade03de7a859e5f6964587058c9c2f48b2c31eaddc789dfc8b391afa
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
name: CI
|
3
|
+
on: push
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
main:
|
7
|
+
name: ${{ matrix.ruby }}
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
strategy:
|
10
|
+
fail-fast: false
|
11
|
+
matrix:
|
12
|
+
ruby: [2.5, 2.6, 2.7, 3.0]
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby }}
|
19
|
+
- run: bundle install
|
20
|
+
- run: bundle exec rubocop
|
21
|
+
- run: bundle exec rspec
|
22
|
+
- run: bundle exec yard
|
23
|
+
- run: gem build bankrupt.gemspec
|
@@ -0,0 +1,33 @@
|
|
1
|
+
---
|
2
|
+
name: Publish Rubygem
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- 'v*'
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
main:
|
10
|
+
name: Release
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
- uses: ruby/setup-ruby@v1
|
15
|
+
- run: gem build bankrupt.gemspec
|
16
|
+
|
17
|
+
- name: setup credentials
|
18
|
+
run: |
|
19
|
+
mkdir -p $HOME/.gem
|
20
|
+
touch $HOME/.gem/credentials
|
21
|
+
chmod 0600 $HOME/.gem/credentials
|
22
|
+
printf -- "---\n:github: ${GH_API_KEY}\n" > $HOME/.gem/credentials
|
23
|
+
printf -- ":rubygems_api_key: ${RUBYGEMS_API_KEY}\n" >> $HOME/.gem/credentials
|
24
|
+
env:
|
25
|
+
GH_API_KEY: Bearer ${{ secrets.GITHUB_TOKEN }}
|
26
|
+
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
27
|
+
|
28
|
+
- name: publish to rubygems
|
29
|
+
run: |
|
30
|
+
gem push *.gem
|
31
|
+
- name: publish to github packages
|
32
|
+
run: |
|
33
|
+
gem push --key github --host https://rubygems.pkg.github.com/${{ github.repository_owner }} *.gem
|
data/.rubocop.yml
CHANGED
@@ -1,25 +1,35 @@
|
|
1
1
|
---
|
2
|
-
require:
|
2
|
+
require:
|
3
|
+
- rubocop-rake
|
4
|
+
- rubocop-rspec
|
3
5
|
|
4
6
|
AllCops:
|
5
|
-
|
7
|
+
NewCops: enable
|
8
|
+
TargetRubyVersion: 2.5.0
|
6
9
|
|
7
10
|
Layout/ExtraSpacing:
|
8
11
|
AllowForAlignment: false
|
9
12
|
|
10
|
-
|
13
|
+
Layout/LineLength:
|
11
14
|
Max: 80
|
15
|
+
|
16
|
+
Metrics/AbcSize:
|
17
|
+
Max: 20
|
18
|
+
|
19
|
+
Metrics/BlockLength:
|
20
|
+
Max: 100
|
12
21
|
Exclude:
|
13
22
|
- 'spec/**/*_spec.rb'
|
14
23
|
|
15
24
|
Metrics/MethodLength:
|
16
|
-
Max:
|
25
|
+
Max: 20
|
17
26
|
|
18
27
|
RSpec/DescribeClass:
|
19
28
|
Exclude:
|
20
29
|
- 'spec/bankrupt/tasks_spec.rb'
|
21
30
|
|
22
31
|
RSpec/ExampleLength:
|
32
|
+
Max: 6
|
23
33
|
Exclude:
|
24
34
|
- 'spec/bankrupt/tasks_spec.rb'
|
25
35
|
|
@@ -32,3 +42,6 @@ RSpec/MultipleExpectations:
|
|
32
42
|
|
33
43
|
RSpec/NestedGroups:
|
34
44
|
Max: 6
|
45
|
+
|
46
|
+
RSpec/StubbedMock:
|
47
|
+
Enabled: false
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.2
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,28 @@
|
|
3
3
|
This file keeps track of changes between releases for the bankrupt project
|
4
4
|
which adheres to [semantic versioning](https://semver.org).
|
5
5
|
|
6
|
+
## v3.0.0 2021-08-21
|
7
|
+
|
8
|
+
* Drop support for ruby 2.4.x.
|
9
|
+
* Mark uploaded assets as `immutable` in the `Cache-Control` header.
|
10
|
+
|
11
|
+
## v2.1.2 2020-01-20
|
12
|
+
|
13
|
+
Take options into account to ensure unique asset lookups.
|
14
|
+
|
15
|
+
## v2.1.1 2020-01-09
|
16
|
+
|
17
|
+
Ensure that the `purge` task works with hashless assets.
|
18
|
+
|
19
|
+
## v2.1.0 2020-01-06
|
20
|
+
|
21
|
+
Add support for unversioned ("hashless") assets.
|
22
|
+
|
23
|
+
* Add new configuration file and `hashless` option (file glob array) to upload
|
24
|
+
files to the CDN without their md5 hash appended.
|
25
|
+
* Add new `raw` helper to just return the full URL of an asset.
|
26
|
+
* Add upload support for PDF files.
|
27
|
+
|
6
28
|
## v2.0.1 2019-07-30
|
7
29
|
|
8
30
|
Add support for uploading font files (`eot`, `ttf`, `woff`, and `woff2`) to
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Bankrupt
|
2
2
|
|
3
3
|
[](https://rubygems.org/gems/bankrupt)
|
4
|
-
|
4
|
+

|
5
5
|
[](https://coveralls.io/github/mfinelli/bankrupt?branch=master)
|
6
6
|
[](https://codeclimate.com/github/mfinelli/bankrupt/maintainability)
|
7
7
|
[](http://inch-ci.org/github/mfinelli/bankrupt)
|
@@ -62,7 +62,14 @@ For images you can optionally pass a hash of options to apply additional
|
|
62
62
|
attributes to the image:
|
63
63
|
|
64
64
|
```slim
|
65
|
-
== image(img.jpg, alt: 'img')
|
65
|
+
== image('img.jpg', alt: 'img')
|
66
|
+
```
|
67
|
+
|
68
|
+
To get the full path of an asset:
|
69
|
+
|
70
|
+
```slim
|
71
|
+
a href=raw('file.pdf')
|
72
|
+
| Click me!
|
66
73
|
```
|
67
74
|
|
68
75
|
### Rake
|
@@ -107,6 +114,17 @@ task default: if ENV['CLOUDBUILD'].to_s.casecmp?('true')
|
|
107
114
|
end
|
108
115
|
```
|
109
116
|
|
117
|
+
Note that it's possible to upload some files to the CDN _without_ their hash
|
118
|
+
appended. Create a `.bankrupt.yml` file in the root of your project and provide
|
119
|
+
an array of file globs to store "hashless":
|
120
|
+
|
121
|
+
```yaml
|
122
|
+
---
|
123
|
+
hashless:
|
124
|
+
- "*.pdf"
|
125
|
+
- "image.png"
|
126
|
+
```
|
127
|
+
|
110
128
|
### Rspec
|
111
129
|
|
112
130
|
If you're testing your app with rspec or similar you need to stub the `CDN` and
|
@@ -138,7 +156,7 @@ end
|
|
138
156
|
## License
|
139
157
|
|
140
158
|
```
|
141
|
-
Copyright 2018 Mario Finelli
|
159
|
+
Copyright 2018-2021 Mario Finelli
|
142
160
|
|
143
161
|
Licensed under the Apache License, Version 2.0 (the "License");
|
144
162
|
you may not use this file except in compliance with the License.
|
data/bankrupt.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.description = 'Load files from local disk or from a CDN in production.'
|
15
15
|
spec.homepage = 'https://github.com/mfinelli/bankrupt'
|
16
16
|
spec.license = 'Apache-2.0'
|
17
|
-
spec.required_ruby_version = '>= 2.
|
17
|
+
spec.required_ruby_version = '>= 2.5.0'
|
18
18
|
|
19
19
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
20
20
|
f.match(%r{^(test|spec|features)/})
|
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency 'redcarpet'
|
34
34
|
spec.add_development_dependency 'rspec'
|
35
35
|
spec.add_development_dependency 'rubocop'
|
36
|
+
spec.add_development_dependency 'rubocop-rake'
|
36
37
|
spec.add_development_dependency 'rubocop-rspec'
|
37
38
|
spec.add_development_dependency 'simplecov'
|
38
39
|
spec.add_development_dependency 'yard'
|
data/lib/bankrupt.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2018-
|
3
|
+
# Copyright 2018-2020 Mario Finelli
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -49,9 +49,6 @@ module Bankrupt
|
|
49
49
|
#
|
50
50
|
# @todo we compute the options on every call, we should do the
|
51
51
|
# lookup first and short circuit
|
52
|
-
# @todo lookup needs to be based on path _and_ options so that the
|
53
|
-
# same asset can be used in multiple places with e.g. different
|
54
|
-
# css classes applied
|
55
52
|
#
|
56
53
|
# @param path [String] relative (from public) path to the img
|
57
54
|
# @param options [Hash] additional attributes to add to the img tag
|
@@ -60,7 +57,7 @@ module Bankrupt
|
|
60
57
|
o = Hash(options).map { |k, v| "#{k}='#{v}'" }.join(' ')
|
61
58
|
|
62
59
|
asset_html(path, [IMAGE_CDN.chomp, o].join(' '),
|
63
|
-
[IMAGE_LOCAL.chomp, o].join(' '))
|
60
|
+
[IMAGE_LOCAL.chomp, o].join(' '), options)
|
64
61
|
end
|
65
62
|
|
66
63
|
# Return a javascript html tag for the asset.
|
@@ -79,14 +76,30 @@ module Bankrupt
|
|
79
76
|
asset_html(path, STYLESHEET_CDN, STYLESHEET_LOCAL)
|
80
77
|
end
|
81
78
|
|
79
|
+
# Get the full path to the asset for use in e.g. a tags.
|
80
|
+
#
|
81
|
+
# @param path [String] relative (from public) path to the asset
|
82
|
+
# @return [String] full path to the asset
|
83
|
+
def raw(path)
|
84
|
+
details = ASSETS.fetch(path)
|
85
|
+
create_fullpath(path, details[:md5], hashless: details[:hashless])
|
86
|
+
rescue KeyError
|
87
|
+
"/#{path}"
|
88
|
+
end
|
89
|
+
|
82
90
|
private
|
83
91
|
|
84
92
|
# Return a precomputed asset path if it exists
|
85
93
|
#
|
86
94
|
# @param path [String] asset on which to perform the lookup
|
95
|
+
# @param options [String] the options string to use in the lookup
|
87
96
|
# @return [String] the rendered slim template with the asset in place
|
88
|
-
def lookup(path)
|
89
|
-
|
97
|
+
def lookup(path, options = nil)
|
98
|
+
if actual_options?(options)
|
99
|
+
@_assets.fetch([path, options].join('?'))
|
100
|
+
else
|
101
|
+
@_assets.fetch(path)
|
102
|
+
end
|
90
103
|
rescue KeyError
|
91
104
|
nil
|
92
105
|
end
|
@@ -95,19 +108,25 @@ module Bankrupt
|
|
95
108
|
#
|
96
109
|
# @param file [String] basename of the asset
|
97
110
|
# @param digest [String] md5 hash of the asset
|
98
|
-
# @
|
99
|
-
|
111
|
+
# @param hashless [Boolean] if the file doesn't have the hash appended
|
112
|
+
# @return [String] filename with digest e.g, style-123.css (style.css if
|
113
|
+
# hashless)
|
114
|
+
def append_md5(file, digest, hashless: false)
|
115
|
+
return file if hashless
|
116
|
+
|
100
117
|
[[file.split(ex = File.extname(file)).first, digest].join('-'), ex].join
|
101
118
|
end
|
102
119
|
|
103
120
|
# Generates the full path to the asset including CDN domain, if set.
|
104
121
|
#
|
105
122
|
# @param path [String] local path to the asset
|
123
|
+
# @param md5 [String] md5 hash of the asset
|
124
|
+
# @param hashless [Boolean] if the files doesn't have the hash appended
|
106
125
|
# @return [String] new, full path to the asset
|
107
|
-
def create_fullpath(path, md5)
|
126
|
+
def create_fullpath(path, md5, hashless: false)
|
108
127
|
return "/#{path}" if CDN.empty?
|
109
128
|
|
110
|
-
[CDN, append_md5(path, md5)].join('/')
|
129
|
+
[CDN, append_md5(path, md5, hashless: hashless)].join('/')
|
111
130
|
end
|
112
131
|
|
113
132
|
# Generate the asset HTML. If the asset exists in the lookup hash then
|
@@ -116,24 +135,57 @@ module Bankrupt
|
|
116
135
|
# @param path [String] relative path to the asset
|
117
136
|
# @param cdn [String] a slim template for generating a cdn asset
|
118
137
|
# @param local [String] a slim template for generating a local asset
|
138
|
+
# @param options [String] options as a string to make unique lookups
|
119
139
|
# @return [String] the asset html
|
120
|
-
def asset_html(path, cdn, local)
|
121
|
-
|
140
|
+
def asset_html(path, cdn, local, options = nil)
|
141
|
+
opts = options_string(options)
|
142
|
+
|
143
|
+
if (asset = lookup("/#{path}", opts))
|
122
144
|
return asset
|
123
145
|
end
|
124
146
|
|
147
|
+
lookup_path = "/#{actual_options?(opts) ? [path, opts].join('?') : path}"
|
148
|
+
|
125
149
|
begin
|
126
150
|
details = ASSETS.fetch(path)
|
127
151
|
|
128
|
-
fullpath = create_fullpath(path, details[:md5]
|
152
|
+
fullpath = create_fullpath(path, details[:md5],
|
153
|
+
hashless: details[:hashless])
|
129
154
|
|
130
|
-
@_assets[
|
155
|
+
@_assets[lookup_path] = Slim::Template.new { cdn }.render(
|
131
156
|
ASSET.new(fullpath, details[:sri])
|
132
157
|
)
|
133
158
|
rescue KeyError
|
134
|
-
@_assets[
|
159
|
+
@_assets[lookup_path] = Slim::Template.new { local }.render(
|
135
160
|
ASSET.new("/#{path}", nil)
|
136
161
|
)
|
137
162
|
end
|
138
163
|
end
|
164
|
+
|
165
|
+
# Turn the options hash into a concatenated string for use in the lookup.
|
166
|
+
#
|
167
|
+
# @param options [Hash] the options has to convert
|
168
|
+
# @return [String] concatenated options suitable for use in lookups
|
169
|
+
def options_string(options)
|
170
|
+
return nil if Hash(options).size.zero?
|
171
|
+
|
172
|
+
options.map do |k, v|
|
173
|
+
[k.to_s, v.to_s].join
|
174
|
+
end.join.gsub(/[^A-Za-z0-9\-_]/, '')
|
175
|
+
end
|
176
|
+
|
177
|
+
# Determine if we actually have options regardless if input is a string,
|
178
|
+
# hash, or nil.
|
179
|
+
#
|
180
|
+
# @param options [String, Hash] options to check
|
181
|
+
# @return [Boolean] true if there are options, false otherwise
|
182
|
+
def actual_options?(options)
|
183
|
+
return false if options.nil?
|
184
|
+
|
185
|
+
if (options.is_a?(String) || options.is_a?(Hash)) && !options.size.zero?
|
186
|
+
true
|
187
|
+
else
|
188
|
+
false
|
189
|
+
end
|
190
|
+
end
|
139
191
|
end
|
data/lib/bankrupt/tasks.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2018-
|
3
|
+
# Copyright 2018-2021 Mario Finelli
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -21,6 +21,7 @@ require 'fileutils'
|
|
21
21
|
require 'json'
|
22
22
|
require 'mini_mime'
|
23
23
|
require 'rake'
|
24
|
+
require 'yaml'
|
24
25
|
|
25
26
|
namespace :bankrupt do
|
26
27
|
desc 'Upload files specified in the manifest to s3/cloudfront'
|
@@ -31,18 +32,22 @@ namespace :bankrupt do
|
|
31
32
|
symbolize_names: true).each do |_key, asset|
|
32
33
|
r = s3.put_object(
|
33
34
|
bucket: CDN_BUCKET,
|
34
|
-
key:
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
key: if asset[:hashless]
|
36
|
+
File.join(CDN_PREFIX, asset[:filename])
|
37
|
+
else
|
38
|
+
File.join(CDN_PREFIX,
|
39
|
+
[[
|
40
|
+
asset[:filename].split(
|
41
|
+
ex = File.extname(asset[:filename])
|
42
|
+
).first, asset[:md5]
|
43
|
+
].join('-'), ex].join)
|
44
|
+
end,
|
40
45
|
body: File.read(f = File.join(APP_ROOT, 'public', asset[:filename])),
|
41
46
|
acl: 'private',
|
42
47
|
# content_md5: Base64.strict_encode64(asset[:md5]),
|
43
48
|
content_length: File.size(f),
|
44
49
|
content_type: MiniMime.lookup_by_filename(f).content_type,
|
45
|
-
cache_control: 'public, max-age=31536000',
|
50
|
+
cache_control: 'public, max-age=31536000, immutable',
|
46
51
|
server_side_encryption: 'AES256',
|
47
52
|
storage_class: 'STANDARD',
|
48
53
|
metadata: {
|
@@ -63,11 +68,15 @@ namespace :bankrupt do
|
|
63
68
|
|
64
69
|
local = JSON.parse(File.read(File.join(APP_ROOT, 'tmp', 'assets.json')),
|
65
70
|
symbolize_names: true).map do |_key, asset|
|
66
|
-
|
67
|
-
CDN_PREFIX,
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
+
if asset[:hashless]
|
72
|
+
File.join(CDN_PREFIX, asset[:filename])
|
73
|
+
else
|
74
|
+
File.join(
|
75
|
+
CDN_PREFIX,
|
76
|
+
[[asset[:filename].split(ex = File.extname(asset[:filename])).first,
|
77
|
+
asset[:md5]].join('-'), ex].join
|
78
|
+
)
|
79
|
+
end
|
71
80
|
end
|
72
81
|
|
73
82
|
if local.empty?
|
@@ -90,15 +99,22 @@ namespace :bankrupt do
|
|
90
99
|
desc 'Generate an asset manifest file with sums and hashes'
|
91
100
|
task :manifest do
|
92
101
|
manifest = {}
|
93
|
-
file_glob = '*.{css,jpg,js,png,svg,eot,ttf,woff,woff2}'
|
102
|
+
file_glob = '*.{css,jpg,js,pdf,png,svg,eot,ttf,woff,woff2}'
|
103
|
+
|
104
|
+
config = begin
|
105
|
+
YAML.safe_load(File.read(File.join(APP_ROOT, '.bankrupt.yml')),
|
106
|
+
[], [], true, symbolize_names: true)
|
107
|
+
rescue Errno::ENOENT
|
108
|
+
{}
|
109
|
+
end
|
94
110
|
|
95
|
-
Dir.glob(File.join(APP_ROOT, 'public', file_glob)) do |file|
|
111
|
+
Dir.glob(File.join(APP_ROOT, 'public', file_glob)).sort.each do |file|
|
96
112
|
md5 = Digest::MD5.file(file).to_s
|
97
113
|
basename = File.basename(file)
|
98
114
|
|
99
115
|
# undo the hash that we have webpack insert (but is important so the
|
100
116
|
# final css uses the correct path)
|
101
|
-
if basename.match?(
|
117
|
+
if basename.match?(/-#{md5}\.#{File.extname(file).delete('.')}$/)
|
102
118
|
File.rename(file,
|
103
119
|
(file = File.join(
|
104
120
|
File.dirname(file),
|
@@ -110,8 +126,18 @@ namespace :bankrupt do
|
|
110
126
|
filename: basename,
|
111
127
|
md5: md5,
|
112
128
|
babble: Digest::MD5.file(file).bubblebabble,
|
113
|
-
sri:
|
129
|
+
sri: "sha384-#{Digest::SHA384.file(file).base64digest}"
|
114
130
|
}
|
131
|
+
|
132
|
+
Array(config[:hashless]).each do |match|
|
133
|
+
# skip unless the file is in a "hashless" glob
|
134
|
+
next unless Dir.glob(File.join(APP_ROOT, 'public', match)).map do |f|
|
135
|
+
File.basename(f)
|
136
|
+
end.include?(basename)
|
137
|
+
|
138
|
+
manifest[basename][:hashless] = true
|
139
|
+
break
|
140
|
+
end
|
115
141
|
end
|
116
142
|
|
117
143
|
LOG.info "Generated asset manifest with #{manifest.keys.size} entries"
|
data/lib/bankrupt/util.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2018 Mario Finelli
|
3
|
+
# Copyright 2018-2021 Mario Finelli
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -22,9 +22,9 @@ module Bankrupt
|
|
22
22
|
# @param path [String] path to the manifest
|
23
23
|
# @return [Hash] parsed manifest or empty hash on error
|
24
24
|
def self.parse_manifest(path)
|
25
|
-
|
26
|
-
[k.freeze,
|
27
|
-
end
|
25
|
+
JSON.parse(File.read(path)).map do |k, v|
|
26
|
+
[k.freeze, v.map { |l, b| [l.to_sym, b.freeze] }.to_h.freeze]
|
27
|
+
end.to_h.freeze
|
28
28
|
rescue StandardError
|
29
29
|
{}
|
30
30
|
end
|
data/lib/bankrupt/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2018-
|
3
|
+
# Copyright 2018-2021 Mario Finelli
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -15,5 +15,5 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
module Bankrupt
|
18
|
-
VERSION = '
|
18
|
+
VERSION = '3.0.0'
|
19
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bankrupt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Finelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slim
|
@@ -156,6 +156,20 @@ dependencies:
|
|
156
156
|
- - ">="
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: rubocop-rake
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
159
173
|
- !ruby/object:Gem::Dependency
|
160
174
|
name: rubocop-rspec
|
161
175
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,10 +220,12 @@ extensions: []
|
|
206
220
|
extra_rdoc_files: []
|
207
221
|
files:
|
208
222
|
- ".editorconfig"
|
223
|
+
- ".github/workflows/default.yml"
|
224
|
+
- ".github/workflows/publish.yml"
|
209
225
|
- ".gitignore"
|
210
226
|
- ".rspec"
|
211
227
|
- ".rubocop.yml"
|
212
|
-
- ".
|
228
|
+
- ".ruby-version"
|
213
229
|
- CHANGELOG.md
|
214
230
|
- Gemfile
|
215
231
|
- LICENSE
|
@@ -231,14 +247,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
231
247
|
requirements:
|
232
248
|
- - ">="
|
233
249
|
- !ruby/object:Gem::Version
|
234
|
-
version: 2.
|
250
|
+
version: 2.5.0
|
235
251
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
252
|
requirements:
|
237
253
|
- - ">="
|
238
254
|
- !ruby/object:Gem::Version
|
239
255
|
version: '0'
|
240
256
|
requirements: []
|
241
|
-
rubygems_version: 3.
|
257
|
+
rubygems_version: 3.2.22
|
242
258
|
signing_key:
|
243
259
|
specification_version: 4
|
244
260
|
summary: A sinatra helper to load assets locally and production.
|
data/.travis.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
---
|
2
|
-
sudo: false
|
3
|
-
|
4
|
-
language: ruby
|
5
|
-
rvm:
|
6
|
-
- 2.4
|
7
|
-
- 2.5
|
8
|
-
- 2.6
|
9
|
-
|
10
|
-
before_install:
|
11
|
-
- gem update --system
|
12
|
-
- gem --version
|
13
|
-
|
14
|
-
script:
|
15
|
-
- bundle exec rubocop
|
16
|
-
- bundle exec rspec
|
17
|
-
- bundle exec yard
|
18
|
-
|
19
|
-
notifications:
|
20
|
-
email: false
|