webpacker_uploader 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +197 -10
- data/.yardopts +8 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +43 -29
- data/README.md +6 -3
- data/Rakefile +5 -0
- data/lib/webpacker_uploader.rb +13 -3
- data/lib/webpacker_uploader/configuration.rb +22 -2
- data/lib/webpacker_uploader/instance.rb +32 -4
- data/lib/webpacker_uploader/manifest.rb +1 -1
- data/lib/webpacker_uploader/mime.rb +6 -0
- data/lib/webpacker_uploader/providers/aws.rb +44 -3
- data/lib/webpacker_uploader/version.rb +3 -1
- data/test/configuration_test.rb +87 -0
- data/test/manifest_test.rb +27 -0
- data/test/mime_test.rb +14 -0
- data/test/test_app/config/webpacker.yml +103 -0
- data/test/test_app/public/packs/manifest.json +33 -0
- data/test/test_helper.rb +35 -0
- data/test/webpacker_uploader_test.rb +32 -0
- data/webpacker_uploader.gemspec +5 -9
- metadata +52 -13
- data/.github/workflows/rubocop.yml +0 -35
- data/.github/workflows/ruby.yml +0 -39
- data/bin/console +0 -14
- data/bin/setup +0 -8
@@ -0,0 +1,33 @@
|
|
1
|
+
{
|
2
|
+
"bootstrap.css": "/packs/bootstrap-c38deda30895059837cf.css",
|
3
|
+
"application.css": "/packs/application-dd6b1cd38bfa093df600.css",
|
4
|
+
"application.css.map": "/packs/application-dd6b1cd38bfa093df600.css.map",
|
5
|
+
"bootstrap.js": "/packs/bootstrap-300631c4f0e0f9c865bc.js",
|
6
|
+
"application.js": "/packs/application-k344a6d59eef8632c9d1.js",
|
7
|
+
"application.png": "/packs/application-k344a6d59eef8632c9d1.png",
|
8
|
+
"fonts/fa-regular-400.woff2": "/packs/fonts/fa-regular-400-944fb546bd7018b07190a32244f67dc9.woff2",
|
9
|
+
"media/images/image.jpg": "/packs/media/images/image-c38deda30895059837cf.jpg",
|
10
|
+
"media/images/image-2x.jpg": "/packs/media/images/image-2x-7cca48e6cae66ec07b8e.jpg",
|
11
|
+
"media/images/nested/image.jpg": "/packs/media/images/nested/image-c38deda30895059837cf.jpg",
|
12
|
+
"media/images/mb-icon.png": "/packs/media/images/mb-icon-c38deda30895059837cf.png",
|
13
|
+
"media/images/nested/mb-icon.png": "/packs/media/images/nested/mb-icon-c38deda30895059837cf.png",
|
14
|
+
"entrypoints": {
|
15
|
+
"application": {
|
16
|
+
"js": [
|
17
|
+
"/packs/vendors~application~bootstrap-c20632e7baf2c81200d3.chunk.js",
|
18
|
+
"/packs/vendors~application-e55f2aae30c07fb6d82a.chunk.js",
|
19
|
+
"/packs/application-k344a6d59eef8632c9d1.js"
|
20
|
+
],
|
21
|
+
"css": [
|
22
|
+
"/packs/1-c20632e7baf2c81200d3.chunk.css",
|
23
|
+
"/packs/application-k344a6d59eef8632c9d1.chunk.css"
|
24
|
+
]
|
25
|
+
},
|
26
|
+
"hello_stimulus": {
|
27
|
+
"css": [
|
28
|
+
"/packs/1-c20632e7baf2c81200d3.chunk.css",
|
29
|
+
"/packs/hello_stimulus-k344a6d59eef8632c9d1.chunk.css"
|
30
|
+
]
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "minitest/autorun"
|
4
|
+
require "rails"
|
5
|
+
require "rails/test_help"
|
6
|
+
require "webpacker"
|
7
|
+
require "webpacker_uploader"
|
8
|
+
|
9
|
+
module TestApp
|
10
|
+
class Application < ::Rails::Application
|
11
|
+
config.root = File.join(File.dirname(__FILE__), "test_app")
|
12
|
+
config.eager_load = true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
TestApp::Application.initialize!
|
17
|
+
|
18
|
+
module WebpackerUploader::Providers
|
19
|
+
class TestProvider
|
20
|
+
def initialize(asset_objects)
|
21
|
+
@asset_objects = asset_objects
|
22
|
+
end
|
23
|
+
|
24
|
+
def upload!(object_key, file, content_type = "")
|
25
|
+
@asset_objects << { object_key: object_key, file: file, content_type: content_type }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
module WebpackerUploader
|
31
|
+
def reset!
|
32
|
+
WebpackerUploader.instance.config = nil
|
33
|
+
end
|
34
|
+
module_function :reset!
|
35
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "test_helper"
|
4
|
+
|
5
|
+
class WebpackerUploaderTest < Minitest::Test
|
6
|
+
def setup
|
7
|
+
@asset_objects = []
|
8
|
+
@provider = WebpackerUploader::Providers::TestProvider.new(@asset_objects)
|
9
|
+
|
10
|
+
WebpackerUploader.config.log_output = false
|
11
|
+
end
|
12
|
+
|
13
|
+
def teardown
|
14
|
+
WebpackerUploader.reset!
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_upload
|
18
|
+
WebpackerUploader.upload!(@provider)
|
19
|
+
|
20
|
+
assert_equal "packs/bootstrap-c38deda30895059837cf.css", @asset_objects.first[:object_key]
|
21
|
+
assert_instance_of Pathname, @asset_objects.first[:file]
|
22
|
+
assert_equal "text/css", @asset_objects.first[:content_type]
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_upload_with_prefix
|
26
|
+
WebpackerUploader.upload!(@provider, prefix: "prefix")
|
27
|
+
|
28
|
+
assert_equal "prefix/packs/bootstrap-c38deda30895059837cf.css", @asset_objects.first[:object_key]
|
29
|
+
assert_instance_of Pathname, @asset_objects.first[:file]
|
30
|
+
assert_equal "text/css", @asset_objects.first[:content_type]
|
31
|
+
end
|
32
|
+
end
|
data/webpacker_uploader.gemspec
CHANGED
@@ -20,20 +20,16 @@ Gem::Specification.new do |s|
|
|
20
20
|
"source_code_uri" => "https://github.com/tlatsas/webpacker_uploader/tree/v#{s.version}"
|
21
21
|
}
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
s.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
26
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
27
|
-
end
|
28
|
-
|
29
|
-
s.bindir = "exe"
|
30
|
-
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
s.files = `git ls-files`.split("\n").reject { |f| f.match(%r{^(bin|test|.github)/}) }
|
24
|
+
s.test_files = `git ls-files -- test/*`.split("\n")
|
31
25
|
s.require_paths = ["lib"]
|
32
26
|
|
33
27
|
s.add_dependency "webpacker", ">= 5.1"
|
34
28
|
s.add_dependency "mime-types"
|
29
|
+
s.add_dependency "rack", "~> 2.0"
|
35
30
|
|
36
31
|
s.add_development_dependency "bundler", ">= 1.3.0"
|
37
|
-
s.add_development_dependency "rubocop", "
|
32
|
+
s.add_development_dependency "rubocop", "1.11.0"
|
38
33
|
s.add_development_dependency "rubocop-performance"
|
34
|
+
s.add_development_dependency "rubocop-minitest"
|
39
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpacker_uploader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tasos Latsas
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: webpacker
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rack
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,16 +70,16 @@ dependencies:
|
|
56
70
|
name: rubocop
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- -
|
73
|
+
- - '='
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
75
|
+
version: 1.11.0
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- -
|
80
|
+
- - '='
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: 1.11.0
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rubocop-performance
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +94,20 @@ dependencies:
|
|
80
94
|
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-minitest
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
83
111
|
description: Uploads manifest.json file contents to the cloud
|
84
112
|
email:
|
85
113
|
- tlatsas@hey.com
|
@@ -87,10 +115,9 @@ executables: []
|
|
87
115
|
extensions: []
|
88
116
|
extra_rdoc_files: []
|
89
117
|
files:
|
90
|
-
- ".github/workflows/rubocop.yml"
|
91
|
-
- ".github/workflows/ruby.yml"
|
92
118
|
- ".gitignore"
|
93
119
|
- ".rubocop.yml"
|
120
|
+
- ".yardopts"
|
94
121
|
- CHANGELOG.md
|
95
122
|
- CONTRIBUTING.md
|
96
123
|
- Gemfile
|
@@ -98,8 +125,6 @@ files:
|
|
98
125
|
- MIT-LICENSE
|
99
126
|
- README.md
|
100
127
|
- Rakefile
|
101
|
-
- bin/console
|
102
|
-
- bin/setup
|
103
128
|
- lib/webpacker_uploader.rb
|
104
129
|
- lib/webpacker_uploader/configuration.rb
|
105
130
|
- lib/webpacker_uploader/instance.rb
|
@@ -107,6 +132,13 @@ files:
|
|
107
132
|
- lib/webpacker_uploader/mime.rb
|
108
133
|
- lib/webpacker_uploader/providers/aws.rb
|
109
134
|
- lib/webpacker_uploader/version.rb
|
135
|
+
- test/configuration_test.rb
|
136
|
+
- test/manifest_test.rb
|
137
|
+
- test/mime_test.rb
|
138
|
+
- test/test_app/config/webpacker.yml
|
139
|
+
- test/test_app/public/packs/manifest.json
|
140
|
+
- test/test_helper.rb
|
141
|
+
- test/webpacker_uploader_test.rb
|
110
142
|
- webpacker_uploader.gemspec
|
111
143
|
homepage: https://github.com/tlatsas/webpacker_uploader
|
112
144
|
licenses:
|
@@ -115,7 +147,7 @@ metadata:
|
|
115
147
|
homepage_uri: https://github.com/tlatsas/webpacker_uploader
|
116
148
|
bug_tracker_uri: https://github.com/tlatsas/webpacker_uploader/issues
|
117
149
|
changelog_uri: https://github.com/tlatsas/webpacker_uploader/blob/main/CHANGELOG.md
|
118
|
-
source_code_uri: https://github.com/tlatsas/webpacker_uploader/tree/v0.
|
150
|
+
source_code_uri: https://github.com/tlatsas/webpacker_uploader/tree/v0.4.0
|
119
151
|
post_install_message:
|
120
152
|
rdoc_options: []
|
121
153
|
require_paths:
|
@@ -135,4 +167,11 @@ rubygems_version: 3.1.4
|
|
135
167
|
signing_key:
|
136
168
|
specification_version: 4
|
137
169
|
summary: Uploads manifest.json file contents to the cloud
|
138
|
-
test_files:
|
170
|
+
test_files:
|
171
|
+
- test/configuration_test.rb
|
172
|
+
- test/manifest_test.rb
|
173
|
+
- test/mime_test.rb
|
174
|
+
- test/test_app/config/webpacker.yml
|
175
|
+
- test/test_app/public/packs/manifest.json
|
176
|
+
- test/test_helper.rb
|
177
|
+
- test/webpacker_uploader_test.rb
|
@@ -1,35 +0,0 @@
|
|
1
|
-
name: RuboCop
|
2
|
-
|
3
|
-
on: [push, pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
build:
|
7
|
-
name: RuboCop
|
8
|
-
runs-on: ${{ matrix.os }}
|
9
|
-
env:
|
10
|
-
BUNDLE_JOBS: 4
|
11
|
-
BUNDLE_RETRY: 3
|
12
|
-
strategy:
|
13
|
-
matrix:
|
14
|
-
os: [ ubuntu-latest ]
|
15
|
-
ruby: [
|
16
|
-
2.7
|
17
|
-
]
|
18
|
-
steps:
|
19
|
-
- uses: actions/checkout@v2
|
20
|
-
- uses: actions/cache@v2
|
21
|
-
with:
|
22
|
-
path: vendor/bundle
|
23
|
-
key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
|
24
|
-
restore-keys: |
|
25
|
-
${{ runner.os }}-rubocop-
|
26
|
-
- uses: ruby/setup-ruby@v1
|
27
|
-
with:
|
28
|
-
ruby-version: ${{ matrix.ruby }}
|
29
|
-
- name: Bundle install
|
30
|
-
run: |
|
31
|
-
gem install bundler -v 2.1.4
|
32
|
-
bundle config path vendor/bundle
|
33
|
-
bundle install
|
34
|
-
- name: Run RuboCop
|
35
|
-
run: bundle exec rubocop
|
data/.github/workflows/ruby.yml
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
name: Ruby tests
|
2
|
-
|
3
|
-
on: [push, pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
build:
|
7
|
-
name: Ruby tests
|
8
|
-
runs-on: ${{ matrix.os }}
|
9
|
-
env:
|
10
|
-
BUNDLE_JOBS: 4
|
11
|
-
BUNDLE_RETRY: 3
|
12
|
-
strategy:
|
13
|
-
fail-fast: false
|
14
|
-
matrix:
|
15
|
-
os: [ubuntu-latest]
|
16
|
-
ruby: [
|
17
|
-
2.5,
|
18
|
-
2.6,
|
19
|
-
2.7,
|
20
|
-
3.0
|
21
|
-
]
|
22
|
-
steps:
|
23
|
-
- uses: actions/checkout@v2
|
24
|
-
- uses: actions/cache@v2
|
25
|
-
with:
|
26
|
-
path: vendor/bundle
|
27
|
-
key: ${{ runner.os }}-ruby-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}-${{ hashFiles('**/*.gemspec') }}
|
28
|
-
restore-keys: |
|
29
|
-
${{ runner.os }}-ruby-${{ matrix.ruby }}-gems-
|
30
|
-
- uses: ruby/setup-ruby@v1
|
31
|
-
with:
|
32
|
-
ruby-version: ${{ matrix.ruby }}
|
33
|
-
- name: Bundle install
|
34
|
-
run: |
|
35
|
-
gem install bundler -v 2.1.4
|
36
|
-
bundle config path vendor/bundle
|
37
|
-
bundle install
|
38
|
-
- name: Run tests
|
39
|
-
run: bundle exec rake test
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "webpacker_uploader"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|