This repository has been archived by the owner on Jul 8, 2019. It is now read-only.
/
appserver
executable file
·48 lines (43 loc) · 1.91 KB
/
appserver
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
#!/usr/bin/env ruby
$:.unshift File.expand_path('../../lib', __FILE__)
require 'optparse'
require 'appserver'
options = {}
opts = OptionParser.new(nil, 20, ' ') do |opts|
opts.banner = 'Usage: appserver [options] init|deploy|update [arguments]'
opts.separator ''
opts.separator 'appserver [options] init <path>'
opts.separator ' Initializes an appserver directory. Run this command to set up the given'
opts.separator ' directory for deploying applications. After this, you can customize'
opts.separator " settings in #{Appserver::ServerDir::CONFIG_FILE_NAME} inside the directory."
opts.separator ''
opts.separator 'appserver [options] update'
opts.separator ' Updates all generated configuration files.'
opts.separator ''
opts.separator 'appserver [options] deploy <git-repository>'
opts.separator ' Deploys an application to the appserver directory and updates configurations.'
opts.separator ' Additionally, a hook is installed to the git repository, that auto-deploys'
opts.separator ' the application from now on, if sombody pushes to it.'
opts.separator ''
opts.separator 'NOTE: For all commands (except "init"), you need to be inside an appserver'
opts.separator ' directory, or specify an appserver directory using the --dir option.'
opts.separator ''
opts.separator 'Options:'
opts.on '-d', '--dir PATH', 'Change to the given directory before running the command' do |dir|
options[:dir] = dir
end
opts.on '-f', '--force', 'Force command execution even if it will overwrite files' do
options[:force] = true
end
opts.separator ''
opts.separator 'Common options:'
opts.on '-h', '--help', 'Show this message' do
puts opts; exit
end
opts.separator ''
opts.separator 'See http://github.com/zargony/appserver for more information'
opts.separator ''
end
args = opts.parse!
(puts opts; exit) if args.size < 1
Appserver::Command.run!(args.shift, args, options)