redmine-installer 1.0.7 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -0
  3. data/.travis.yml +7 -0
  4. data/Gemfile +3 -15
  5. data/README.md +49 -177
  6. data/bin/redmine +4 -5
  7. data/lib/redmine-installer/backup.rb +13 -40
  8. data/lib/redmine-installer/cli.rb +92 -61
  9. data/lib/redmine-installer/command.rb +63 -117
  10. data/lib/redmine-installer/configuration.rb +148 -0
  11. data/lib/redmine-installer/database.rb +204 -0
  12. data/lib/redmine-installer/environment.rb +21 -0
  13. data/lib/redmine-installer/errors.rb +7 -0
  14. data/lib/redmine-installer/install.rb +37 -42
  15. data/lib/redmine-installer/logger.rb +83 -0
  16. data/lib/redmine-installer/package.rb +180 -0
  17. data/lib/redmine-installer/patches/ruby.rb +35 -0
  18. data/lib/redmine-installer/patches/tty.rb +16 -0
  19. data/lib/redmine-installer/profile.rb +24 -55
  20. data/lib/redmine-installer/redmine.rb +551 -0
  21. data/lib/redmine-installer/spec/spec.rb +81 -0
  22. data/lib/redmine-installer/task.rb +18 -77
  23. data/lib/redmine-installer/task_module.rb +12 -0
  24. data/lib/redmine-installer/upgrade.rb +51 -59
  25. data/lib/redmine-installer/utils.rb +46 -233
  26. data/lib/redmine-installer/version.rb +2 -4
  27. data/lib/redmine-installer.rb +69 -56
  28. data/redmine-installer.gemspec +20 -19
  29. data/spec/custom_matchers.rb +21 -0
  30. data/spec/installer_helper.rb +107 -0
  31. data/spec/installer_process.rb +82 -0
  32. data/spec/lib/backup_restore_spec.rb +81 -0
  33. data/spec/lib/install_spec.rb +125 -36
  34. data/spec/lib/upgrade_spec.rb +73 -52
  35. data/spec/packages/redmine-3.1.0.zip +0 -0
  36. data/spec/packages/redmine-3.2.0.zip +0 -0
  37. data/spec/packages/redmine-3.3.0-bad-migration.zip +0 -0
  38. data/spec/packages/redmine-3.3.0.zip +0 -0
  39. data/spec/packages/something-else.zip +0 -0
  40. data/spec/packages_helper.rb +19 -0
  41. data/spec/shared_contexts.rb +13 -0
  42. data/spec/spec_helper.rb +34 -18
  43. metadata +62 -63
  44. data/lib/redmine-installer/config_param.rb +0 -100
  45. data/lib/redmine-installer/error.rb +0 -5
  46. data/lib/redmine-installer/exec.rb +0 -158
  47. data/lib/redmine-installer/ext/module.rb +0 -7
  48. data/lib/redmine-installer/ext/string.rb +0 -15
  49. data/lib/redmine-installer/git.rb +0 -51
  50. data/lib/redmine-installer/helper.rb +0 -5
  51. data/lib/redmine-installer/helpers/generate_config.rb +0 -29
  52. data/lib/redmine-installer/locales/cs.yml +0 -147
  53. data/lib/redmine-installer/locales/en.yml +0 -154
  54. data/lib/redmine-installer/plugin.rb +0 -9
  55. data/lib/redmine-installer/plugins/base.rb +0 -24
  56. data/lib/redmine-installer/plugins/database.rb +0 -180
  57. data/lib/redmine-installer/plugins/email_sending.rb +0 -82
  58. data/lib/redmine-installer/plugins/redmine_plugin.rb +0 -82
  59. data/lib/redmine-installer/plugins/web_server.rb +0 -26
  60. data/lib/redmine-installer/step.rb +0 -16
  61. data/lib/redmine-installer/steps/backup.rb +0 -125
  62. data/lib/redmine-installer/steps/base.rb +0 -79
  63. data/lib/redmine-installer/steps/database_config.rb +0 -15
  64. data/lib/redmine-installer/steps/email_config.rb +0 -11
  65. data/lib/redmine-installer/steps/env_check.rb +0 -20
  66. data/lib/redmine-installer/steps/install.rb +0 -23
  67. data/lib/redmine-installer/steps/load_package.rb +0 -226
  68. data/lib/redmine-installer/steps/move_redmine.rb +0 -22
  69. data/lib/redmine-installer/steps/redmine_root.rb +0 -52
  70. data/lib/redmine-installer/steps/upgrade.rb +0 -57
  71. data/lib/redmine-installer/steps/validation.rb +0 -38
  72. data/lib/redmine-installer/steps/webserver_config.rb +0 -22
  73. data/spec/load_redmine.rb +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8e6a6e259f87926c7534b63c8bc6219878c441d
