pakyow-assets 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -1
- data/lib/pakyow/application/behavior/assets/externals.rb +1 -2
- data/lib/pakyow/assets/external.rb +68 -34
- data/lib/pakyow/assets/types/js.rb +1 -1
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d835e94d5a1dc792fb8e3f0f943780e6ae6e9d477742b4a03c470a0afa664d5
|
4
|
+
data.tar.gz: 6b9c1c1f17ad8a054d91c1e37940d6cefbc88f9d7e2a76439bd40edce7f0dd98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39a751d90c7d04f47e2c88be8dcce709c4a809caad1c62c5e7a0df2859e7ad17f314f723e9202d087426406d6f58aa0d01d29bd17aec83eeaf56de8e0a011ee7
|
7
|
+
data.tar.gz: 23252b5168d08e7cbc0c8d038e21219bd81e777b3f7d2fa5ee0826f0508ecbe3bf9073d111a35a73bc37052d6cea0d78a4fc60fa4aa30fb9f097a9ff33fa0620
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,17 @@
|
|
1
|
-
# v1.0.
|
1
|
+
# v1.0.3 (unreleased)
|
2
|
+
|
3
|
+
* `fix` **Make `pakyow/assets` compatible with Ruby 2.7.0.**
|
4
|
+
- External assets used the `http` gem, which is failing on Ruby 2.7.0-preview3. We replaced it
|
5
|
+
with the `async-http` gem which is already a dependency of other Pakyow frameworks.
|
6
|
+
|
7
|
+
*Related links:*
|
8
|
+
- [Pull Request #362][pr-362]
|
9
|
+
- [Commit 4278340][4278340]
|
10
|
+
|
11
|
+
[pr-362]: https://github.com/pakyow/pakyow/pull/362/commits
|
12
|
+
[4278340]: https://github.com/pakyow/pakyow/commit/4278340178abea1dc7891ed02d098c5b747b2d5b
|
13
|
+
|
14
|
+
# v1.0.2
|
2
15
|
|
3
16
|
* `fix` **CDN prefix is now correctly added to assets in plugin views.**
|
4
17
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "http"
|
4
|
-
|
5
3
|
require "pakyow/support/cli/runner"
|
6
4
|
|
7
5
|
module Pakyow
|
@@ -58,46 +56,82 @@ module Pakyow
|
|
58
56
|
end
|
59
57
|
|
60
58
|
Support::CLI::Runner.new(message: "Fetching #{file_with_version}").run do |runner|
|
61
|
-
|
62
|
-
|
59
|
+
Async do
|
60
|
+
downloader = Downloader.new(
|
61
|
+
File.join(@config.externals.provider, package_with_version, file.to_s)
|
62
|
+
).perform
|
63
|
+
|
64
|
+
FileUtils.mkdir_p(@config.externals.path)
|
65
|
+
|
66
|
+
fetched_version = downloader.path.to_s.split(@package.to_s, 2)[1].split("/", 2)[0].split("@", 2)[1]
|
67
|
+
file_basename = File.basename(file.to_s, File.extname(file.to_s))
|
68
|
+
|
69
|
+
local_path = if file && file_basename != name.to_s
|
63
70
|
File.join(
|
64
|
-
@config.externals.
|
65
|
-
|
66
|
-
file.to_s
|
71
|
+
@config.externals.path,
|
72
|
+
"#{name}@#{fetched_version}__#{file_basename}.js"
|
67
73
|
)
|
68
|
-
)
|
69
|
-
|
70
|
-
if response.code == 200
|
71
|
-
FileUtils.mkdir_p(@config.externals.path)
|
72
|
-
|
73
|
-
fetched_version = response.uri.to_s.split(@package.to_s, 2)[1].split("/", 2)[0].split("@", 2)[1]
|
74
|
-
file_basename = File.basename(file.to_s, File.extname(file.to_s))
|
75
|
-
|
76
|
-
local_path = if file && file_basename != name.to_s
|
77
|
-
File.join(
|
78
|
-
@config.externals.path,
|
79
|
-
"#{name}@#{fetched_version}__#{file_basename}.js"
|
80
|
-
)
|
81
|
-
else
|
82
|
-
File.join(
|
83
|
-
@config.externals.path,
|
84
|
-
"#{name}@#{fetched_version}.js"
|
85
|
-
)
|
86
|
-
end
|
87
|
-
|
88
|
-
File.open(local_path, "w") do |fp|
|
89
|
-
fp.write(response.body.to_s)
|
90
|
-
end
|
91
|
-
|
92
|
-
runner.succeeded
|
93
74
|
else
|
94
|
-
|
75
|
+
File.join(
|
76
|
+
@config.externals.path,
|
77
|
+
"#{name}@#{fetched_version}.js"
|
78
|
+
)
|
95
79
|
end
|
96
|
-
|
80
|
+
|
81
|
+
File.open(local_path, "w") do |fp|
|
82
|
+
fp.write(downloader.body.to_s)
|
83
|
+
end
|
84
|
+
|
85
|
+
runner.succeeded
|
86
|
+
rescue Downloader::Failed => error
|
97
87
|
runner.failed(error.to_s)
|
98
88
|
end
|
99
89
|
end
|
100
90
|
end
|
91
|
+
|
92
|
+
require "uri"
|
93
|
+
|
94
|
+
require "async"
|
95
|
+
require "async/http/internet"
|
96
|
+
|
97
|
+
# @api private
|
98
|
+
class Downloader
|
99
|
+
attr_reader :status, :body, :path
|
100
|
+
|
101
|
+
def initialize(uri)
|
102
|
+
@uri = URI.parse(uri)
|
103
|
+
end
|
104
|
+
|
105
|
+
def perform
|
106
|
+
get(@uri.path); self
|
107
|
+
end
|
108
|
+
|
109
|
+
private def get(path)
|
110
|
+
@path = path
|
111
|
+
internet = Async::HTTP::Internet.new
|
112
|
+
response = internet.get(build_uri(path))
|
113
|
+
@status = response.status
|
114
|
+
|
115
|
+
if response.status == 301 || response.status == 302
|
116
|
+
get(response.headers["location"])
|
117
|
+
elsif response.status >= 500
|
118
|
+
raise Failed, "Unexpected response status: #{response.status}"
|
119
|
+
else
|
120
|
+
@body = response.body.read
|
121
|
+
end
|
122
|
+
rescue SocketError => error
|
123
|
+
raise Failed.build(error)
|
124
|
+
ensure
|
125
|
+
response&.close
|
126
|
+
internet&.close
|
127
|
+
end
|
128
|
+
|
129
|
+
private def build_uri(path)
|
130
|
+
File.join("#{@uri.scheme}://#{@uri.host}", path)
|
131
|
+
end
|
132
|
+
|
133
|
+
class Failed < Error; end
|
134
|
+
end
|
101
135
|
end
|
102
136
|
end
|
103
137
|
end
|
@@ -25,7 +25,7 @@ module Pakyow
|
|
25
25
|
|
26
26
|
def process(content)
|
27
27
|
result = if transformable?
|
28
|
-
transformed = Babel.transform(content,
|
28
|
+
transformed = Babel.transform(content, **@options)
|
29
29
|
{ content: transformed["code"], map: transformed["map"] }
|
30
30
|
else
|
31
31
|
{ content: content, map: "" }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pakyow-assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Powell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pakyow-core
|
@@ -16,84 +16,84 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0.
|
19
|
+
version: 1.0.3
|
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.0.
|
26
|
+
version: 1.0.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pakyow-presenter
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.0.
|
33
|
+
version: 1.0.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.0.
|
40
|
+
version: 1.0.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pakyow-routing
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.0.
|
47
|
+
version: 1.0.3
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.0.
|
54
|
+
version: 1.0.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pakyow-support
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.0.
|
61
|
+
version: 1.0.3
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.0.
|
68
|
+
version: 1.0.3
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: async-http
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 0.49.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 0.49.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: execjs
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '2.7'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '2.7'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: mini_mime
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|