Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 55 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,79 @@
# Rack::Connector
[![Gem Version](https://badge.fury.io/rb/foobara-rack-connector.svg)](https://badge.fury.io/rb/foobara-rack-connector)

TODO: Delete this and the text below, and describe your gem

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library
into a gem. Put your Ruby code in the file `lib/rack/connector`. To experiment with that code, run `bin/console` for an
interactive prompt.
# Foobara::RackConnector
Rack connector for the foobara gem.

## Installation

From this directory, run the following:

```
bundle config set local.foobara ../foobara
bundle config set disable_local_branch_check true
gem install foobara-rack-connector
```
or
in Gemfile:
```
gem "foobara-rack-connector"
```

TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it
to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with
instructions to install your gem from git if you don't plan to release to RubyGems.org.
## Usage
```ruby
command_connector = Foobara::CommandConnectors::Http::Rack.new
command_connector.connect(Add) # Your Foobara::Command should go here
Rackup::Server.start(app: command_connector)
```

Install the gem and add to the application's Gemfile by executing:
## Example
```ruby
require "foobara/rack_connector"
require "rackup/server"
require "foobara"

$ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
class Add < Foobara::Command
inputs do
operand1 :integer, :required
operand2 :integer, :required
end

If bundler is not being used to manage dependencies, install the gem by executing:
result :integer

$ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
def execute
add_operands
end

## Usage
attr_accessor :sum

TODO: Write usage instructions here
def add_operands
self.sum = operand1 + operand2
end
end

## Development
command_connector = Foobara::CommandConnectors::Http::Rack.new
command_connector.connect(Add)
Rackup::Server.start(app: command_connector)
```

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can
also run `bin/console` for an interactive prompt that will allow you to experiment.
### Manifests

You can see the generated manifest by opening the URL:
```
http://localhost:9292/help/Add
```

### Commands
Commands can be executed by sending:
```
curl 'http://localhost:9292/run/Add?operand1=1&operand2=2'
```

## Development
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.

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).
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.

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rack-connector. 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/[USERNAME]/rack-connector/blob/main/CODE_OF_CONDUCT.md).
Bug reports and pull requests are welcome on GitHub at https://github.com/foobara/rack-connector.

## License

Expand Down