Class: Staticise::CLI

Inherits:
Guard::CLI
  • Object
show all
Defined in:
lib/staticise/cli.rb

Instance Method Summary collapse

Instance Method Details

#init(*guard_names) ⇒ Object

Initializes the templates of all installed Guard plugins and adds them to the ‘Guardfile` when no Guard name is passed. When passing Guard plugin names it does the same but only for those Guard plugins.

Parameters:

  • guard_names (Array<String>)

    the name of the Guard plugins to initialize

See Also:

  • Guard::Guard.initialize_template
  • Guard::Guard.initialize_all_templates


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/staticise/cli.rb', line 25

def init(*guard_names)
  puts "initializing..."

  ::Staticise::Renderer.init

  verify_bundler_presence

  ::Guard::Guardfile.create_guardfile(:abort_on_existence => options[:bare])

  return if options[:bare]

  File.open('Guardfile', 'wb') do |f|

    f.puts("guard 'coffeescript', :input => 'app/js', :output => 'public/js'")
    f.puts("guard 'sass', :input => 'app/css', :output => 'public/css'")
    f.puts("guard 'less', :output => 'public/css'")
    f.puts("guard 'staticise', :input => 'app', :output => 'public'")

  end

=begin
  if guard_names.empty?
    ::Guard::Guardfile.initialize_all_templates
  else
    guard_names.each do |guard_name|
      ::Guard::Guardfile.initialize_template(guard_name)
    end
  end
=end

end