rack-app 3.4.0 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/VERSION +1 -1
- data/lib/rack/app/cli.rb +2 -7
- data/lib/rack/app/cli/fetcher.rb +24 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e631f311a40138f62d53fa4b26bb7c91257f416
|
4
|
+
data.tar.gz: e3b004dd24dd12c2d25a1197f65b677948131775
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1281d2dc6004621dbd9bae6a59e32b5a1239f804eca735e823580c450d8d19715b7c8436e077687caa20fc0433e65099ba48c0a9fce8af209c24338e2695d1b7
|
7
|
+
data.tar.gz: 4c9525b1ebae32d9a8a7656d4542b60e22f08c69e492766efa2cd8ca011268037553dfee1c3aa5551fc5e4ea6d0a7f6ff3fba1141d38bc55feafb89c94c20370
|
data/README.md
CHANGED
@@ -115,6 +115,8 @@ require 'rack/app'
|
|
115
115
|
|
116
116
|
class App < Rack::App
|
117
117
|
|
118
|
+
apply_extensions :front_end
|
119
|
+
|
118
120
|
mount SomeAppClass
|
119
121
|
|
120
122
|
headers 'Access-Control-Allow-Origin' => '*',
|
@@ -145,7 +147,6 @@ class App < Rack::App
|
|
145
147
|
raise(StandardError,'error block rescued')
|
146
148
|
end
|
147
149
|
|
148
|
-
|
149
150
|
def say
|
150
151
|
"hello #{params['user_id']}!"
|
151
152
|
end
|
@@ -264,4 +265,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/adamlu
|
|
264
265
|
## License and Copyright
|
265
266
|
|
266
267
|
Rack::App is free software released under the [Apache License V2](https://opensource.org/licenses/Apache-2.0) License.
|
267
|
-
The logo was designed by Zsófia Gebauer. It is Copyright © 2015 Adam Luzsi. All Rights Reserved.
|
268
|
+
The logo was designed by Zsófia Gebauer. It is Copyright © 2015 Adam Luzsi. All Rights Reserved.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.5.0
|
data/lib/rack/app/cli.rb
CHANGED
@@ -2,6 +2,7 @@ require 'rack/app'
|
|
2
2
|
require 'optparse'
|
3
3
|
class Rack::App::CLI
|
4
4
|
|
5
|
+
require 'rack/app/cli/fetcher'
|
5
6
|
require 'rack/app/cli/command'
|
6
7
|
require 'rack/app/cli/default_commands'
|
7
8
|
require 'rack/app/cli/runner'
|
@@ -17,13 +18,7 @@ class Rack::App::CLI
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def rack_app
|
20
|
-
@rack_app ||=
|
21
|
-
context = {}
|
22
|
-
Kernel.__send__(:define_method, :run) { |app, *_| context[:app]= app }
|
23
|
-
config_ru_file_path = Rack::App::Utils.pwd('config.ru')
|
24
|
-
load(config_ru_file_path) if File.exist?(config_ru_file_path)
|
25
|
-
context[:app]
|
26
|
-
}.call
|
21
|
+
@rack_app ||= Rack::App::CLI::Fetcher.rack_app
|
27
22
|
end
|
28
23
|
|
29
24
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Rack::App::CLI::Fetcher
|
2
|
+
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def rack_app
|
6
|
+
|
7
|
+
server = Rack::Server.new(:config => 'config.ru')
|
8
|
+
|
9
|
+
app = server.app
|
10
|
+
|
11
|
+
until app.is_a?(Class) && app <= Rack::App
|
12
|
+
app.instance_variables.each do |ivar|
|
13
|
+
value = app.instance_variable_get(ivar)
|
14
|
+
if value.respond_to?(:call) and not [Method, Proc, UnboundMethod].include?(value.class)
|
15
|
+
app = value
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
app
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- lib/rack/app/cli/default_commands.rb
|
97
97
|
- lib/rack/app/cli/default_commands/list_commands.rb
|
98
98
|
- lib/rack/app/cli/default_commands/show_routes.rb
|
99
|
+
- lib/rack/app/cli/fetcher.rb
|
99
100
|
- lib/rack/app/cli/runner.rb
|
100
101
|
- lib/rack/app/constants.rb
|
101
102
|
- lib/rack/app/endpoint.rb
|