Class: RedmineCLI::Config

Inherits:
NonConfig::Base
  • Object
show all
Defined in:
lib/redmine_cli/config.rb

Overview

Class that stores configuration and manipulates with it

Class Method Summary collapse

Class Method Details

.configure_restObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/redmine_cli/config.rb', line 11

def self.configure_rest
  RedmineRest::Models.configure_models user: user,
                                       password: password,
                                       site: site
rescue
  puts '!!!'
  puts 'Looks like your config file is corrupted or it was just created.'
  puts 'Please, use `redmine conf init`'
  puts '!!!'
  puts
end

.create_configObject



23
24
25
26
27
28
29
# File 'lib/redmine_cli/config.rb', line 23

def self.create_config
  defaults = { 'just_created' => true,
               'user' => nil,
               'password' => nil,
               'site' => nil }
  File.open(@path_to_config, 'w') { |f| f.write defaults.to_yaml }
end

.new?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/redmine_cli/config.rb', line 31

def self.new?
  self['just_created']
end