feast 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +41 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +20 -0
- data/LICENSE.txt +21 -0
- data/README.md +51 -0
- data/Rakefile +16 -0
- data/examples/app.rb +6 -0
- data/examples/config.ru +2 -0
- data/feast.gemspec +33 -0
- data/lib/feast/api.rb +33 -0
- data/lib/feast/version.rb +5 -0
- data/lib/feast.rb +8 -0
- data/sig/feast.rbs +4 -0
- metadata +75 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3fbf57ec97ad904fc495d65f1948a2e2b54255d989d9f34ca5339d70272fa115
|
4
|
+
data.tar.gz: cae64bdf7d0ce62cc5bea3b1a789680a8810147f16253ddbfe1e2a1230bdfbcc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9d65ebf62d936f0ceeca22c6a84d7f74be0a6d601d23aadd7be4c7719958b7b1630c8070bc85b8905f3e978323b8992e5822c171d121eb5b256d5d65ec4e23ea
|
7
|
+
data.tar.gz: 5bdfcef1345a216535352be572ce71db62dfec59f1755a06f8036961e7324b56bbcd769645340e9bf654f8f6df398034f5f6aa9fb42c95ab6d5dc9af46d5be9b
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
inherit_gem:
|
2
|
+
rubocop-sensible: 'config/rubocop.yml'
|
3
|
+
|
4
|
+
require:
|
5
|
+
- rubocop-minitest
|
6
|
+
- rubocop-performance
|
7
|
+
- rubocop-rake
|
8
|
+
|
9
|
+
AllCops:
|
10
|
+
Exclude:
|
11
|
+
- 'Gemfile' # They are dev dependencies
|
12
|
+
- 'Rakefile'
|
13
|
+
- 'feast.gemspec'
|
14
|
+
- 'bin/**/*'
|
15
|
+
- 'examples/**/*'
|
16
|
+
NewCops: enable
|
17
|
+
EnabledByDefault: true
|
18
|
+
TargetRubyVersion: 3.1
|
19
|
+
|
20
|
+
# My style
|
21
|
+
Layout/MultilineAssignmentLayout:
|
22
|
+
EnforcedStyle: same_line
|
23
|
+
|
24
|
+
# In test files, we want to keep constants simpler and we know when it's broken
|
25
|
+
Lint/ConstantResolution:
|
26
|
+
Exclude:
|
27
|
+
- 'test/**/*'
|
28
|
+
|
29
|
+
# We need VERSION visible
|
30
|
+
Style/ConstantVisibility:
|
31
|
+
Exclude:
|
32
|
+
- 'lib/feast/version.rb'
|
33
|
+
|
34
|
+
# We want this!
|
35
|
+
Style/DisableCopsWithinSourceCodeDirective:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
# We don't care test style
|
39
|
+
Style:
|
40
|
+
Exclude:
|
41
|
+
- 'test/**/*'
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at masafumi.o1988@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in feast.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem 'rake', '~> 13.0'
|
9
|
+
|
10
|
+
gem 'minitest', '~> 5.0'
|
11
|
+
|
12
|
+
gem 'rubocop', '~> 1.21'
|
13
|
+
gem 'rubocop-minitest', '>= 0.17.0'
|
14
|
+
gem 'rubocop-performance', '>= 1.13.0'
|
15
|
+
gem 'rubocop-rake', '>= 0.5.1'
|
16
|
+
gem 'rubocop-sensible', '~> 0.3.0'
|
17
|
+
|
18
|
+
gem 'rack-test'
|
19
|
+
|
20
|
+
gem 'puma'
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 OKURA Masafumi
|
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,51 @@
|
|
1
|
+
# Feast
|
2
|
+
|
3
|
+
Feast is a FastAPI-inspired web framework for Ruby.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'feast'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install feast
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
The simplest web API with Feast looks like this:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require 'feast/api'
|
27
|
+
|
28
|
+
api = Feast::API.new
|
29
|
+
|
30
|
+
api.get '/' do
|
31
|
+
{message: 'Hello World'}.to_json
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
35
|
+
## Development
|
36
|
+
|
37
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
38
|
+
|
39
|
+
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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/okuramasafumi/feast. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/okuramasafumi/feast/blob/master/CODE_OF_CONDUCT.md).
|
44
|
+
|
45
|
+
## License
|
46
|
+
|
47
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
48
|
+
|
49
|
+
## Code of Conduct
|
50
|
+
|
51
|
+
Everyone interacting in the Feast project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/okuramasafumi/feast/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.libs << "lib"
|
9
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
10
|
+
end
|
11
|
+
|
12
|
+
require "rubocop/rake_task"
|
13
|
+
|
14
|
+
RuboCop::RakeTask.new
|
15
|
+
|
16
|
+
task default: %i[test rubocop]
|
data/examples/app.rb
ADDED
data/examples/config.ru
ADDED
data/feast.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/feast/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "feast"
|
7
|
+
spec.version = Feast::VERSION
|
8
|
+
spec.authors = ["OKURA Masafumi"]
|
9
|
+
spec.email = ["masafumi.o1988@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Feast is a FastAPI-inspired web framework for Ruby."
|
12
|
+
spec.description = "Feast is a web framework. It focuses on speed, simplicity and type safety. It makes developing a web API a feast."
|
13
|
+
spec.homepage = "https://github.com/okuramasafumi/feast"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 3.1.0"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/okuramasafumi/feast/blob/main/CHANGELOG.md"
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
25
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
26
|
+
end
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_dependency "rack", "~> 2.0"
|
33
|
+
end
|
data/lib/feast/api.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Feast
|
6
|
+
# API class represents a set of APIs
|
7
|
+
# This class is also a rack app but this might change in the future
|
8
|
+
class API
|
9
|
+
# `@results` variable stores results for all paths
|
10
|
+
def initialize
|
11
|
+
@results = {}
|
12
|
+
end
|
13
|
+
|
14
|
+
# Accepts GET request
|
15
|
+
#
|
16
|
+
# @param route [String]
|
17
|
+
def get(route)
|
18
|
+
@results[route] = yield
|
19
|
+
self
|
20
|
+
end
|
21
|
+
|
22
|
+
# rubocop:disable Style/StringHashKeys
|
23
|
+
# rack app convention
|
24
|
+
#
|
25
|
+
# @param env [Rack::ENV]
|
26
|
+
def call(env)
|
27
|
+
path_info = env['PATH_INFO']
|
28
|
+
result = @results[path_info] || ''
|
29
|
+
[200, { 'ContentType' => 'application/json' }, [result]]
|
30
|
+
end
|
31
|
+
# rubocop:enable Style/StringHashKeys
|
32
|
+
end
|
33
|
+
end
|
data/lib/feast.rb
ADDED
data/sig/feast.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: feast
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- OKURA Masafumi
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-03-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rack
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
description: Feast is a web framework. It focuses on speed, simplicity and type safety.
|
28
|
+
It makes developing a web API a feast.
|
29
|
+
email:
|
30
|
+
- masafumi.o1988@gmail.com
|
31
|
+
executables: []
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- ".rubocop.yml"
|
36
|
+
- CHANGELOG.md
|
37
|
+
- CODE_OF_CONDUCT.md
|
38
|
+
- Gemfile
|
39
|
+
- LICENSE.txt
|
40
|
+
- README.md
|
41
|
+
- Rakefile
|
42
|
+
- examples/app.rb
|
43
|
+
- examples/config.ru
|
44
|
+
- feast.gemspec
|
45
|
+
- lib/feast.rb
|
46
|
+
- lib/feast/api.rb
|
47
|
+
- lib/feast/version.rb
|
48
|
+
- sig/feast.rbs
|
49
|
+
homepage: https://github.com/okuramasafumi/feast
|
50
|
+
licenses:
|
51
|
+
- MIT
|
52
|
+
metadata:
|
53
|
+
homepage_uri: https://github.com/okuramasafumi/feast
|
54
|
+
source_code_uri: https://github.com/okuramasafumi/feast
|
55
|
+
changelog_uri: https://github.com/okuramasafumi/feast/blob/main/CHANGELOG.md
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options: []
|
58
|
+
require_paths:
|
59
|
+
- lib
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 3.1.0
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
requirements: []
|
71
|
+
rubygems_version: 3.3.7
|
72
|
+
signing_key:
|
73
|
+
specification_version: 4
|
74
|
+
summary: Feast is a FastAPI-inspired web framework for Ruby.
|
75
|
+
test_files: []
|