{"id":20779132,"url":"https://github.com/solidusio/solidus_dev_support","last_synced_at":"2025-05-07T16:06:19.782Z","repository":{"id":38244174,"uuid":"219722441","full_name":"solidusio/solidus_dev_support","owner":"solidusio","description":"A collection of tools for developing Solidus extensions.","archived":false,"fork":false,"pushed_at":"2024-01-22T13:57:42.000Z","size":616,"stargazers_count":21,"open_issues_count":14,"forks_count":27,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-04-25T12:01:29.039Z","etag":null,"topics":["development","extension","solidus","tools"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/solidusio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"open_collective":"solidus"}},"created_at":"2019-11-05T10:52:17.000Z","updated_at":"2023-11-29T20:55:55.000Z","dependencies_parsed_at":"2023-01-30T00:35:12.516Z","dependency_job_id":"d37b40b5-b000-44b4-8f50-e1e8f556d30e","html_url":"https://github.com/solidusio/solidus_dev_support","commit_stats":{"total_commits":361,"total_committers":25,"mean_commits":14.44,"dds":0.6509695290858726,"last_synced_commit":"417285f899c3541234b789732816647456172560"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidusio%2Fsolidus_dev_support","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidusio%2Fsolidus_dev_support/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidusio%2Fsolidus_dev_support/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidusio%2Fsolidus_dev_support/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solidusio","download_url":"https://codeload.github.com/solidusio/solidus_dev_support/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233352198,"owners_count":18663252,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["development","extension","solidus","tools"],"created_at":"2024-11-17T13:26:11.531Z","updated_at":"2025-05-07T16:06:19.759Z","avatar_url":"https://github.com/solidusio.png","language":"Ruby","readme":"# solidus_dev_support\n\n\n[![Test](https://github.com/solidusio/solidus_dev_support/actions/workflows/test.yml/badge.svg)](https://github.com/solidusio/solidus_dev_support/actions/workflows/test.yml)\n[![codecov](https://codecov.io/gh/solidusio/solidus_dev_support/branch/main/graph/badge.svg)](https://codecov.io/gh/solidusio/solidus_dev_support)\n\nThis gem contains common development functionality for Solidus extensions.\n\nIf you're looking for runtime tools instead, look at\n[solidus_support](https://github.com/solidusio/solidus_support).\n\n## Installation\n\nAdd this gem as a development dependency of your extension:\n\n```ruby\nspec.add_development_dependency 'solidus_dev_support'\n```\n\nAnd then execute:\n\n```console\n$ bundle\n```\n\n## Usage\n\n### Extension generator\n\nThis gem provides a generator for Solidus extensions. To use it, simply run:\n\n```console\n$ solidus extension my_awesome_extension\n```\n\nThis will generate the basic extension structure, already configured to use all the shiny helpers\nin solidus_dev_support.\n\n#### Updating existing extensions\n\nIf you have an existing extension generated with `solidus_dev_support` and want to update it to use\nthe latest standards from this gem, you can run the following in the extension's directory:\n\n```console\n$ bundle exec solidus extension .\n```\n\nIn case of conflicting files, you will be prompted for an action. You can overwrite the files with\nthe new version, keep the current version or view the diff and only apply the adjustments that make\nsense to you.\n\n### Sandbox app\n\nWhen developing an extension you will surely need to try it out within a Rails app with Solidus\ninstalled. Using solidus_dev_support your extension will have a `bin/rails-sandbox` executable that will\noperate on a _sandbox_ app (creating it if necessary).\n\nThe path for the sandbox app is `./sandbox` and `bin/rails-sandbox` will forward any Rails command\nto `sandbox/bin/rails`.\n\nExample:\n\n```bash\n$ bin/rails-sandbox server\n=\u003e Booting Puma\n=\u003e Rails 6.0.2.1 application starting in development\n* Listening on tcp://127.0.0.1:3000\nUse Ctrl-C to stop\n```\n\n#### Rebuilding the sandbox app\n\nTo rebuild the sandbox app just remove the `./sandbox` folder or run `bin/sandbox`.\nYou can control the DB adapter and Solidus version used with the sandbox by providing\nthe `DB` and `SOLIDUS_BRANCH` env variables.\n\n```bash\nDB=[postgres|mysql|sqlite] SOLIDUS_BRANCH=\u003cBRANCH-NAME\u003e bin/sandbox\n```\n\nBy default we use sqlite3 and the main branch.\n\n### Rails generators\n\nYour extension will have a `bin/rails-engine` executable that you can use for generating models, migrations\netc. It's the same as the default `rails` command in Rails engines.\n\nExample:\n\n```bash\n$ bin/rails-engine generate migration AddStoreIdToProducts\n```\n\n### The `bin/rails` shortcut\n\nFor convenience a `bin/rails` executable is also provided that will run everything but generators on the sandbox application. Generators will instead be processed in the context of the extension.\n\n\n### RSpec helpers\n\nThis gem provides some useful helpers for RSpec to setup an extension's test environment easily.\n\nAdd this to your extension's `spec/spec_helper.rb`:\n\n```ruby\nrequire 'solidus_dev_support/rspec/feature_helper'\n```\n\nThis helper loads configuration needed to run extension feature specs correctly, setting up Capybara\nand configuring a Rails test application to precompile assets before the first feature spec.\n\n`feature_helper` builds on top of `rails_helper`, which you can also use a standalone helper if you\nwant:\n\n```ruby\nrequire 'solidus_dev_support/rspec/rails_helper'\n```\n\nThis will include the Rails and Solidus-related RSpec configuration, such as authorization helpers,\nSolidus factories, URL helpers, and other helpers to easily work with Solidus.\n\n`rails_helper`, in turn, builds on top of `spec_helper`, which is responsible for setting up a\nbasic RSpec environment:\n\n```ruby\nrequire 'solidus_dev_support/rspec/spec_helper'\n```\n\n### Code coverage\n\nThe gem also includes a SimpleCov configuration that will send your test coverage information\ndirectly to Codecov.io. Simply add this at the top of your `spec/spec_helper.rb`:\n\n```ruby\nrequire 'solidus_dev_support/rspec/coverage'\n```\n\n**Note: Make sure to add this at the VERY TOP of your spec_helper, otherwise you'll get skewed\ncoverage reports!**\n\nIf your extension is in a public repo and being tested on GitHub actions, there's nothing else\nyou need to do! If your setup is more complex, look at the\n[SimpleCov](https://github.com/colszowka/simplecov)\nand [codecov](https://about.codecov.io/language/ruby/) docs.\n\n#### Using GitHub Actions\n\nThe recommended way to upload coverage reports to Codecov with GitHub Actions is to use the `solidusio/test-solidus-extension`\nworkflow.\n\n```yaml\njobs:\n  RSpec:\n    env:\n      CODECOV_COVERAGE_PATH: ./coverage/coverage.xml\n    steps:\n      - uses: actions/checkout@v4\n      - name: Run extension tests\n        uses: solidusio/test-solidus-extension@main\n      - name: Upload coverage reports to Codecov\n        uses: codecov/codecov-action@v5\n        continue-on-error: true\n        with:\n          token: ${{ secrets.CODECOV_TOKEN }}\n          files: ${{ env.CODECOV_COVERAGE_PATH }}\n```\n\n### RuboCop configuration\n\nsolidus_dev_support includes a default [RuboCop](https://github.com/rubocop-hq/rubocop)\nconfiguration for Solidus extensions. This configuration is based on the excellent [`standardrb`](https://github.com/standardrb/standard) gem.\n\nWe strongly recommend including the RuboCop configuration in your extension. All you have to do is\nadd this to your `.rubocop.yml`:\n\n```yaml\nrequire:\n  - solidus_dev_support/rubocop\n```\n\nYou can now run RuboCop with:\n\n```console\n$ bundle exec rubocop\n```\n\n### Changelog generator\n\nGenerating a changelog for your extension is possible by running this command:\n\n```console\n$ CHANGELOG_GITHUB_TOKEN=\"«your-40-digit-github-token»\" bundle exec github_changelog_generator github_username/github_project\n```\n\nThis generates a `CHANGELOG.md`, with pretty Markdown formatting.\n\nFor further instructions please read the [GitHub Changelog Generator documentation](https://github.com/github-changelog-generator/github-changelog-generator#usage).\n\n### Release management\n\nBy installing solidus_dev_support, you also get\n[`gem release`](https://github.com/svenfuchs/gem-release), which you can use to automatically manage\nreleases for your gem.\n\nFor instance, you can run the following to release a new minor version:\n\n```console\n$ gem bump -v minor -r\n```\n\nThe above command will:\n\n* bump the gem version to the next minor (you can also use `patch`, `major` or a specific version\n  number);\n* commit the change and push it to `origin/main`;\n* create a Git tag;\n* push the tag to the `origin` remote;\n* release the new version on RubyGems.\n\nYou can refer to\n[`gem release`'s documentation](https://github.com/svenfuchs/gem-release/blob/master/README.md) for\nfurther configuration and usage instructions.\n\n### Rake tasks\n\nTo install extension-related Rake tasks, add this to your `Rakefile`:\n\n```rb\nrequire 'solidus_dev_support/rake_tasks'\nSolidusDevSupport::RakeTasks.install\n\ntask default: 'extension:specs'\n```\n\n(If your extension used the legacy extension Rakefile, then you should completely replace its\ncontents with the block above.)\n\nThis will provide the following tasks:\n\n- `extension:test_app`, which generates a dummy app for your extension\n- `extension:specs` (default), which runs the specs for your extension\n\nIf your extension requires the `test_app` to be always recreated you can do so by running:\n\n```rb\nbin/rake extension:test_app extension:specs\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run\nthe tests. You can also run `bin/console` for an interactive prompt that will allow you to\nexperiment.\n\nTo install this gem onto your local machine, run `bin/rake install`.\n\n### Releasing new versions\n\nPlease use the same process suggested for extensions in the [dedicated page](https://github.com/solidusio/solidus/wiki/How-to-release-extensions) in the Solidus wiki.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/solidusio/solidus_dev_support.\n\n## License\n\nThe gem is available as open source under the terms of the\n[MIT License](https://opensource.org/licenses/MIT).\n","funding_links":["https://opencollective.com/solidus"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidusio%2Fsolidus_dev_support","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolidusio%2Fsolidus_dev_support","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidusio%2Fsolidus_dev_support/lists"}