Class: Naginata::CLI::Init

Inherits:
LocalAbstract show all
Defined in:
lib/naginata/cli/init.rb

Instance Method Summary collapse

Methods inherited from LocalAbstract

#configure_backend, #load_remote_objects

Methods inherited from RemoteAbstract

#configure_backend, #execute, #initialize, #load_remote_objects, #set_log_level, #set_nagios_filter

Constructor Details

This class inherits a constructor from Naginata::CLI::RemoteAbstract

Instance Method Details

#load_configurationObject



14
15
16
# File 'lib/naginata/cli/init.rb', line 14

def load_configuration
  # Skip loading configuration because Nagipfile does not exist yet.
end

#runObject



5
6
7
8
9
10
11
12
# File 'lib/naginata/cli/init.rb', line 5

def run
  if File.exist?("Naginatafile")
    Naginata.ui.error "Naginatafile already exists at #{Dir.pwd}/Naginatafile"
    exit 1
  end
  Naginata.ui.info "Writing new Naginatafile to #{Dir.pwd}/Naginatafile"
  FileUtils.cp(File.expand_path('../../templates/Naginatafile', __FILE__), 'Naginatafile')
end