Module: Middleman::Presentation::Cli::Shared
Overview
Bundle shared methods for all cli classes
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#assets_loader ⇒ Object
Create assets loader base on bower directory.
-
#bower_path ⇒ Object
Create bower directory.
-
#enable_debug_mode ⇒ Object
Enable debug mode.
- #open_in_editor(paths) ⇒ Object
Class Method Details
.included(base) ⇒ Object
7 8 9 |
# File 'lib/middleman-presentation-core/cli/shared.rb', line 7 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#assets_loader ⇒ Object
Create assets loader base on bower directory
22 23 24 25 26 |
# File 'lib/middleman-presentation-core/cli/shared.rb', line 22 def assets_loader return @assets_loader if @assets_loader @assets_loader = Middleman::Presentation::AssetsLoader.new(bower_directory: bower_path) end |
#bower_path ⇒ Object
Create bower directory
17 18 19 |
# File 'lib/middleman-presentation-core/cli/shared.rb', line 17 def bower_path MiddlemanEnvironment.new.bower_path end |
#enable_debug_mode ⇒ Object
Enable debug mode
12 13 14 |
# File 'lib/middleman-presentation-core/cli/shared.rb', line 12 def enable_debug_mode Middleman::Presentation.enable_debug_mode if [:debug_mode] == true end |
#open_in_editor(paths) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/middleman-presentation-core/cli/shared.rb', line 28 def open_in_editor(paths) editor = [] begin editor << Erubis::Eruby.new([:editor_command]).result(Middleman::Presentation.config.to_h) rescue NameError => e $stderr.puts Middleman::Presentation.t('errors.missing_data_attribute', message: e.) end editor.concat paths Middleman::Presentation.logger.warn Middleman::Presentation.t('infos.open_slide_in_editor', editor: editor.first) system(editor.join(' ')) end |