lambda-version-manager 0.0.3 → 0.0.5
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/bin/lambda-version-manager +12 -6
- data/lib/deployer.rb +5 -3
- 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: 3c21913555acfe10646922aac94eda25c6f81770
|
4
|
+
data.tar.gz: 78f52a4298e46fd8a2dcade9631b57e739fdd18a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3eab516eb26682349ee882e129512a6c69151db550dcd42da12ef444873eb542f2f088702a430c6370cc2947131b1762249b14a271ee53092314810071171f8b
|
7
|
+
data.tar.gz: 4429e12c3c2567cd586e779b717ff5e459917d38044a8bb9447cb186a4529beaddaa98b3c9fde9f7d5537db90959885f74834ff08c5f099aaeca25f79c16c316
|
data/bin/lambda-version-manager
CHANGED
@@ -16,7 +16,7 @@ class GeneratorCLI < ::Thor
|
|
16
16
|
option 'version_map_file', banner: 'VERSION_MAP_FILE', type: :string, desc: 'A java properties file mapping artifacts to update to version'
|
17
17
|
|
18
18
|
def deploy
|
19
|
-
opts =
|
19
|
+
opts = validate_deploy(options)
|
20
20
|
if opts['version_map_file']
|
21
21
|
#for each x=y pair we need to call
|
22
22
|
File.readlines(options['version_map_file']).each do |line|
|
@@ -38,7 +38,7 @@ class GeneratorCLI < ::Thor
|
|
38
38
|
option 'accounts', banner: 'ACCOUNT', type: :array, desc: 'Account to deploy to', :required => true
|
39
39
|
|
40
40
|
def update_project
|
41
|
-
opts =
|
41
|
+
opts = validate_project_update(options)
|
42
42
|
project = Project.new(opts['project_path'])
|
43
43
|
lambda_env_map = project.get_lambdas
|
44
44
|
account_env_map = project.account_env_map
|
@@ -69,14 +69,20 @@ class GeneratorCLI < ::Thor
|
|
69
69
|
end
|
70
70
|
|
71
71
|
no_commands do
|
72
|
-
def
|
72
|
+
def validate_project_update(options)
|
73
73
|
unless options['version_map_file'] || (options['version'] && (options['lambda'] || options['artifact']))
|
74
74
|
raise 'Either a file must be specified or a version and lambda or artifact.'
|
75
75
|
end
|
76
|
-
|
77
|
-
opts = options.dup
|
78
|
-
opts
|
76
|
+
options.dup
|
79
77
|
end
|
78
|
+
|
79
|
+
def validate_deploy(options)
|
80
|
+
unless options['version_map_file'] || options['environments'] || options['lambda'] || options['artifact']
|
81
|
+
raise 'Either a file must be specified or a environment or lambda or artifact.'
|
82
|
+
end
|
83
|
+
options.dup
|
84
|
+
end
|
85
|
+
|
80
86
|
end
|
81
87
|
end
|
82
88
|
|
data/lib/deployer.rb
CHANGED
@@ -7,8 +7,9 @@ class Deployer
|
|
7
7
|
attr_accessor :project
|
8
8
|
attr_accessor :lambda
|
9
9
|
attr_accessor :artifact
|
10
|
+
attr_accessor :environments
|
10
11
|
|
11
|
-
def initialize(project_path, account, artifact, lambda)
|
12
|
+
def initialize(project_path, account, artifact=nil, lambda=nil)
|
12
13
|
@project_path = project_path
|
13
14
|
@account = account
|
14
15
|
@project = Project.new("#{project_path}")
|
@@ -47,9 +48,10 @@ class Deployer
|
|
47
48
|
#Filter by account as the primary owner of envs
|
48
49
|
lambda_env_map = project.get_lambdas
|
49
50
|
lambda_env_map = get_deployable_lambdas(lambda_env_map)
|
51
|
+
environments ||= project.environments
|
50
52
|
account_env_map.each do |env|
|
51
53
|
#IF users has specified environments, skip if the environment is not a user specified one
|
52
|
-
next
|
54
|
+
next unless !environments.nil? && environments.include?(env)
|
53
55
|
lambda_env_map[env].each do |lambda_name, properties|
|
54
56
|
client = Client.new(env_region_map[env])
|
55
57
|
|
@@ -60,7 +62,7 @@ class Deployer
|
|
60
62
|
puts "Lambda Name: #{lambda_name}"
|
61
63
|
puts "S3 Bucket: #{s3_bucket}"
|
62
64
|
puts "S3 Key: #{s3_key}"
|
63
|
-
|
65
|
+
client.update_function_code(lambda_name,s3_bucket,s3_key)
|
64
66
|
end
|
65
67
|
end
|
66
68
|
end
|