4
- data.tar.gz: 31079d8b9948fe9623254a566f3569ef1170b616
3
+ metadata.gz: 22ee60b5ea969b4287d629fd536e57d59ef15674
4
+ data.tar.gz: aa29dc2561c8f9feaecd3ca005c443dbe4f32b10
5
5
  SHA512:
6
- metadata.gz: bca25f6166145d3424b376b927c8b4b2267954fde33772963c7e7326ea19939c44c85695a6c25be81ef0ed030049411f6773bb917a85126db37d44021f9983b2
7
- data.tar.gz: ce9962bdad632a74d36421d3f1e14e0f64d5d3862343035306d2d2bbe5d459fb8428b99b738212396acba550c97f133cdafc7e032655a2ebc4e16cdc8aff7a48
6
+ metadata.gz: 833e0b691d62ac3c0016d41958247ee1a58995fc8ee720cf8d1cfa31d6bfba3a6f6b75032bb51cb8bb5df1a6e73117f94e837a11bd8e8067401a36fd048d6464
7
+ data.tar.gz: 5e10b97774c463b927f87230fedfaa10070392cfccc8661f520563e3ba8af364d81f911258a9add411354046abc16b4c3b1d748762b2ef439a16538cab5653ad
data/.gitignore CHANGED
@@ -23,3 +23,7 @@ tmp
23
23
  *.a
24
24
  mkmf.log
