Class: RedmineInstaller::CLI
- Includes:
- Commander::Methods
- Defined in:
- lib/redmine-installer/cli.rb
Instance Method Summary collapse
-
#parse_keep_options(values) ⇒ Object
For multiple user –keep option.
- #run ⇒ Object
Instance Method Details
#parse_keep_options(values) ⇒ Object
For multiple user –keep option
134 135 136 137 138 139 140 141 142 143 |
# File 'lib/redmine-installer/cli.rb', line 134 def (values) = Commander::Runner.instance.active_command. saved = .find{|switch, _| switch == :keep } if saved saved[1].concat(values) else << [:keep, values] end end |
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/redmine-installer/cli.rb', line 15 def run program :name, 'Ruby installer' program :version, RedmineInstaller::VERSION program :description, 'Easy way how install/upgrade redmine or plugin.' global_option('-d', '--debug', 'Logging message to stdout'){ $DEBUG = true } global_option('-s', '--silent', 'Be less version in output') { $SILENT_MODE = true } global_option('-e', '--env', 'For backward compatibility. Production is now always use.') global_option('--skip-old-modifications', 'For backward compatibility. Missing modifications are now always copied.') default_command :help # --- Install ----------------------------------------------------------- command :install do |c| c.syntax = 'install [PACKAGE] [REDMINE_ROOT] [options]' c.description = 'Install redmine or easyredmine' c.example 'Install from archive', 'redmine install ~/REDMINE_PACKAGE.zip' c.example 'Install package from internet', 'redmine install https://server.tld/REDMINE_PACKAGE.zip' c.example 'Install specific version from internet', 'redmine install v3.1.0' c.example 'Install package to new dir', 'redmine install ~/REDMINE_PACKAGE.zip redmine_root' c.option '--enable-user-root', 'Skip root as root validation' c.option '--bundle-options OPTIONS', String, 'Add options to bundle command' c.option '--database-dump DUMP', String, 'Load dump before migration (experimental function)' c.action do |args, | .default(enable_user_root: false) RedmineInstaller::Install.new(args[0], args[1], .__hash__).run end end alias_command :i, :install # --- Upgrade ----------------------------------------------------------- command :upgrade do |c| c.syntax = 'upgrade [PACKAGE] [REDMINE_ROOT] [options]' c.description = 'Upgrade redmine or easyredmine' c.example 'Upgrade with new package', 'redmine upgrade ~/REDMINE_PACKAGE.zip' c.example 'Upgrade with package from internet', 'redmine upgrade ~/REDMINE_PACKAGE.zip redmine_root' c.example 'Upgrade', 'redmine upgrade https://server.tld/REDMINE_PACKAGE.zip redmine_root' c.example 'Upgrade and keep directory', 'redmine upgrade --keep git_repositories' c.option '--enable-user-root', 'Skip root as root validation' c.option '--bundle-options OPTIONS', String, 'Add options to bundle command' c.option '-p', '--profile PROFILE_ID', Integer, 'Use saved profile' c.option '--keep PATH(s)', Array, 'Keep paths, use multiple options or separate values by comma (paths must be relative)', &method(:parse_keep_options) c.option '--copy-files-with-symlink', 'Files will be referenced by symlinks instead of copying files. Only for advance users.' c.action do |args, | .default(enable_user_root: false, copy_files_with_symlink: false) RedmineInstaller::Upgrade.new(args[0], args[1], .__hash__).run end end alias_command :u, :upgrade # --- Verify log -------------------------------------------------------- command :'verify-log' do |c| c.syntax = 'verify-log LOGFILE' c.description = 'Verify redmine installer log file' c.example 'Verify log', 'redmine verify-log LOGFILE' c.action do |args, _| RedmineInstaller::Logger.verify(args[0]) end end # --- Backup ------------------------------------------------------------ command :backup do |c| c.syntax = 'backup [REDMINE_ROOT]' c.description = 'Backup redmine' c.example 'Backup', 'redmine backup /srv/redmine' c.action do |args, _| RedmineInstaller::Backup.new(args[0]).run end end alias_command :b, :backup # --- Restore db -------------------------------------------------------- command :'restore-db' do |c| c.syntax = 'restore-db DATABASE_DUMP [REDMINE_ROOT] [options]' c.description = 'Restore database and delete old data' c.example 'Restore DB', 'redmine restore-db /srv/redmine.sql' c.option '--enable-user-root', 'Skip root as root validation' c.action do |args, | .default(enable_user_root: false) RedmineInstaller::RestoreDB.new(args[0], args[1]).run end end run! end |