redmine-installer 2.2.7 → 2.3.0.beta

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: 442c2401c5d539b505972aea53825e4c4fb1cabc164a5872d339d424626cc5a3
4
- data.tar.gz: abe111e9299aee2213a67be19bd71b05b5089b6e06d6e7168f008ab607e57190
3
+ metadata.gz: d94674fa60f2209607eb93d0d61fa089720de8bef92776d795d27692d4b54a2f
4
+ data.tar.gz: f8ab75a7abee89a142261a5d2ffe32b3ff28df1bf620012062a8da5cede7f033
5
5
  SHA512:
6
- metadata.gz: 8d5131a3289953a8f7dee7b65ddb8ea2eb83f846b69f6bdef3c6d84f52587891cc2370e50cf7a3d7f68f2a9b35b1cac847f743816558a80bc557b1e5dd80e7d8
7
- data.tar.gz: 8efdddf3a50d8ea3179a75f11166cea67b5e76ea471717290501bd73cc370775fa909c412fd0095db99166249f33be94e86cd9abaa8684c4f45c5205b587ede4
6
+ metadata.gz: 1413b109d141ec1a6be72921c2b0172a42685a7b82a33b75b85be6c2409a3a515c48940cc74ba697005d44cfa426a8588f2b1a23c00ed2a4585bead56b4995dc
7
+ data.tar.gz: 379b682c95ae9f978a34d7ea516e2f97cb356d6b6c28a2e6a5b4c521ba2b26f61e71d1fcc5a62a2765cb36530804d9639ccc9d4dc636598e0f7978710188062e
data/.gitignore CHANGED
@@ -27,3 +27,4 @@ test/*
27
27
  /redmine-installer-err
28
28
  /redmine-installer-out
29
29
  /redmine
30
+ /gems.locked
data/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ ## [2.3.0.beta] - 2019-06-10
4
+
5
+ ### Added
6
+ - Gems are required via Bundler
7
+ - Easycheck for server requirenments
8
+ - Validation for the package for upgrading
9
+
10
+ ### Changed
11
+ - Gemfile was renamed to gems.rb
12
+ - Installer is now asking if user wants to copy missing plugins
13
+ - Tests aren't using system redmine-installer
14
+
15
+ ### Deprecated
16
+ - Ruby <= 2.3
17
+
18
+ ### Removed
19
+
20
+ ### Fixed
21
+
22
+ ### Security
23
+
data/bin/redmine CHANGED
@@ -1,5 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../gems.rb', __dir__)
4
+
5
+ require 'bundler'
6
+ Bundler.require(:default)
7
+
3
8
  lib = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
4
9
  $LOAD_PATH.unshift(lib) if !$LOAD_PATH.include?(lib)
5
10
 
@@ -3,6 +3,8 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in redmine-installer.gemspec
4
4
  gemspec
5
5
 
6
- gem 'pry'
7
- gem 'rspec'
8
- gem 'childprocess'
6
+ group :development, :test do
7
+ gem 'pry'
8
+ gem 'rspec'
9
+ gem 'childprocess'
10
+ end
@@ -20,7 +20,10 @@ module RedmineInstaller
20
20
  global_option('-d', '--debug', 'Logging message to stdout'){ $DEBUG = true }
21
21
  global_option('-s', '--silent', 'Be less version in output') { $SILENT_MODE = true }
22
22
  global_option('-e', '--env', 'For backward compatibility. Production is now always use.')
23
- global_option('--skip-old-modifications', 'For backward compatibility. Missing modifications are now always copied.')
23
+ global_option('--run-easycheck', 'Run easycheck.sh from https://github.com/easyredmine/easy_server_requirements_check') do
24
+ RedmineInstaller::Easycheck.run
25
+ end
26
+
24
27
  default_command :help
25
28
 
26
29
 
@@ -13,6 +13,12 @@ module RedmineInstaller
13
13
  end
14
14
 
15
15
  def run
16
+ Bundler.with_clean_env do
17
+ run!
18
+ end
19
+ end
20
+
21
+ def run!
16
22
  success = false
17
23
 
18
24
  logger.std("--> #{cmd}")
@@ -0,0 +1,27 @@
1
+ require 'open3'
2
+
3
+ module RedmineInstaller
4
+ class Easycheck
5
+ extend Utils
6
+
7
+ EASYCHECK_SH = 'https://raw.githubusercontent.com/easyredmine/easy_server_requirements_check/master/easycheck.sh'
8
+
9
+ def self.run
10
+ if Kernel.system('which', 'wget')
11
+ Open3.pipeline(['wget', EASYCHECK_SH, '-O', '-', '--quiet'], 'bash')
12
+
13
+ elsif Kernel.system('which', 'curl')
14
+ Open3.pipeline(['curl', EASYCHECK_SH, '--output', '-', '--silent'], 'bash')
15
+
16
+ else
17
+ error 'Neither wget nor curl was found'
18
+ end
19
+
20
+ puts
21
+ if !prompt.yes?('Continue?')
22
+ error 'Canceled'
23
+ end
24
+ end
25
+
26
+ end
27
+ end
@@ -17,11 +17,13 @@ module RedmineInstaller
17
17
  @temp_redmine.valid_options
18
18
  @environment.check
19
19
  @target_redmine.ensure_and_valid_root
20
+
20
21
  @package.ensure_and_valid_package
21
22
  @package.extract
22
23
 
23
24
  @temp_redmine.root = @package.redmine_root
24
25
  @package_config.check_version
26
+ @temp_redmine.validate
25
27
 
26
28
  @temp_redmine.create_database_yml
27
29
  @temp_redmine.create_configuration_yml
@@ -395,11 +395,12 @@ module RedmineInstaller
395
395
  logger.info('Important files was copyied')
396
396
  end
397
397
 
398
- # New package may not have all plugins
399
- #
400
- def copy_missing_plugins_from(other_redmine)
401
- # Copy missing redmine plugins
402
- Dir.chdir(other_redmine.plugins_path) do
398
+ def yield_missing_plugins(source_directory, target_directory)
399
+ if !Dir.exist?(source_directory)
400
+ return
401
+ end
402
+
403
+ Dir.chdir(source_directory) do
403
404
  Dir.entries('.').each do |plugin|
404
405
  next if plugin == '.' || plugin == '..'
405
406
 
@@ -408,28 +409,44 @@ module RedmineInstaller
408
409
  next
409
410
  end
410
411
 
411
- to = File.join(plugins_path, plugin)
412
+ to = File.join(target_directory, plugin)
412
413
 
413
414
  # Plugins does not exist
414
415
  unless Dir.exist?(to)
415
- FileUtils.cp_r(plugin, to)
416
+ yield File.expand_path(plugin), File.expand_path(to)
416
417
  end
417
418
  end
418
419
  end
420
+ end
419
421
 
420
- # Copy missing client modification plugin
421
- if easyproject?
422
- old_modifications = Dir.glob(File.join(other_redmine.easy_plugins_path, 'modification_*'))
423
- old_modifications.each do |old_modification_path|
424
- next if !File.directory?(old_modification_path)
422
+ # New package may not have all plugins
423
+ #
424
+ def copy_missing_plugins_from(other_redmine)
425
+ missing = []
425
426
 
426
- basename = File.basename(old_modification_path)
427
+ yield_missing_plugins(other_redmine.plugins_path, plugins_path) do |from, to|
428
+ missing << [from, to]
429
+ end
430
+
431
+ yield_missing_plugins(other_redmine.easy_plugins_path, easy_plugins_path) do |from, to|
432
+ missing << [from, to]
433
+ end
427
434
 
428
- new_modification_path = File.join(easy_plugins_path, basename)
429
- next if File.exist?(new_modification_path)
435
+ missing_plugin_names = missing.map{|(from, to)| File.basename(from) }
436
+ logger.info("Missing plugins: #{missing_plugin_names.join(', ')}")
430
437
 
431
- FileUtils.cp_r(old_modification_path, new_modification_path)
432
- end
438
+ if missing.empty?
439
+ return
440
+ end
441
+
442
+ puts
443
+ if !prompt.yes?("Your application contains plugins that are not present in the package (#{missing_plugin_names.join(', ')}). Would you like to copy them?")
444
+ return
445
+ end
446
+
447
+ missing.each do |(from, to)|
448
+ FileUtils.cp_r(from, to)
449
+ logger.info("Copied #{from} to #{to}")
433
450
  end
434
451
  end
435
452
 
@@ -438,7 +455,7 @@ module RedmineInstaller
438
455
  Dir.chdir(root) do
439
456
  REQUIRED_FILES.each do |path|
440
457
  unless File.exist?(path)
441
- error "Redmine #{root} is not valid. Missing #{path}."
458
+ error "Redmine #{root} is not valid. Directory '#{path}' is missing."
442
459
  end
443
460
  end
444
461
  end
@@ -20,6 +20,7 @@ module RedmineInstaller
20
20
 
21
21
  @temp_redmine.root = @package.redmine_root
22
22
  @package_config.check_version
23
+ @temp_redmine.validate
23
24
 
24
25
  @target_redmine.make_backup
25
26
 
@@ -1,3 +1,3 @@
1
1
  module RedmineInstaller
2
- VERSION = '2.2.7'
2
+ VERSION = '2.3.0.beta'
3
3
  end
@@ -29,6 +29,7 @@ module RedmineInstaller
29
29
  autoload :Backup, 'redmine-installer/backup'
30
30
  autoload :RestoreDB, 'redmine-installer/restore_db'
31
31
  autoload :PackageConfig, 'redmine-installer/package_config'
32
+ autoload :Easycheck, 'redmine-installer/easycheck'
32
33
 
33
34
  # Settings
34
35
  MIN_SUPPORTED_RUBY = '2.3.0'
@@ -53,7 +54,7 @@ module RedmineInstaller
53
54
  /_/ \\__/\\_,_/_/_/_/_/_//_/\\__/
54
55
 
55
56
 
56
- Powered by EasyRedmine
57
+ Powered by EasySoftware
57
58
 
58
59
  PRINT
59
60
  end
@@ -16,14 +16,14 @@ Gem::Specification.new do |spec|
16
16
  spec.license = 'MIT'
17
17
 
18
18
  files = `git ls-files -z`.split("\x0")
19
- files.delete_if{|f| f.start_with?('spec/packages/') }
19
+ files.delete_if {|f| f.start_with?('spec/packages/') }
20
20
 
21
21
  spec.files = files
22
22
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
23
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
24
24
  spec.require_paths = ['lib']
25
25
 
26
- spec.required_ruby_version = '>= 2.1.0'
26
+ spec.required_ruby_version = '>= 2.3.0'
27
27
 
28
28
  spec.add_runtime_dependency 'commander'
29
29
  spec.add_runtime_dependency 'rubyzip'
@@ -17,8 +17,11 @@ class InstallerProcess
17
17
  args << '--bundle-options' << '--without rmagick'
18
18
  end
19
19
 
20
+ redmine_bin_file = File.expand_path('../bin/redmine', __dir__)
21
+
22
+ @process = ChildProcess.build(redmine_bin_file, command, *args)
20
23
  # @process = ChildProcess.build('bin/redmine', command, *args)
21
- @process = ChildProcess.build('redmine', command, *args)
24
+ # @process = ChildProcess.build('redmine', command, *args)
22
25
  @process.io.stdout = tempfile_out
23
26
  @process.io.stderr = tempfile_err
24
27
  @process.environment['REDMINE_INSTALLER_SPEC'] = '1'
@@ -82,20 +82,7 @@ RSpec.describe RedmineInstaller::Install, command: 'install' do
82
82
  it 'installing something else', args: [package_someting_else] do
83
83
  write(@redmine_root)
84
84
 
85
- expected_successful_configuration
86
-
87
- expected_output('Redmine installing')
88
- expected_output_in('--> Bundle install', 50)
89
-
90
- expected_output("Gemfile.lock wasn't created")
91
- expected_output('‣ Try again')
92
-
93
- go_down
94
- go_down
95
- expected_output('‣ Cancel')
96
- write('')
97
-
98
- expected_output('Operation canceled by user')
85
+ expected_output('is not valid')
99
86
  end
100
87
 
101
88
  it 'bad database settings', args: [package_v345] do
@@ -158,6 +145,7 @@ RSpec.describe RedmineInstaller::Install, command: 'install' do
158
145
  expected_successful_installation(
159
146
  after_create: proc {
160
147
  expected_output('Would you like to load default data')
148
+
161
149
  write('y')
162
150
  expected_output('Database cleaning')
163
151
  expected_output('Database restoring')
@@ -147,4 +147,55 @@ RSpec.describe RedmineInstaller::Upgrade, :install_first, command: 'upgrade' do
147
147
  expect(plugin_paths).to start_with(@redmine_root)
148
148
  end
149
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
+
150
201
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,8 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../gems.rb', __dir__)
2
+
3
+ require 'bundler'
4
+ Bundler.require(:default, :test)
5
+
1
6
  lib = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
2
7
  $LOAD_PATH.unshift(lib) if !$LOAD_PATH.include?(lib)
3
8
 
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.2.7
4
+ version: 2.3.0.beta
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: 2019-01-08 00:00:00.000000000 Z
11
+ date: 2019-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -132,17 +132,19 @@ extra_rdoc_files: []
132
132
  files:
133
133
  - ".gitignore"
134
134
  - ".travis.yml"
135
- - Gemfile
135
+ - CHANGELOG.md
136
136
  - LICENSE.txt
137
137
  - README.md
138
138
  - Rakefile
139
139
  - bin/redmine
140
+ - gems.rb
140
141
  - lib/redmine-installer.rb
141
142
  - lib/redmine-installer/backup.rb
142
143
  - lib/redmine-installer/cli.rb
143
144
  - lib/redmine-installer/command.rb
144
145
  - lib/redmine-installer/configuration.rb
145
146
  - lib/redmine-installer/database.rb
147
+ - lib/redmine-installer/easycheck.rb
146
148
  - lib/redmine-installer/environment.rb
147
149
  - lib/redmine-installer/errors.rb
148
150
  - lib/redmine-installer/install.rb
@@ -182,12 +184,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
182
184
  requirements:
183
185
  - - ">="
184
186
  - !ruby/object:Gem::Version
185
- version: 2.1.0
187
+ version: 2.3.0
186
188
  required_rubygems_version: !ruby/object:Gem::Requirement
187
189
  requirements:
188
- - - ">="
190
+ - - ">"
189
191
  - !ruby/object:Gem::Version
190
- version: '0'
192
+ version: 1.3.1
191
193
  requirements: []
192
194
  rubyforge_project:
193
195
  rubygems_version: 2.7.6