pakyow-assets 1.0.1 → 1.0.6

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
2
  SHA256:
3
- metadata.gz: 994e8c28b8152f1355d7d0d5ef87e8ee4c974bf5e828c3f98f5c29e561b0bcd3
4
- data.tar.gz: 457cc3641b54e99340175c2126309b84272e801ee6bfe4c81dea79a43b341512
3
+ metadata.gz: 4d707b98bd1e8b7eb85b4665f9c2c07023b9313c504d00aebc71eedcb3a6bae9
4
+ data.tar.gz: 2ce1978d448d7279041f39a41b9d196b68e141d7bf73f56024710dc413f62e9c
5
5
  SHA512:
6
- metadata.gz: 680fb55b55b0462a746af58eb316bfd65e6d444b76dcc0887fbadafc064c501d1679ec8154040fbed1bc8dc7dc85d4d5756e91bcd882c033b6b6ae0449f48b7f
7
- data.tar.gz: 2d2c7229731f67d111cab9796a2215339f50ac7e8d5aebaf417df60f6fbd73eb7095a587acf47f457e38f7ec2169e020e72670ee1b99d5978ffb9164c60d6105
6
+ metadata.gz: e0b3c095e5649fb568e685789191f38009824dbdb13334d732505496df3b9289afedfe6605b3a1d936c485066050695babd2ff2e2d20dd9dc81614e8a553ec52
7
+ data.tar.gz: 0270d95a8c089cebe17891f1f2dd17e999b09ec75b092b82b8a0cca134e2f205a17d2eb46b2c0daff61a0627c383b2fc1d677be61963feffe4dec1cf40f28d99
@@ -1,5 +1,52 @@
1
- # UNRELEASED
1
+ # v1.0.6
2
2
 
