redmine-installer 2.3.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dockerignore +8 -0
- data/.gitignore +2 -2
- data/CHANGELOG.md +17 -0
- data/Dockerfile +13 -0
- data/README.md +27 -19
- data/gems.locked +76 -0
- data/gems.rb +1 -0
- data/lib/redmine-installer/cli.rb +30 -10
- data/lib/redmine-installer/command.rb +1 -1
- data/lib/redmine-installer/database.rb +2 -2
- data/lib/redmine-installer/easycheck.rb +1 -1
- data/lib/redmine-installer/environment.rb +14 -2
- data/lib/redmine-installer/package.rb +4 -4
- data/lib/redmine-installer/package_config.rb +1 -1
- data/lib/redmine-installer/profile.rb +2 -2
- data/lib/redmine-installer/redmine.rb +13 -2
- data/lib/redmine-installer/version.rb +3 -1
- data/lib/redmine-installer.rb +1 -1
- data/redmine-installer.gemspec +20 -22
- metadata +58 -45
- data/.travis.yml +0 -7
- data/spec/custom_matchers.rb +0 -21
- data/spec/installer_helper.rb +0 -204
- data/spec/installer_process.rb +0 -94
- data/spec/lib/backup_restore_spec.rb +0 -81
- data/spec/lib/install_spec.rb +0 -164
- data/spec/lib/upgrade_spec.rb +0 -201
- data/spec/packages_helper.rb +0 -27
- data/spec/shared_contexts.rb +0 -13
- data/spec/spec_helper.rb +0 -51
metadata
CHANGED
@@ -1,31 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redmine-installer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ondřej Moravčík
|
8
|
-
|
8
|
+
- Easy Software Ltd.
|
9
|
+
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2022-12-13 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
+
name: bundler
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
18
|
- - ">="
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
+
version: 2.3.7
|
20
21
|
type: :runtime
|
21
22
|
prerelease: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
25
|
- - ">="
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
+
version: 2.3.7
|
27
28
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
29
|
+
name: commander
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
30
31
|
requirements:
|
31
32
|
- - ">="
|
@@ -39,47 +40,61 @@ dependencies:
|
|
39
40
|
- !ruby/object:Gem::Version
|
40
41
|
version: '0'
|
41
42
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
43
|
+
name: pastel
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.8.0
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.8.0
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rubyzip
|
43
58
|
requirement: !ruby/object:Gem::Requirement
|
44
59
|
requirements:
|
45
60
|
- - ">="
|
46
61
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
62
|
+
version: '0'
|
48
63
|
type: :runtime
|
49
64
|
prerelease: false
|
50
65
|
version_requirements: !ruby/object:Gem::Requirement
|
51
66
|
requirements:
|
52
67
|
- - ">="
|
53
68
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
69
|
+
version: '0'
|
55
70
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
71
|
+
name: tty-progressbar
|
57
72
|
requirement: !ruby/object:Gem::Requirement
|
58
73
|
requirements:
|
59
74
|
- - "~>"
|
60
75
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
76
|
+
version: 0.18.2
|
62
77
|
type: :runtime
|
63
78
|
prerelease: false
|
64
79
|
version_requirements: !ruby/object:Gem::Requirement
|
65
80
|
requirements:
|
66
81
|
- - "~>"
|
67
82
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
83
|
+
version: 0.18.2
|
69
84
|
- !ruby/object:Gem::Dependency
|
70
85
|
name: tty-prompt
|
71
86
|
requirement: !ruby/object:Gem::Requirement
|
72
87
|
requirements:
|
73
88
|
- - "~>"
|
74
89
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
90
|
+
version: 0.23.1
|
76
91
|
type: :runtime
|
77
92
|
prerelease: false
|
78
93
|
version_requirements: !ruby/object:Gem::Requirement
|
79
94
|
requirements:
|
80
95
|
- - "~>"
|
81
96
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
97
|
+
version: 0.23.1
|
83
98
|
- !ruby/object:Gem::Dependency
|
84
99
|
name: tty-spinner
|
85
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,19 +110,19 @@ dependencies:
|
|
95
110
|
- !ruby/object:Gem::Version
|
96
111
|
version: 0.8.0
|
97
112
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
113
|
+
name: childprocess
|
99
114
|
requirement: !ruby/object:Gem::Requirement
|
100
115
|
requirements:
|
101
116
|
- - "~>"
|
102
117
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
104
|
-
type: :
|
118
|
+
version: 4.1.0
|
119
|
+
type: :development
|
105
120
|
prerelease: false
|
106
121
|
version_requirements: !ruby/object:Gem::Requirement
|
107
122
|
requirements:
|
108
123
|
- - "~>"
|
109
124
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
125
|
+
version: 4.1.0
|
111
126
|
- !ruby/object:Gem::Dependency
|
112
127
|
name: rake
|
113
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,21 +137,37 @@ dependencies:
|
|
122
137
|
- - ">="
|
123
138
|
- !ruby/object:Gem::Version
|
124
139
|
version: '0'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: rspec
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: 3.11.0
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: 3.11.0
|
125
154
|
description: ''
|
126
155
|
email:
|
127
|
-
-
|
156
|
+
- developers@easysoftware.com
|
128
157
|
executables:
|
129
158
|
- redmine
|
130
159
|
extensions: []
|
131
160
|
extra_rdoc_files: []
|
132
161
|
files:
|
162
|
+
- ".dockerignore"
|
133
163
|
- ".gitignore"
|
134
|
-
- ".travis.yml"
|
135
164
|
- CHANGELOG.md
|
165
|
+
- Dockerfile
|
136
166
|
- LICENSE.txt
|
137
167
|
- README.md
|
138
168
|
- Rakefile
|
139
169
|
- bin/redmine
|
170
|
+
- gems.locked
|
140
171
|
- gems.rb
|
141
172
|
- lib/redmine-installer.rb
|
142
173
|
- lib/redmine-installer/backup.rb
|
@@ -163,45 +194,27 @@ files:
|
|
163
194
|
- lib/redmine-installer/utils.rb
|
164
195
|
- lib/redmine-installer/version.rb
|
165
196
|
- redmine-installer.gemspec
|
166
|
-
- spec/custom_matchers.rb
|
167
|
-
- spec/installer_helper.rb
|
168
|
-
- spec/installer_process.rb
|
169
|
-
- spec/lib/backup_restore_spec.rb
|
170
|
-
- spec/lib/install_spec.rb
|
171
|
-
- spec/lib/upgrade_spec.rb
|
172
|
-
- spec/packages_helper.rb
|
173
|
-
- spec/shared_contexts.rb
|
174
|
-
- spec/spec_helper.rb
|
175
197
|
homepage: https://github.com/easyredmine/redmine-installer
|
176
198
|
licenses:
|
177
199
|
- MIT
|
178
200
|
metadata: {}
|
179
|
-
post_install_message:
|
201
|
+
post_install_message:
|
180
202
|
rdoc_options: []
|
181
203
|
require_paths:
|
182
204
|
- lib
|
183
205
|
required_ruby_version: !ruby/object:Gem::Requirement
|
184
206
|
requirements:
|
185
|
-
- -
|
207
|
+
- - '='
|
186
208
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
209
|
+
version: 3.1.2
|
188
210
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
211
|
requirements:
|
190
212
|
- - ">="
|
191
213
|
- !ruby/object:Gem::Version
|
192
214
|
version: '0'
|
193
215
|
requirements: []
|
194
|
-
rubygems_version: 3.
|
195
|
-
signing_key:
|
216
|
+
rubygems_version: 3.3.22
|
217
|
+
signing_key:
|
196
218
|
specification_version: 4
|
197
219
|
summary: Easy way how install/upgrade Redmine, EasyRedmine or EasyProject.
|
198
|
-
test_files:
|
199
|
-
- spec/custom_matchers.rb
|
200
|
-
- spec/installer_helper.rb
|
201
|
-
- spec/installer_process.rb
|
202
|
-
- spec/lib/backup_restore_spec.rb
|
203
|
-
- spec/lib/install_spec.rb
|
204
|
-
- spec/lib/upgrade_spec.rb
|
205
|
-
- spec/packages_helper.rb
|
206
|
-
- spec/shared_contexts.rb
|
207
|
-
- spec/spec_helper.rb
|
220
|
+
test_files: []
|
data/.travis.yml
DELETED
data/spec/custom_matchers.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'rspec/expectations'
|
2
|
-
|
3
|
-
RSpec::Matchers.define :have_output do |text|
|
4
|
-
match do |process|
|
5
|
-
expect(process.get(text)).to include(text)
|
6
|
-
end
|
7
|
-
|
8
|
-
failure_message do |process|
|
9
|
-
"expected that \"#{process.last_get_return}\" would contains: #{text}"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
RSpec::Matchers.define :have_output_in do |text, second|
|
14
|
-
match do |process|
|
15
|
-
expect(process.get(text, max_wait: second)).to include(text)
|
16
|
-
end
|
17
|
-
|
18
|
-
failure_message do |process|
|
19
|
-
"expected that \"#{process.last_get_return}\" would contains: #{text} in #{second}s"
|
20
|
-
end
|
21
|
-
end
|
data/spec/installer_helper.rb
DELETED
@@ -1,204 +0,0 @@
|
|
1
|
-
module InstallerHelper
|
2
|
-
|
3
|
-
def db_username
|
4
|
-
ENV['SPEC_DB_USERNAME'].to_s
|
5
|
-
end
|
6
|
-
|
7
|
-
def db_password
|
8
|
-
ENV['SPEC_DB_PASSWORD'].to_s
|
9
|
-
end
|
10
|
-
|
11
|
-
def expected_output(text)
|
12
|
-
expect(@process).to have_output(text)
|
13
|
-
end
|
14
|
-
|
15
|
-
def expected_output_in(text, max_wait)
|
16
|
-
expect(@process).to have_output_in(text, max_wait)
|
17
|
-
end
|
18
|
-
|
19
|
-
def write(text)
|
20
|
-
@process.write(text + "\n")
|
21
|
-
end
|
22
|
-
|
23
|
-
# Be carefull - this could have later unpredictable consequences on stdin
|
24
|
-
def select_choice
|
25
|
-
# @process.write(' ')
|
26
|
-
@process.write("\r")
|
27
|
-
# @process.write("\r\n")
|
28
|
-
end
|
29
|
-
|
30
|
-
def go_up
|
31
|
-
@process.write("\e[A")
|
32
|
-
end
|
33
|
-
|
34
|
-
def go_down
|
35
|
-
# write(TTY::Reader::Keys.keys[:down])
|
36
|
-
# write("\e[B")
|
37
|
-
@process.write("\e[B")
|
38
|
-
end
|
39
|
-
|
40
|
-
def email_username
|
41
|
-
'username'
|
42
|
-
end
|
43
|
-
|
44
|
-
def email_password
|
45
|
-
'password'
|
46
|
-
end
|
47
|
-
|
48
|
-
def email_address
|
49
|
-
'address'
|
50
|
-
end
|
51
|
-
|
52
|
-
def email_port
|
53
|
-
'123'
|
54
|
-
end
|
55
|
-
|
56
|
-
def email_domain
|
57
|
-
'domain'
|
58
|
-
end
|
59
|
-
|
60
|
-
def email_authentication
|
61
|
-
'plain'
|
62
|
-
end
|
63
|
-
|
64
|
-
def email_openssl_verify_mode
|
65
|
-
'none'
|
66
|
-
end
|
67
|
-
|
68
|
-
def email_enable_tls
|
69
|
-
false
|
70
|
-
end
|
71
|
-
|
72
|
-
def email_enable_starttls
|
73
|
-
true
|
74
|
-
end
|
75
|
-
|
76
|
-
def expected_successful_configuration(email: false)
|
77
|
-
expected_output('Creating database configuration')
|
78
|
-
expected_output('What database do you want use?')
|
79
|
-
expected_output('‣ MySQL')
|
80
|
-
|
81
|
-
go_down
|
82
|
-
expected_output('‣ PostgreSQL')
|
83
|
-
select_choice
|
84
|
-
|
85
|
-
expected_output('Database:')
|
86
|
-
write('test')
|
87
|
-
|
88
|
-
expected_output('Host: (localhost)')
|
89
|
-
write('')
|
90
|
-
|
91
|
-
expected_output('Username:')
|
92
|
-
write(db_username)
|
93
|
-
|
94
|
-
expected_output('Password:')
|
95
|
-
write(db_password)
|
96
|
-
|
97
|
-
expected_output('Encoding: (utf8)')
|
98
|
-
write('')
|
99
|
-
|
100
|
-
expected_output('Port: (5432)')
|
101
|
-
write('')
|
102
|
-
|
103
|
-
expected_output('Creating email configuration')
|
104
|
-
expected_output('Which service to use for email sending?')
|
105
|
-
|
106
|
-
if email
|
107
|
-
go_up
|
108
|
-
go_up
|
109
|
-
go_up
|
110
|
-
expected_output('‣ Custom configuration (SMTP)')
|
111
|
-
select_choice
|
112
|
-
|
113
|
-
expected_output('Username:')
|
114
|
-
write(email_username)
|
115
|
-
|
116
|
-
expected_output('Password:')
|
117
|
-
write(email_password)
|
118
|
-
|
119
|
-
expected_output('Address:')
|
120
|
-
write(email_address)
|
121
|
-
|
122
|
-
expected_output('Port:')
|
123
|
-
write(email_port)
|
124
|
-
|
125
|
-
expected_output('Domain:')
|
126
|
-
write(email_domain)
|
127
|
-
|
128
|
-
expected_output('Authentication:')
|
129
|
-
write(email_authentication)
|
130
|
-
|
131
|
-
expected_output('Openssl verify mode:')
|
132
|
-
write(email_openssl_verify_mode)
|
133
|
-
|
134
|
-
expected_output('Enable tls?: (y/N)')
|
135
|
-
write(email_enable_tls ? 'y' : 'n')
|
136
|
-
|
137
|
-
expected_output('Enable starttls?: (Y/n)')
|
138
|
-
write(email_enable_starttls ? 'y' : 'n')
|
139
|
-
else
|
140
|
-
expected_output('‣ Nothing')
|
141
|
-
select_choice
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
def expected_successful_installation_or_upgrade(db_creating: false, after_create: nil)
|
146
|
-
expected_output_in('--> Bundle install', 50)
|
147
|
-
expected_output_in('--> Database creating', 50) if db_creating
|
148
|
-
after_create && after_create.call
|
149
|
-
expected_output_in('--> Database migrating', 50)
|
150
|
-
expected_output_in('--> Plugins migration', 50)
|
151
|
-
expected_output_in('--> Generating secret token', 50)
|
152
|
-
|
153
|
-
expected_output('Cleaning root ... OK')
|
154
|
-
expected_output('Moving redmine to target directory ... OK')
|
155
|
-
expected_output('Cleanning up ... OK')
|
156
|
-
expected_output('Moving installer log ... OK')
|
157
|
-
end
|
158
|
-
|
159
|
-
def expected_successful_installation(**options)
|
160
|
-
expected_output('Redmine installing')
|
161
|
-
expected_successful_installation_or_upgrade(db_creating: true, **options)
|
162
|
-
expected_output('Redmine was installed')
|
163
|
-
end
|
164
|
-
|
165
|
-
def expected_successful_upgrade
|
166
|
-
expected_output('Redmine upgrading')
|
167
|
-
expected_successful_installation_or_upgrade
|
168
|
-
expected_output('Redmine was upgraded')
|
169
|
-
|
170
|
-
expected_output('Do you want save steps for further use?')
|
171
|
-
write('n')
|
172
|
-
end
|
173
|
-
|
174
|
-
def expected_redmine_version(version)
|
175
|
-
Dir.chdir(@redmine_root) do
|
176
|
-
out = `rails runner "puts Redmine::VERSION.to_s"`
|
177
|
-
expect($?.success?).to be_truthy
|
178
|
-
expect(out).to include(version)
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
def expected_email_configuration
|
183
|
-
Dir.chdir(@redmine_root) do
|
184
|
-
configuration = YAML.load_file('config/configuration.yml')['default']['email_delivery']
|
185
|
-
smtp_settings = configuration['smtp_settings']
|
186
|
-
|
187
|
-
expect(configuration['delivery_method']).to eq(:smtp)
|
188
|
-
expect(smtp_settings['address']).to eq(email_address)
|
189
|
-
expect(smtp_settings['port']).to eq(email_port.to_i)
|
190
|
-
expect(smtp_settings['authentication']).to eq(email_authentication.to_sym)
|
191
|
-
expect(smtp_settings['domain']).to eq(email_domain)
|
192
|
-
expect(smtp_settings['user_name']).to eq(email_username)
|
193
|
-
expect(smtp_settings['password']).to eq(email_password)
|
194
|
-
expect(smtp_settings['tls']).to eq(email_enable_tls)
|
195
|
-
expect(smtp_settings['enable_starttls_auto']).to eq(email_enable_starttls)
|
196
|
-
expect(smtp_settings['openssl_verify_mode']).to eq(email_openssl_verify_mode)
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
def wait_for_stdin_buffer
|
201
|
-
sleep 0.5
|
202
|
-
end
|
203
|
-
|
204
|
-
end
|
data/spec/installer_process.rb
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
require 'childprocess'
|
2
|
-
|
3
|
-
class InstallerProcess
|
4
|
-
|
5
|
-
attr_reader :stdout, :last_get_return
|
6
|
-
|
7
|
-
def initialize(command, *args)
|
8
|
-
tempfile_out = File.open('redmine-installer-out', 'w')
|
9
|
-
tempfile_err = File.open('redmine-installer-err', 'w')
|
10
|
-
|
11
|
-
tempfile_out.sync = true
|
12
|
-
tempfile_err.sync = true
|
13
|
-
|
14
|
-
args = args.flatten.compact
|
15
|
-
|
16
|
-
if ['install', 'upgrade'].include?(command)
|
17
|
-
args << '--bundle-options' << '--without rmagick'
|
18
|
-
end
|
19
|
-
|
20
|
-
redmine_bin_file = File.expand_path('../bin/redmine', __dir__)
|
21
|
-
|
22
|
-
@process = ChildProcess.build(redmine_bin_file, command, *args)
|
23
|
-
# @process = ChildProcess.build('bin/redmine', command, *args)
|
24
|
-
# @process = ChildProcess.build('redmine', command, *args)
|
25
|
-
@process.io.stdout = tempfile_out
|
26
|
-
@process.io.stderr = tempfile_err
|
27
|
-
@process.environment['REDMINE_INSTALLER_SPEC'] = '1'
|
28
|
-
@process.environment['REDMINE_INSTALLER_LOGFILE'] = File.expand_path(File.join(File.dirname(__FILE__), '..', 'log.log'))
|
29
|
-
@process.duplex = true
|
30
|
-
@process.detach = true
|
31
|
-
|
32
|
-
# Because of file description is shared with redmine installer
|
33
|
-
# so changing posiiotn has effect fot both processes
|
34
|
-
@stdout = File.open(tempfile_out.path)
|
35
|
-
|
36
|
-
@last_get_return = ''
|
37
|
-
@buffer = ''
|
38
|
-
@seek = 0
|
39
|
-
end
|
40
|
-
|
41
|
-
def run
|
42
|
-
Bundler.with_clean_env {
|
43
|
-
start
|
44
|
-
yield
|
45
|
-
}
|
46
|
-
ensure
|
47
|
-
stop
|
48
|
-
end
|
49
|
-
|
50
|
-
def start
|
51
|
-
@process.start
|
52
|
-
end
|
53
|
-
|
54
|
-
def stop
|
55
|
-
@process.stop
|
56
|
-
end
|
57
|
-
|
58
|
-
def write(text)
|
59
|
-
@process.io.stdin << text
|
60
|
-
|
61
|
-
# @process.io.stdin.puts(text)
|
62
|
-
# @process.io.stdin.flush
|
63
|
-
|
64
|
-
# @process.io.stdin.syswrite(text + "\n")
|
65
|
-
# @process.io.stdin.flush
|
66
|
-
|
67
|
-
# @process.io.stdin.write_nonblock(text + "\n")
|
68
|
-
end
|
69
|
-
|
70
|
-
def get(*args)
|
71
|
-
@last_get_return = _get(*args)
|
72
|
-
end
|
73
|
-
|
74
|
-
private
|
75
|
-
|
76
|
-
# max_wait in s
|
77
|
-
def _get(text, max_wait: 10)
|
78
|
-
wait_to = Time.now + max_wait
|
79
|
-
while Time.now < wait_to
|
80
|
-
@buffer << @stdout.read
|
81
|
-
index = @buffer.rindex(text)
|
82
|
-
|
83
|
-
if index
|
84
|
-
break
|
85
|
-
# return @buffer.slice!(0, index+text.size)
|
86
|
-
else
|
87
|
-
sleep 0.5
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
@buffer
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
DATABASE_DUMP = File.join(Dir.tmpdir, 'redmine_installer_database_backup.sql')
|
4
|
-
|
5
|
-
RSpec.describe 'RedmineInstaller backup / restore', order: :defined do
|
6
|
-
|
7
|
-
let(:project_count) { 5 }
|
8
|
-
|
9
|
-
it 'create backup', :install_first, command: 'backup' do
|
10
|
-
# First ensure `project_count` project
|
11
|
-
Dir.chdir(@redmine_root) do
|
12
|
-
out = `rails runner "
|
13
|
-
Project.delete_all
|
14
|
-
|
15
|
-
#{project_count}.times do |i|
|
16
|
-
p = Project.new
|
17
|
-
p.name = 'Test ' + i.to_s
|
18
|
-
p.identifier = 'test_' + i.to_s
|
19
|
-
p.save(validate: false)
|
20
|
-
end
|
21
|
-
|
22
|
-
puts Project.count
|
23
|
-
"`
|
24
|
-
|
25
|
-
expect($?.success?).to be_truthy
|
26
|
-
expect(out.to_i).to eq(project_count)
|
27
|
-
end
|
28
|
-
|
29
|
-
# Backup database
|
30
|
-
expected_output('Path to redmine root:')
|
31
|
-
write(@redmine_root)
|
32
|
-
expected_output('Data backup')
|
33
|
-
go_down
|
34
|
-
expected_output('‣ Only database')
|
35
|
-
select_choice
|
36
|
-
expected_output('Where to save backup:')
|
37
|
-
write(@backup_dir)
|
38
|
-
expected_output('Database backuping')
|
39
|
-
expected_output('Database backed up')
|
40
|
-
|
41
|
-
# Ensure 0 project (database is shared with all tests)
|
42
|
-
Dir.chdir(@redmine_root) do
|
43
|
-
out = `rails runner "
|
44
|
-
Project.delete_all
|
45
|
-
puts Project.count
|
46
|
-
"`
|
47
|
-
|
48
|
-
expect($?.success?).to be_truthy
|
49
|
-
expect(out.to_i).to eq(0)
|
50
|
-
end
|
51
|
-
|
52
|
-
# Save backup (after test end - all backup will be deleted)
|
53
|
-
dump = Dir.glob(File.join(@backup_dir, '*', '*')).last
|
54
|
-
expect(dump).to end_with('test.sql')
|
55
|
-
|
56
|
-
FileUtils.rm_f(DATABASE_DUMP)
|
57
|
-
FileUtils.cp(dump, DATABASE_DUMP)
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'restore', command: 'install', args: [package_v345, '--database-dump', DATABASE_DUMP] do
|
61
|
-
expected_output('Path to redmine root:')
|
62
|
-
write(@redmine_root)
|
63
|
-
|
64
|
-
expected_successful_configuration
|
65
|
-
|
66
|
-
expected_output('Database dump will be loaded.')
|
67
|
-
expected_output('‣ Skip dump loading')
|
68
|
-
|
69
|
-
go_down
|
70
|
-
expected_output('‣ I am aware of this.')
|
71
|
-
select_choice
|
72
|
-
|
73
|
-
expected_output_in('Redmine was installed', 500)
|
74
|
-
|
75
|
-
Dir.chdir(@redmine_root) do
|
76
|
-
out = `rails runner "puts Project.count"`
|
77
|
-
expect(out.to_i).to eq(project_count)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|