pakyow-core 1.0.0.rc2 → 1.0.0.rc3
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/lib/pakyow/app.rb +2 -2
- data/lib/pakyow/behavior/aspects.rb +5 -1
- data/lib/pakyow/behavior/helpers.rb +9 -8
- data/lib/pakyow/behavior/operations.rb +1 -0
- data/lib/pakyow/behavior/pipeline.rb +5 -5
- data/lib/pakyow/behavior/restarting.rb +2 -0
- data/lib/pakyow/cli.rb +3 -3
- data/lib/pakyow/connection.rb +12 -4
- data/lib/pakyow/environment/behavior/input_parsing.rb +6 -3
- data/lib/pakyow/environment.rb +12 -3
- data/lib/pakyow/generators/project/default/%dot%gitignore +4 -0
- data/lib/pakyow/generators/project/default/Gemfile.erb +1 -1
- data/lib/pakyow/generators/project/default/README.md +1 -1
- data/lib/pakyow/generators/project/default/config/environment.rb +4 -0
- data/lib/pakyow/integrations/bundler/require.rb +1 -1
- data/lib/pakyow/logger/formatters/json.rb +0 -2
- data/lib/pakyow/operation.rb +0 -1
- data/lib/pakyow/plugin/lookup.rb +0 -1
- data/lib/pakyow/plugin/state.rb +1 -1
- data/lib/pakyow/plugin.rb +4 -1
- data/lib/pakyow/validations/presence.rb +1 -3
- data/lib/pakyow/validator.rb +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12e96f8e6d8402b05a724cf25346153e3dd6e983a781553b048f5f22ee5f9658
|
4
|
+
data.tar.gz: 34981bf9cb7538249e849bdf3974ab610e11beb47a780b51deb16663478cd926
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d681b76e4c741396812704e3af8b548f6e6d400985cd27c8bafbd59ae3597c5aa799981a2b99ed65f1bc161d41e8bfbe15c0dc1dab4c9e96e818bfbe25621efb
|
7
|
+
data.tar.gz: 8596bc0d9d783cf15af6178b0f4acaf681c1decf56ecfffd1da1a8b209a4a4c704d9050f165d2de7c7534f1a4b7e0af36c7bff525533c487e744bd1949f183ed
|
data/lib/pakyow/app.rb
CHANGED
@@ -188,8 +188,8 @@ module Pakyow
|
|
188
188
|
app_connection = isolated(:Connection).new(self, connection)
|
189
189
|
super(app_connection)
|
190
190
|
rescue => error
|
191
|
-
if respond_to?(:controller_for_connection)
|
192
|
-
|
191
|
+
if respond_to?(:controller_for_connection) && controller = controller_for_connection(app_connection)
|
192
|
+
controller.handle_error(error)
|
193
193
|
else
|
194
194
|
raise error
|
195
195
|
end
|
@@ -32,12 +32,16 @@ module Pakyow
|
|
32
32
|
private
|
33
33
|
|
34
34
|
def load_aspect(aspect, path: File.join(config.src, aspect.to_s), target: self.class)
|
35
|
+
__load_aspect(aspect, path: path, target: target)
|
36
|
+
end
|
37
|
+
|
38
|
+
def __load_aspect(aspect, path: File.join(config.src, aspect.to_s), target: self.class)
|
35
39
|
Dir.glob(File.join(path, "*.rb")) do |file_path|
|
36
40
|
Loader.new(file_path).call(target)
|
37
41
|
end
|
38
42
|
|
39
43
|
Dir.glob(File.join(path, "*")).select { |sub_path| File.directory?(sub_path) }.each do |directory|
|
40
|
-
|
44
|
+
__load_aspect(aspect, path: directory, target: target)
|
41
45
|
end
|
42
46
|
end
|
43
47
|
end
|
@@ -79,14 +79,6 @@ module Pakyow
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
def included_helper_context(object)
|
83
|
-
@__included_helpers.each_pair do |object_with_helpers, context|
|
84
|
-
return context if object.is_a?(object_with_helpers)
|
85
|
-
end
|
86
|
-
|
87
|
-
nil
|
88
|
-
end
|
89
|
-
|
90
82
|
def helpers(context)
|
91
83
|
case context.to_sym
|
92
84
|
when :global
|
@@ -101,6 +93,15 @@ module Pakyow
|
|
101
93
|
)
|
102
94
|
end
|
103
95
|
end
|
96
|
+
|
97
|
+
# @api private
|
98
|
+
def included_helper_context(object)
|
99
|
+
@__included_helpers.each_pair do |object_with_helpers, context|
|
100
|
+
return context if object.is_a?(object_with_helpers)
|
101
|
+
end
|
102
|
+
|
103
|
+
nil
|
104
|
+
end
|
104
105
|
end
|
105
106
|
end
|
106
107
|
end
|
@@ -25,12 +25,12 @@ module Pakyow
|
|
25
25
|
|
26
26
|
def load_pipeline_defaults(pipeline)
|
27
27
|
if self.class.includes_framework?(:assets)
|
28
|
-
pipeline.action(Assets::
|
29
|
-
pipeline.action(Assets::
|
28
|
+
pipeline.action(Actions::Assets::Public, self)
|
29
|
+
pipeline.action(Actions::Assets::Process)
|
30
30
|
end
|
31
31
|
|
32
32
|
if self.class.includes_framework?(:realtime) && Pakyow.config.realtime.server && !is_a?(Plugin)
|
33
|
-
pipeline.action(Realtime::
|
33
|
+
pipeline.action(Actions::Realtime::Upgrader)
|
34
34
|
end
|
35
35
|
|
36
36
|
if self.class.includes_framework?(:routing) && !Pakyow.env?(:prototype)
|
@@ -46,11 +46,11 @@ module Pakyow
|
|
46
46
|
end
|
47
47
|
|
48
48
|
if self.class.includes_framework?(:presenter)
|
49
|
-
pipeline.action(Presenter::
|
49
|
+
pipeline.action(Actions::Presenter::AutoRender)
|
50
50
|
end
|
51
51
|
|
52
52
|
if self.class.includes_framework?(:routing) && !Pakyow.env?(:prototype) && !is_a?(Plugin)
|
53
|
-
pipeline.action(Routing::
|
53
|
+
pipeline.action(Actions::Routing::RespondMissing)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
data/lib/pakyow/cli.rb
CHANGED
@@ -19,12 +19,12 @@ module Pakyow
|
|
19
19
|
app: {
|
20
20
|
description: "The app to run the command on",
|
21
21
|
global: true
|
22
|
-
},
|
22
|
+
}.freeze,
|
23
23
|
env: {
|
24
24
|
description: "What environment to use",
|
25
25
|
global: true
|
26
|
-
}
|
27
|
-
}
|
26
|
+
}.freeze
|
27
|
+
}.freeze
|
28
28
|
|
29
29
|
def initialize(argv = ARGV.dup)
|
30
30
|
@argv = argv
|
data/lib/pakyow/connection.rb
CHANGED
@@ -6,6 +6,8 @@ require "securerandom"
|
|
6
6
|
require "async/http"
|
7
7
|
require "async/http/protocol/response"
|
8
8
|
|
9
|
+
require "protocol/http/body/rewindable"
|
10
|
+
|
9
11
|
require "mini_mime"
|
10
12
|
|
11
13
|
require "pakyow/support/deep_dup"
|
@@ -109,8 +111,8 @@ module Pakyow
|
|
109
111
|
#
|
110
112
|
def method
|
111
113
|
unless instance_variable_defined?(:@method)
|
112
|
-
@method = if request_method == "POST" && params.include?(:
|
113
|
-
params[:
|
114
|
+
@method = if request_method == "POST" && params.include?(:"pw-http-method")
|
115
|
+
params[:"pw-http-method"].downcase.to_sym
|
114
116
|
else
|
115
117
|
request_method.downcase.to_sym
|
116
118
|
end
|
@@ -494,8 +496,14 @@ module Pakyow
|
|
494
496
|
|
495
497
|
def parse_input
|
496
498
|
if instance_variable_defined?(:@input_parser) && input
|
497
|
-
@input_parser
|
498
|
-
|
499
|
+
if @input_parser[:rewindable]
|
500
|
+
request.body = Async::HTTP::Body::Rewindable.new(request.body)
|
501
|
+
end
|
502
|
+
|
503
|
+
@input_parser[:block].call(input, self).tap do
|
504
|
+
if input.respond_to?(:rewind)
|
505
|
+
input.rewind
|
506
|
+
end
|
499
507
|
end
|
500
508
|
else
|
501
509
|
nil
|
@@ -29,7 +29,7 @@ module Pakyow
|
|
29
29
|
).parse(input)
|
30
30
|
end
|
31
31
|
|
32
|
-
Pakyow.parse_input "application/json" do |input, connection|
|
32
|
+
Pakyow.parse_input "application/json", rewindable: true do |input, connection|
|
33
33
|
values = JSON.parse(input.read)
|
34
34
|
|
35
35
|
if values.is_a?(Hash)
|
@@ -44,8 +44,11 @@ module Pakyow
|
|
44
44
|
end
|
45
45
|
|
46
46
|
class_methods do
|
47
|
-
def parse_input(type, &block)
|
48
|
-
@input_parsers[type] =
|
47
|
+
def parse_input(type, rewindable: true, &block)
|
48
|
+
@input_parsers[type] = {
|
49
|
+
block: block,
|
50
|
+
rewindable: rewindable
|
51
|
+
}
|
49
52
|
end
|
50
53
|
end
|
51
54
|
end
|
data/lib/pakyow/environment.rb
CHANGED
@@ -12,7 +12,6 @@ require "pakyow/support/configurable"
|
|
12
12
|
require "pakyow/support/class_state"
|
13
13
|
require "pakyow/support/deep_dup"
|
14
14
|
require "pakyow/support/deep_freeze"
|
15
|
-
require "pakyow/support/logging"
|
16
15
|
require "pakyow/support/pipeline"
|
17
16
|
require "pakyow/support/inflector"
|
18
17
|
|
@@ -371,13 +370,23 @@ module Pakyow
|
|
371
370
|
def handle_boot_failure(error)
|
372
371
|
@error = error
|
373
372
|
|
374
|
-
|
375
|
-
logger.houston
|
373
|
+
safe_logger do |logger|
|
374
|
+
if logger.respond_to?(:houston)
|
375
|
+
logger.houston(error)
|
376
|
+
else
|
377
|
+
logger.error(error)
|
378
|
+
end
|
376
379
|
end
|
377
380
|
|
378
381
|
if config.exit_on_boot_failure
|
379
382
|
exit(false)
|
380
383
|
end
|
381
384
|
end
|
385
|
+
|
386
|
+
require "logger"
|
387
|
+
|
388
|
+
def safe_logger
|
389
|
+
yield logger || ::Logger.new($stdout)
|
390
|
+
end
|
382
391
|
end
|
383
392
|
end
|
@@ -9,6 +9,6 @@ You can access your project at [`localhost:3000`](http://localhost:3000) from yo
|
|
9
9
|
## Learn more
|
10
10
|
|
11
11
|
* Website: https://pakyow.com
|
12
|
-
* Community: https://pakyow.com/
|
12
|
+
* Community: https://pakyow.com/community
|
13
13
|
* Documentation: https://pakyow.com/docs/hello
|
14
14
|
* View Source: https://github.com/pakyow/pakyow
|
@@ -6,6 +6,10 @@ Pakyow.configure :development do
|
|
6
6
|
config.data.connections.sql[:default] = "sqlite://database/development.db"
|
7
7
|
end
|
8
8
|
|
9
|
+
Pakyow.configure :prototype do
|
10
|
+
config.data.connections.sql[:default] = "sqlite://database/prototype.db"
|
11
|
+
end
|
12
|
+
|
9
13
|
Pakyow.configure :production do
|
10
14
|
config.data.connections.sql[:default] = ENV["DATABASE_URL"]
|
11
15
|
end
|
data/lib/pakyow/operation.rb
CHANGED
data/lib/pakyow/plugin/lookup.rb
CHANGED
data/lib/pakyow/plugin/state.rb
CHANGED
@@ -45,7 +45,7 @@ module Pakyow
|
|
45
45
|
if app_info = app_templates.info(path)
|
46
46
|
# Define the plugin view as the `plug` partial so that it can be included.
|
47
47
|
#
|
48
|
-
plugin_info[:partials][:plug] = Presenter::Partial.from_object(
|
48
|
+
plugin_info[:partials][:plug] = Presenter::Views::Partial.from_object(
|
49
49
|
:plug, plugin_info[:page].object
|
50
50
|
)
|
51
51
|
|
data/lib/pakyow/plugin.rb
CHANGED
@@ -140,6 +140,7 @@ module Pakyow
|
|
140
140
|
@helper_class.new(self, connection)
|
141
141
|
end
|
142
142
|
|
143
|
+
# @api private
|
143
144
|
def __object_name
|
144
145
|
self.class.__object_name
|
145
146
|
end
|
@@ -172,6 +173,7 @@ module Pakyow
|
|
172
173
|
:"__#{prefix}.#{name}"
|
173
174
|
end
|
174
175
|
|
176
|
+
# @api private
|
175
177
|
def _dump(_)
|
176
178
|
Marshal.dump(
|
177
179
|
{
|
@@ -186,6 +188,7 @@ module Pakyow
|
|
186
188
|
)
|
187
189
|
end
|
188
190
|
|
191
|
+
# @api private
|
189
192
|
def self._load(state)
|
190
193
|
state = Marshal.load(state)
|
191
194
|
Pakyow.app(state[:parent][:name]).plugs.find { |plug|
|
@@ -215,7 +218,7 @@ module Pakyow
|
|
215
218
|
end
|
216
219
|
end
|
217
220
|
|
218
|
-
def load_aspect(aspect)
|
221
|
+
def load_aspect(aspect, **)
|
219
222
|
@state.each do |state|
|
220
223
|
super(aspect, path: state.backend_path(aspect), target: self)
|
221
224
|
end
|
@@ -15,8 +15,6 @@ module Pakyow
|
|
15
15
|
#
|
16
16
|
# @api public
|
17
17
|
module Presence
|
18
|
-
WHITESPACE_ONLY = /^\s*$/
|
19
|
-
|
20
18
|
def self.name
|
21
19
|
:presence
|
22
20
|
end
|
@@ -27,7 +25,7 @@ module Pakyow
|
|
27
25
|
|
28
26
|
def self.valid?(value, **)
|
29
27
|
if value.is_a?(String)
|
30
|
-
!value.
|
28
|
+
!value.strip.empty?
|
31
29
|
elsif value.respond_to?(:empty?)
|
32
30
|
!value.empty?
|
33
31
|
else
|
data/lib/pakyow/validator.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pakyow-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Powell
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: commands
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-07-
|
12
|
+
date: 2019-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pakyow-support
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.0.0.
|
20
|
+
version: 1.0.0.rc3
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - '='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.0.0.
|
27
|
+
version: 1.0.0.rc3
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: async
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|