Class: Evertils::Controller::Firstrun

Inherits:
Base
  • Object
show all
Defined in:
lib/evertils/controllers/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 Evertils::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
# File 'lib/evertils/controllers/firstrun.rb', line 5

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

  File.open("#{Dir.home}/.evertils/config.yml", "w") do |f|
    f.write <<-'CONTENTS'
  templates:
  Monthly:
"templates/monthly.enml"
  Daily:
"templates/daily.enml"

  provider: Evernote
    CONTENTS
  end
end