Frontend contains controllers and views implementing a storefront and cart for Solidus.
For new Solidus apps, we recommend that you use SolidusStarterFrontend instead.
In order to customize a view you should copy the file into your host app. Using Deface is not recommended as it provides lots of headaches while debugging and degrades your shops performance.
Solidus provides a generator to help with copying the right view into your host app.
Simply call the generator to copy all views into your host app.
$ bundle exec rails g solidus:views:override
If you only want to copy certain views into your host app, you can provide the
$ bundle exec rails g solidus:views:override --only products/show
The argument to
--only can also be a substring of the name of the view from the
$ bundle exec rails g solidus:views:override --only product
This will copy all views whose directory or filename contains the string "product".
After upgrading Solidus to a new version run the generator again and follow on screen instructions.
Developing Solidus Frontend
Clone the Git repo
git clone git://github.com/solidusio/solidus_frontend.git cd solidus
Install the gem dependencies
Note: If you're using PostgreSQL or MySQL, you'll need to install those gems through the DB environment variable.
# PostgreSQL export DB=postgresql bin/setup # MySQL export DB=mysql bin/setup
docker-compose up -d
Wait for all the gems to be installed (progress can be checked through
docker-compose logs -f app).
You can provide the ruby version you want your image to use:
docker-compose build --build-arg RUBY_VERSION=2.6 app docker-compose up -d
The rails version can be customized at runtime through
RAILS_VERSION environment variable:
RAILS_VERSION='~> 5.0' docker-compose up -d
# sqlite docker-compose exec app bundle exec rspec # postgres docker-compose exec app env DB=postgres bundle exec rspec # mysql docker-compose exec app env DB=mysql bundle exec rspec
Accessing the databases:
# sqlite docker-compose exec app sqlite3 /path/to/db # postgres docker-compose exec app env PGPASSWORD=password psql -U root -h postgres # mysql docker-compose exec app mysql -u root -h mysql -ppassword
In order to be able to access the sandbox application, just make
sure to provide the appropriate
--binding option to
rails server. By
3000 is exposed, but you can change it through
SANDBOX_PORT=4000 docker-compose up -d docker-compose exec app bin/sandbox docker-compose exec app bin/rails server --binding 0.0.0.0 --port 4000
Solidus is meant to be run within the context of Rails application. You can easily create a sandbox application inside of your cloned source directory for testing purposes.
This sandbox includes solidus_auth_devise and generates with seed and sample data already loaded.
Create the sandbox application
You can create a sandbox with PostgreSQL or MySQL by setting the DB environment variable.
# PostgreSQL export DB=postgresql bin/sandbox # MySQL export DB=mysql bin/sandbox
If you need to create a Rails 5.2 application for your sandbox, for example if you are still using Ruby 2.4 which is not supported by Rails 6, you can use the
export RAILS_VERSION='~> 5.2.0' bin/setup bin/sandbox
Start the server (
bin/railswill forward any argument to the sandbox)
Solidus uses RSpec for tests. Refer to its documentation for more information about the testing library.
We use CircleCI to run the tests for Solidus as well as all incoming pull requests. All pull requests must pass to be merged.
You can see the build statuses at https://circleci.com/gh/solidusio/solidus_frontend.
Run all tests
ChromeDriver is required to run the frontend suites.
Run the tests
bundle exec rspec
rspec runs the tests for SQLite 3. If you would like to run specs
against another database you may specify the database in the command:
env DB=postgresql bundle exec rspec
Code coverage reports
If you want to run the SimpleCov code coverage report:
COVERAGE=true bundle exec rspec