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.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.travis.yml +7 -0
- data/Gemfile +3 -15
- data/README.md +49 -177
- data/bin/redmine +4 -5
- data/lib/redmine-installer/backup.rb +13 -40
- data/lib/redmine-installer/cli.rb +92 -61
- data/lib/redmine-installer/command.rb +63 -117
- data/lib/redmine-installer/configuration.rb +148 -0
- data/lib/redmine-installer/database.rb +204 -0
- data/lib/redmine-installer/environment.rb +21 -0
- data/lib/redmine-installer/errors.rb +7 -0
- data/lib/redmine-installer/install.rb +37 -42
- data/lib/redmine-installer/logger.rb +83 -0
- data/lib/redmine-installer/package.rb +180 -0
- data/lib/redmine-installer/patches/ruby.rb +35 -0
- data/lib/redmine-installer/patches/tty.rb +16 -0
- data/lib/redmine-installer/profile.rb +24 -55
- data/lib/redmine-installer/redmine.rb +551 -0
- data/lib/redmine-installer/spec/spec.rb +81 -0
- data/lib/redmine-installer/task.rb +18 -77
- data/lib/redmine-installer/task_module.rb +12 -0
- data/lib/redmine-installer/upgrade.rb +51 -59
- data/lib/redmine-installer/utils.rb +46 -233
- data/lib/redmine-installer/version.rb +2 -4
- data/lib/redmine-installer.rb +69 -56
- data/redmine-installer.gemspec +20 -19
- data/spec/custom_matchers.rb +21 -0
- data/spec/installer_helper.rb +107 -0
- data/spec/installer_process.rb +82 -0
- data/spec/lib/backup_restore_spec.rb +81 -0
- data/spec/lib/install_spec.rb +125 -36
- data/spec/lib/upgrade_spec.rb +73 -52
- data/spec/packages/redmine-3.1.0.zip +0 -0
- data/spec/packages/redmine-3.2.0.zip +0 -0
- data/spec/packages/redmine-3.3.0-bad-migration.zip +0 -0
- data/spec/packages/redmine-3.3.0.zip +0 -0
- data/spec/packages/something-else.zip +0 -0
- data/spec/packages_helper.rb +19 -0
- data/spec/shared_contexts.rb +13 -0
- data/spec/spec_helper.rb +34 -18
- metadata +62 -63
- data/lib/redmine-installer/config_param.rb +0 -100
- data/lib/redmine-installer/error.rb +0 -5
- data/lib/redmine-installer/exec.rb +0 -158
- data/lib/redmine-installer/ext/module.rb +0 -7
- data/lib/redmine-installer/ext/string.rb +0 -15
- data/lib/redmine-installer/git.rb +0 -51
- data/lib/redmine-installer/helper.rb +0 -5
- data/lib/redmine-installer/helpers/generate_config.rb +0 -29
- data/lib/redmine-installer/locales/cs.yml +0 -147
- data/lib/redmine-installer/locales/en.yml +0 -154
- data/lib/redmine-installer/plugin.rb +0 -9
- data/lib/redmine-installer/plugins/base.rb +0 -24
- data/lib/redmine-installer/plugins/database.rb +0 -180
- data/lib/redmine-installer/plugins/email_sending.rb +0 -82
- data/lib/redmine-installer/plugins/redmine_plugin.rb +0 -82
- data/lib/redmine-installer/plugins/web_server.rb +0 -26
- data/lib/redmine-installer/step.rb +0 -16
- data/lib/redmine-installer/steps/backup.rb +0 -125
- data/lib/redmine-installer/steps/base.rb +0 -79
- data/lib/redmine-installer/steps/database_config.rb +0 -15
- data/lib/redmine-installer/steps/email_config.rb +0 -11
- data/lib/redmine-installer/steps/env_check.rb +0 -20
- data/lib/redmine-installer/steps/install.rb +0 -23
- data/lib/redmine-installer/steps/load_package.rb +0 -226
- data/lib/redmine-installer/steps/move_redmine.rb +0 -22
- data/lib/redmine-installer/steps/redmine_root.rb +0 -52
- data/lib/redmine-installer/steps/upgrade.rb +0 -57
- data/lib/redmine-installer/steps/validation.rb +0 -38
- data/lib/redmine-installer/steps/webserver_config.rb +0 -22
- data/spec/load_redmine.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22ee60b5ea969b4287d629fd536e57d59ef15674
|
4
|
+
data.tar.gz: aa29dc2561c8f9feaecd3ca005c443dbe4f32b10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 833e0b691d62ac3c0016d41958247ee1a58995fc8ee720cf8d1cfa31d6bfba3a6f6b75032bb51cb8bb5df1a6e73117f94e837a11bd8e8067401a36fd048d6464
|
7
|
+
data.tar.gz: 5e10b97774c463b927f87230fedfaa10070392cfccc8661f520563e3ba8af364d81f911258a9add411354046abc16b4c3b1d748762b2ef439a16538cab5653ad
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
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 '
|
7
|
-
gem '
|
8
|
-
gem '
|
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
|
-
|
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
|
-
|
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
|
-
|
31
|
+
To display global documentation for installer.
|
28
32
|
|
29
33
|
```
|
30
|
-
|
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
|
-
|
37
|
+
You can also check more detailed documentation for each command.
|
43
38
|
|
44
39
|
```
|
45
|
-
|
40
|
+
redmine help [COMMAND]
|
46
41
|
```
|
47
42
|
|
48
|
-
|
49
|
-
|
50
|
-
```
|
51
|
-
redmine GLOBAL_FLAGS ACTION ARGUMENTS FLAGS
|
52
|
-
```
|
43
|
+
### Installing
|
53
44
|
|
54
|
-
|
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
|
-
|
91
|
-
|
92
|
-
redmine i package
|
53
|
+
--bundle-options OPTIONS Options for bundle install
|
54
|
+
--silent Less verbose installation
|
93
55
|
```
|
94
56
|
|
95
|
-
|
57
|
+
Examples:
|
96
58
|
|
97
|
-
|
98
|
-
|
99
|
-
u -> upgrade
|
100
|
-
b -> backup
|
101
|
-
```
|
59
|
+
Install Redmine. Installer will ask for every required parameters.
|
60
|
+
- `redmine install`
|
102
61
|
|
103
|
-
|
62
|
+
Install Redmine from redmine.zip package into /srv/redmine folder.
|
63
|
+
- `redmine install redmine.zip /srv/redmine`
|
104
64
|
|
105
|
-
|
106
|
-
|
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
|
-
<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
|
-
|
68
|
+
### Upgrading
|
127
69
|
|
128
|
-
|
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
|
-
|
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
|
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
|
-
|
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
|
-
|
90
|
+
Examples:
|
166
91
|
|
167
|
-
|
92
|
+
Upgrade Redmine located on /srv/redmine with package redmine2.zip
|
93
|
+
- `redmine upgrade redmine2.zip /srv/redmine`
|
168
94
|
|
169
|
-
|
170
|
-
-
|
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
|
-
|
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
|
-
|
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
|
-
|
110
|
+
Examples:
|
212
111
|
|
213
|
-
|
214
|
-
|
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__)
|
4
|
-
$LOAD_PATH.unshift(lib) if
|
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
|
-
|
9
|
-
|
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
|
-
|
29
|
-
|
30
|
-
|
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
|
42
|
-
|
43
|
-
|
44
|
-
|
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 '
|
1
|
+
require 'commander'
|
2
2
|
|
3
|
-
module
|
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
|
-
|
13
|
+
include Commander::Methods
|
6
14
|
|
7
|
-
def
|
8
|
-
|
9
|
-
|
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
|
-
#
|
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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
-
|
24
|
-
|
25
|
-
|
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
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|
-
|
43
|
-
|
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.
|
46
|
-
|
47
|
-
|
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.
|
50
|
-
|
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
|
-
|
64
|
-
|
65
|
-
|
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.
|
83
|
+
c.example 'Verify log',
|
84
|
+
'redmine verify-log LOGFILE'
|
68
85
|
|
69
|
-
c.action do |
|
70
|
-
|
86
|
+
c.action do |args, _|
|
87
|
+
RedmineInstaller::Logger.verify(args[0])
|
71
88
|
end
|
72
89
|
end
|
73
90
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
c.
|
79
|
-
|
80
|
-
|
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
|
107
|
+
run!
|
85
108
|
end
|
86
109
|
|
87
|
-
|
88
|
-
|
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
|