Module: Rur::Produce
- Defined in:
- lib/rur/produce.rb
Instance Method Summary collapse
Instance Method Details
#parse_routes(targets) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/rur/produce.rb', line 5 def parse_routes(targets) return [] if targets.blank? if targets.include?(',') targets.gsub(/[[:space:]]/, '').split(',') else targets.split(' ')&.compact end end |
#r_produce(target) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rur/produce.rb', line 15 def r_produce(target) dir = case target when 'app' 'app' when 'models', 'model' 'app/models' when 'controllers', 'controller' 'app/contollers' when 'views', 'view' 'app/views' when 'config' 'config' when 'lib' 'lib' when 'db' 'db' when '.' '' else false end # TODO: catch error here! return unless dir `rubocop #{Rails.root}/#{dir}/ --format html -o app/views/rur/#{target}.html.erb` end |