module RedmineInstaller::Utils
Constants
- PROGRESSBAR_FORMAT
Public Instance Methods
class_name()
click to toggle source
# File lib/redmine-installer/utils.rb, line 6 def class_name self.class.name.split('::').last end
create_dir(dir)
click to toggle source
Try create a dir When mkdir raise an error (permission problem) method ask user if wants exist or try again
# File lib/redmine-installer/utils.rb, line 41 def create_dir(dir) FileUtils.mkdir_p(dir) rescue if prompt.yes?("Dir #{dir} doesn't exist and can't be created. Try again?", default: true) create_dir(dir) else error('Dir creating was aborted by user.') end end
env_user()
click to toggle source
# File lib/redmine-installer/utils.rb, line 35 def env_user ENV['USER'] || ENV['USERNAME'] end
error(message)
click to toggle source
# File lib/redmine-installer/utils.rb, line 56 def error(message) raise RedmineInstaller::Error, message end
logger()
click to toggle source
# File lib/redmine-installer/utils.rb, line 10 def logger RedmineInstaller.logger end
ok(title) { || ... }
click to toggle source
# File lib/redmine-installer/utils.rb, line 26 def ok(title) print "#{title} ... " yield puts pastel.green('OK') rescue => e puts pastel.red('FAIL') raise end
pastel()
click to toggle source
# File lib/redmine-installer/utils.rb, line 18 def pastel RedmineInstaller.pastel end
print_title(title)
click to toggle source
# File lib/redmine-installer/utils.rb, line 51 def print_title(title) puts puts pastel.white.on_black(title) end
prompt()
click to toggle source
# File lib/redmine-installer/utils.rb, line 14 def prompt RedmineInstaller.prompt end
run_command(cmd, title=nil)
click to toggle source
# File lib/redmine-installer/utils.rb, line 22 def run_command(cmd, title=nil) RedmineInstaller::Command.new(cmd, title: title).run end