fastrb 0.1.0 → 0.2.1
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/bin/fastrb +3 -0
- data/lib/{rubyapi → fastrb}/cli.rb +19 -17
- data/lib/{rubyapi → fastrb}/config.rb +1 -1
- data/lib/{rubyapi → fastrb}/openapi.rb +1 -1
- data/lib/{rubyapi → fastrb}/session.rb +2 -2
- data/lib/fastrb/version.rb +3 -0
- data/lib/{rubyapi.rb → fastrb.rb} +22 -22
- metadata +56 -28
- data/bin/rubyapi +0 -2
- data/lib/rubyapi/version.rb +0 -3
- /data/lib/{rubyapi → fastrb}/context.rb +0 -0
- /data/lib/{rubyapi → fastrb}/di.rb +0 -0
- /data/lib/{rubyapi → fastrb}/error_handler.rb +0 -0
- /data/lib/{rubyapi → fastrb}/job.rb +0 -0
- /data/lib/{rubyapi → fastrb}/middleware/logging.rb +0 -0
- /data/lib/{rubyapi → fastrb}/param_converters.rb +0 -0
- /data/lib/{rubyapi → fastrb}/plugin.rb +0 -0
- /data/lib/{rubyapi → fastrb}/plugins/auth.rb +0 -0
- /data/lib/{rubyapi → fastrb}/plugins/cache.rb +0 -0
- /data/lib/{rubyapi → fastrb}/plugins/cors.rb +0 -0
- /data/lib/{rubyapi → fastrb}/plugins/jwt.rb +0 -0
- /data/lib/{rubyapi → fastrb}/router.rb +0 -0
- /data/lib/{rubyapi → fastrb}/schema.rb +0 -0
- /data/lib/{rubyapi → fastrb}/serializer.rb +0 -0
- /data/lib/{rubyapi → fastrb}/sse.rb +0 -0
- /data/lib/{rubyapi → fastrb}/streaming.rb +0 -0
- /data/lib/{rubyapi → fastrb}/websocket.rb +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5bd8a42d176cd81c91138c9fe6496d63a28e042fc82199efe5106bceadb7797a
|
|
4
|
+
data.tar.gz: 5cf1b0323b4f8824555bcf6d21c22542fa9766cdf719bbc30debf692644cd7ef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 151d228fad9bd6f36828dcae5a3f355e48cb8d8d8addadb62c29ec75fe951b3df9314b5aa9b730dbf7caea3c7d03b412766aa1b02747679baa1dc92bbc5478a8
|
|
7
|
+
data.tar.gz: d424fc566c2d93cac6c4acbe4b0e96a334ad44d04a0537f56e9ab34b2a6b9bab9ce5350b6349fcd831243600b018d9cd24feee73bf0da1a73398a2b5fd2c7217
|
data/bin/fastrb
ADDED
|
@@ -13,12 +13,12 @@ module RubyAPI
|
|
|
13
13
|
when "server"
|
|
14
14
|
start_server
|
|
15
15
|
when "version"
|
|
16
|
-
puts "
|
|
16
|
+
puts "fastrb #{VERSION}"
|
|
17
17
|
else
|
|
18
|
-
puts "Usage:
|
|
18
|
+
puts "Usage: fastrb <command> [options]"
|
|
19
19
|
puts ""
|
|
20
20
|
puts "Commands:"
|
|
21
|
-
puts " new <name> Create a new
|
|
21
|
+
puts " new <name> Create a new FastRb project"
|
|
22
22
|
puts " server Start the server (Falcon/Puma)"
|
|
23
23
|
puts " version Show version"
|
|
24
24
|
exit 1
|
|
@@ -26,7 +26,7 @@ module RubyAPI
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def self.new_project(name)
|
|
29
|
-
puts "Creating new
|
|
29
|
+
puts "Creating new FastRb project: #{name}"
|
|
30
30
|
|
|
31
31
|
FileUtils.mkdir_p(name)
|
|
32
32
|
FileUtils.mkdir_p("#{name}/app")
|
|
@@ -44,11 +44,17 @@ module RubyAPI
|
|
|
44
44
|
File.write("#{name}/spec/requests/hello_spec.rb", hello_spec_content)
|
|
45
45
|
File.write("#{name}/README.md", readme_content(name))
|
|
46
46
|
|
|
47
|
-
puts "Done! cd #{name} && bundle install &&
|
|
47
|
+
puts "Done! cd #{name} && bundle install && fastrb server"
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def self.start_server
|
|
51
|
-
|
|
51
|
+
require "rackup"
|
|
52
|
+
rackup_file = File.join(Dir.pwd, "config.ru")
|
|
53
|
+
unless File.exist?(rackup_file)
|
|
54
|
+
puts "Error: config.ru not found in current directory"
|
|
55
|
+
exit 1
|
|
56
|
+
end
|
|
57
|
+
Rackup::Server.start(config: rackup_file, Host: "0.0.0.0", Port: 3000)
|
|
52
58
|
end
|
|
53
59
|
|
|
54
60
|
private
|
|
@@ -74,16 +80,12 @@ module RubyAPI
|
|
|
74
80
|
|
|
75
81
|
def self.main_rb_content
|
|
76
82
|
<<~RUBY
|
|
77
|
-
require "
|
|
83
|
+
require "fastrb"
|
|
78
84
|
|
|
79
85
|
class App < RubyAPI::App
|
|
80
86
|
def initialize
|
|
81
87
|
super do
|
|
82
|
-
|
|
83
|
-
# use MyMiddleware
|
|
84
|
-
|
|
85
|
-
# Routes
|
|
86
|
-
include Routes
|
|
88
|
+
Routes.apply(self)
|
|
87
89
|
end
|
|
88
90
|
end
|
|
89
91
|
end
|
|
@@ -93,8 +95,8 @@ module RubyAPI
|
|
|
93
95
|
def self.routes_rb_content
|
|
94
96
|
<<~RUBY
|
|
95
97
|
module Routes
|
|
96
|
-
def self.
|
|
97
|
-
|
|
98
|
+
def self.apply(app)
|
|
99
|
+
app.get "/hello" do
|
|
98
100
|
{ message: "Hello World" }
|
|
99
101
|
end
|
|
100
102
|
end
|
|
@@ -104,7 +106,7 @@ module RubyAPI
|
|
|
104
106
|
|
|
105
107
|
def self.spec_helper_content
|
|
106
108
|
<<~RUBY
|
|
107
|
-
require "
|
|
109
|
+
require "fastrb"
|
|
108
110
|
require "rack/test"
|
|
109
111
|
|
|
110
112
|
RSpec.configure do |config|
|
|
@@ -143,7 +145,7 @@ module RubyAPI
|
|
|
143
145
|
<<~MARKDOWN
|
|
144
146
|
# #{name}
|
|
145
147
|
|
|
146
|
-
A
|
|
148
|
+
A FastRb application.
|
|
147
149
|
|
|
148
150
|
## Setup
|
|
149
151
|
|
|
@@ -151,7 +153,7 @@ module RubyAPI
|
|
|
151
153
|
|
|
152
154
|
## Running
|
|
153
155
|
|
|
154
|
-
|
|
156
|
+
fastrb server
|
|
155
157
|
|
|
156
158
|
## Testing
|
|
157
159
|
|
|
@@ -5,11 +5,11 @@ require "openssl"
|
|
|
5
5
|
|
|
6
6
|
module RubyAPI
|
|
7
7
|
class Session
|
|
8
|
-
SESSION_COOKIE = "
|
|
8
|
+
SESSION_COOKIE = "_fastrb_session".freeze
|
|
9
9
|
|
|
10
10
|
def initialize(request, secret_key: nil)
|
|
11
11
|
@request = request
|
|
12
|
-
@secret_key = secret_key || "
|
|
12
|
+
@secret_key = secret_key || "fastrb_default_secret"
|
|
13
13
|
@data = load_session
|
|
14
14
|
end
|
|
15
15
|
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
require_relative "
|
|
2
|
-
require_relative "
|
|
3
|
-
require_relative "
|
|
4
|
-
require_relative "
|
|
5
|
-
require_relative "
|
|
6
|
-
require_relative "
|
|
7
|
-
require_relative "
|
|
8
|
-
require_relative "
|
|
9
|
-
require_relative "
|
|
10
|
-
require_relative "
|
|
11
|
-
require_relative "
|
|
12
|
-
require_relative "
|
|
13
|
-
require_relative "
|
|
14
|
-
require_relative "
|
|
15
|
-
require_relative "
|
|
16
|
-
require_relative "
|
|
17
|
-
require_relative "
|
|
18
|
-
require_relative "
|
|
19
|
-
require_relative "
|
|
20
|
-
require_relative "
|
|
21
|
-
require_relative "
|
|
1
|
+
require_relative "fastrb/version"
|
|
2
|
+
require_relative "fastrb/router"
|
|
3
|
+
require_relative "fastrb/context"
|
|
4
|
+
require_relative "fastrb/param_converters"
|
|
5
|
+
require_relative "fastrb/serializer"
|
|
6
|
+
require_relative "fastrb/openapi"
|
|
7
|
+
require_relative "fastrb/schema"
|
|
8
|
+
require_relative "fastrb/session"
|
|
9
|
+
require_relative "fastrb/error_handler"
|
|
10
|
+
require_relative "fastrb/config"
|
|
11
|
+
require_relative "fastrb/di"
|
|
12
|
+
require_relative "fastrb/plugin"
|
|
13
|
+
require_relative "fastrb/websocket"
|
|
14
|
+
require_relative "fastrb/sse"
|
|
15
|
+
require_relative "fastrb/streaming"
|
|
16
|
+
require_relative "fastrb/job"
|
|
17
|
+
require_relative "fastrb/middleware/logging"
|
|
18
|
+
require_relative "fastrb/plugins/cors"
|
|
19
|
+
require_relative "fastrb/plugins/jwt"
|
|
20
|
+
require_relative "fastrb/plugins/auth"
|
|
21
|
+
require_relative "fastrb/plugins/cache"
|
|
22
22
|
|
|
23
23
|
module RubyAPI
|
|
24
24
|
class App
|
|
@@ -288,7 +288,7 @@ module RubyAPI
|
|
|
288
288
|
<!DOCTYPE html>
|
|
289
289
|
<html>
|
|
290
290
|
<head>
|
|
291
|
-
<title>
|
|
291
|
+
<title>FastRb Docs</title>
|
|
292
292
|
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist/swagger-ui.css">
|
|
293
293
|
</head>
|
|
294
294
|
<body>
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fastrb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bruno Queiroz
|
|
@@ -23,6 +23,34 @@ dependencies:
|
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: '3.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: rackup
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: webrick
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
26
54
|
- !ruby/object:Gem::Dependency
|
|
27
55
|
name: bigdecimal
|
|
28
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -96,35 +124,35 @@ dependencies:
|
|
|
96
124
|
description: FastRb is a modern web framework for Ruby, inspired by FastAPI, with
|
|
97
125
|
optional typing, automatic validation, and OpenAPI documentation.
|
|
98
126
|
executables:
|
|
99
|
-
-
|
|
127
|
+
- fastrb
|
|
100
128
|
extensions: []
|
|
101
129
|
extra_rdoc_files: []
|
|
102
130
|
files:
|
|
103
|
-
- bin/
|
|
104
|
-
- lib/
|
|
105
|
-
- lib/
|
|
106
|
-
- lib/
|
|
107
|
-
- lib/
|
|
108
|
-
- lib/
|
|
109
|
-
- lib/
|
|
110
|
-
- lib/
|
|
111
|
-
- lib/
|
|
112
|
-
- lib/
|
|
113
|
-
- lib/
|
|
114
|
-
- lib/
|
|
115
|
-
- lib/
|
|
116
|
-
- lib/
|
|
117
|
-
- lib/
|
|
118
|
-
- lib/
|
|
119
|
-
- lib/
|
|
120
|
-
- lib/
|
|
121
|
-
- lib/
|
|
122
|
-
- lib/
|
|
123
|
-
- lib/
|
|
124
|
-
- lib/
|
|
125
|
-
- lib/
|
|
126
|
-
- lib/
|
|
127
|
-
homepage: https://github.com/
|
|
131
|
+
- bin/fastrb
|
|
132
|
+
- lib/fastrb.rb
|
|
133
|
+
- lib/fastrb/cli.rb
|
|
134
|
+
- lib/fastrb/config.rb
|
|
135
|
+
- lib/fastrb/context.rb
|
|
136
|
+
- lib/fastrb/di.rb
|
|
137
|
+
- lib/fastrb/error_handler.rb
|
|
138
|
+
- lib/fastrb/job.rb
|
|
139
|
+
- lib/fastrb/middleware/logging.rb
|
|
140
|
+
- lib/fastrb/openapi.rb
|
|
141
|
+
- lib/fastrb/param_converters.rb
|
|
142
|
+
- lib/fastrb/plugin.rb
|
|
143
|
+
- lib/fastrb/plugins/auth.rb
|
|
144
|
+
- lib/fastrb/plugins/cache.rb
|
|
145
|
+
- lib/fastrb/plugins/cors.rb
|
|
146
|
+
- lib/fastrb/plugins/jwt.rb
|
|
147
|
+
- lib/fastrb/router.rb
|
|
148
|
+
- lib/fastrb/schema.rb
|
|
149
|
+
- lib/fastrb/serializer.rb
|
|
150
|
+
- lib/fastrb/session.rb
|
|
151
|
+
- lib/fastrb/sse.rb
|
|
152
|
+
- lib/fastrb/streaming.rb
|
|
153
|
+
- lib/fastrb/version.rb
|
|
154
|
+
- lib/fastrb/websocket.rb
|
|
155
|
+
homepage: https://github.com/BrunoMoreno/FastRb
|
|
128
156
|
licenses:
|
|
129
157
|
- MIT
|
|
130
158
|
metadata: {}
|
|
@@ -142,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
142
170
|
- !ruby/object:Gem::Version
|
|
143
171
|
version: '0'
|
|
144
172
|
requirements: []
|
|
145
|
-
rubygems_version: 4.0.
|
|
173
|
+
rubygems_version: 4.0.6
|
|
146
174
|
specification_version: 4
|
|
147
175
|
summary: A FastAPI-inspired web framework for Ruby
|
|
148
176
|
test_files: []
|
data/bin/rubyapi
DELETED
data/lib/rubyapi/version.rb
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|