Class: Guard::EmberTools

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/embertools.rb

Instance Method Summary collapse

Constructor Details

#initialize(watchers = [], options = {}) ⇒ EmberTools

Returns a new instance of EmberTools.



8
9
10
11
12
13
14
15
# File 'lib/guard/embertools.rb', line 8

def initialize(watchers = [], options = {})
  super
  @options = {
      :debug => false,
      :no_cleanup => false,
      :out_file => nil
  }.merge(options)
end

Instance Method Details

#compile_emberObject



26
27
28
29
30
# File 'lib/guard/embertools.rb', line 26

def  compile_ember
  command = "ember build #{generate_cl_arguments}"
  puts command
  puts `#{command}`
end

#generate_cl_argumentsObject



32
33
34
35
36
37
38
# File 'lib/guard/embertools.rb', line 32

def generate_cl_arguments
  args = []
  args << "-d" if @options[:debug]
  args << "-c" if @options[:no_cleanup]
  args << "--out-file #{@options[:out_file]}" if @options[:out_file]
  args.join(' ')
end

#run_allObject



17
18
19
# File 'lib/guard/embertools.rb', line 17

def run_all
  compile_ember
end

#run_on_changes(path) ⇒ Object



21
22
23
24
# File 'lib/guard/embertools.rb', line 21

def run_on_changes(path)
  puts "detected changes in #{path.join(', ')}".yellow
  compile_ember
end