Module: SearchCraft::Annotate
- Included in:
- Builder
- Defined in:
- lib/searchcraft/annotate.rb
Instance Method Summary collapse
-
#annotate_models! ⇒ Object
If using annotate gem, then automatically annotate models after rebuilding views TODO: I’m suspicious this is not working for dependent Builders, e.g.
- #capture_stdout(&block) ⇒ Object
Instance Method Details
#annotate_models! ⇒ Object
If using annotate gem, then automatically annotate models after rebuilding views TODO: I’m suspicious this is not working for dependent Builders, e.g. demo_app’s OnsaleSearchBuilder
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/searchcraft/annotate.rb', line 4 def annotate_models! return if SearchCraft.config.disable_annotate return unless Rails.env.development? return unless Object.const_defined?(:Annotate) = { is_rake: true, position: "before", additional_file_patterns: [], model_dir: "app/models", root_dir: Rails.root.to_s, require: [], exclude_controllers: true, exclude_helpers: true, hide_limit_column_types: "", hide_default_column_types: "", ignore_unknown_models: true, show_indexes: true } capture_stdout do AnnotateModels.do_annotations() end rescue PG::UndefinedTable rescue => e puts "Error annotating models: #{e.}" pp e.backtrace end |
#capture_stdout(&block) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/searchcraft/annotate.rb', line 32 def capture_stdout(&block) old_stdout = $stdout $stdout = StringIO.new yield if SearchCraft.debug? puts $stdout.string end ensure $stdout = old_stdout end |