redmine-installer 1.0.7 → 2.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.travis.yml +7 -0
- data/Gemfile +3 -15
- data/README.md +49 -177
- data/bin/redmine +4 -5
- data/lib/redmine-installer/backup.rb +13 -40
- data/lib/redmine-installer/cli.rb +92 -61
- data/lib/redmine-installer/command.rb +63 -117
- data/lib/redmine-installer/configuration.rb +148 -0
- data/lib/redmine-installer/database.rb +204 -0
- data/lib/redmine-installer/environment.rb +21 -0
- data/lib/redmine-installer/errors.rb +7 -0
- data/lib/redmine-installer/install.rb +37 -42
- data/lib/redmine-installer/logger.rb +83 -0
- data/lib/redmine-installer/package.rb +180 -0
- data/lib/redmine-installer/patches/ruby.rb +35 -0
- data/lib/redmine-installer/patches/tty.rb +16 -0
- data/lib/redmine-installer/profile.rb +24 -55
- data/lib/redmine-installer/redmine.rb +551 -0
- data/lib/redmine-installer/spec/spec.rb +81 -0
- data/lib/redmine-installer/task.rb +18 -77
- data/lib/redmine-installer/task_module.rb +12 -0
- data/lib/redmine-installer/upgrade.rb +51 -59
- data/lib/redmine-installer/utils.rb +46 -233
- data/lib/redmine-installer/version.rb +2 -4
- data/lib/redmine-installer.rb +69 -56
- data/redmine-installer.gemspec +20 -19
- data/spec/custom_matchers.rb +21 -0
- data/spec/installer_helper.rb +107 -0
- data/spec/installer_process.rb +82 -0
- data/spec/lib/backup_restore_spec.rb +81 -0
- data/spec/lib/install_spec.rb +125 -36
- data/spec/lib/upgrade_spec.rb +73 -52
- data/spec/packages/redmine-3.1.0.zip +0 -0
- data/spec/packages/redmine-3.2.0.zip +0 -0
- data/spec/packages/redmine-3.3.0-bad-migration.zip +0 -0
- data/spec/packages/redmine-3.3.0.zip +0 -0
- data/spec/packages/something-else.zip +0 -0
- data/spec/packages_helper.rb +19 -0
- data/spec/shared_contexts.rb +13 -0
- data/spec/spec_helper.rb +34 -18
- metadata +62 -63
- data/lib/redmine-installer/config_param.rb +0 -100
- data/lib/redmine-installer/error.rb +0 -5
- data/lib/redmine-installer/exec.rb +0 -158
- data/lib/redmine-installer/ext/module.rb +0 -7
- data/lib/redmine-installer/ext/string.rb +0 -15
- data/lib/redmine-installer/git.rb +0 -51
- data/lib/redmine-installer/helper.rb +0 -5
- data/lib/redmine-installer/helpers/generate_config.rb +0 -29
- data/lib/redmine-installer/locales/cs.yml +0 -147
- data/lib/redmine-installer/locales/en.yml +0 -154
- data/lib/redmine-installer/plugin.rb +0 -9
- data/lib/redmine-installer/plugins/base.rb +0 -24
- data/lib/redmine-installer/plugins/database.rb +0 -180
- data/lib/redmine-installer/plugins/email_sending.rb +0 -82
- data/lib/redmine-installer/plugins/redmine_plugin.rb +0 -82
- data/lib/redmine-installer/plugins/web_server.rb +0 -26
- data/lib/redmine-installer/step.rb +0 -16
- data/lib/redmine-installer/steps/backup.rb +0 -125
- data/lib/redmine-installer/steps/base.rb +0 -79
- data/lib/redmine-installer/steps/database_config.rb +0 -15
- data/lib/redmine-installer/steps/email_config.rb +0 -11
- data/lib/redmine-installer/steps/env_check.rb +0 -20
- data/lib/redmine-installer/steps/install.rb +0 -23
- data/lib/redmine-installer/steps/load_package.rb +0 -226
- data/lib/redmine-installer/steps/move_redmine.rb +0 -22
- data/lib/redmine-installer/steps/redmine_root.rb +0 -52
- data/lib/redmine-installer/steps/upgrade.rb +0 -57
- data/lib/redmine-installer/steps/validation.rb +0 -38
- data/lib/redmine-installer/steps/webserver_config.rb +0 -22
- data/spec/load_redmine.rb +0 -24
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
module Redmine::Installer::Step
|
4
|
-
class MoveRedmine < Base
|
5
|
-
|
6
|
-
def up
|
7
|
-
# Move all files from tmp_redmine_root to redmine_root
|
8
|
-
Dir.chdir(base.tmp_redmine_root) do
|
9
|
-
Dir.glob('{*,.*}') do |entry|
|
10
|
-
next if entry.end_with?('.') || entry.end_with?('..')
|
11
|
-
|
12
|
-
FileUtils.mv(entry, base.redmine_root)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def print_footer
|
18
|
-
say '<green>... OK</green>', 1
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'find'
|
2
|
-
|
3
|
-
module Redmine::Installer::Step
|
4
|
-
class RedmineRoot < Base
|
5
|
-
|
6
|
-
CHECK_N_INACCESSIBLE_FILES = 10
|
7
|
-
|
8
|
-
def up
|
9
|
-
# Get redmine root
|
10
|
-
base.redmine_root ||= ask(:path_for_redmine_root, default: '.')
|
11
|
-
|
12
|
-
# Make absolute path
|
13
|
-
base.redmine_root = File.expand_path(base.redmine_root)
|
14
|
-
|
15
|
-
if base.redmine_root == Dir.pwd
|
16
|
-
error "You cannot upgrade current dir. Please go to the different directory."
|
17
|
-
end
|
18
|
-
|
19
|
-
unless Dir.exist?(base.redmine_root)
|
20
|
-
try_create_dir(base.redmine_root)
|
21
|
-
end
|
22
|
-
|
23
|
-
unless File.writable?(base.redmine_root)
|
24
|
-
error t(:dir_is_not_writeable, dir: base.redmine_root)
|
25
|
-
end
|
26
|
-
|
27
|
-
inaccessible_files = []
|
28
|
-
Find.find(base.redmine_root).each do |item|
|
29
|
-
if !File.writable?(item) || !File.readable?(item)
|
30
|
-
inaccessible_files << item
|
31
|
-
end
|
32
|
-
|
33
|
-
if inaccessible_files.size > CHECK_N_INACCESSIBLE_FILES
|
34
|
-
break
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
if inaccessible_files.any?
|
39
|
-
error "Redmine root contains inaccessible files. Make sure that all files in #{base.redmine_root} are readable/writeable. (limit #{CHECK_N_INACCESSIBLE_FILES} files: #{inaccessible_files.join(', ')})"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def save(configuration)
|
44
|
-
configuration['redmine_root'] = base.redmine_root
|
45
|
-
end
|
46
|
-
|
47
|
-
def load(configuration)
|
48
|
-
base.redmine_root = configuration['redmine_root']
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
module Redmine::Installer::Step
|
4
|
-
class Upgrade < Base
|
5
|
-
|
6
|
-
def up
|
7
|
-
# Copy database.yml
|
8
|
-
copy_config_file(plugin::Database::DATABASE_YML_PATH)
|
9
|
-
|
10
|
-
# Copy configuration.yml
|
11
|
-
copy_config_file(plugin::EmailSending::CONFIGURATION_YML_PATH)
|
12
|
-
|
13
|
-
# Copy files
|
14
|
-
FileUtils.cp_r(File.join(base.redmine_root, 'files'), base.tmp_redmine_root)
|
15
|
-
|
16
|
-
# Copy plugins
|
17
|
-
tmp_plugin_dir = File.join(base.tmp_redmine_root, 'plugins')
|
18
|
-
redmine_plugins.each do |plugin|
|
19
|
-
# Copy only plugins which are not part of package
|
20
|
-
# - this is a upgrade so package should contains newer version
|
21
|
-
unless Dir.exist?(File.join(tmp_plugin_dir, File.basename(plugin)))
|
22
|
-
FileUtils.cp_r(plugin, tmp_plugin_dir)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
Dir.chdir(base.tmp_redmine_root) do
|
27
|
-
command.bundle_install(base.env)
|
28
|
-
command.rake_db_migrate(base.env)
|
29
|
-
command.rake_redmine_plugin_migrate(base.env) if some_plugins?
|
30
|
-
command.rake_generate_secret_token(base.env)
|
31
|
-
|
32
|
-
# Other plugins can have post-install procedure
|
33
|
-
plugin::RedminePlugin.all.each do |plugin|
|
34
|
-
plugin.upgrade(base)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
# Delete content of redmine_root
|
39
|
-
Dir.glob(File.join(base.redmine_root, '{*,.*}')) do |entry|
|
40
|
-
next if entry.end_with?('.') || entry.end_with?('..')
|
41
|
-
|
42
|
-
FileUtils.remove_entry_secure(entry)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
def copy_config_file(relative_path)
|
49
|
-
file = File.join(base.redmine_root, relative_path)
|
50
|
-
|
51
|
-
if File.exist?(file)
|
52
|
-
FileUtils.cp(file, File.join(base.tmp_redmine_root, 'config'))
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
57
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# Validate redmine folder
|
3
|
-
#
|
4
|
-
module Redmine::Installer::Step
|
5
|
-
class Validation < Base
|
6
|
-
|
7
|
-
REDMINE_SHOULD_CONTAINS = [
|
8
|
-
'app', 'lib', 'config', 'public', 'db',
|
9
|
-
'Gemfile', 'Rakefile', 'config.ru',
|
10
|
-
File.join('lib', 'redmine'),
|
11
|
-
File.join('lib', 'redmine', 'core_ext'),
|
12
|
-
File.join('lib', 'redmine', 'helpers'),
|
13
|
-
File.join('lib', 'redmine', 'views'),
|
14
|
-
File.join('lib', 'redmine.rb'),
|
15
|
-
].sort
|
16
|
-
|
17
|
-
def up
|
18
|
-
Dir.chdir(base.redmine_root) do
|
19
|
-
@records = Dir.glob(File.join('**', '*')).sort
|
20
|
-
end
|
21
|
-
|
22
|
-
# Is this redmine
|
23
|
-
unless (@records & REDMINE_SHOULD_CONTAINS) == REDMINE_SHOULD_CONTAINS
|
24
|
-
error :error_redmine_not_contains_all, records: REDMINE_SHOULD_CONTAINS.join(', ')
|
25
|
-
end
|
26
|
-
|
27
|
-
# Plugins are in righ dir
|
28
|
-
if @records.select{|x| x.start_with?('vendor/plugins')}.size > 1
|
29
|
-
error :error_plugins_should_be_on_plugins
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def print_footer
|
34
|
-
say '<green>... OK</green>', 1
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Redmine::Installer::Step
|
2
|
-
class WebserverConfig < Base
|
3
|
-
|
4
|
-
def up
|
5
|
-
choices = {}
|
6
|
-
plugin::WebServer.all.each do |m|
|
7
|
-
choices[m] = m.title
|
8
|
-
end
|
9
|
-
choices[nil] = t(:skip)
|
10
|
-
|
11
|
-
answer = choose(:"what_web_server_do_you_want", choices, default: nil)
|
12
|
-
|
13
|
-
# Skip
|
14
|
-
return if answer.nil?
|
15
|
-
|
16
|
-
say("(#{answer.title })", 5)
|
17
|
-
|
18
|
-
say(answer.generate_config(base.redmine_root))
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
data/spec/load_redmine.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'rest_client'
|
2
|
-
|
3
|
-
class LoadRedmine
|
4
|
-
|
5
|
-
def self.files
|
6
|
-
@files ||= []
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.clean
|
10
|
-
files.each(&:unlink)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.get(version)
|
14
|
-
file = Tempfile.new(['redmine', '.zip'])
|
15
|
-
files << file
|
16
|
-
|
17
|
-
file.binmode
|
18
|
-
# file.write RestClient.get("http://www.redmine.org/releases/redmine-#{version}.zip")
|
19
|
-
file.write RestClient.get("http://localhost:5000/redmine-#{version}.zip")
|
20
|
-
file.close
|
21
|
-
file.path
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|