redmine-installer 2.1.3 → 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/redmine-installer/redmine.rb +32 -7
- data/lib/redmine-installer/version.rb +1 -1
- data/spec/installer_process.rb +6 -3
- data/spec/lib/install_spec.rb +17 -3
- data/spec/lib/upgrade_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2fca52362c2073113f2fae44d25c875ad0d3a8107a419306ef52c1f201ed1e6
|
4
|
+
data.tar.gz: 4f7263a4b318f5e240b8523120c064c79fa1585d5e9e4c4656c64a062227bcec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c1888894ac0799c639910e8ff3d39c39c8f3c1245994a87528fd6cc28e30111d215bbe01631a5226a3a5bd55c5737be24bd6f7dbe0b27eb6ca542edeaeeac49
|
7
|
+
data.tar.gz: '0827654c93010b7ae6753508487dd07b88fc85f9f57a525e92603e66c45b81feabfdb929d3ca126801d67df61c3390f0f15c2a0e9d5a191330e2a7aca2b7ea7d'
|
@@ -116,20 +116,45 @@ module RedmineInstaller
|
|
116
116
|
|
117
117
|
logger.info("REDMINE_ROOT: #{@root}")
|
118
118
|
|
119
|
-
|
119
|
+
unreadable_files = []
|
120
|
+
all_directories = []
|
120
121
|
|
121
122
|
Find.find(@root).each do |item|
|
122
|
-
if
|
123
|
-
|
123
|
+
if unreadable_files.size > CHECK_N_INACCESSIBLE_FILES
|
124
|
+
break
|
124
125
|
end
|
125
126
|
|
126
|
-
|
127
|
-
|
127
|
+
# Installer only need read permission for a few files
|
128
|
+
# but for sure it checks all of them
|
129
|
+
if !File.readable?(item)
|
130
|
+
unreadable_files << item
|
131
|
+
next
|
132
|
+
end
|
133
|
+
|
134
|
+
# Actualy this permission should not be needed
|
135
|
+
# becase deletable is checked by parent directory
|
136
|
+
# if !File.writable?(item)
|
137
|
+
# unreadable_files << item
|
138
|
+
# end
|
139
|
+
|
140
|
+
all_directories << File.dirname(item)
|
141
|
+
end
|
142
|
+
|
143
|
+
if unreadable_files.any?
|
144
|
+
error "Application root contains unreadable files. Make sure that all files in #{@root} are readable for user #{env_user} (limit #{CHECK_N_INACCESSIBLE_FILES} files: #{unreadable_files.join(', ')})"
|
145
|
+
end
|
146
|
+
|
147
|
+
unwritable_directories = []
|
148
|
+
|
149
|
+
all_directories.uniq!
|
150
|
+
all_directories.each do |item|
|
151
|
+
if !File.writable?(item)
|
152
|
+
unwritable_directories << item
|
128
153
|
end
|
129
154
|
end
|
130
155
|
|
131
|
-
if
|
132
|
-
error "
|
156
|
+
if unwritable_directories.any?
|
157
|
+
error "Application root contains unwritable directories. Make sure that all directories in #{@root} are writable for user #{env_user} (limit #{CHECK_N_INACCESSIBLE_FILES} files: #{unwritable_directories.join(', ')})"
|
133
158
|
end
|
134
159
|
end
|
135
160
|
|
data/spec/installer_process.rb
CHANGED
@@ -17,7 +17,8 @@ class InstallerProcess
|
|
17
17
|
args << '--bundle-options' << '--without rmagick'
|
18
18
|
end
|
19
19
|
|
20
|
-
@process = ChildProcess.build('bin/redmine', command, *args)
|
20
|
+
# @process = ChildProcess.build('bin/redmine', command, *args)
|
21
|
+
@process = ChildProcess.build('redmine', command, *args)
|
21
22
|
@process.io.stdout = tempfile_out
|
22
23
|
@process.io.stderr = tempfile_err
|
23
24
|
@process.environment['REDMINE_INSTALLER_SPEC'] = '1'
|
@@ -35,8 +36,10 @@ class InstallerProcess
|
|
35
36
|
end
|
36
37
|
|
37
38
|
def run
|
38
|
-
|
39
|
-
|
39
|
+
Bundler.with_clean_env {
|
40
|
+
start
|
41
|
+
yield
|
42
|
+
}
|
40
43
|
ensure
|
41
44
|
stop
|
42
45
|
end
|
data/spec/lib/install_spec.rb
CHANGED
@@ -2,17 +2,32 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
RSpec.describe RedmineInstaller::Install, command: 'install' do
|
4
4
|
|
5
|
-
it '
|
5
|
+
it 'unreadable file', args: [] do
|
6
6
|
FileUtils.chmod(0000, @redmine_root)
|
7
7
|
|
8
8
|
expected_output('Path to redmine root:')
|
9
9
|
write(@redmine_root)
|
10
10
|
|
11
|
-
expected_output('
|
11
|
+
expected_output('Application root contains unreadable files')
|
12
12
|
|
13
13
|
FileUtils.chmod(0600, @redmine_root)
|
14
14
|
end
|
15
15
|
|
16
|
+
it 'unwritable directory', args: [] do
|
17
|
+
directory = File.join(@redmine_root, 'directory')
|
18
|
+
subdirectory = File.join(directory, 'subdirectory')
|
19
|
+
|
20
|
+
FileUtils.mkdir_p(subdirectory)
|
21
|
+
FileUtils.chmod(0444, directory)
|
22
|
+
|
23
|
+
expected_output('Path to redmine root:')
|
24
|
+
write(@redmine_root)
|
25
|
+
|
26
|
+
expected_output('Application root contains unreadable files')
|
27
|
+
|
28
|
+
FileUtils.chmod(0700, directory)
|
29
|
+
end
|
30
|
+
|
16
31
|
it 'non-existinig package', args: [] do
|
17
32
|
this_file = File.expand_path(File.join(File.dirname(__FILE__)))
|
18
33
|
|
@@ -111,7 +126,6 @@ RSpec.describe RedmineInstaller::Install, command: 'install' do
|
|
111
126
|
expected_output('‣ Change database configuration')
|
112
127
|
write('')
|
113
128
|
|
114
|
-
|
115
129
|
go_down
|
116
130
|
expected_output('‣ PostgreSQL')
|
117
131
|
write('')
|
data/spec/lib/upgrade_spec.rb
CHANGED
@@ -10,6 +10,11 @@ RSpec.describe RedmineInstaller::Upgrade, :install_first, command: 'upgrade' do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'upgrading with full backup' do
|
13
|
+
# This should not be a problem because file still could be deleted
|
14
|
+
unwritable_file = File.join(@redmine_root, 'unwritable_file')
|
15
|
+
FileUtils.touch(unwritable_file)
|
16
|
+
FileUtils.chmod(0400, unwritable_file)
|
17
|
+
|
13
18
|
test_test_dir = File.join(@redmine_root, 'test_test')
|
14
19
|
test_test_file = File.join(test_test_dir, 'test.txt')
|
15
20
|
FileUtils.mkdir_p(test_test_dir)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redmine-installer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ondřej Moravčík
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|