lib/guard/cli.rb
def init(guard_name = nil)
      if guard_name
        guard_class = ::Guard.get_guard_class(guard_name)
        guard_class.init(guard_name)

      else
        if File.exist?('Guardfile')
          puts 'Writing new Guardfile to #{Dir.pwd}/Guardfile'
          FileUtils.cp(File.expand_path('../templates/Guardfile', __FILE__), 'Guardfile')
        else
          Guard::UI.error "Guardfile already exists at #{ Dir.pwd }/Guardfile"
          exit 1
        end
      end
    end
# Appends the Guard template to the `Guardfile`, or creates an initial
# `Guardfile` when no Guard name is passed,
#
# @param [String] guard_name the name of the Guard to initialize
#
Appends the Guard template to the `Guardfile`, or creates an initial
`Guardfile` when no Guard name is passed.
Appends the Guard template to the ` Guardfile ` or creates an initial ` Guardfile ` when no Guard name is passed .
def init(guard_name = nil)
      if guard_name
        guard_class = ::Guard.get_guard_class(guard_name)
        guard_class.init(guard_name)
      else
        if File.exist?('Guardfile')
          puts 'Writing new Guardfile to #{Dir.pwd}/Guardfile'
          FileUtils.cp(File.expand_path('../templates/Guardfile', __FILE__), 'Guardfile')
        else
          Guard::UI.error "Guardfile already exists at #{ Dir.pwd }/Guardfile"
          exit 1
        end
      end
    end
def init ( guard_name = nil ) if guard_name guard_class = :: Guard . get_guard_class ( guard_name ) guard_class . init ( guard_name ) else if File . exist? ( 'Guardfile' ) puts 'Writing new Guardfile to #{Dir.pwd}/Guardfile' FileUtils . cp ( File . expand_path ( '../templates/Guardfile' , __FILE__ ) , 'Guardfile' ) else Guard :: UI . error "Guardfile already exists at #{ Dir.pwd }/Guardfile" exit 1 end end end
Appends the Guard template to the `Guardfile`, or creates an initial
`Guardfile` when no Guard name is passed,
Appends the Guard template to the ` Guardfile ` or creates an initial ` Guardfile ` when no Guard name is passed
guard_name
guard_name the name of the Guard to initialize
guard_name the name of the Guard to initialize