redmine-installer 2.1.3 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7500e6a34d0f24f23278c108421b7528da2fa5e603622dd0eca7951edd64a44
4
- data.tar.gz: '09f3708353e33358a19e9fc868c751d8b0affa0d29cf18edddcffd57a8a614db'
3
+ metadata.gz: e2fca52362c2073113f2fae44d25c875ad0d3a8107a419306ef52c1f201ed1e6
4
+ data.tar.gz: 4f7263a4b318f5e240b8523120c064c79fa1585d5e9e4c4656c64a062227bcec
5
5
  SHA512:
6
- metadata.gz: b40c8c8e8bc3e5e15bef62f038851a248cb3ab8fa1128ccbedcc4866a976e3670c818304d1e653b4747477c2fc62bec0998a6ac49311a0c757db5ef11c2c1d44
7
- data.tar.gz: 9907445abb7761c17cc41755b0f3a7a681cf73575686486b1836c81ef7487c8749dd1e7a270ba06d7e29c59ed70b5736997a214fdcaed494bad4fcd3705e6046
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
- inaccessible_files = []
119
+ unreadable_files = []
120
+ all_directories = []
120
121
 
121
122
  Find.find(@root).each do |item|
122
- if !File.writable?(item) || !File.readable?(item)
123
- inaccessible_files << item
123
+ if unreadable_files.size > CHECK_N_INACCESSIBLE_FILES
124
+ break
124
125
  end
125
126
 
126
- if inaccessible_files.size > CHECK_N_INACCESSIBLE_FILES
127
- break
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 inaccessible_files.any?
132
- error "Redmine root contains inaccessible files. Make sure that all files in #{@root} are readable/writeable for user #{env_user} (limit #{CHECK_N_INACCESSIBLE_FILES} files: #{inaccessible_files.join(', ')})"
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
 
@@ -1,3 +1,3 @@
1
1
  module RedmineInstaller
2
- VERSION = '2.1.3'
2
+ VERSION = '2.1.4'
3
3
  end
@@ -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
- start
39
- yield
39
+ Bundler.with_clean_env {
40
+ start
41
+ yield
42
+ }
40
43
  ensure
41
44
  stop
42
45
  end
@@ -2,17 +2,32 @@ require 'spec_helper'
2
2
 
3
3
  RSpec.describe RedmineInstaller::Install, command: 'install' do
4
4
 
5
- it 'bad permission', args: [] do
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('Redmine root contains inaccessible files')
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('')
@@ -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.3
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-08-20 00:00:00.000000000 Z
11
+ date: 2018-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander