redmine-installer 2.3.2 → 3.0.0

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.
@@ -1,164 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe RedmineInstaller::Install, command: 'install' do
4
-
5
- it 'unreadable file', args: [] do
6
- FileUtils.chmod(0000, @redmine_root)
7
-
8
- expected_output('Path to redmine root:')
9
- write(@redmine_root)
10
-
11
- expected_output('Application root contains unreadable files')
12
-
13
- FileUtils.chmod(0600, @redmine_root)
14
- end
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
-
31
- it 'non-existinig package', args: [] do
32
- this_file = File.expand_path(File.join(File.dirname(__FILE__)))
33
-
34
- expected_output('Path to redmine root:')
35
- write(@redmine_root)
36
-
37
- expected_output('Path to package:')
38
- write(this_file)
39
-
40
- expected_output("File #{this_file} must have format: .zip, .gz, .tgz")
41
- end
42
-
43
- it 'non-existinig zip package', args: [] do
44
- expected_output('Path to redmine root:')
45
- write(@redmine_root)
46
-
47
- expected_output('Path to package:')
48
- write('aaa.zip')
49
-
50
- expected_output("File doesn't exist")
51
- end
52
-
53
- it 'install without arguments', args: [] do
54
- expected_output('Path to redmine root:')
55
- write(@redmine_root)
56
-
57
- expected_output('Path to package:')
58
- write(package_v345)
59
-
60
- expected_output('Extracting redmine package')
61
-
62
- expected_successful_configuration(email: true)
63
- expected_successful_installation
64
-
65
- expected_redmine_version('3.4.5')
66
- expected_email_configuration
67
- end
68
-
69
- it 'download redmine', args: ['v3.4.5'] do
70
- expected_output('Path to redmine root:')
71
- write(@redmine_root)
72
-
73
- expected_output_in('Downloading http://www.redmine.org/releases/redmine-3.4.5.zip', 30)
74
- expected_output('Extracting redmine package')
75
-
76
- expected_successful_configuration
77
- expected_successful_installation
78
-
79
- expected_redmine_version('3.4.5')
80
- end
81
-
82
- it 'installing something else', args: [package_someting_else] do
83
- write(@redmine_root)
84
-
85
- expected_output('is not valid')
86
- end
87
-
88
- it 'bad database settings', args: [package_v345] do
89
- write(@redmine_root)
90
-
91
- expected_output('Creating database configuration')
92
- go_down
93
- expected_output('‣ PostgreSQL')
94
- write('')
95
-
96
- write('test')
97
- write('')
98
- write('testtesttest')
99
- sleep 0.5 # wait for buffer
100
- write(db_password)
101
- write('')
102
- write('')
103
-
104
- expected_output('Creating email configuration')
105
- write('')
106
-
107
- expected_output('Redmine installing')
108
- expected_output_in('--> Database migrating', 60)
109
- expected_output('Migration end with error')
110
- expected_output('‣ Try again')
111
-
112
- go_down
113
- go_down
114
- expected_output('‣ Change database configuration')
115
- write('')
116
-
117
- go_down
118
- expected_output('‣ PostgreSQL')
119
- write('')
120
-
121
- write('test')
122
- write('')
123
- write(db_username)
124
- sleep 0.5 # wait for buffer
125
- write(db_password)
126
- write('')
127
- write('')
128
-
129
- expected_output('--> Database migrating')
130
- expected_output_in('Redmine was installed', 60)
131
-
132
- expected_redmine_version('3.4.5')
133
- end
134
-
135
- it 'high installer version', args: [package_high_installer_version] do
136
- write(@redmine_root)
137
- expected_output('You are using an old version of installer')
138
- end
139
-
140
- it 'download redmine', args: [package_default_db] do
141
- expected_output('Path to redmine root:')
142
- write(@redmine_root)
143
-
144
- expected_successful_configuration
145
- expected_successful_installation(
146
- after_create: proc {
147
- expected_output('Would you like to load default data')
148
-
149
- write('y')
150
- expected_output('Database cleaning')
151
- expected_output('Database restoring')
152
- }
153
- )
154
-
155
- expected_redmine_version('3.4.5')
156
-
157
- Dir.chdir(@redmine_root) do
158
- out = `rails runner "puts Issue.count"`.strip
159
- expect($?.success?).to be_truthy
160
- expect(out).to eq('3')
161
- end
162
- end
163
-
164
- end
@@ -1,201 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe RedmineInstaller::Upgrade, :install_first, command: 'upgrade' do
4
-
5
- it 'bad redmine root', args: [] do
6
- FileUtils.remove_entry(File.join(@redmine_root, 'app'))
7
- write(@redmine_root)
8
-
9
- expected_output("Redmine #{@redmine_root} is not valid.")
10
- end
11
-
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
-
18
- test_test_dir = File.join(@redmine_root, 'test_test')
19
- test_test_file = File.join(test_test_dir, 'test.txt')
20
- FileUtils.mkdir_p(test_test_dir)
21
- FileUtils.touch(test_test_file)
22
-
23
- expect(File.exist?(test_test_file)).to be_truthy
24
-
25
- expected_output('Path to redmine root:')
26
- write(@redmine_root)
27
-
28
- expected_output('Path to package:')
29
- write(package_v345)
30
-
31
- expected_output('Extracting redmine package')
32
- expected_output('Data backup')
33
-
34
- expected_output('‣ Full (redmine root and database)')
35
- select_choice
36
-
37
- expected_output('Where to save backup:')
38
- write(@backup_dir)
39
-
40
- expected_output('Files backuping')
41
- expected_output('Files backed up')
42
- expected_output('Database backuping')
43
- expected_output('Database backed up')
44
-
45
- expected_successful_upgrade
46
-
47
- expected_redmine_version('3.4.5')
48
-
49
- expect(File.exist?(test_test_file)).to be_falsey
50
-
51
- last_backup = Dir.glob(File.join(@backup_dir, '*')).sort.last
52
- backuped = Dir.glob(File.join(last_backup, '*'))
53
-
54
- expect(backuped.map{|f| File.zero?(f) }).to all(be_falsey)
55
- end
56
-
57
- it 'upgrade with no backup and files keeping', args: ['--keep', 'test_test'] do
58
- test_test_dir = File.join(@redmine_root, 'test_test')
59
- test_test_file = File.join(test_test_dir, 'test.txt')
60
- FileUtils.mkdir_p(test_test_dir)
61
- FileUtils.touch(test_test_file)
62
-
63
- expect(File.exist?(test_test_file)).to be_truthy
64
-
65
- wait_for_stdin_buffer
66
- write(@redmine_root)
67
-
68
- wait_for_stdin_buffer
69
- write(package_v345)
70
-
71
- wait_for_stdin_buffer
72
-
73
- go_down
74
- go_down
75
- expected_output('‣ Nothing')
76
- select_choice
77
-
78
- expected_output('Are you sure you dont want backup?')
79
- write('y')
80
-
81
- expected_successful_upgrade
82
-
83
- expected_redmine_version('3.4.5')
84
-
85
- expect(File.exist?(test_test_file)).to be_truthy
86
- end
87
-
88
- it 'copy files with symlink ', args: ['--copy-files-with-symlink'] do
89
- files_dir = File.join(@redmine_root, 'files')
90
- files = (0..10).map {|i| File.join(files_dir, "file_#{i}.txt") }
91
- FileUtils.touch(files)
92
-
93
- wait_for_stdin_buffer
94
- write(@redmine_root)
95
-
96
- wait_for_stdin_buffer
97
- write(package_v345)
98
-
99
- wait_for_stdin_buffer
100
-
101
- go_down
102
- go_down
103
- expected_output('‣ Nothing')
104
- select_choice
105
-
106
- expected_output('Are you sure you dont want backup?')
107
- write('y')
108
-
109
- expected_successful_upgrade
110
-
111
- expected_redmine_version('3.4.5')
112
-
113
- # Not bullet-prof but at least check if files are still there
114
- expect(Dir.glob(File.join(files_dir, '*.txt')).sort).to eq(files.sort)
115
- end
116
-
117
- it 'upgrade rys and modify bundle/index' do
118
- wait_for_stdin_buffer
119
- write(@redmine_root)
120
-
121
- wait_for_stdin_buffer
122
- write(package_v345_rys)
123
-
124
- wait_for_stdin_buffer
125
-
126
- go_down
127
- go_down
128
- expected_output('‣ Nothing')
129
- select_choice
130
-
131
- expected_output('Are you sure you dont want backup?')
132
- write('y')
133
-
134
- expected_successful_upgrade
135
-
136
- expected_redmine_version('3.4.5')
137
-
138
- index = YAML.load_file(File.join(@redmine_root, '.bundle/plugin/index'))
139
-
140
- load_paths = index['load_paths']['rys-bundler']
141
- expect(load_paths.size).to eq(1)
142
-
143
- load_path = load_paths.first
144
- expect(load_path).to start_with(@redmine_root)
145
-
146
- plugin_paths = index['plugin_paths']['rys-bundler']
147
- expect(plugin_paths).to start_with(@redmine_root)
148
- end
149
-
150
- it 'upgrading something else' do
151
- wait_for_stdin_buffer
152
- write(@redmine_root)
153
-
154
- wait_for_stdin_buffer
155
- write(package_someting_else)
156
-
157
- wait_for_stdin_buffer
158
- expected_output('is not valid')
159
- end
160
-
161
- context 'missing plugins' do
162
-
163
- def upgrade_it(answer, result)
164
- # Create some plugins
165
- plugin_name = 'new_plugin'
166
- plugin_dir = File.join(@redmine_root, 'plugins', plugin_name)
167
- FileUtils.mkdir_p(plugin_dir)
168
- FileUtils.touch(File.join(plugin_dir, 'init.rb'))
169
-
170
- wait_for_stdin_buffer
171
- write(@redmine_root)
172
-
173
- wait_for_stdin_buffer
174
- write(package_v345)
175
-
176
- go_down
177
- go_down
178
- expected_output('‣ Nothing')
179
- select_choice
180
- write('y')
181
-
182
- expected_output("Your application contains plugins that are not present in the package (#{plugin_name}). Would you like to copy them?")
183
-
184
- write(answer)
185
- expected_successful_upgrade
186
- expected_redmine_version('3.4.5')
187
-
188
- expect(Dir.exist?(plugin_dir)).to be(result)
189
- end
190
-
191
- it 'yes' do
192
- upgrade_it('y', true)
193
- end
194
-
195
- it 'no' do
196
- upgrade_it('n', false)
197
- end
198
-
199
- end
200
-
201
- end
@@ -1,27 +0,0 @@
1
- module PackagesHelper
2
-
3
- def packages_dir
4
- File.expand_path(File.join(__dir__, 'packages'))
5
- end
6
-
7
- def package_v345
8
- File.join(packages_dir, 'redmine-3.4.5.zip')
9
- end
10
-
11
- def package_v345_rys
12
- File.join(packages_dir, 'redmine-3.4.5-rys.zip')
13
- end
14
-
15
- def package_someting_else
16
- File.join(packages_dir, 'something-else.zip')
17
- end
18
-
19
- def package_high_installer_version
20
- File.join(packages_dir, 'high-installer-version.zip')
21
- end
22
-
23
- def package_default_db
24
- File.join(packages_dir, 'redmine-3.4.5-default-db.zip')
25
- end
26
-
27
- end
@@ -1,13 +0,0 @@
1
- RSpec.shared_context 'run installer' do
2
-
3
- around(:each) do |example|
4
- @process = InstallerProcess.new(example.metadata[:command], example.metadata[:args])
5
- @process.run do
6
- Dir.mktmpdir('redmine_root') do |dir|
7
- @redmine_root = dir
8
- example.run
9
- end
10
- end
11
- end
12
-
13
- end
data/spec/spec_helper.rb DELETED
@@ -1,51 +0,0 @@
1
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../gems.rb', __dir__)
2
-
3
- require 'bundler'
4
- Bundler.require(:default, :development)
5
-
6
- lib = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
7
- $LOAD_PATH.unshift(lib) if !$LOAD_PATH.include?(lib)
8
-
9
- require 'redmine-installer'
10
-
11
- require 'custom_matchers'
12
- require 'shared_contexts'
13
-
14
- require 'installer_process'
15
- require 'installer_helper'
16
- require 'packages_helper'
17
-
18
- RSpec.configure do |config|
19
- config.default_formatter = 'doc'
20
- config.color = true
21
- config.tty = true
22
-
23
- config.disable_monkey_patching!
24
-
25
- config.include_context 'run installer', :command
26
-
27
- config.include PackagesHelper
28
- config.extend PackagesHelper
29
- config.include InstallerHelper
30
-
31
- config.before(:all, :install_first) do
32
- @redmine_root = @origin_redmine = Dir.mktmpdir('redmine_root')
33
- @process = InstallerProcess.new('install', package_v345, @origin_redmine)
34
- @process.run do
35
- expected_successful_configuration
36
- expected_successful_installation
37
-
38
- expected_redmine_version('3.4.5')
39
- end
40
- @backup_dir = Dir.mktmpdir('backup_dir')
41
- end
42
-
43
- config.after(:all, :install_first) do
44
- FileUtils.remove_entry(@origin_redmine)
45
- FileUtils.remove_entry(@backup_dir)
46
- end
47
-
48
- config.before(:each, :install_first) do
49
- FileUtils.cp_r(File.join(@origin_redmine, '.'), @redmine_root)
50
- end
51
- end