Module: AnnotateModels::FilePatterns
- Defined in:
- lib/annotated/annotate_models/file_patterns.rb
Overview
This module provides module method to get file paths.
Constant Summary collapse
- CONTROLLER_DIR =
Controller files
File.join("app", "controllers")
- ACTIVEADMIN_DIR =
Active admin registry files
File.join("app", "admin")
- HELPER_DIR =
Helper files
File.join("app", "helpers")
- UNIT_TEST_DIR =
File.join for windows reverse bar compat? I dont use windows, can`t test
File.join("test", "unit")
- MODEL_TEST_DIR =
since rails 4.0
File.join("test", "models")
- SPEC_MODEL_DIR =
File.join("spec", "models")
- FIXTURE_TEST_DIR =
File.join("test", "fixtures")
- FIXTURE_SPEC_DIR =
File.join("spec", "fixtures")
- CONTROLLER_TEST_DIR =
Other test files
File.join("test", "controllers")
- CONTROLLER_SPEC_DIR =
File.join("spec", "controllers")
- REQUEST_SPEC_DIR =
File.join("spec", "requests")
- ROUTING_SPEC_DIR =
File.join("spec", "routing")
- EXEMPLARS_TEST_DIR =
Object Daddy github.com/flogic/object_daddy/tree/master
File.join("test", "exemplars")
- EXEMPLARS_SPEC_DIR =
File.join("spec", "exemplars")
- BLUEPRINTS_TEST_DIR =
Machinist github.com/notahat/machinist
File.join("test", "blueprints")
- BLUEPRINTS_SPEC_DIR =
File.join("spec", "blueprints")
- FACTORY_BOT_TEST_DIR =
Factory Bot github.com/thoughtbot/factory_bot
File.join("test", "factories")
- FACTORY_BOT_SPEC_DIR =
File.join("spec", "factories")
- FABRICATORS_TEST_DIR =
Fabrication github.com/paulelliott/fabrication.git
File.join("test", "fabricators")
- FABRICATORS_SPEC_DIR =
File.join("spec", "fabricators")
- SERIALIZERS_DIR =
Serializers github.com/rails-api/active_model_serializers
File.join("app", "serializers")
- SERIALIZERS_TEST_DIR =
File.join("test", "serializers")
- SERIALIZERS_SPEC_DIR =
File.join("spec", "serializers")
Class Method Summary collapse
Class Method Details
.generate(root_directory, pattern_type, options) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/annotated/annotate_models/file_patterns.rb', line 50 def generate(root_directory, pattern_type, ) case pattern_type when "test" then test_files(root_directory) when "fixture" then fixture_files(root_directory) when "scaffold" then scaffold_files(root_directory) when "factory" then factory_files(root_directory) when "serializer" then serialize_files(root_directory) when "additional_file_patterns" [[:additional_file_patterns] || []].flatten when "controller" [File.join(root_directory, CONTROLLER_DIR, "%PLURALIZED_MODEL_NAME%_controller.rb")] when "admin" [ File.join(root_directory, ACTIVEADMIN_DIR, "%MODEL_NAME%.rb"), File.join(root_directory, ACTIVEADMIN_DIR, "%PLURALIZED_MODEL_NAME%.rb") ] when "helper" [File.join(root_directory, HELPER_DIR, "%PLURALIZED_MODEL_NAME%_helper.rb")] else [] end end |