项目作者: solidusio

项目描述 :
🛒Solidus, Rails eCommerce System
高级语言: Ruby
项目地址: git://github.com/solidusio/solidus.git
创建时间: 2015-02-18T20:41:58Z
项目社区:https://github.com/solidusio/solidus

开源协议:Other

下载


Solidus logo

Solidus

Circle CI
codecov
Gem
License

Supporters on Open Collective
Bronze Partners on Open Collective
Silver Partners on Open Collective
Gold Partners on Open Collective
Open Source Helpers
Slack

A free, open-source e-commerce platform that gives you complete control over your store.

Table of Contents

Supporting Solidus

As a community-driven project, Solidus relies on funds and time donated by developers and stakeholders who use Solidus for their businesses. If you’d like to help Solidus keep growing, please consider:

Main Contributor & Director

At present, Nebulab is the main code contributor and director of Solidus, providing technical guidance and coordinating community efforts and activities.

Nebulab

Ambassadors

Support this project by becoming a Solidus Ambassador. Your logo will show up here with a link to your website. Become an Ambassador.

Super Good Software


Summary

Solidus is a complete open source e-commerce solution built with Ruby on Rails.
It is a fork of Spree.

See the Solidus class documentation and the Solidus
Guides
for information about the functionality that
Solidus provides.

Solidus consists of several gems. When you require the solidus gem in your
Gemfile, Bundler will install all of the following gems:

All of the gems are designed to work together to provide a fully functional
e-commerce platform. However, you may only want to use the
solidus_core gem
combine it with your own custom frontend, admin interface, and API.

Demo

You can try the live Solidus demo here. The admin section can be accessed here.

Getting started

Begin by making sure you have
Imagemagick installed, which is
required for Paperclip. (You can install it using Homebrew if
you’re on a Mac.)

To add Solidus, begin with a newly created Rails application with its database.

  1. rails new my_store

[!CAUTION]
Due to a bug in sprockets-rails we need to manually add the sprockets manifest into the generated rails app before running any rails commands inside the rails app folder.

  1. mkdir -p my_store/app/assets/config
  2. cat <<MANIFEST > my_store/app/assets/config/manifest.js
  3. //= link_tree ../images
  4. //= link_directory ../javascripts .js
  5. //= link_directory ../stylesheets .css
  6. MANIFEST

Installing Solidus

In your application’s root folder run:

  1. bundle add solidus
  2. bin/rails g solidus:install

[!NOTE]
Please make sure to generate the sprockets manifest before running the solidus:install generator.

And follow the prompt’s instructions.

Accessing Solidus Store

Start the Rails server with the command:

  1. bin/rails s

The storefront will be accessible at
http://localhost:3000/ and the admin can be found at
http://localhost:3000/admin/.

For information on how to customize your store, check out the customization guides.

Default Username/Password

As part of running the above installation steps, you will be asked to set an admin email/password combination. The default values are admin@example.com and test123, respectively.

Questions?

The best way to ask questions is to join the Solidus Slack and join the #support channel.

Installation options

Instead of a stable build, if you want to use the bleeding edge version of
Solidus, use this line:

  1. gem 'solidus', github: 'solidusio/solidus'

Note: The master branch is not guaranteed to ever be in a fully functioning
state. It is too risky to use this branch in production.

By default, the installation generator (solidus:install) will run
migrations as well as adding seed and sample data. This can be disabled using

  1. bin/rails g solidus:install --migrate=false --sample=false --seed=false

You can always perform any of these steps later by using these commands.

  1. bin/rails railties:install:migrations
  2. bin/rails db:migrate
  3. bin/rails db:seed
  4. bin/rails spree_sample:load

There are also options and rake tasks provided by
solidus_auth_devise.

Performance

You may notice that your Solidus store runs slowly in development mode. This
can be because in development each CSS and JavaScript is loaded as a separate
include. This can be disabled by adding the following to
config/environments/development.rb.

  1. config.assets.debug = false

To gain some extra speed you may enable Turbolinks inside of Solidus admin.

Add gem 'turbolinks', '~> 5.0.0' into your Gemfile (if not already present)
and change vendor/assets/javascripts/spree/backend/all.js as follows:

  1. //= require turbolinks
  2. //
  3. // ... current file content
  4. //
  5. //= require spree/backend/turbolinks-integration.js

