|
1 | | -# |
2 | | - |
3 | | -TODO: Delete this and the text below, and describe your gem |
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/foobara/empty_ruby_project_generator`. To experiment with that code, |
7 | | -run `bin/console` for an interactive prompt. |
| 1 | +# FoobifyRailsApp |
8 | 2 |
|
| 3 | +This is a code generator for quickly wiring up foobara to an existing Rails application. |
9 | 4 |
|
10 | 5 | ## Installation |
11 | 6 |
|
12 | | -Typical stuff: add `gem "foobara-foobify-rails-app"` to your Gemfile or .gemspec file. Or even just |
13 | | -`gem install foobara-foobify-rails-app` if just playing with it directly in scripts. |
| 7 | +Normally, you would just use this with `foob` so you would install `foob` however you would, such as |
| 8 | +adding `foob` to the `:development` section of your Gemfile or maybe even just `gem install foob`. |
| 9 | + |
| 10 | +If you want to use this code generator outside of `foob` you can do the typical stuff like adding |
| 11 | +`gem "foobara-foobify-rails-app"` to your Gemfile or .gemspec file. |
14 | 12 |
|
15 | 13 | ## Usage |
16 | 14 |
|
17 | | -TODO: Write usage instructions here |
| 15 | +### Using via `foob` |
18 | 16 |
|
19 | | -```ruby |
20 | | -#!/usr/bin/env ruby |
| 17 | +You can see the options with `foob help foobify-rails-app` or `foob h foobify-rails-app`: |
| 18 | + |
| 19 | +``` |
| 20 | +$ foob help foobify-rails-app |
| 21 | +``` |
| 22 | + |
| 23 | +#### Using foobara as a service-object solution in an existing Rails application |
| 24 | + |
| 25 | +You would only need to run it with: |
| 26 | + |
| 27 | +``` |
| 28 | +$ foob g foobify-rails-app |
| 29 | +``` |
21 | 30 |
|
22 | | -require "foobara/load_dotenv" |
23 | | -Foobara::LoadDotenv.run!(dir: __dir__) |
| 31 | +TODO: Finish this up once deployed and added to `foob` |
| 32 | + |
| 33 | +If you're new to Foobara and want a sample command generated, you can run: |
| 34 | + |
| 35 | +#### Exposing Foobara through the Rails router with foobara-rails-command-generator |
| 36 | + |
| 37 | +If you want to expose your Foobara commands such that they can be used by external tools like |
| 38 | +code generators (to generate a TypeScript SDK, for example), MCP servers, etc, then run: |
| 39 | + |
| 40 | +TODO |
| 41 | + |
| 42 | +#### Letting ActiveRecord Models be used as if they were Foobara types |
| 43 | + |
| 44 | +You can run: |
| 45 | + |
| 46 | +This will allow you to use active record as types like so: |
| 47 | + |
| 48 | +```ruby |
| 49 | +TODO |
24 | 50 |
|
25 | | -TODO: some example code |
26 | 51 | ``` |
| 52 | + |
| 53 | +You can do this without `foobara-active-record-type` and Foobara will still guarantee that what is |
| 54 | +passed in is an instance of that active record class. But with `foobara-active-record-type` you can |
| 55 | +get additional foobara-entity-like behaviors, such as automatically casting primary keys to records |
| 56 | +and being able to make use of the record attributes in code generators if, for example, you wanted |
| 57 | +to quickly generate a TypeScript React form as a starting point for working with your |
| 58 | +ActiveRecord class. |
| 59 | + |
27 | 60 | ## Contributing |
28 | 61 |
|
29 | 62 | Bug reports and pull requests are welcome on GitHub |
30 | 63 | at https://github.com/foobara/foobify-rails-app |
31 | 64 |
|
| 65 | +You can find a contributing guide in the foobara monorepo here: |
| 66 | +https://github.com/foobara/foobara/blob/main/CONTRIBUTING.md |
| 67 | + |
32 | 68 | ## License |
33 | 69 |
|
34 | 70 | This project is licensed under the MPL-2.0 license. Please see LICENSE.txt for more info. |
0 commit comments