Module: Prepd::Component
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/prepd/models/base.rb
Instance Method Summary collapse
- #component_dir ⇒ Object
- #component_directory_does_not_exist ⇒ Object
- #component_root ⇒ Object
- #files_dir ⇒ Object
- #in_component_dir ⇒ Object
- #in_component_root(dir = self.class::WORK_DIR) ⇒ Object
- #in_workspace_root ⇒ Object
- #klass_name ⇒ Object
- #workspace_root ⇒ Object
Instance Method Details
#component_dir ⇒ Object
37 38 39 |
# File 'lib/prepd/models/base.rb', line 37 def component_dir "#{component_root}/#{name}" end |
#component_directory_does_not_exist ⇒ Object
26 27 28 29 |
# File 'lib/prepd/models/base.rb', line 26 def component_directory_does_not_exist return if Prepd.config.force errors.add(:directory_exists, component_dir) if Dir.exists?(component_dir) end |
#component_root ⇒ Object
47 48 49 |
# File 'lib/prepd/models/base.rb', line 47 def component_root "#{workspace_root}/#{self.class::WORK_DIR}" end |
#files_dir ⇒ Object
64 65 66 |
# File 'lib/prepd/models/base.rb', line 64 def files_dir "#{Prepd.files_dir}/#{self.class::WORK_DIR}" end |
#in_component_dir ⇒ Object
31 32 33 34 35 |
# File 'lib/prepd/models/base.rb', line 31 def in_component_dir in_component_root do Dir.chdir(name) { yield } end end |
#in_component_root(dir = self.class::WORK_DIR) ⇒ Object
41 42 43 44 45 |
# File 'lib/prepd/models/base.rb', line 41 def in_component_root(dir = self.class::WORK_DIR) in_workspace_root do Dir.chdir(dir) { yield } end end |
#in_workspace_root ⇒ Object
51 52 53 54 |
# File 'lib/prepd/models/base.rb', line 51 def in_workspace_root raise StandardError, 'Not a prepd workspace' if workspace_root.nil? Dir.chdir(workspace_root) { yield } end |