CAUTION Please be aware that Turbolinks can break extensions
and/or customizations to the Solidus admin. Use at your own risk.

Developing Solidus

  • Clone the Git repo

    1. git clone git://github.com/solidusio/solidus.git
    2. cd solidus

Without Docker

  • Install the gem dependencies

    1. bin/setup

    Note: If you’re using PostgreSQL or MySQL, you’ll need to install those gems through the DB environment variable.

    1. # PostgreSQL
    2. export DB=postgresql
    3. bin/setup
    4. # MySQL
    5. export DB=mysql
    6. bin/setup

With Docker

  1. 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:

  1. docker-compose build --build-arg RUBY_VERSION=3.0 app
  2. docker-compose up -d

The rails version can be customized at runtime through the RAILS_VERSION environment variable:

  1. RAILS_VERSION='~> 5.0' docker-compose up -d

Running tests:

  1. # sqlite
  2. docker-compose exec app bin/rspec
  3. # postgres
  4. docker-compose exec app env DB=postgres bin/rspec
  5. # mysql
  6. docker-compose exec app env DB=mysql bin/rspec

Accessing the databases:

  1. # sqlite
  2. docker-compose exec app sqlite3 /path/to/db
  3. # postgres
  4. docker-compose exec app env PGPASSWORD=password psql -U root -h postgres
  5. # mysql
  6. 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
default, port 3000 is exposed, but you can change it through SANDBOX_PORT
environment variable:

  1. SANDBOX_PORT=4000 docker-compose up -d
  2. docker-compose exec app bin/sandbox
  3. docker-compose exec app bin/rails server --binding 0.0.0.0 --port 4000

Sandbox

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

    1. bin/sandbox

    You can create a sandbox with PostgreSQL or MySQL by setting the DB environment variable.

    1. # PostgreSQL
    2. export DB=postgresql
    3. bin/sandbox
    4. # MySQL
    5. export DB=mysql
    6. bin/sandbox

    Depending on your local environment, it may be necessary for you to set environment variables for your RDBMS, namely:

    • DB_HOST
    • DB_USER
    • DB_PASSWORD

    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 RAILS_VERSION environment variable.

    1. export RAILS_VERSION='~> 5.2.0'
    2. bin/setup
    3. bin/sandbox
  • You can start the Rails server and other services from either the Solidus folder or the
    sandbox one by running the command:

    1. bin/dev

Please note: if you run bin/rails server or similar commands, only the Rails server will
start. This might cause the error couldn't find file 'solidus_admin/tailwind.css' when you
try to load admin pages.

Tests

Solidus uses RSpec for tests. Refer to its documentation for
more information about the testing library.

CircleCI

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.

Run all tests

ChromeDriver is required to run
the backend test suites.

To execute all of the test specs, run the bin/build script at the root of the Solidus project:

  1. createuser --superuser --echo postgres # only the first time
  2. bin/build

The bin/build script runs using PostgreSQL by default, but it can be overridden by setting the DB environment variable to DB=sqlite or DB=mysql. For example:

  1. env DB=mysql bin/build

If the command fails with MySQL related errors you can try creating a user with this command:

  1. # Creates a user with the same name as the current user and no restrictions.
  2. mysql --user="root" --execute="CREATE USER '$USER'@'localhost'; GRANT ALL PRIVILEGES ON * . * TO '$USER'@'localhost';"

Run an individual test suite

Each gem contains its own series of tests. To run the tests for the core project:

  1. cd core
  2. bundle exec rspec

By default, 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:

  1. env DB=postgresql bundle exec rspec

Code coverage reports

If you want to run the SimpleCov code
coverage report:

  1. COVERAGE=true bundle exec rspec

Extensions

In addition to core functionality provided in Solidus, there are a number of
ways to add features to your store that are not (or not yet) part of the core
project.

A list can be found at extensions.solidus.io.

If you want to write an extension for Solidus, you can use the
solidus_dev_support gem.

Contributing

Solidus is an open source project and we encourage contributions. Please read
CONTRIBUTING.md before contributing.