Class: Vermillion::Controller::Firstrun

Inherits:
Base
  • Object
show all
Defined in:
lib/client/controller/firstrun.rb

Constant Summary

Constants inherited from Base

Base::OK, Base::QUIT, Base::QUIT_SOFT

Instance Attribute Summary

Attributes inherited from Base

#config, #request

Instance Method Summary collapse

Methods inherited from Base

#can_exec?, #exec, #initialize, #post_exec, #pre_exec, #sample

Constructor Details

This class inherits a constructor from Vermillion::Controller::Base

Instance Method Details

#defaultObject

Create the configuration file if it does not exist



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/client/controller/firstrun.rb', line 5

def default
  if File.exist?(Dir.home + '/.vermillion.yml')
    Notify.error("Configuration already exists, this is not the first run!  Exiting.", show_time: false)
  end

  File.open(Dir.home + '/.vermillion.yml', "w") do |f|
    f.write <<-'CONTENTS'
servers:
  -
    name: dev
    address: 192.168.0.74
    https: false
    key: EDIT_ME
  -
    name: local
    address: localhost:8000
    https: false
    key: EDIT_ME
user:
  [email protected]
    CONTENTS
  end
end