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
|
# File 'lib/opts_parser.rb', line 6
def self.parse(args)
options = OpenStruct.new
options.src = args[-1]
opt_parser = OptionParser.new do |opts|
opts.banner = "Usage: rstreet [options] <src_dir>"
opts.separator ""
opts.separator "Options:"
opts.on("-e", "--load-env",
"Load environment from .env file") do |load_env|
options.load_env = true
end
opts.on("-b b", "--bucket b",
"S3 destination bucket") do |s3_bucket|
options.s3_bucket = s3_bucket
end
opts.on("-k k", "--aws-key k",
"AWS Access Key ID") do |aws_key|
options.aws_key = aws_key
end
opts.on("-s s", "--aws-secret s",
"AWS Secret Access Key") do |aws_secret|
options.aws_secret = aws_secret
end
opts.on("-v", "--verbose",
"Run with expanded messages") do |verbose|
options.verbose = true
end
opts.on("-n", "--dry-run",
"Run but do not upload") do |dry_run|
options.dry_run = true
end
end
opt_parser.parse!(args)
options
end
|