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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13e1e2010580def947129c3b9c5185d2a8ef6286fb1d507c80f330d8f8d796da
4
- data.tar.gz: 9b9e53ad61201f2c3521f62bf551926c1dd2039d94153314d8e415bf9ee7d73e
3
+ metadata.gz: 5bd8a42d176cd81c91138c9fe6496d63a28e042fc82199efe5106bceadb7797a
4
+ data.tar.gz: 5cf1b0323b4f8824555bcf6d21c22542fa9766cdf719bbc30debf692644cd7ef
5
5
  SHA512:
6
- metadata.gz: 5f23bede7eb0a07968893f19eaf2d32326638d1bb6be94f87337f3090c63be615aa46de939a8fc4149b91f6c2fc467d9377038d825bf454755fb0eb379447f6c
7
- data.tar.gz: 9a18768236867b0e470ed56adc2a09e9021656230648c9b01eaa52e9c1c58b1c77b5024de4229dcc2845536f04ef805aff8136e49e3cf4b652853afe48678f7f
6
+ metadata.gz: 151d228fad9bd6f36828dcae5a3f355e48cb8d8d8addadb62c29ec75fe951b3df9314b5aa9b730dbf7caea3c7d03b412766aa1b02747679baa1dc92bbc5478a8
7
+ data.tar.gz: d424fc566c2d93cac6c4acbe4b0e96a334ad44d04a0537f56e9ab34b2a6b9bab9ce5350b6349fcd831243600b018d9cd24feee73bf0da1a73398a2b5fd2c7217
data/bin/fastrb ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative "../lib/fastrb/cli"
3
+ RubyAPI::CLI.invoke(ARGV)
@@ -13,12 +13,12 @@ module RubyAPI
13
13
  when "server"
14
14
  start_server
15
15
  when "version"
16
- puts "rubyapi #{VERSION}"
16
+ puts "fastrb #{VERSION}"
17
17
  else
18
- puts "Usage: rubyapi <command> [options]"
18
+ puts "Usage: fastrb <command> [options]"
19
19
  puts ""
20
20
  puts "Commands:"
21
- puts " new <name> Create a new RubyAPI project"
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 RubyAPI project: #{name}"
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 && rubyapi server"
47
+ puts "Done! cd #{name} && bundle install && fastrb server"
48
48
  end
49
49
 
50
50
  def self.start_server
51
- require_relative "../../config.ru"
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 "rubyapi"
83
+ require "fastrb"
78
84
 
79
85
  class App < RubyAPI::App
80
86
  def initialize
81
87
  super do
82
- # Middleware
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.included(base)
97
- base.get "/hello" do
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 "rubyapi"
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 RubyAPI application.
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
- rubyapi server
156
+ fastrb server
155
157
 
156
158
  ## Testing
157
159
 
@@ -3,7 +3,7 @@ module RubyAPI
3
3
  attr_accessor :environment, :settings
4
4
 
5
5
  def initialize
6
- @environment = ENV.fetch("RUBYAPI_ENV", "development")
6
+ @environment = ENV.fetch("FASTRB_ENV", "development")
7
7
  @settings = default_settings
8
8
  end
9
9
 
@@ -10,7 +10,7 @@ module RubyAPI
10
10
  {
11
11
  openapi: "3.0.0",
12
12
  info: {
13
- title: "RubyAPI App",
13
+ title: "FastRb App",
14
14
  version: "0.1.0"
15
15
  },
16
16
  paths: generate_paths
@@ -5,11 +5,11 @@ require "openssl"
5
5
 
6
6
  module RubyAPI
7
7
  class Session
8
- SESSION_COOKIE = "_rubyapi_session".freeze
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 || "rubyapi_default_secret"
12
+ @secret_key = secret_key || "fastrb_default_secret"
13
13
  @data = load_session
14
14
  end
15
15
 
@@ -0,0 +1,3 @@
1
+ module RubyAPI
2
+ VERSION = "0.2.1"
3
+ end
@@ -1,24 +1,24 @@
1
- require_relative "rubyapi/version"
2
- require_relative "rubyapi/router"
3
- require_relative "rubyapi/context"
4
- require_relative "rubyapi/param_converters"
5
- require_relative "rubyapi/serializer"
6
- require_relative "rubyapi/openapi"
7
- require_relative "rubyapi/schema"
8
- require_relative "rubyapi/session"
9
- require_relative "rubyapi/error_handler"
10
- require_relative "rubyapi/config"
11
- require_relative "rubyapi/di"
12
- require_relative "rubyapi/plugin"
13
- require_relative "rubyapi/websocket"
14
- require_relative "rubyapi/sse"
15
- require_relative "rubyapi/streaming"
16
- require_relative "rubyapi/job"
17
- require_relative "rubyapi/middleware/logging"
18
- require_relative "rubyapi/plugins/cors"
19
- require_relative "rubyapi/plugins/jwt"
20
- require_relative "rubyapi/plugins/auth"
21
- require_relative "rubyapi/plugins/cache"
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>RubyAPI Docs</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.0
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
- - rubyapi
127
+ - fastrb
100
128
  extensions: []
101
129
  extra_rdoc_files: []
102
130
  files:
103
- - bin/rubyapi
104
- - lib/rubyapi.rb
105
- - lib/rubyapi/cli.rb
106
- - lib/rubyapi/config.rb
107
- - lib/rubyapi/context.rb
108
- - lib/rubyapi/di.rb
109
- - lib/rubyapi/error_handler.rb
110
- - lib/rubyapi/job.rb
111
- - lib/rubyapi/middleware/logging.rb
112
- - lib/rubyapi/openapi.rb
113
- - lib/rubyapi/param_converters.rb
114
- - lib/rubyapi/plugin.rb
115
- - lib/rubyapi/plugins/auth.rb
116
- - lib/rubyapi/plugins/cache.rb
117
- - lib/rubyapi/plugins/cors.rb
118
- - lib/rubyapi/plugins/jwt.rb
119
- - lib/rubyapi/router.rb
120
- - lib/rubyapi/schema.rb
121
- - lib/rubyapi/serializer.rb
122
- - lib/rubyapi/session.rb
123
- - lib/rubyapi/sse.rb
124
- - lib/rubyapi/streaming.rb
125
- - lib/rubyapi/version.rb
126
- - lib/rubyapi/websocket.rb
127
- homepage: https://github.com/bruno/rubyapi
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.16
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
@@ -1,2 +0,0 @@
1
- require_relative "../lib/rubyapi/cli"
2
- RubyAPI::CLI.invoke(ARGV)
@@ -1,3 +0,0 @@
1
- module RubyAPI
2
- VERSION = "0.1.0"
3
- end
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