class Malvolio::CLI
Public Instance Methods
build(path = nil)
click to toggle source
# File lib/malvolio/cli.rb, line 19 def build(path = nil) safely do Malvolio::Compiler.new(path, options[:no_warnings]).run! end end
new(name)
click to toggle source
# File lib/malvolio/cli.rb, line 9 def new(name) if options[:inky] ::Rails::Generators.invoke("malvolio:create_with_inky", [name]) else ::Rails::Generators.invoke("malvolio:create", [name]) end end
watch(path = nil)
click to toggle source
# File lib/malvolio/cli.rb, line 27 def watch(path = nil) path = File.expand_path(path || ".") compiler = Malvolio::Compiler.new(path, options[:no_warnings]) html_files = Dir[File.join(path, "src", "**", "*.html")] css_files = Dir[File.join(path, "src", "**", "*.css")] sass_files = Dir[File.join(path, "src", "**", "*.scss")] files = html_files + css_files + sass_files puts "Now watching project for changes at #{path}" Filewatcher.new(files).watch do safely { compiler.run! } end end
Private Instance Methods
safely() { || ... }
click to toggle source
# File lib/malvolio/cli.rb, line 42 def safely(&block) begin yield rescue Malvolio::CompilationError => e puts e end end