From 28206d706583002817a64156322b3c888879b198 Mon Sep 17 00:00:00 2001 From: zhephyn Date: Mon, 21 Sep 2026 20:15:56 +0300 Subject: [PATCH 1/2] Updated README.md file --- README.md | 85 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 5b0534d..4dbfe29 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,80 @@ # Foobara::EmptyRubyProjectGenerator -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/foobara/empty_ruby_project_generator`. To experiment with that code, -run `bin/console` for an interactive prompt. +Generates an empty Ruby project with rubocop, rspec, and GitHub Actions +already wired up, so you can focus on writing your gem's code rather than +setting up boilerplate code. ## Installation -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. +Install the gem directly in the terminal: + + $ gem install foobara-empty-ruby-project-generator -Install the gem and add to the application's Gemfile by executing: +Or add it to your Gemfile: - $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG + $ bundle add foobara-empty-ruby-project-generator -If bundler is not being used to manage dependencies, install the gem by executing: +You will also need the `foob` CLI to run the generator: - $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG + $ gem install foob ## Usage -TODO: Write usage instructions here +Run the generator to create a new project: + + $ foob g ruby-project -n NAME [options] + +The `-n` flag represents the name of the project to be generated and is required. It accepts either a plain project name or a name in the +`org/project` format: + +- **Individual account:** `-n my-gem` — creates a project with a single + module e.g. `MyGem` +- **Organization:** `-n my-org/my-gem` — creates a project with a nested + module e.g. `MyOrg::MyGem` and uses `my-org` as the GitHub organization + +For a full list of available options run: -## Development + $ foob g ruby-project --help -```bash -bundle config --global local.foobara /path/to/foobara -bundle config set disable_local_branch_check true -``` +**Commonly used options:** -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. +| Flag | Description | +|------|-------------| +| `-n, --name` | Project name or org/project (required) | +| `-d, --description` | Project description. Defaults to `"No description. Add one."` | +| `-a, --author-names` | Author name(s) | +| `--author-emails` | Author email(s) | +| `-l, --license` | One of: `MIT`, `Apache-2.0`, `MPL-2.0`, `Apache-2.0 OR MIT` | +| `-u, --use-git` | Initialize a git repository | +| `--push-to-github` | Create a private GitHub repo and push to it | +| `-o, --output-directory` | Where to generate the project. Defaults to the project name | -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). +**Example:** + + $ foob g ruby-project -n my-org/my-gem -d "Does something useful" -l MIT --use-git + +Once generated, your project will have a `lib/` folder which is where +your gem's Ruby code lives. Based on the name you provided when generating the project, the lib folder will be +structured as: + +- `lib/my_org/my_gem.rb` for an org/project name +- `lib/my_gem.rb` for a plain project name + +Within the generated `.rb` file located in the `lib/` folder, you can place your gem's Ruby code. ## Contributing -Bug reports and pull requests are welcome on GitHub -at https://github.com/[USERNAME]/foobara-empty_ruby_project_generator. +Contributions in the form of PRs and issues are always welcome. + +To work on an existing issue or submit a PR: + +1. Fork the repo and clone it to your local machine +2. Run `bundle install` to install dependencies +3. Implement your changes and add tests where applicable +4. Run `rake` to ensure all tests pass and that rubocop reports no errors +5. Commit, push to GitHub and open a PR for review ## License -This project is licensed under your choice of the Apache-2.0 license or the MIT license. -See [LICENSE.txt](LICENSE.txt) for more info about licensing. +This project is licensed under your choice of the Apache-2.0 license or +the MIT license. See [LICENSE.txt](LICENSE.txt) for more info. \ No newline at end of file From 63099bedb6b2376531f604d783d1e745de1b86f8 Mon Sep 17 00:00:00 2001 From: zhephyn Date: Wed, 23 Sep 2026 04:38:32 +0300 Subject: [PATCH 2/2] Make changes to README file --- README.md | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 4dbfe29..c5f6705 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,26 @@ # Foobara::EmptyRubyProjectGenerator -Generates an empty Ruby project with rubocop, rspec, and GitHub Actions -already wired up, so you can focus on writing your gem's code rather than -setting up boilerplate code. +Generates an empty Ruby project with RuboCop, RSpec, and GitHub Actions already wired up, so you can focus on writing your gem's code rather than setting up boilerplate code. + +The generated project is ideally meant to be used with Foobara however, it can also be used for non-Foobara projects by deleting Foobara-specific parts after generation. ## Installation +The `foobara-empty-ruby-project-generator` is part of the `foob` family of code generators. Installing the `foob` gem will therefore automatically bring in this generator along with all other foobara generators eliminating the need to install the `foobara-empty-ruby-project-generator` gem separately. + Install the gem directly in the terminal: - $ gem install foobara-empty-ruby-project-generator + `$ gem install foob` Or add it to your Gemfile: - $ bundle add foobara-empty-ruby-project-generator - -You will also need the `foob` CLI to run the generator: - - $ gem install foob + `$ bundle add foob` ## Usage Run the generator to create a new project: - $ foob g ruby-project -n NAME [options] + `$ foob g ruby-project -n NAME [options]` The `-n` flag represents the name of the project to be generated and is required. It accepts either a plain project name or a name in the `org/project` format: @@ -34,7 +32,11 @@ The `-n` flag represents the name of the project to be generated and is required For a full list of available options run: - $ foob g ruby-project --help + `$ foob g ruby-project --help` + +or + + `$ foob help ruby-project` **Commonly used options:** @@ -51,16 +53,17 @@ For a full list of available options run: **Example:** - $ foob g ruby-project -n my-org/my-gem -d "Does something useful" -l MIT --use-git + `$ foob g ruby-project -n my-org/my-gem -d "Does something useful" -l MIT --use-git` + +The above generator example when run will put the project in the `my-org/my-gem` folder. + +Upon running the generator, all projects will have the following structure: -Once generated, your project will have a `lib/` folder which is where -your gem's Ruby code lives. Based on the name you provided when generating the project, the lib folder will be -structured as: +- `lib/` - Contains all files that are loaded via `require` and based on the name you provided when generating the project, this folder will be structured as either `lib/my_org/my_gem.rb` for an organisation project name OR `lib/my_gem.rb` for a plain project name. -- `lib/my_org/my_gem.rb` for an org/project name -- `lib/my_gem.rb` for a plain project name +- `src/` - Contains your ruby gem code. This is a Foobara-specific convention whereby instead of putting all your code in the `lib/` folder, the actual implementation code lives in `src/` folder while the `lib/` folder is reserved for code that can be required. -Within the generated `.rb` file located in the `lib/` folder, you can place your gem's Ruby code. +If you used the `foobara-empty-ruby-project-generator` gem to generate a non-Foobara Ruby project, you can delete the `src/` folder and place all your code in the `lib/` folder as well as delete any associated Foobara-specific parts. ## Contributing @@ -70,9 +73,10 @@ To work on an existing issue or submit a PR: 1. Fork the repo and clone it to your local machine 2. Run `bundle install` to install dependencies -3. Implement your changes and add tests where applicable -4. Run `rake` to ensure all tests pass and that rubocop reports no errors -5. Commit, push to GitHub and open a PR for review +3. Run `rake` to ensure that everything works as expected before making any changes. +4. Implement your changes and add tests where applicable +5. Re-run `rake` to make sure that all tests and rubocop pass. +6. Commit, push to GitHub and open a PR for review ## License