25
25
  test/*
26
+ /log.log
27
+ /redmine-installer-err
28
+ /redmine-installer-out
29
+ /redmine
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2
4
+ services:
5
+ - postgresql
6
+ before_install:
7
+ - gem install bundler
data/Gemfile CHANGED
@@ -3,18 +3,6 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in redmine-installer.gemspec
4
4
  gemspec
5
5
 
6
- gem 'ansi'
7
- gem 'gli'
8
- gem 'i18n'
9
- gem 'notifier'
10
- gem 'ruby-progressbar'
11
- gem 'rubyzip'
12
-
13
- group :development do
14
- gem 'pry'
15
- gem 'rspec'
16
- gem 'rspec-mocks'
17
- gem 'guard'
18
- gem 'guard-rspec'
19
- gem 'rest_client'
20
- end
6
+ gem 'pry'
7
+ gem 'rspec'
8
+ gem 'childprocess'
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
- # Redmine::Installer
1
+ **This is a documentation for new unreleased version. For current version [go there](https://github.com/easyredmine/redmine-installer/tree/v1.0.7).**
2
2
 
3
- Easy way how to install/upgrade Redmine or plugin
3
+ # Redmine installer
4
+
5
+ Easy way hot to install/upgrade Redmine, EasyRedmine or EasyProject.
6
+
7
+ Please do not run installer on background. It may happen that process will be paused by some event. For example database may require enter password during backuping database.
4
8
 
5
9
  ## Installation
6
10
 
@@ -24,218 +28,86 @@ $ gem install redmine-installer
24
28
 
25
29
  ## Examples
26
30
 
27
- Simple install and ugrade
31
+ To display global documentation for installer.
28
32
 
29
33
  ```
30
- # From archive
31
- $ wget http://www.redmine.org/releases/redmine-2.3.0.zip
32
- $ wget http://www.redmine.org/releases/redmine-2.5.0.zip
33
-
34
- $ redmine install redmine-2.3.0.zip
35
- $ redmine upgrade redmine-2.5.0.zip
36
-
37
- # From website
38
- $ redmine install v2.3.0
39
- $ redmine upgrade v2.5.0
34
+ redmine help
40
35
  ```
41
36
 
42
- Set languages
37
+ You can also check more detailed documentation for each command.
43
38
 
44
39
  ```
45
- $ redmine --locale cs install redmine-2.3.0.zip
40
+ redmine help [COMMAND]
46
41
  ```
47
42
 
48
- ## Usage
49
-
50
- ```
51
- redmine GLOBAL_FLAGS ACTION ARGUMENTS FLAGS
52
- ```
43
+ ### Installing
53
44
 
54
- See help for more details
45
+ Create new project on empty directory. All argument are optional. Directory should be empty because installer delete all content for ensuring correct installation. If directory does not exist, current user must have privileges to create it.
55
46
 
56
47
  ```
57
- redmine help
48
+ redmine help install
49
+ redmine install [PACKAGE] [REDMINE_ROOT] [options]
58
50
  ```
59
51
 
60
- #### Global flags
61
-
62
- <table>
63
- <thead>
64
- <tr>
65
- <th>arguments</th>
66
- <th>default value</th>
67
- <th>description</th>
68
- </tr>
69
- </thead>
70
- <tbody>
71
- <tr>
72
- <td>--verbose / -v</td>
73
- <td>false</td>
74
- <td>show verbosed output</td>
75
- </tr>
76
- <tr>
77
- <td>--locale / -l</td>
78
- <td>en</td>
79
- <td>language for application</td>
80
- </tr>
81
- </tbody>
82
- </table>
83
-
84
-
85
- #### Shortcut
86
-
87
- Some commands have defined shortcut for quicker access. Fox example:
88
-
89
52
  ```
90
- redmine install package
91
- # is equal as
92
- redmine i package
53
+ --bundle-options OPTIONS Options for bundle install
54
+ --silent Less verbose installation
93
55
  ```
94
56
 
95
- Commands shortcut.
57
+ Examples:
96
58
 
97
- ```
98
- i -> install
99
- u -> upgrade
100
- b -> backup
101
- ```
59
+ Install Redmine. Installer will ask for every required parameters.
60
+ - `redmine install`
102
61
 
103
- #### Common flags for all command
62
+ Install Redmine from redmine.zip package into /srv/redmine folder.
63
+ - `redmine install redmine.zip /srv/redmine`
104
64
 
105
- <table>
106
- <thead>
107
- <tr>
108
- <th>arguments</th>
109
- <th>default</th>
110
- <th>description</th>
111
- </tr>
112
- </thead>
113
- <tbody>
114
- <tr>
115
- <td>--environment / --env / -e</td>
116
- <td>production</td>
117
- <td>
118
- environment for redmine<br>
119
- you can set more environment like: <br>
120
- &nbsp;&nbsp;&nbsp;<i>--env env1,env2,env3</i>
121
- </td>
122
- </tr>
123
- </tbody>
124
- </table>
65
+ Install Redmine without rmgaick dependencies.
66
+ - `redmine install redmine.zip /srv/redmine --bundle-options "--without rmagick"`
125
67
 
126
- ## Install
68
+ ### Upgrading
127
69
 
128
- Install new redmine instance from archive or website.
70
+ Upgrade existing project with new package. Full and correct upgrading is ensured by these steps:
71
+ 1. project is build on temporary directory
72
+ 2. previous root is deleted
73
+ 3. projects is moved to target location
129
74
 
130
- #### Steps:
75
+ Since current root is deleted you should use option `--keep` if you want preserved some files.
131
76
 
132
- - **1. Redmine root** - insert _path_ where redmine will be installed
133
- - _path_ must point to the folder
134
- - target folder must be writable
135
- - **2. Load package** - loading package to temporary folder
136
- - **3. Database configuration** - you can choose type of DB which you want to use
137
- - currently: MySQL or PostgreSQL
138
- - you can also skip this step and run migration manually
139
- - **4. Email sending configuration** - you can set email configuration
140
- - **5. Install** - install commands are executed
141
- - **6. Moving redmine** - redmine is moved from temporarily folder to given _redmine\_root_
142
- - **7. Webserve configuration** - you can generate setting from selected webserver
143
-
144
- #### From archive
145
-
146
- Supported archives are **.zip** and **.tar.gz**.
147
77
 
148
78
  ```
149
- redmine install PATH_TO_PACKAGE
150
-
151
- # with environment
152
- redmine install PATH_TO_PACKAGE --env environment
79
+ redmine help upgrade
80
+ redmine upgrade [PACKAGE] [REDMINE_ROOT] [options]
153
81
  ```
154
82
 
155
- ## Upgrade
156
-
157
- Upgrading existing instance of redmine with archive or defined version. If your redmine contain plugins which are not part of new package - all these plugins will be kept otherwise are replaced with those from package.
158
-
159
- Final step will ask you if you want save steps configuration. If you say _YES_, configuration will be stored as profile so next time you can upgrade redmine faster.
160
-
161
83
  ```
162
- redmine upgrade PACKAGE --profile PROFILE_ID
84
+ --bundle-options OPTIONS Options for bundle install
85
+ --silent Less verbose upgrading
86
+ --profile PROFILE_ID Using saved profile
87
+ --keep PATH(s) Keep selected files or directories
163
88
  ```
164
89
 
165
- Profiles are stored on *HOME_FOLDER/.redmine-installer-profiles.yml*.
90
+ Examples:
166
91
 
167
- #### Steps:
92
+ Upgrade Redmine located on /srv/redmine with package redmine2.zip
93
+ - `redmine upgrade redmine2.zip /srv/redmine`
168
94
 
169
- - **1. Redmine root** - where is redmine located
170
- - **2. Load package** - loading package to temporary folder
171
- - **3. Validation** - validation of current redmine
172
- - **4. Backup** - backup current instance
173
- - **full backup**: complete _redmine\_root_ with database
174
- - **backup** (default): only configuration file with database
175
- - **database**: only database
176
- - **5. Upgrading** - upgrade commands are executed
177
- - **6. Moving redmine** - current redmine is upgraded by new files
178
- - **7. Profile saving** - generating profile (see profile section)
95
+ Upgrade Redmine and keep directory.
96
+ - `redmine upgrade redmine2.zip /srv/redmine --keep directory_i_want_keep`
179
97
 
98
+ Once you've saved profile you can use previouse "answer" again.
99
+ - `redmine upgrade redmine2.zip /srv/redmine --profile 1`
180
100
 
181
- #### From archive
101
+ ### Backuping
182
102
 
183
- ```
184
- redmine upgrade PATH_TO_PACKAGE
103
+ Backup existing project. You can backup full redmine with database or just database.
185
104
 
186
- # with environment
187
- redmine upgrade PATH_TO_PACKAGE --env environment
188
105
  ```
189
-
190
- ### Easyproject
191
-
192
- If you are using easyproject plugin and you dont want copy client modifications from old instance use switch `--skip-old-modifications`.
193
-
194
-
195
- ## Backup
196
-
106
+ redmine help backup
107
+ redmine backup [REDMINE_ROOT]
197
108
  ```
198
- redmine backup
199
- ```
200
-
201
- #### Steps:
202
-
203
- - **1. Redmine root** - where is redmine located
204
- - **2. Validation** - validation of current redmine
205
- - **3. Backup** - backup current instance
206
- - **full backup**: complete _redmine\_root_ with database
207
- - **backup** (default): only configuration file with database
208
- - **database**: only database
209
- - **4. Profile saving** - generating profile (see profile section)
210
109
 
211
- You can choose one of 3 types.
110
+ Examples:
212
111
 
213
- <table>
214
- <thead>
215
- <tr>
216
- <th>Type</th>
217
- <th>Description</th>
218
- </tr>
219
- </thead>
220
- <tbody>
221
- <tr>
222
- <td><b>Full backup</b></td>
223
- <td>archive full redmine_root folder with all you databases defined at config/database.yml</td>
224
- </tr>
225
- <tr>
226
- <td><b>Backup</b></td>
227
- <td>
228
- archive
229
- <ul>
230
- <li>files folder</li>
231
- <li>config/database.yml, config/configuration.yml</li>
232
- <li>databases</li>
233
- </ul>
234
- </td>
235
- </tr>
236
- <tr>
237
- <td><b>Only database</b></td>
238
- <td>archive only databases</td>
239
- </tr>
240
- </tbody>
241
- </table>
112
+ Backup project located on /srv/redmine
113
+ - `redmine upgrade /srv/redmine`
data/bin/redmine CHANGED
@@ -1,10 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
4
- $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
3
+ lib = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
4
+ $LOAD_PATH.unshift(lib) if !$LOAD_PATH.include?(lib)
5
5
 
6
6
  require 'redmine-installer'
7
7
 
8
- Redmine::Installer.set_i18n
9
- Redmine::Installer.print_logo
10
- Redmine::Installer::CLI.start(ARGV)
8
+ RedmineInstaller.print_logo
9
+ RedmineInstaller::CLI.new.run
@@ -1,47 +1,20 @@
1
- ##
2
- # Backup redmine
3
- #
4
- # Usage: `redmine backup`
5
- #
6
- # == Steps:
7
- # 1. Redmine root - where should be new redmine located
8
- # 2. Validation - current redmine should be valid
9
- # 3. Backup - backup current redmine (see backup section)
10
- # 4. Profile saving - generating profile (see profile section)
11
- #
12
- # == Types:
13
- #
14
- # Full backup::
15
- # archive full redmine_root folder with all you databases defined at config/database.yml
16
- #
17
- # Backup archive::
18
- # - files folder
19
- # - config/database.yml, config/configuration.yml
20
- # - databases
21
- #
22
- # Only database::
23
- # archive only databases
24
- #
25
- module Redmine::Installer
1
+ module RedmineInstaller
26
2
  class Backup < Task
27
3
 
28
- STEPS = [
29
- step::RedmineRoot,
30
- step::Validation,
31
- step::Backup
32
- ]
33
-
34
- attr_accessor :redmine_root
35
-
36
- def initialize(redmine_root, options={})
37
- self.redmine_root = redmine_root
38
- super(options)
4
+ def initialize(redmine_root)
5
+ super()
6
+ @target_redmine = Redmine.new(self, redmine_root)
39
7
  end
40
8
 
41
- def run
42
- Redmine::Installer::Profile.load(self, options[:profile])
43
- super
44
- Redmine::Installer::Profile.save(self) if options[:profile].nil?
9
+ def up
10
+ @target_redmine.ensure_and_valid_root
11
+ @target_redmine.validate
12
+ @target_redmine.check_running_state
13
+ @target_redmine.make_backup
14
+
15
+ puts
16
+ puts pastel.bold('Redmine was backuped')
17
+ logger.info('Redmine was backuped')
45
18
  end
46
19
 
47
20
  end
@@ -1,91 +1,122 @@
1
- require 'gli'
1
+ require 'commander'
2
2
 
3
- module Redmine::Installer
3
+ module Commander
4
+ module UI
5
+ # Disable paging for 'classic' help
6
+ def self.enable_paging
7
+ end
8
+ end
9
+ end
10
+
11
+ module RedmineInstaller
4
12
  class CLI
5
- extend GLI::App
13
+ include Commander::Methods
6
14
 
7
- def self.spec
8
- @spec ||= Gem::Specification::load('redmine-installer.gemspec')
9
- end
15
+ def run
16
+ program :name, 'Ruby installer'
17
+ program :version, RedmineInstaller::VERSION
18
+ program :description, 'Easy way how install/upgrade redmine or plugin.'
19
+
20
+ global_option('-d', '--debug', 'Logging message to stdout'){ $DEBUG = true }
21
+ global_option('-s', '--silent', 'Be less version in output') { $SILENT_MODE = true }
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.')
24
+ default_command :help
10
25
 
11
- def self.start(argv)
12
- # Program settings
13
- program_desc I18n.translate(:redmine_installer_summary)
14
- version Redmine::Installer::VERSION
15
26
 
16
- # Global options
27
+ # --- Install -----------------------------------------------------------
28
+ command :install do |c|
29
+ c.syntax = 'install [PACKAGE] [REDMINE_ROOT] [options]'
30
+ c.description = 'Install redmine or easyredmine'
17
31
 
18
- # Verbose
19
- desc I18n.translate(:cli_show_verbose_output)
20
- default_value false
21
- switch [:d, :v, :debug, :verbose], negatable: false
32
+ c.example 'Install from archive',
33
+ 'redmine install ~/REDMINE_PACKAGE.zip'
34
+ c.example 'Install specific version from internet',
35
+ 'redmine install v3.1.0'
36
+ c.example 'Install package to new dir',
37
+ 'redmine install ~/REDMINE_PACKAGE.zip redmine_root'
22
38
 
23
- # Locale
24
- default_value 'en'
25
- flag [:l, :locale]
39
+ c.option '--enable-user-root', 'Skip root as root validation'
40
+ c.option '--bundle-options OPTIONS', String, 'Add options to bundle command'
41
+ c.option '--database-dump DUMP', String, 'Load dump before migration (experimental function)'
26
42
 
27
- # Before all action
28
- pre do |global_options, command, options, args|
29
- $verbose = global_options[:debug]
30
- I18n.locale = global_options[:locale]
31
- true
43
+ c.action do |args, options|
44
+ options.default(enable_user_root: false)
45
+
46
+ RedmineInstaller::Install.new(args[0], args[1], options.__hash__).run
47
+ end
32
48
  end
49
+ alias_command :i, :install
33
50
 
34
- # Install command
35
- desc I18n.translate(:cli_install_desc)
36
- arg :package
37
- command [:i, :install] do |c|
38
- c.flag [:s, :source], default_value: 'file',
39
- must_match: ['file', 'git'],
40
- desc: I18n.translate(:cli_flag_source)
41
51
 
42
- c.flag [:b, :branch], default_value: 'master',
43
- desc: I18n.translate(:cli_flag_branch)
52
+ # --- Upgrade -----------------------------------------------------------
53
+ command :upgrade do |c|
54
+ c.syntax = 'upgrade [PACKAGE] [REDMINE_ROOT] [options]'
55
+ c.description = 'Upgrade redmine or easyredmine'
44
56
 
45
- c.flag [:e, :env, :environment], default_value: ['production'],
46
- desc: I18n.translate(:cli_flag_environment),
47
- type: Array
57
+ c.example 'Upgrade with new package',
58
+ 'redmine upgrade ~/REDMINE_PACKAGE.zip'
59
+ c.example 'Upgrade',
60
+ 'redmine upgrade ~/REDMINE_PACKAGE.zip redmine_root'
61
+ c.example 'Upgrade and keep directory',
62
+ 'redmine upgrade --keep git_repositories'
48
63
 
49
- c.action do |global_options, options, args|
50
- run_action('install', args.first, options)
64
+ c.option '--enable-user-root', 'Skip root as root validation'
65
+ c.option '--bundle-options', String, 'Add options to bundle command'
66
+ c.option '-p', '--profile PROFILE_ID', Integer, 'Use saved profile'
67
+ c.option '--keep PATH(s)', Array, 'Keep paths, use multiple options or separate values by comma (paths must be relative)', &method(:parse_keep_options)
68
+
69
+ c.action do |args, options|
70
+ options.default(enable_user_root: false)
71
+
72
+ RedmineInstaller::Upgrade.new(args[0], args[1], options.__hash__).run
51
73
  end
52
74
  end
75
+ alias_command :u, :upgrade
53
76
 
54
- # Upgrade command
55
- desc I18n.translate(:cli_upgrade_desc)
56
- arg :package
57
- command [:u, :upgrade] do |c|
58
- c.flag [:p, :profile]
59
- c.flag [:s, :source], default_value: 'file',
60
- must_match: ['file', 'git'],
61
- desc: I18n.translate(:cli_flag_source)
62
77
 
63
- c.flag [:e, :env, :environment], default_value: ['production'],
64
- desc: I18n.translate(:cli_flag_environment),
65
- type: Array
78
+ # --- Verify log --------------------------------------------------------
79
+ command :'verify-log' do |c|
80
+ c.syntax = 'verify-log LOGFILE'
81
+ c.description = 'Verify redmine installer log file'
66
82
 
67
- c.switch 'skip-old-modifications', default_value: false
83
+ c.example 'Verify log',
84
+ 'redmine verify-log LOGFILE'
68
85
 
69
- c.action do |global_options, options, args|
70
- run_action('upgrade', args.first, options)
86
+ c.action do |args, _|
87
+ RedmineInstaller::Logger.verify(args[0])
71
88
  end
72
89
  end
73
90
 
74
- # Backup command
75
- desc I18n.translate(:cli_backup_desc)
76
- arg :redmine_root
77
- command [:b, :backup] do |c|
78
- c.flag [:p, :profile]
79
- c.action do |global_options, options, args|
80
- run_action('backup', args.first, options)
91
+
92
+ # --- Backup ------------------------------------------------------------
93
+ command :'backup' do |c|
94
+ c.syntax = 'backup [REDMINE_ROOT]'
95
+ c.description = 'Backup redmine'
96
+
97
+ c.example 'Backup',
98
+ 'redmine backup /srv/redmine'
99
+
100
+ c.action do |args, _|
101
+ RedmineInstaller::Backup.new(args[0]).run
81
102
  end
82
103
  end
104
+ alias_command :b, :backup
105
+
83
106
 
84
- run(argv)
107
+ run!
85
108
  end
86
109
 
87
- def self.run_action(action, *args)
88
- Redmine::Installer.const_get(action.capitalize).new(*args).run
110
+ # For multiple user --keep option
111
+ def parse_keep_options(values)
112
+ proxy_options = Commander::Runner.instance.active_command.proxy_options
113
+
114
+ saved = proxy_options.find{|switch, _| switch == :keep }
115
+ if saved
116
+ saved[1].concat(values)
117
+ else
118
+ proxy_options << [:keep, values]
119
+ end
89
120
  end
90
121
 
91
122
  end