lambda-version-manager 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/deployer.rb +34 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 956f8eec69ae5cd6730d7e4a61a5dd98e90fa8af
|
4
|
+
data.tar.gz: cf2597c815b9a37eeb5778fec66fe2810b716435
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9bcbf3f8e310b63db6b1151bc9eba8d51f3888a492d8a5121a319bafd348766315d7327b22bb9160ed0e026a9b3f1931bd3a5e365dd2d7ee61a176f75ad457f
|
7
|
+
data.tar.gz: 5a45b8da5fa4bd410ffad070b1ded3b91beaa17edf0db64728a1c9640e6c36c77f38459f889701aca8b0e8c0ac4066fd2b69c20a8d4676a1b21c24518ee8b910
|
data/lib/deployer.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative 'client'
|
2
2
|
require_relative 'project'
|
3
|
+
require 'fileutils'
|
3
4
|
class Deployer
|
4
5
|
attr_accessor :project_path
|
5
6
|
attr_accessor :account
|
@@ -47,6 +48,7 @@ class Deployer
|
|
47
48
|
env_region_map = project.env_region_map
|
48
49
|
#Filter by account as the primary owner of envs
|
49
50
|
lambda_env_map = project.get_lambdas
|
51
|
+
lambda_env_map = diff_projects(lambda_env_map)
|
50
52
|
lambda_env_map = get_deployable_lambdas(lambda_env_map)
|
51
53
|
environments ||= project.environments
|
52
54
|
account_env_map.each do |env|
|
@@ -65,6 +67,7 @@ class Deployer
|
|
65
67
|
client.update_function_code(lambda_name,s3_bucket,s3_key)
|
66
68
|
end
|
67
69
|
end
|
70
|
+
archive_project
|
68
71
|
end
|
69
72
|
|
70
73
|
|
@@ -84,5 +87,36 @@ class Deployer
|
|
84
87
|
return "#{config['environments'][env]['base_path']}/#{properties['artifact_name']}-#{properties['version']}.#{properties['extension']}"
|
85
88
|
end
|
86
89
|
end
|
90
|
+
|
91
|
+
def archive_project
|
92
|
+
if Dir.exist?("#{project_path}/.history/")
|
93
|
+
FileUtils.remove_dir("#{project_path}/.history/environments")
|
94
|
+
FileUtils.remove_dir("#{project_path}/.history/config")
|
95
|
+
end
|
96
|
+
FileUtils.copy_entry("#{project_path}/config","#{project_path}/.history/config")
|
97
|
+
FileUtils.copy_entry("#{project_path}/environments","#{project_path}/.history/environments")
|
98
|
+
end
|
99
|
+
|
100
|
+
def parse_archive
|
101
|
+
archived_project = Project.new("#{project_path}/.history/")
|
102
|
+
archived_project.get_lambdas
|
103
|
+
end
|
104
|
+
|
105
|
+
def diff_projects(new_project)
|
106
|
+
unless Dir.exist?("#{project_path}/.history/")
|
107
|
+
return new_project
|
108
|
+
end
|
109
|
+
historic = parse_archive
|
110
|
+
historic.each do |environment, lambdas|
|
111
|
+
lambdas.each do |lambda, configs|
|
112
|
+
if new_project[environment][lambda].eql?(configs)
|
113
|
+
new_project[environment].delete(lambda)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
#Delete empty environments as no lambdas changed so they all removed from bing deployable
|
117
|
+
new_project.delete(environment) if new_project[environment].empty?
|
118
|
+
end
|
119
|
+
new_project
|
120
|
+
end
|
87
121
|
end
|
88
122
|
|