Class: Redmine::Installer::Step::LoadPackage

Inherits:
Base
  • Object
show all
Defined in:
lib/redmine-installer/steps/load_package.rb

Constant Summary collapse

SUPPORTED_ARCHIVE_FORMATS =
['.zip', '.gz', '.tgz']
'././@LongLink'
PROGRESSBAR_FORMAT =
'%a [%b>%i] %p%% %t'

Instance Attribute Summary

Attributes inherited from Base

#base, #index, #ran

Instance Method Summary collapse

Methods inherited from Base

#initialize, #load, #print_footer, #print_header, #print_title, #redmine_plugins, #save

Methods included from Utils

included

Constructor Details

This class inherits a constructor from Redmine::Installer::Step::Base

Instance Method Details

#downObject



52
53
54
55
# File 'lib/redmine-installer/steps/load_package.rb', line 52

def down
  FileUtils.remove_entry_secure(@tmpdir) if @tmpdir
  FileUtils.safe_unlink(@tmpfile) if @tmpfile
end

#finalObject



57
58
59
60
# File 'lib/redmine-installer/steps/load_package.rb', line 57

def final
  down
  say(t(:redmine_was_installed_to, dir: base.redmine_root), 1)
end

#prepareObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/redmine-installer/steps/load_package.rb', line 17

def prepare
  case base.options[:source]
  when 'file'

    unless File.exist?(base.package)
      if base.package =~ /\Av?(\d\.\d\.\d)\Z/
        download_redmine($1)
      end
    end

    unless File.exist?(base.package)
      error :file_not_exist, file: base.package
    end

    @type = File.extname(base.package)
    unless SUPPORTED_ARCHIVE_FORMATS.include?(@type)
      error :file_must_have_format, file: base.package, formats: SUPPORTED_ARCHIVE_FORMATS.join(', ')
    end

  when 'git'
    nil
  else
    error :error_unsupported_source, source: base.options[:source]
  end
end

#upObject



43
44
45
46
47
48
49
50
# File 'lib/redmine-installer/steps/load_package.rb', line 43

def up
  case base.options[:source]
  when 'file'
    load_from_archive
  when 'git'
    load_from_git
  end
end