Class: RedmineInstaller::Environment

Inherits:
TaskModule show all
Defined in:
lib/redmine-installer/environment.rb

Constant Summary

Constants included from Utils

Utils::PROGRESSBAR_FORMAT

Instance Attribute Summary

Attributes inherited from TaskModule

#task

Instance Method Summary collapse

Methods inherited from TaskModule

#initialize

Methods included from Utils

#class_name, #create_dir, #env_user, #error, #logger, #ok, #pastel, #print_title, #prompt, #run_command

Constructor Details

This class inherits a constructor from RedmineInstaller::TaskModule

Instance Method Details

#checkObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/redmine-installer/environment.rb', line 4

def check
  if user_is_root? && !task.options.enable_user_root
    error 'You cannot install redmine under root. Please change user.'
  end

  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new(RedmineInstaller::MIN_SUPPORTED_RUBY)
    error "You are using unsupported ruby. Please install ruby v#{RedmineInstaller::MIN_SUPPORTED_RUBY}."
  end

  if mysql_version =~ /^mysql\s+Ver\s(8\.\d)/
    unless mysql_version.include? "Percona"
      puts pastel.on_red 'WARNING: It seems you are using MySQL 8.x, but ER / EP supported only Percona 8 db.'
    end
  else
    error 'Only Percona 8.x db server is supported!.'
  end

  logger.info 'Environment checked'
end

#mysql_versionObject



28
29
30
31
32
# File 'lib/redmine-installer/environment.rb', line 28

def mysql_version
  `mysql --version`
rescue StandardError
  ""
end

#user_is_root?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/redmine-installer/environment.rb', line 24

def user_is_root?
  Process.euid == 0
end