Class: Medivo::Generators::LabsGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Medivo::Generators::LabsGenerator
- Defined in:
- lib/generators/medivo/labs/labs_generator.rb
Instance Method Summary collapse
- #lab_controller_sample ⇒ Object
- #lab_resource_file ⇒ Object
- #lab_search_view_sample ⇒ Object
- #routes ⇒ Object
Instance Method Details
#lab_controller_sample ⇒ Object
13 14 15 16 |
# File 'lib/generators/medivo/labs/labs_generator.rb', line 13 def lab_controller_sample FileUtils.mkdir_p('app/controllers') copy_file "labs_controller.rb", "app/controllers/labs_controller.rb" end |
#lab_resource_file ⇒ Object
8 9 10 11 |
# File 'lib/generators/medivo/labs/labs_generator.rb', line 8 def lab_resource_file FileUtils.mkdir_p('config/medivo') copy_file "lab_resource.yml", "config/medivo/lab_resource.yml" end |
#lab_search_view_sample ⇒ Object
18 19 20 21 |
# File 'lib/generators/medivo/labs/labs_generator.rb', line 18 def lab_search_view_sample FileUtils.mkdir_p('app/views/labs') copy_file "search.html.haml", "app/views/labs/search.html.haml" end |
#routes ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/generators/medivo/labs/labs_generator.rb', line 23 def routes medivo_engine_routes = 'mount Medivo::Engine => "/medivo", :as => "medivo"' lab_search_route = 'match "/labs/search" => "labs#search", :via => :get, :as=> :search_labs' line = "application.routes.draw do" gsub_file 'config/routes.rb', /(#{Regexp.escape(line)})/mi do |match| "#{match}\n #{medivo_engine_routes}\n #{lab_search_route}" end end |