Commit 0f1cc029 by ivan Lan

Update README.md

parent b8f1994a
......@@ -20,9 +20,51 @@ Or install it yourself as:
$ gem install shotengai
## Usage
## Rails Generators
#Model Generator:
```ruby
# options:
# --produt custom your own product class
# --order custom your own order class
```
For example:
```shell
$ rails g shotengai:models --product MyProduct --order MyOrder
```
This will create two model file:
create app/models/my_product.rb
create app/models/my_product_series.rb
create app/models/my_product_snapshot.rb
create app/models/my_order.rb
create app/models/my_catalog.rb
#Controller Generator:
```ruby
# attr:
# role ( merchant | customer )
# options:
# -n, --namespace add the namespec folder, default nil.
# --product custom your own product class, default Product
# --order custom your own order class, default Order
```
For example:
```shell
$ rails g shotengai:controllers merchant -n my_merchant --product MyProduct --order MyOrder
```
This will create serveral controller classes inherited from merchant product and order class
For example:
app/controllers/store/product_controller.rb like this:
class Store::MyProductsController < Shotengai::Merchant::ProductsController
content...
end
#Views Generator:
```shell
$ rails g shotengai:views -f
```
This will copy shotengai example views to your application under 'app/views/shotengai/'.
TODO: Write usage instructions here
## Development
......
......@@ -8,12 +8,16 @@ module Shotengai
Use --produt to custom your own product class
Use --order to custom your own order class
Use --catalog to custom your own catalog class
For example:
rails g shotengai:models --product MyProduct --order MyOrder
This will create two model file:
This will create some model file:
create app/models/my_product.rb
create app/models/my_product_series.rb
create app/models/my_product_snapshot.rb
create app/models/my_order.rb
create app/models/my_catalog.rb
DESC
class_option :product, type: :string, default: 'Product',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment