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,154 +0,0 @@
|
|
1
|
-
en:
|
2
|
-
redmine_installer_summary: 'Easy way how install/upgrade redmine or plugin.'
|
3
|
-
backup: 'Backup'
|
4
|
-
backup_is_stored_at: 'Backup is stored at <bright>%{dir}</bright>'
|
5
|
-
cannot_download_redmine_version: 'Cannot download redmine %{version}'
|
6
|
-
cli_install_desc: 'Install redmine'
|
7
|
-
cli_show_verbose_output: 'Show verbose output'
|
8
|
-
cli_upgrade_desc: 'Upgrade redmine'
|
9
|
-
cli_backup_desc: 'Backup redmine'
|
10
|
-
cli_flag_source: 'What type is package argument'
|
11
|
-
cli_flag_branch: 'Different branch for git'
|
12
|
-
cli_flag_environment: 'Environment for redmine'
|
13
|
-
command_exit_with_error: 'Command exit with an error: <bright>%{command}</bright>'
|
14
|
-
dir_not_exist_and_cannot_be_created: 'Dir %{dir} does not exist and can not be created'
|
15
|
-
dir_is_not_writeable: 'Dir <bright>%{dir}</bright> is not writeable'
|
16
|
-
do_you_want_repeat_command: 'Do you want repeat this command?'
|
17
|
-
do_you_want_full_backup: 'Do you want full backup?'
|
18
|
-
do_you_want_backup_redmine: 'Do you want backup redmine?'
|
19
|
-
do_you_want_save_step_for_further_use: 'Do you want save steps for further use?'
|
20
|
-
error_redmine_not_contains_all: 'Redmine root does not contains necessary folders: <bright>%{records}</bright>'
|
21
|
-
error_plugins_should_be_on_plugins: 'Plugin shoold be on plugins dir'
|
22
|
-
error_argument_package_is_missing: 'Missing argument: redmine package'
|
23
|
-
error_unsupported_source: 'Unsupported source: %{source}'
|
24
|
-
exit: 'exit'
|
25
|
-
file_not_exist: 'File <bright>%{file}</bright> does not exist'
|
26
|
-
file_must_have_format: 'File <bright>%{file}</bright> must have format: %{formats}'
|
27
|
-
full_backup: 'Full backup'
|
28
|
-
git_repository_cannot_be_clonned: 'Repository cannot be clonned'
|
29
|
-
git_repository_cannot_be_localy_clonned: 'Repository cannot be localy clonned'
|
30
|
-
git_repository_cannot_be_fetched: 'Repository cannot fetch new version'
|
31
|
-
no_t: 'no'
|
32
|
-
only_database: 'Only database'
|
33
|
-
path_for_redmine_root: 'Path for redmine_root'
|
34
|
-
powered_by: 'Powered by EasyRedmine'
|
35
|
-
redmine_downloading: 'Redmine downloading'
|
36
|
-
redmine_was_installed_to: 'Redmine was installed to %{dir}'
|
37
|
-
restoring_database: '... Restoring database'
|
38
|
-
skip: 'Skip'
|
39
|
-
try_again: 'try again'
|
40
|
-
what_dir_for_backups: 'What dir for backups?'
|
41
|
-
what_database_do_you_want: 'What database do you want?'
|
42
|
-
what_web_server_do_you_want: 'What web-server do you want?'
|
43
|
-
yes_t: 'yes'
|
44
|
-
your_profile_can_be_used_as: 'Your profile is saved as #%{id} and can be use with <bright>--profile %{id}</bright>'
|
45
|
-
installer_run_as_root: 'Installer run as root. This can be dangerous. Continue?'
|
46
|
-
terminated_by_user: Terminated by user.
|
47
|
-
|
48
|
-
step:
|
49
|
-
load_package:
|
50
|
-
title: 'Load package'
|
51
|
-
database_config:
|
52
|
-
title: 'Database configuration'
|
53
|
-
email_config:
|
54
|
-
title: 'Email sending configuration'
|
55
|
-
install:
|
56
|
-
title: 'Install'
|
57
|
-
move_redmine:
|
58
|
-
title: 'Moving redmine'
|
59
|
-
webserver_config:
|
60
|
-
title: 'Webserver configuration'
|
61
|
-
validation:
|
62
|
-
title: 'Validation'
|
63
|
-
backup:
|
64
|
-
title: 'Backup'
|
65
|
-
upgrade:
|
66
|
-
title: 'Upgrading'
|
67
|
-
save_profile:
|
68
|
-
title: 'Saving profile'
|
69
|
-
redmine_root:
|
70
|
-
title: 'Getting a redmine root'
|
71
|
-
env_check:
|
72
|
-
title: 'Environment checking'
|
73
|
-
|
74
|
-
plugin:
|
75
|
-
database:
|
76
|
-
mysql:
|
77
|
-
title: 'MySQL'
|
78
|
-
postgresql:
|
79
|
-
title: 'PostgreSQL'
|
80
|
-
emailsending:
|
81
|
-
gmail:
|
82
|
-
title: 'Gmail'
|
83
|
-
sendmail:
|
84
|
-
title: 'Sendmail'
|
85
|
-
smtpfromscratch:
|
86
|
-
title: 'SMTP from scratch'
|
87
|
-
webserver:
|
88
|
-
webrick:
|
89
|
-
title: 'Webrick'
|
90
|
-
configuration: |
|
91
|
-
Webrick is default webserver.
|
92
|
-
Server is ready to start.
|
93
|
-
thin:
|
94
|
-
title: 'Thin'
|
95
|
-
configuration: |
|
96
|
-
Add:
|
97
|
-
<bright>gem 'thin'</bright>
|
98
|
-
|
99
|
-
to <bright>Gemfile.local</bright>
|
100
|
-
|
101
|
-
and run: <bright>bundle install</bright>
|
102
|
-
|
103
|
-
(More informations can be found at http://code.macournoyer.com/thin)
|
104
|
-
apachepassenger:
|
105
|
-
title: 'Passenger (apache)'
|
106
|
-
configuration: |
|
107
|
-
Add this to apache configuration file.
|
108
|
-
|
109
|
-
<bright><VirtualHost *:80>
|
110
|
-
ServerName www.yourhost.com
|
111
|
-
DocumentRoot %{redmine_root}/public
|
112
|
-
<Directory %{redmine_root}/public>
|
113
|
-
# This relaxes Apache security settings.
|
114
|
-
AllowOverride all
|
115
|
-
# MultiViews must be turned off.
|
116
|
-
Options -MultiViews
|
117
|
-
# Uncomment this if you're on Apache >= 2.4:
|
118
|
-
#Require all granted
|
119
|
-
</Directory>
|
120
|
-
</VirtualHost></bright>
|
121
|
-
|
122
|
-
More informations can be found at https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html
|
123
|
-
nginxpassenger:
|
124
|
-
title: 'Passenger (nginx)'
|
125
|
-
configuration: |
|
126
|
-
Add this to nginx configuration file.
|
127
|
-
|
128
|
-
<bright>server {
|
129
|
-
listen 80;
|
130
|
-
server_name www.yourhost.com;
|
131
|
-
root %{redmine_root}/public; # <--- be sure to point to 'public'!
|
132
|
-
passenger_enabled on;
|
133
|
-
}</bright>
|
134
|
-
|
135
|
-
More informations can be found at https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html
|
136
|
-
puma:
|
137
|
-
title: 'Puma'
|
138
|
-
configuration: |
|
139
|
-
Add:
|
140
|
-
<bright>gem 'puma'</bright>
|
141
|
-
|
142
|
-
to <bright>Gemfile.local</bright>
|
143
|
-
|
144
|
-
More informations can be found at http://puma.io
|
145
|
-
redmine_plugin:
|
146
|
-
easyproject:
|
147
|
-
install: 'Easyproject installing'
|
148
|
-
|
149
|
-
command:
|
150
|
-
bundle_install: 'Bundle install'
|
151
|
-
rake_db_create: 'DB creating'
|
152
|
-
rake_db_migrate: 'DB migrating'
|
153
|
-
rake_redmine_plugin_migrate: 'Plugin migrating'
|
154
|
-
rake_generate_secret_token: 'Generate secret token'
|
@@ -1,9 +0,0 @@
|
|
1
|
-
module Redmine::Installer
|
2
|
-
module Plugin
|
3
|
-
autoload :Base, 'redmine-installer/plugins/base'
|
4
|
-
autoload :Database, 'redmine-installer/plugins/database'
|
5
|
-
autoload :EmailSending, 'redmine-installer/plugins/email_sending'
|
6
|
-
autoload :WebServer, 'redmine-installer/plugins/web_server'
|
7
|
-
autoload :RedminePlugin, 'redmine-installer/plugins/redmine_plugin'
|
8
|
-
end
|
9
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module Redmine::Installer::Plugin
|
2
|
-
class Base
|
3
|
-
|
4
|
-
include Redmine::Installer::Utils
|
5
|
-
|
6
|
-
# Register children
|
7
|
-
def self.inherited(child)
|
8
|
-
all << child
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.all
|
12
|
-
unless self.instance_variable_defined?(:@all)
|
13
|
-
self.instance_variable_set(:@all, Array.new)
|
14
|
-
end
|
15
|
-
|
16
|
-
self.instance_variable_get(:@all)
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.title
|
20
|
-
translate("plugin.#{self.superclass.class_name.downcase}.#{self.class_name.downcase}.title")
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
@@ -1,180 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
|
-
module Redmine::Installer::Plugin
|
4
|
-
class Database < Base
|
5
|
-
|
6
|
-
DATABASE_YML_PATH = 'config/database.yml'
|
7
|
-
DATABASE_BACKUP_DIR = '__database'
|
8
|
-
|
9
|
-
attr_reader :params
|
10
|
-
|
11
|
-
def self.load_all(redmine_root)
|
12
|
-
database_file = File.join(redmine_root, DATABASE_YML_PATH)
|
13
|
-
return [] unless File.exist?(database_file)
|
14
|
-
|
15
|
-
to_return = []
|
16
|
-
definitions = YAML.load_file(database_file)
|
17
|
-
definitions.each do |name, data|
|
18
|
-
|
19
|
-
klass = all.detect{|klass| klass.adapter_name == data['adapter']}
|
20
|
-
|
21
|
-
next if klass.nil?
|
22
|
-
|
23
|
-
klass = klass.new
|
24
|
-
klass.load(data)
|
25
|
-
|
26
|
-
to_return << klass
|
27
|
-
end
|
28
|
-
to_return
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.backup_all(redmine_root, backup_dir)
|
32
|
-
load_all(redmine_root).each do |klass|
|
33
|
-
klass.backup(backup_dir)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.restore_all(redmine_root, backup_dir)
|
38
|
-
databases = load_all(redmine_root)
|
39
|
-
databases.uniq! {|d| d.params['database'].value}
|
40
|
-
databases.each do |klass|
|
41
|
-
klass.restore(backup_dir)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def initialize
|
46
|
-
@params = Redmine::Installer::ConfigParams.new
|
47
|
-
@params.add('database')
|
48
|
-
@params.add('host').default('localhost')
|
49
|
-
@params.add('username')
|
50
|
-
@params.add('password').hide(true)
|
51
|
-
@params.add('encoding').default('utf8')
|
52
|
-
end
|
53
|
-
|
54
|
-
# Transform ConfigParams into rails database.yml structure.
|
55
|
-
# Method creates production and developemtn environemnt
|
56
|
-
# with the same parameters.
|
57
|
-
def build
|
58
|
-
data = Hash[@params.map{|p| [p.name, p.value]}]
|
59
|
-
data['adapter'] = self.class.adapter_name
|
60
|
-
data = {
|
61
|
-
'production' => data,
|
62
|
-
'development' => data,
|
63
|
-
}
|
64
|
-
data
|
65
|
-
end
|
66
|
-
|
67
|
-
# Load paramaters for connection
|
68
|
-
def load(data)
|
69
|
-
data.each do |name, value|
|
70
|
-
# Get param
|
71
|
-
param = @params[name]
|
72
|
-
|
73
|
-
# Unsupported key or unnecessary parameter
|
74
|
-
next if param.nil?
|
75
|
-
|
76
|
-
# Save value
|
77
|
-
param.value = value
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def make_config(redmine_root)
|
82
|
-
File.open(File.join(redmine_root, DATABASE_YML_PATH), 'w') do |f|
|
83
|
-
f.puts(YAML.dump(build))
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def file_for_backup(dir)
|
88
|
-
FileUtils.mkdir_p(File.join(dir, DATABASE_BACKUP_DIR))
|
89
|
-
File.join(dir, DATABASE_BACKUP_DIR, "#{self.class.adapter_name}.#{params['database'].value}.dump")
|
90
|
-
end
|
91
|
-
|
92
|
-
def backup(dir)
|
93
|
-
file = file_for_backup(dir)
|
94
|
-
|
95
|
-
# More enviroments can use the same database
|
96
|
-
return if File.exist?(file)
|
97
|
-
|
98
|
-
Kernel.system(command_for_backup(file))
|
99
|
-
end
|
100
|
-
|
101
|
-
def restore(dir)
|
102
|
-
file = file_for_backup(dir)
|
103
|
-
|
104
|
-
# More enviroments can use the same database
|
105
|
-
return unless File.exist?(file)
|
106
|
-
|
107
|
-
Kernel.system(command_for_empty)
|
108
|
-
Kernel.system(command_for_restore(file))
|
109
|
-
end
|
110
|
-
|
111
|
-
# Get valu from param
|
112
|
-
def get(name)
|
113
|
-
params[name].value
|
114
|
-
end
|
115
|
-
|
116
|
-
|
117
|
-
# =========================================================================
|
118
|
-
# MySQL
|
119
|
-
|
120
|
-
class MySQL < Database
|
121
|
-
def self.adapter_name
|
122
|
-
'mysql2'
|
123
|
-
end
|
124
|
-
|
125
|
-
def initialize
|
126
|
-
super
|
127
|
-
@params.add('port').default(3306)
|
128
|
-
end
|
129
|
-
|
130
|
-
def command_args
|
131
|
-
"-h #{params['host'].value} -P #{get('port')} -u #{get('username')} -p#{get('password')} #{get('database')}"
|
132
|
-
end
|
133
|
-
|
134
|
-
def command_for_empty
|
135
|
-
"mysql #{command_args} -e 'drop database #{get('database')}; create database #{get('database')};'"
|
136
|
-
end
|
137
|
-
|
138
|
-
def command_for_backup(file)
|
139
|
-
"mysqldump --add-drop-database #{command_args} > #{file}"
|
140
|
-
end
|
141
|
-
|
142
|
-
def command_for_restore(file)
|
143
|
-
"mysql #{command_args} < #{file}"
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
|
148
|
-
# =========================================================================
|
149
|
-
# PostgreSQL
|
150
|
-
|
151
|
-
class PostgreSQL < Database
|
152
|
-
def self.adapter_name
|
153
|
-
'postgresql'
|
154
|
-
end
|
155
|
-
|
156
|
-
def initialize
|
157
|
-
super
|
158
|
-
@params.add('port').default(5432)
|
159
|
-
end
|
160
|
-
|
161
|
-
def command(comm, file)
|
162
|
-
%{PGPASSWORD="#{get('password')}" #{comm} -i -h #{get('host')} -p #{get('port')} -U #{get('username')} -Fc -f #{file} #{get('database')}}
|
163
|
-
end
|
164
|
-
|
165
|
-
def command_for_empty
|
166
|
-
# %{PGPASSWORD="#{get('password')}" psql -i -h #{get('host')} -p #{get('port')} -U #{get('username')} -c 'drop database #{get('database')}; create database #{get('database')};'}
|
167
|
-
''
|
168
|
-
end
|
169
|
-
|
170
|
-
def command_for_backup(file)
|
171
|
-
command('pg_dump', file)
|
172
|
-
end
|
173
|
-
|
174
|
-
def command_for_restore(file)
|
175
|
-
command('psql', file)
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
end
|
180
|
-
end
|
@@ -1,82 +0,0 @@
|
|
1
|
-
module Redmine::Installer::Plugin
|
2
|
-
class EmailSending < Base
|
3
|
-
|
4
|
-
CONFIGURATION_YML_PATH = 'config/configuration.yml'
|
5
|
-
|
6
|
-
attr_reader :params
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
@params = Redmine::Installer::ConfigParams.new
|
10
|
-
@params.add('user_name')
|
11
|
-
@params.add('password').hide(true)
|
12
|
-
end
|
13
|
-
|
14
|
-
def build
|
15
|
-
{
|
16
|
-
'default' => {
|
17
|
-
'email_delivery' => {
|
18
|
-
'delivery_method' => delivery_method,
|
19
|
-
"#{delivery_method}_settings" => delivery_settings
|
20
|
-
}
|
21
|
-
}
|
22
|
-
}
|
23
|
-
end
|
24
|
-
|
25
|
-
def make_config(redmine_root)
|
26
|
-
File.open(File.join(redmine_root, CONFIGURATION_YML_PATH), 'w') do |f|
|
27
|
-
f.puts(YAML.dump(build))
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def delivery_method
|
32
|
-
:smtp
|
33
|
-
end
|
34
|
-
|
35
|
-
# Build ConfigParams
|
36
|
-
def delivery_settings
|
37
|
-
settings = {}
|
38
|
-
@params.each do |param|
|
39
|
-
next if param.value.empty?
|
40
|
-
settings[param.name] = param.value
|
41
|
-
end
|
42
|
-
settings
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
class Gmail < EmailSending
|
47
|
-
def delivery_settings
|
48
|
-
super.merge({
|
49
|
-
'enable_starttls_auto' => true,
|
50
|
-
'address' => 'smtp.gmail.com',
|
51
|
-
'port' => 587,
|
52
|
-
'domain' => 'smtp.gmail.com',
|
53
|
-
'authentication' => :plain
|
54
|
-
})
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
class SendMail < EmailSending
|
59
|
-
def initialize
|
60
|
-
@params = Redmine::Installer::ConfigParams.new
|
61
|
-
@params.add('location').default('/usr/sbin/sendmail')
|
62
|
-
@params.add('arguments').default('-i -t')
|
63
|
-
end
|
64
|
-
|
65
|
-
def delivery_method
|
66
|
-
:sendmail
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
class SMTPFromScratch < EmailSending
|
71
|
-
def initialize
|
72
|
-
@params = Redmine::Installer::ConfigParams.new
|
73
|
-
@params.add('address')
|
74
|
-
@params.add('port').default(587)
|
75
|
-
@params.add('domain')
|
76
|
-
@params.add('user_name')
|
77
|
-
@params.add('password')
|
78
|
-
@params.add('authentication')
|
79
|
-
@params.add('enable_starttls_auto')
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|