本工具是一个团队效率工具,快速构建非rails项目的脚手架,兼容其他语言。
- 安装 Ruby 版本要求2.0以上
- gem install flg
如果安装很慢的话,请使用国内ruby源
你可以使用 flg start 来新建一个项目,或者 flg start url 来同步已经有的模板库
- 在你的项目里新建 generators 文件夹
- 在 generators 里面创建 flg 目录
- 上面的 generators 是一个例子
'active_record'.camelize # => "ActiveRecord"
'active_record'.camelize(:lower) # => "activeRecord"
'ham_and_eggs'.classify # => "HamAndEgg"
'posts'.classify # => "Post"
'employee_salary'.humanize # => "Employee salary"
'author_id'.humanize # => "Author"
'author_id'.humanize(capitalize: false) # => "author"
'_id'.humanize # => "Id"
'ActiveModel'.underscore # => "active_model"
'ActiveModel::Errors'.underscore # => "active_model/errors"
'RawScaledScorer'.tableize # => "raw_scaled_scorers"
'ham_and_egg'.tableize # => "ham_and_eggs"
'fancyCategory'.tableize # => "fancy_categories"
'posts'.singularize # => "post"
'octopi'.singularize # => "octopus"
'sheep'.singularize # => "sheep"
'word'.singularize # => "word"
'the blue mailmen'.singularize # => "the blue mailman"
'CamelOctopi'.singularize # => "CamelOctopus"
'leyes'.singularize(:es) # => "ley"
'post'.pluralize # => "posts"
'octopus'.pluralize # => "octopi"
'sheep'.pluralize # => "sheep"
'words'.pluralize # => "words"
'the blue mailman'.pluralize # => "the blue mailmen"
'CamelOctopus'.pluralize # => "CamelOctopi"
'apple'.pluralize(1) # => "apple"
'apple'.pluralize(2) # => "apples"
'ley'.pluralize(:es) # => "leyes"
'ley'.pluralize(1, :es) # => "ley"