3
- # 1.0
3
+ * `chg` **Update mini_racer to v0.3 for improved compatibility with containers.**
4
+
5
+ *Related links:*
6
+ - [Pull Request #514][pr-514]
7
+
8
+ [pr-514]: https://github.com/pakyow/pakyow/pull/514/
9
+
10
+ # v1.0.5
11
+
12
+ * `fix` **Download external asset content in full.**
13
+
14
+ *Related links:*
15
+ - [Pull Request #415][pr-415]
16
+
17
+ [pr-415]: https://github.com/pakyow/pakyow/pull/415/
18
+
19
+ # v1.0.4
20
+
21
+ * `fix` **Escape external asset uris so they do not fail on fetch.**
22
+
23
+ *Related links:*
24
+ - [Commit e2d7e2e][e2d7e2e]
25
+
26
+ [e2d7e2e]: https://github.com/pakyow/pakyow/commit/e2d7e2ea2f36cb0a4c7073c17a692423b5cd1efe
27
+
28
+ # v1.0.3
29
+
30
+ * `fix` **Make `pakyow/assets` compatible with Ruby 2.7.0.**
31
+ - External assets used the `http` gem, which is failing on Ruby 2.7.0-preview3. We replaced it
32
+ with the `async-http` gem which is already a dependency of other Pakyow frameworks.
33
+
34
+ *Related links:*
35
+ - [Pull Request #362][pr-362]
36
+ - [Commit 4278340][4278340]
37
+
38
+ [pr-362]: https://github.com/pakyow/pakyow/pull/362/commits
39
+ [4278340]: https://github.com/pakyow/pakyow/commit/4278340178abea1dc7891ed02d098c5b747b2d5b
40
+
41
+ # v1.0.2
42
+
43
+ * `fix` **CDN prefix is now correctly added to assets in plugin views.**
44
+
45
+ *Related links:*
46
+ - [Commit 84da911][84da911]
47
+
48
+ [84da911]: https://github.com/pakyow/pakyow/commit/84da911d78a33e0328bc64a7051f56268f088273
49
+
50
+ # v1.0.0
4
51
 
5
52
  * Hello, Web
@@ -23,10 +23,14 @@ module Pakyow
23
23
  )
24
24
  end
25
25
 
26
+ private def pakyow_js_version
27
+ "^1.0.0"
28
+ end
29
+
26
30
  apply_extension do
27
31
  after "boot", "fetch.assets.externals" do
28
32
  if config.assets.externals.pakyow
29
- external_script :pakyow, "^1.0.0", package: "@pakyow/js", files: [
33
+ external_script :pakyow, pakyow_js_version, package: "@pakyow/js", files: [
30
34
  "dist/pakyow.js",
31
35
  "dist/components/confirmable.js",
32
36
  "dist/components/form.js",
@@ -48,8 +52,7 @@ module Pakyow
48
52
  end
49
53
 
50
54
  if fetched
51
- FileUtils.mkdir_p "./tmp"
52
- FileUtils.touch "./tmp/restart.txt"
55
+ touch_restart
53
56
  end
54
57
  end
55
58
  end
@@ -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,45 +56,90 @@ module Pakyow
58
56
  end
59
57
 
60
58
  Support::CLI::Runner.new(message: "Fetching #{file_with_version}").run do |runner|
61
- begin
62
- response = HTTP.follow(true).get(
59
+ Async do
60
+ downloader = Downloader.new(
61
+ File.join(@config.externals.provider, CGI.escape(package_with_version), CGI.escape(file.to_s))
62
+ ).perform
63
+
64
+ FileUtils.mkdir_p(@config.externals.path)
65
+
66
+ fetched_version = CGI.unescape(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.provider,
65
- package_with_version,
66
- file.to_s
71
+ @config.externals.path,
72
+ "#{name}@#{fetched_version}__#{file_basename}.js"
67
73
  )
68
- )
74
+ else
75
+ File.join(
76
+ @config.externals.path,
77
+ "#{name}@#{fetched_version}.js"
78
+ )
79
+ end
69
80
 
70
- if response.code == 200
71
- FileUtils.mkdir_p(@config.externals.path)
81
+ File.open(local_path, "w") do |fp|
82
+ fp.write(downloader.body.to_s)
83
+ end
72
84
 
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))
85
+ runner.succeeded
86
+ rescue Downloader::Failed => error
87
+ runner.failed(error.to_s)
88
+ end
89
+ end
90
+ end
75
91
 
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
92
+ require "uri"
87
93
 
88
- File.open(local_path, "w") do |fp|
89
- fp.write(response.body.to_s)
90
- end
94
+ require "async"
95
+ require "async/http/internet"
91
96
 
92
- runner.succeeded
93
- else
94
- runner.failed(response.to_s)
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
+
113
+ Async do
114
+ begin
115
+ response = internet.get(build_uri(path))
116
+ @status = response.status
117
+
118
+ if response.status == 301 || response.status == 302
119
+ get(response.headers["location"])
120
+ elsif response.status >= 500
121
+ raise Failed, "Unexpected response status: #{response.status}"
122
+ else
123
+ @body = String.new
124
+ while body = response.body.read
125
+ @body << body
126
+ end
127
+ end
128
+ rescue SocketError => error
129
+ raise Failed.build(error)
130
+ ensure
131
+ response&.close
95
132
  end
96
- rescue HTTP::ConnectionError => error
97
- runner.failed(error.to_s)
98
- end
133
+ end.wait
134
+ ensure
135
+ internet&.close
99
136
  end
137
+
138
+ private def build_uri(path)
139
+ File.join("#{@uri.scheme}://#{@uri.host}", path)
140
+ end
141
+
142
+ class Failed < Error; end
100
143
  end
101
144
  end
102
145
  end
@@ -25,7 +25,7 @@ module Pakyow
25
25
 
26
26
  def process(content)
27
27
  result = if transformable?
28
- transformed = Babel.transform(content, @options)
28
+ transformed = Babel.transform(content, **@options)
29
29
  { content: transformed["code"], map: transformed["map"] }
30
30
  else
31
31
  { content: content, map: "" }
@@ -23,11 +23,11 @@ module Pakyow
23
23
  pack.public_path
24
24
  }.each do |pack|
25
25
  if pack.javascripts?
26
- head.object.append_html("<script src=\"#{File.join(app.config.assets.host, pack.public_path)}.js\"></script>\n")
26
+ head.object.append_html("<script src=\"#{File.join(app.top.config.assets.host, pack.public_path)}.js\"></script>\n")
27
27
  end
28
28
 
29
29
  if pack.stylesheets?
30
- head.object.append_html("<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"#{File.join(app.config.assets.host, pack.public_path)}.css\">\n")
30
+ head.object.append_html("<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"#{File.join(app.top.config.assets.host, pack.public_path)}.css\">\n")
31
31
  end
32
32
  end
33
33
  end
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.1
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Powell
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-16 00:00:00.000000000 Z
11
+ date: 2020-09-03 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.1
19
+ version: 1.0.6
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.1
26
+ version: 1.0.6
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.1
33
+ version: 1.0.6
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.1
40
+ version: 1.0.6
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.1
47
+ version: 1.0.6
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.1
54
+ version: 1.0.6
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.1
61
+ version: 1.0.6
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.1
68
+ version: 1.0.6
69
69
  - !ruby/object:Gem::Dependency
70
- name: execjs
70
+ name: async-http
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '2.7'
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: '2.7'
82
+ version: 0.49.0
83
83
  - !ruby/object:Gem::Dependency
84
- name: http
84
+ name: execjs
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '4.1'
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: '4.1'
96
+ version: '2.7'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: mini_mime
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -114,28 +114,28 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.2.6
117
+ version: 0.3.1
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.2.6
124
+ version: 0.3.1
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: sassc
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '2.0'
131
+ version: '2.2'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '2.0'
138
+ version: '2.2'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: source_map
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '4.1'
159
+ version: '4.2'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '4.1'
166
+ version: '4.2'
167
167
  description: Asset pipeline for Pakyow
168
168
  email: bryan@bryanp.org
169
169
  executables: []
@@ -204,7 +204,7 @@ homepage: https://pakyow.com
204
204
  licenses:
205
205
  - LGPL-3.0
206
206
  metadata: {}
207
- post_install_message:
207
+ post_install_message:
208
208
  rdoc_options: []
209
209
  require_paths:
210
210
  - lib
@@ -219,8 +219,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  - !ruby/object:Gem::Version
220
220
  version: '0'
221
221
  requirements: []
222
- rubygems_version: 3.0.3
223
- signing_key:
222
+ rubygems_version: 3.1.2
223
+ signing_key:
224
224
  specification_version: 4
225
225
  summary: Pakyow Assets
226
226
  test_files: []