phaedra 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/CODE_OF_CONDUCT.md +77 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +144 -0
- data/Rakefile +2 -0
- data/example/api/the-time.rb +24 -0
- data/example/config.ru +3 -0
- data/lib/phaedra.rb +7 -0
- data/lib/phaedra/base.rb +133 -0
- data/lib/phaedra/concerns/callbacks_actionable.rb +25 -0
- data/lib/phaedra/rack_app.rb +57 -0
- data/lib/phaedra/version.rb +3 -0
- data/phaedra.gemspec +26 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 50fe608ca2567e6f1262fcfd1d7a9cc4171a5b467989b115692442dd1ae82e4a
|
4
|
+
data.tar.gz: 3a0da1de124ebd66b6d70ab25a9eee6e9288f28bad0adca7b800e8d82ecd0c31
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6ef12e516dbbbfdbc487554d6422bfba931933598934a960c71bb4946b31c3d0b9e2e568bd818b1dd3c2bfbda5ebd556af99f8df62284f33d14ff8578b30c1b9
|
7
|
+
data.tar.gz: ae9bd0c2850334dd67b58e18e19a3444b7230539c45fb1b995b7441240930abecb3ff47c6211da5cb2bd2998b4454f3a7a6390fe7f2509d2718e2af13b0932f5
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at
|
59
|
+
[jared@whitefusion.io](mailto:jared@whitefusion.io). All complaints will
|
60
|
+
be reviewed and investigated and will result in a response that is deemed
|
61
|
+
necessary and appropriate to the circumstances. The project team is obligated
|
62
|
+
to maintain confidentiality with regard to the reporter of an incident.
|
63
|
+
Further details of specific enforcement policies may be posted separately.
|
64
|
+
|
65
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
66
|
+
faith may face temporary or permanent repercussions as determined by other
|
67
|
+
members of the project's leadership.
|
68
|
+
|
69
|
+
## Attribution
|
70
|
+
|
71
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
72
|
+
available at [https://www.contributor-covenant.org/version/1/4/code-of-conduct.html](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html)
|
73
|
+
|
74
|
+
[homepage]: https://www.contributor-covenant.org
|
75
|
+
|
76
|
+
For answers to common questions about this code of conduct, see
|
77
|
+
[https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Jared White
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
# Phaedra: Serverless Ruby Functions
|
2
|
+
|
3
|
+
_NOTE: not yet released! Check back in June 2020!_
|
4
|
+
|
5
|
+
Phaedra is a REST microframework for writing serverless Ruby functions. They are isolated pieces of logic which respond to HTTP requests (GET, POST, etc.) and typically get mounted at a particular URL path. They can be tested locally and deployed to a supported serverless hosting platform or to any [Rack-compatible web server](https://github.com/rack/rack).
|
6
|
+
|
7
|
+
Serverless compatibility is presently focused on [Vercel](https://vercel.com), but there are likely additional platforms we'll be adding support for in the future (OpenFaaS, Fission, etc.).
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem "phaedra"
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
```sh
|
20
|
+
$ bundle
|
21
|
+
```
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
```sh
|
26
|
+
$ gem install phaedra
|
27
|
+
```
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
Functions are single Ruby files which respond to a URL path (aka `/api/path/to/function`). The path is determined by the location of the file on the filesystem relative to the functions root (aka `api`). So, given a path of `./api/folder/run-me.rb`, the URL path would be `/api/folder/run-me`.
|
32
|
+
|
33
|
+
Functions are written as subclasses of `Phaedra::Base` using the name `PhaedraFunction`. The `params` argument is a Hash containing the parsed contents of the incoming query string, form data, or body JSON. The response object returned by your function is typically a Hash which will be transformed into JSON output automatically, but it can also be plain text.
|
34
|
+
|
35
|
+
Some platforms require the function class name to be `Handler`, so you can put that at the bottom of your file for full compatibility.
|
36
|
+
|
37
|
+
Here's a basic example:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
require "phaedra"
|
41
|
+
|
42
|
+
class PhaedraFunction < Phaedra::Base
|
43
|
+
def get(params)
|
44
|
+
{
|
45
|
+
text: "I am a response!",
|
46
|
+
equals: params[:left].to_i + params[:right].to_i
|
47
|
+
}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
Handler = PhaedraFunction
|
52
|
+
```
|
53
|
+
|
54
|
+
Your function can support `get`, `post`, `put`, `patch`, and `delete` methods which map to the corresponding HTTP verbs.
|
55
|
+
|
56
|
+
Each method is provided access to `request` and `response` objects. If your function was directly instantiated by WEBrick, those will be `WEBrick::HTTPRequest` and `WEBrick::HTTPResponse` respectively. If your function was instantiated by Rack, those will be `Phaedra::Request` (a thin wrapper around `Rack::Request`) and `Rack::Response` respectively.
|
57
|
+
|
58
|
+
## Callbacks
|
59
|
+
|
60
|
+
Functions can define `action` callbacks:
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
class PhaedraFunction < Phaedra::Base
|
64
|
+
before_action :do_stuff_before
|
65
|
+
after_action :do_stuff_after
|
66
|
+
around_action :do_it_all_around
|
67
|
+
|
68
|
+
def do_stuff_before
|
69
|
+
# code
|
70
|
+
end
|
71
|
+
|
72
|
+
# do_stuff_after, etc.
|
73
|
+
|
74
|
+
def get(params)
|
75
|
+
# this will be run within the callback chain
|
76
|
+
end
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
80
|
+
You can modify the `request` object in a `before_action` callback to perform setup tasks before the actions are executed, or you can modify `response` in a `after_action` to further process the response.
|
81
|
+
|
82
|
+
## Rack
|
83
|
+
|
84
|
+
Booting Phaedra up as Rack app is very simple. All you need is a `config.ru` file alongside your `api` folder:
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
require "phaedra"
|
88
|
+
|
89
|
+
run Phaedra::RackApp.new
|
90
|
+
```
|
91
|
+
|
92
|
+
Then run `rackup` in the terminal.
|
93
|
+
|
94
|
+
## WEBrick
|
95
|
+
|
96
|
+
Integrating Phaedra into a WEBrick server is pretty straightforward. Given a `server` object, it can be accomplished thusly:
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
full_api_path = File.expand_path("api", Dir.pwd)
|
100
|
+
base_api_folder = File.basename(full_api_path)
|
101
|
+
|
102
|
+
server.mount_proc "/#{base_api_folder}" do |req, res|
|
103
|
+
api_folder = File.dirname(req.path).sub("/#{base_api_folder}", "")
|
104
|
+
endpoint = File.basename(req.path)
|
105
|
+
ruby_path = File.join(full_api_path, api_folder, "#{endpoint}.rb")
|
106
|
+
|
107
|
+
if File.exist?(ruby_path)
|
108
|
+
original_verbosity = $VERBOSE
|
109
|
+
$VERBOSE = nil
|
110
|
+
load ruby_path
|
111
|
+
$VERBOSE = original_verbosity
|
112
|
+
|
113
|
+
handler = Handler.new(server)
|
114
|
+
handler.service(req, res)
|
115
|
+
else
|
116
|
+
raise HTTPStatus::NotFound, "`#{req.path}' not found."
|
117
|
+
end
|
118
|
+
end
|
119
|
+
```
|
120
|
+
|
121
|
+
You also have the option of loading and mounting `Handler` directly to the server:
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
load File.join(Dir.pwd, "api", "func.rb")
|
125
|
+
@server.mount '/path', Handler
|
126
|
+
```
|
127
|
+
|
128
|
+
----
|
129
|
+
|
130
|
+
## Development
|
131
|
+
|
132
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
133
|
+
|
134
|
+
## Contributing
|
135
|
+
|
136
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/whitefusionhq/phaedra.
|
137
|
+
|
138
|
+
## License
|
139
|
+
|
140
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
141
|
+
|
142
|
+
## Code of Conduct
|
143
|
+
|
144
|
+
Everyone interacting in the Phaedra project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/whitefusionhq/phaedra/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require "phaedra"
|
2
|
+
|
3
|
+
class PhaedraFunction < Phaedra::Base
|
4
|
+
before_action :earlier_stuff
|
5
|
+
|
6
|
+
def get(params)
|
7
|
+
response["Content-Type"] = 'text/plain; charset=utf-8'
|
8
|
+
"The Current Time is: #{Time.new} and Search Param is #{params[:search]}."
|
9
|
+
end
|
10
|
+
|
11
|
+
def post(params)
|
12
|
+
{message: "POST works!", params: params}
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def earlier_stuff
|
18
|
+
request.query["search"] += " SEARCH!" if request.query["search"]
|
19
|
+
|
20
|
+
if request.body
|
21
|
+
request.body.sub!("Works", "Lurks")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/example/config.ru
ADDED
data/lib/phaedra.rb
ADDED
data/lib/phaedra/base.rb
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
require "json"
|
2
|
+
require "webrick"
|
3
|
+
require "active_support/core_ext/hash/indifferent_access"
|
4
|
+
require "phaedra/concerns/callbacks_actionable"
|
5
|
+
|
6
|
+
module Phaedra
|
7
|
+
class Base
|
8
|
+
include CallbacksActionable
|
9
|
+
|
10
|
+
# Used by WEBrick
|
11
|
+
def self.get_instance(server, *options)
|
12
|
+
self.new(server, *options)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Context might be a WEBrick server, nil if coming from Rack
|
16
|
+
def initialize(context = nil)
|
17
|
+
@context = context
|
18
|
+
end
|
19
|
+
|
20
|
+
######################
|
21
|
+
# Override in subclass
|
22
|
+
def get(params)
|
23
|
+
raise WEBrick::HTTPStatus::NotFound, "`#{request.path}' not found."
|
24
|
+
end
|
25
|
+
|
26
|
+
def post(params)
|
27
|
+
raise WEBrick::HTTPStatus::NotFound, "`#{request.path}' not found."
|
28
|
+
end
|
29
|
+
|
30
|
+
def put(params)
|
31
|
+
raise WEBrick::HTTPStatus::NotFound, "`#{request.path}' not found."
|
32
|
+
end
|
33
|
+
|
34
|
+
def patch(params)
|
35
|
+
put(params)
|
36
|
+
end
|
37
|
+
|
38
|
+
def delete(params)
|
39
|
+
raise WEBrick::HTTPStatus::NotFound, "`#{request.path}' not found."
|
40
|
+
end
|
41
|
+
######################
|
42
|
+
|
43
|
+
def request; @req; end
|
44
|
+
def response; @res; end
|
45
|
+
|
46
|
+
def service(req, res)
|
47
|
+
method_name = "do_" + req.request_method.gsub(/-/, "_")
|
48
|
+
if respond_to?(method_name)
|
49
|
+
__send__(method_name, req, res)
|
50
|
+
else
|
51
|
+
raise WEBrick::HTTPStatus::MethodNotAllowed,
|
52
|
+
"unsupported method `#{req.request_method}'."
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def do_GET(req, res)
|
57
|
+
@req = req
|
58
|
+
@res = res
|
59
|
+
|
60
|
+
set_initial_status
|
61
|
+
|
62
|
+
result = run_callbacks :action do
|
63
|
+
# WEBrick's query string handler with DELETE is funky
|
64
|
+
params = if @req.request_method == "DELETE"
|
65
|
+
WEBrick::HTTPUtils::parse_query(@req.query_string)
|
66
|
+
else
|
67
|
+
@req.query
|
68
|
+
end
|
69
|
+
|
70
|
+
@res.body = call_method_action(params)
|
71
|
+
end
|
72
|
+
|
73
|
+
return error_condition unless result
|
74
|
+
|
75
|
+
complete_response
|
76
|
+
end
|
77
|
+
|
78
|
+
def do_POST(req, res)
|
79
|
+
@req = req
|
80
|
+
@res = res
|
81
|
+
|
82
|
+
set_initial_status
|
83
|
+
|
84
|
+
result = run_callbacks :action do
|
85
|
+
params = if (@req.header["content-type"] || @req.header["content_type"]).to_s.include?("multipart/form-data")
|
86
|
+
if @req.respond_to?(:params) # Rack
|
87
|
+
@req.params
|
88
|
+
else
|
89
|
+
@req.query # WEBrick
|
90
|
+
end
|
91
|
+
else
|
92
|
+
begin
|
93
|
+
JSON.parse(@req.body)
|
94
|
+
rescue JSON::ParserError, TypeError
|
95
|
+
@req.body
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
@res.body = call_method_action(params)
|
100
|
+
end
|
101
|
+
|
102
|
+
return error_condition unless result
|
103
|
+
|
104
|
+
complete_response
|
105
|
+
end
|
106
|
+
|
107
|
+
alias_method :do_PUT, :do_POST
|
108
|
+
alias_method :do_PATCH, :do_POST
|
109
|
+
alias_method :do_DELETE, :do_GET
|
110
|
+
|
111
|
+
protected
|
112
|
+
|
113
|
+
def set_initial_status
|
114
|
+
@res.status = 200
|
115
|
+
@res["Content-Type"] = 'application/json'
|
116
|
+
end
|
117
|
+
|
118
|
+
def call_method_action(params)
|
119
|
+
params = params.is_a?(Hash) ? params.with_indifferent_access : params
|
120
|
+
send(@req.request_method.downcase, params)
|
121
|
+
end
|
122
|
+
|
123
|
+
def complete_response
|
124
|
+
@res.body = @res.body.to_json if @res["Content-Type"] == "application/json"
|
125
|
+
end
|
126
|
+
|
127
|
+
def error_condition
|
128
|
+
@res.status = 500
|
129
|
+
@res["Content-Type"] = "text/plain"
|
130
|
+
@res.body = "Internal Server Error (callback chain halted)"
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "active_support/callbacks"
|
2
|
+
require "active_support/concern"
|
3
|
+
|
4
|
+
module Phaedra
|
5
|
+
module CallbacksActionable
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
include ActiveSupport::Callbacks
|
8
|
+
|
9
|
+
included do
|
10
|
+
define_callbacks :action
|
11
|
+
end
|
12
|
+
|
13
|
+
module ClassMethods
|
14
|
+
def before_action(*args)
|
15
|
+
set_callback :action, :before, *args
|
16
|
+
end
|
17
|
+
def after_action(*args)
|
18
|
+
set_callback :action, :after, *args
|
19
|
+
end
|
20
|
+
def around_action(*args)
|
21
|
+
set_callback :action, :around, *args
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Phaedra
|
2
|
+
class Request < Rack::Request
|
3
|
+
def query
|
4
|
+
self.GET
|
5
|
+
end
|
6
|
+
|
7
|
+
def header
|
8
|
+
@env.dup.transform_keys do |key|
|
9
|
+
key.respond_to?(:downcase) ? key.downcase : key
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def body
|
14
|
+
@request_body ||= get_header(Rack::RACK_INPUT).read
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class RackApp
|
19
|
+
def initialize(settings = {})
|
20
|
+
@settings = {
|
21
|
+
"root_dir" => Dir.pwd,
|
22
|
+
"serverless_api_dir" => "api"
|
23
|
+
}.merge(settings)
|
24
|
+
end
|
25
|
+
|
26
|
+
def call(env)
|
27
|
+
full_api_path = File.expand_path(@settings["serverless_api_dir"], @settings["root_dir"])
|
28
|
+
base_api_folder = File.basename(full_api_path)
|
29
|
+
req = Request.new(env)
|
30
|
+
res = Rack::Response.new
|
31
|
+
|
32
|
+
api_folder = File.dirname(req.path).sub("/#{base_api_folder}", "")
|
33
|
+
endpoint = File.basename(req.path)
|
34
|
+
ruby_path = File.join(full_api_path, api_folder, "#{endpoint}.rb")
|
35
|
+
if File.exist?(ruby_path)
|
36
|
+
original_verbosity = $VERBOSE
|
37
|
+
$VERBOSE = nil
|
38
|
+
load ruby_path
|
39
|
+
$VERBOSE = original_verbosity
|
40
|
+
|
41
|
+
func = PhaedraFunction.new
|
42
|
+
func.service(req, res)
|
43
|
+
|
44
|
+
output = res.finish
|
45
|
+
unless output[2].respond_to?(:each)
|
46
|
+
output[2] = Array(output[2])
|
47
|
+
end
|
48
|
+
|
49
|
+
output
|
50
|
+
else
|
51
|
+
raise WEBrick::HTTPStatus::NotFound, "`#{req.path}' not found."
|
52
|
+
end
|
53
|
+
rescue WEBrick::HTTPStatus::Status => e
|
54
|
+
[e.code, { "Content-Type" => "text/plain" }, [e.reason_phrase]]
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/phaedra.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative "lib/phaedra/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "phaedra"
|
5
|
+
spec.version = Phaedra::VERSION
|
6
|
+
spec.authors = ["Jared White"]
|
7
|
+
spec.email = ["jared@whitefusion.io"]
|
8
|
+
|
9
|
+
spec.summary = %q{Write serverless Ruby functions via a REST microframework compatible with Rack or WEBrick.}
|
10
|
+
spec.description = spec.summary
|
11
|
+
spec.homepage = "https://github.com/whitefusionhq/phaedra"
|
12
|
+
spec.license = "MIT"
|
13
|
+
|
14
|
+
# Specify which files should be added to the gem when it is released.
|
15
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
16
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
17
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
end
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "activesupport", "~> 6.0"
|
22
|
+
spec.add_runtime_dependency "rack", "~> 2.0"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler"
|
25
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: phaedra
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jared White
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-06-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '6.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '6.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rack
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '12.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '12.0'
|
69
|
+
description: Write serverless Ruby functions via a REST microframework compatible
|
70
|
+
with Rack or WEBrick.
|
71
|
+
email:
|
72
|
+
- jared@whitefusion.io
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- CODE_OF_CONDUCT.md
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- example/api/the-time.rb
|
84
|
+
- example/config.ru
|
85
|
+
- lib/phaedra.rb
|
86
|
+
- lib/phaedra/base.rb
|
87
|
+
- lib/phaedra/concerns/callbacks_actionable.rb
|
88
|
+
- lib/phaedra/rack_app.rb
|
89
|
+
- lib/phaedra/version.rb
|
90
|
+
- phaedra.gemspec
|
91
|
+
homepage: https://github.com/whitefusionhq/phaedra
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubygems_version: 3.0.8
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: Write serverless Ruby functions via a REST microframework compatible with
|
114
|
+
Rack or WEBrick.
|
115
|
+
test_files: []
|