Commit ba5b1e76 by ivan Lan

Fix the target path for factory files in controller generator

parent 66bbe9ce
...@@ -21,12 +21,12 @@ Or install it yourself as: ...@@ -21,12 +21,12 @@ Or install it yourself as:
$ gem install shotengai $ gem install shotengai
## Rails Generators ## Rails Generators
# Migration Generator ### Migration Generator
```shell ```shell
$ rails g shotengai:migrations $ rails g shotengai:migrations
``` ```
# Model Generator: ### Model Generator:
```ruby ```ruby
# options: # options:
# --product custom your own product class # --product custom your own product class
...@@ -43,7 +43,7 @@ For example: ...@@ -43,7 +43,7 @@ For example:
create app/models/my_order.rb create app/models/my_order.rb
create app/models/my_catalog.rb create app/models/my_catalog.rb
# Controller & Routes Generator: ### Controller & Routes Generator:
```ruby ```ruby
# attr: # attr:
# role ( merchant | customer ) # role ( merchant | customer )
...@@ -66,18 +66,12 @@ This will create serveral controller classes inherited from merchant product and ...@@ -66,18 +66,12 @@ This will create serveral controller classes inherited from merchant product and
content... content...
end end
# Views Generator: ### Views Generator:
```shell ```shell
$ rails g shotengai:views -f $ rails g shotengai:views -f
``` ```
This will copy shotengai example views to your application under 'app/views/shotengai/'. This will copy shotengai example views to your application under 'app/views/shotengai/'.
# Spec Generator:
```shell
$ rails g shotengai:spec --customer User --merchant Merchant --product MyProduct --order Myorder
```
This will create all request swagger spec & factory files to your application under 'app/spec/shotengai/'.
## Development ## Development
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment. After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
......
...@@ -57,7 +57,6 @@ module Shotengai ...@@ -57,7 +57,6 @@ module Shotengai
end end
create_routes create_routes
create_factory create_factory
create_request_spec create_request_spec
end end
...@@ -67,7 +66,7 @@ module Shotengai ...@@ -67,7 +66,7 @@ module Shotengai
def create_factory def create_factory
Dir["#{self.class.source_root}/../spec/factories/*.rb"].each do |path| Dir["#{self.class.source_root}/../spec/factories/*.rb"].each do |path|
template path, "spec/shotengai/#{path.match(/(.*)\/spec\/(.*)/)[2]}" template path, "spec/#{path.match(/(.*)\/spec\/(.*)/)[2]}"
end end
end end
......
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