Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shotengai
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
shotengai
Commits
0f1cc029
Commit
0f1cc029
authored
Aug 29, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update README.md
parent
b8f1994a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
3 deletions
+49
-3
README.md
README.md
+44
-2
models_generator.rb
lib/generators/shotengai/models_generator.rb
+5
-1
No files found.
README.md
View file @
0f1cc029
...
...
@@ -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
...
...
lib/generators/shotengai/models_generator.rb
View file @
0f1cc029
...
...
@@ -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'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment