Overview
FactoryGirlBsGen = factory_girl build syntax generater
The build syntax of factory_girl from a file is CLI tool to generate. Currently I only supports CSV.
Installation
Add this line to your application's Gemfile:
gem 'factory_girl_bs_gen'And then execute:
$ bundle
Or install it yourself as:
$ gem install factory_girl_bs_gen
Usage
$ factory_girl_bs_gen exec -t hoge -f data.csv -o factory_girl_bs_gen.out --format=build --omit_syntax=false
Input(CSV file):
hoge,foo,bar
1,2,3
4,5,6
7,8,9
Output:
FactoryGirl.build(:hoge, hoge:1, foo:2, bar:3)
FactoryGirl.build(:hoge, hoge:4, foo:5, bar:6)
FactoryGirl.build(:hoge, hoge:7, foo:8, bar:9)CommandLine Option
| Name | Alias | Type | Required | Setting | Remarks |
| --table | -t | string | true | table name | - |
| --file | -f | string | true | input csv file | - |
| --format | none | string | true | create | build | specifies the format of the output after |
| --output | -o | string | false | output file name | specify if you want to output the output results to a file. If not specified, the stdout. |
| --omit_syntax | none | boolean | false | true | false | enable an abbreviated notation. Ex: FactoryGirl.build -> build |
Contributing
- Fork it ( https://github.com/fukuiretu/factory_girl_bs_gen/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request