foobara-rack-connector 0.0.9 → 0.1.0
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/CHANGELOG.md +8 -0
- data/README.md +55 -26
- data/lib/foobara/command_connectors/http/puma_runner.rb +2 -2
- metadata +22 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f562aca4b2fefaf624ec980cb2edc0f8e3339cf8df25250c3d58e1525887b5e
|
4
|
+
data.tar.gz: d09607d42c9794362c77a9cf1a0257e21c3299cecb49e3fb1d4ee4d86dfa3bae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e12d42e6c182c38d55ab7d851f8e42b21bf0ae4fe54664b21956c9c2460a19ba10d4b56022587135abe5cdfafe14336a49a04fcac3db9796d3f04b976cab70dd
|
7
|
+
data.tar.gz: b0f17192bf591ad9c01e201a8dca1fd2f229ea5f9ef0160789d80c0aa2a1aa14d5098ea1a4c118cd36f893e70daf91b03a9adcb769315c6af4db45e53e74f030
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,50 +1,79 @@
|
|
1
|
-
|
1
|
+
[](https://badge.fury.io/rb/foobara-rack-connector)
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library
|
6
|
-
into a gem. Put your Ruby code in the file `lib/rack/connector`. To experiment with that code, run `bin/console` for an
|
7
|
-
interactive prompt.
|
3
|
+
# Foobara::RackConnector
|
4
|
+
Rack connector for the foobara gem.
|
8
5
|
|
9
6
|
## Installation
|
10
7
|
|
11
8
|
From this directory, run the following:
|
12
9
|
|
13
10
|
```
|
14
|
-
|
15
|
-
|
11
|
+
gem install foobara-rack-connector
|
12
|
+
```
|
13
|
+
or
|
14
|
+
in Gemfile:
|
15
|
+
```
|
16
|
+
gem "foobara-rack-connector"
|
16
17
|
```
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
## Usage
|
20
|
+
```ruby
|
21
|
+
command_connector = Foobara::CommandConnectors::Http::Rack.new
|
22
|
+
command_connector.connect(Add) # Your Foobara::Command should go here
|
23
|
+
Rackup::Server.start(app: command_connector)
|
24
|
+
```
|
21
25
|
|
22
|
-
|
26
|
+
## Example
|
27
|
+
```ruby
|
28
|
+
require "foobara/rack_connector"
|
29
|
+
require "rackup/server"
|
30
|
+
require "foobara"
|
23
31
|
|
24
|
-
|
32
|
+
class Add < Foobara::Command
|
33
|
+
inputs do
|
34
|
+
operand1 :integer, :required
|
35
|
+
operand2 :integer, :required
|
36
|
+
end
|
25
37
|
|
26
|
-
|
38
|
+
result :integer
|
27
39
|
|
28
|
-
|
40
|
+
def execute
|
41
|
+
add_operands
|
42
|
+
end
|
29
43
|
|
30
|
-
|
44
|
+
attr_accessor :sum
|
31
45
|
|
32
|
-
|
46
|
+
def add_operands
|
47
|
+
self.sum = operand1 + operand2
|
48
|
+
end
|
49
|
+
end
|
33
50
|
|
34
|
-
|
51
|
+
command_connector = Foobara::CommandConnectors::Http::Rack.new
|
52
|
+
command_connector.connect(Add)
|
53
|
+
Rackup::Server.start(app: command_connector)
|
54
|
+
```
|
35
55
|
|
36
|
-
|
37
|
-
|
56
|
+
### Manifests
|
57
|
+
|
58
|
+
You can see the generated manifest by opening the URL:
|
59
|
+
```
|
60
|
+
http://localhost:9292/help/Add
|
61
|
+
```
|
62
|
+
|
63
|
+
### Commands
|
64
|
+
Commands can be executed by sending:
|
65
|
+
```
|
66
|
+
curl 'http://localhost:9292/run/Add?operand1=1&operand2=2'
|
67
|
+
```
|
68
|
+
|
69
|
+
## Development
|
70
|
+
After checking out the repo, run `bundle install` to install dependencies. Then, run `bundle exec rspec` to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
|
38
71
|
|
39
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
|
40
|
-
version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
|
41
|
-
push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
72
|
+
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.
|
42
73
|
|
43
74
|
## Contributing
|
44
75
|
|
45
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
46
|
-
intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
|
47
|
-
the [code of conduct](https://github.com/[USERNAME]/rack-connector/blob/main/CODE_OF_CONDUCT.md).
|
76
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/foobara/rack-connector.
|
48
77
|
|
49
78
|
## License
|
50
79
|
|
@@ -4,12 +4,12 @@ module Foobara
|
|
4
4
|
class Rack < Http
|
5
5
|
# Just a convenience method for demos. In real projects use rackup/config.ru
|
6
6
|
# or set it all up with `foob g rack-connector`
|
7
|
-
def run_puma
|
7
|
+
def run_puma(**)
|
8
8
|
# :nocov:
|
9
9
|
require "puma"
|
10
10
|
require "rack/handler/puma"
|
11
11
|
|
12
|
-
::Rack::Handler::Puma.run(self)
|
12
|
+
::Rack::Handler::Puma.run(self, **)
|
13
13
|
# :nocov:
|
14
14
|
end
|
15
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foobara-rack-connector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
@@ -13,30 +13,42 @@ dependencies:
|
|
13
13
|
name: foobara
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
|
-
- - "
|
16
|
+
- - ">="
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: 0.1.1
|
19
|
+
- - "<"
|
17
20
|
- !ruby/object:Gem::Version
|
18
|
-
version: 0.0
|
21
|
+
version: 2.0.0
|
19
22
|
type: :runtime
|
20
23
|
prerelease: false
|
21
24
|
version_requirements: !ruby/object:Gem::Requirement
|
22
25
|
requirements:
|
23
|
-
- - "
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 0.1.1
|
29
|
+
- - "<"
|
24
30
|
- !ruby/object:Gem::Version
|
25
|
-
version: 0.0
|
31
|
+
version: 2.0.0
|
26
32
|
- !ruby/object:Gem::Dependency
|
27
33
|
name: foobara-http-command-connector
|
28
34
|
requirement: !ruby/object:Gem::Requirement
|
29
35
|
requirements:
|
30
|
-
- - "
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 0.1.0
|
39
|
+
- - "<"
|
31
40
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.0
|
41
|
+
version: 2.0.0
|
33
42
|
type: :runtime
|
34
43
|
prerelease: false
|
35
44
|
version_requirements: !ruby/object:Gem::Requirement
|
36
45
|
requirements:
|
37
|
-
- - "
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.1.0
|
49
|
+
- - "<"
|
38
50
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.0
|
51
|
+
version: 2.0.0
|
40
52
|
- !ruby/object:Gem::Dependency
|
41
53
|
name: rack
|
42
54
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
101
|
- !ruby/object:Gem::Version
|
90
102
|
version: '0'
|
91
103
|
requirements: []
|
92
|
-
rubygems_version: 3.6.
|
104
|
+
rubygems_version: 3.6.9
|
93
105
|
specification_version: 4
|
94
106
|
summary: Exposes foobara commands and entities via rack interface.
|
95
107
|
test_files: []
|