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
|
# File 'lib/routes/upload.rb', line 33
def opts_routing
case @action
when STACKS
local_path = @profile[App::AWSProfile::STACKS]['Local']['File']
s3_bucket = @profile[App::AWSProfile::STACKS]['S3Bucket']['Name']
s3_path = @profile[App::AWSProfile::STACKS]['S3Bucket']['File']
s3_region = @profile[App::AWSProfile::STACKS]['S3Bucket']['Region']
when PROJECTS
local_path = @profile[App::AWSProfile::PROJECTS]['Local']['File']
s3_bucket = @profile[App::AWSProfile::PROJECTS]['S3Bucket']['Name']
s3_path = @profile[App::AWSProfile::PROJECTS]['S3Bucket']['File']
s3_region = @profile[App::AWSProfile::PROJECTS]['S3Bucket']['Region']
when TEMPLATES
local_path = @profile[App::AWSProfile::CLOUDFORMATION]['Templates']['Local']['Path']
s3_bucket = @profile[App::AWSProfile::CLOUDFORMATION]['Templates']['S3Bucket']['Name']
s3_path = @profile[App::AWSProfile::CLOUDFORMATION]['Templates']['S3Bucket']['Path']
s3_region = @profile[App::AWSProfile::CLOUDFORMATION]['Templates']['S3Bucket']['Region']
else
raise RuntimeError, "Unrecognized action: #{@action}"
end
if [TEMPLATES].include?(@action)
Blufin::Terminal::error("Path not found: #{Blufin::Terminal::format_directory(local_path)}") unless Blufin::Files::path_exists(local_path)
is_file = false
else
Blufin::Terminal::error("File not found: #{Blufin::Terminal::format_directory(local_path)}") unless Blufin::Files::file_exists(local_path)
is_file = true
end
puts
Blufin::AWS::upload_s3_data(s3_bucket, s3_path, local_path, profile: @profile[App::AWSProfile::PROFILE], region: s3_region, is_file: is_file, dryrun: true)
puts
if Blufin::Terminal::prompt_yes?('Sync these files to S3?')
s3_path = Blufin::AWS::upload_s3_data(s3_bucket, s3_path, local_path, profile: @profile[App::AWSProfile::PROFILE], region: s3_region, is_file: is_file)
Blufin::Terminal::success('Files have been successfully uploaded to S3.', s3_path)
end
end
|