idlc-sdk-pfm 1.0.0.rc6 → 1.0.0.rc7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22f158883cace29d6474a62d0dfd9c9cd1362288
4
- data.tar.gz: d33742ec54d29cf92123cf4ca38fbb41dbd96e55
3
+ metadata.gz: ecf1428206635c111556009a3ed6c1ed876841e0
4
+ data.tar.gz: 14e24bf8d9aabb943d3704263537c2e796a77abb
5
5
  SHA512:
6
- metadata.gz: ed41406a615c9978eba350638514e8e679d31af15952beae9ee90ff9ab2ffad3b80ba77fe7d886a031dc96f7a0374120cf88a516d852efd33429839259faadda
7
- data.tar.gz: a385132d62448f8672c779782756f3ad135bc82829662946ae1b42f2e03d004b77debd6c4a9fa7fc1905b02598b3326d5aa625a215c8b0bb59a5332c7a78df86
6
+ metadata.gz: 1bf76743218f5319b30517390e146144203f64f53eeebd1e31b68e3c07bde296016d8ab7a0a0d5bdb506f5496d4567962703ddd39275fffccb14c61a89fa21d0
7
+ data.tar.gz: a1e329236b7b7399601290d3ea722a2c910c4f39bd29d031b725dce33cb3a19dfb96877cf763c7fb2d483f1594054bf2dec44ad140fda0c02db662c170c2997a
@@ -8,4 +8,5 @@ Pfm.commands do |c|
8
8
  c.builtin 'apply', :Apply, desc: 'Apply the infrastructure plan'
9
9
  c.builtin 'destroy', :Destroy, desc: 'Destroy all managed infrastructure'
10
10
  c.builtin 'format', :Format, desc: 'format infrastructure code'
11
+ c.builtin 'package', :Package, desc: 'package infrastructure repository'
11
12
  end
@@ -0,0 +1,70 @@
1
+ require 'idlc-sdk-pfm/command/base'
2
+ require 'mixlib/shellout'
3
+
4
+ module Pfm
5
+ module Command
6
+ class Package < Base
7
+ banner 'Usage: pfm package [options]'
8
+
9
+ option :application_name,
10
+ long: '--application-name NAME',
11
+ description: 'Application Name',
12
+ default: ''
13
+
14
+ def initialize
15
+ super
16
+ @params_valid = true
17
+ @errors = []
18
+ end
19
+
20
+ def run(params)
21
+ @params = params
22
+ read_and_validate_params
23
+
24
+ if params_valid?
25
+ package
26
+ # @workspace.cleanup causing bundler issues
27
+ 0
28
+ else
29
+ @errors.each { |error| err("Error: #{error}") }
30
+ parse_options(params)
31
+ msg(opt_parser)
32
+ 1
33
+ end
34
+ rescue DeploymentFailure => e
35
+ err("ERROR: #{e.message}\n")
36
+ 1
37
+ end
38
+
39
+ def package
40
+ raise InvalidRepository, 'This doesn\'t look like a valid infrastructure repository' unless File.directory? "#{inf_base_dir}/tf"
41
+
42
+ workspace = Idlc::Workspace.new
43
+
44
+ workspace.flatten("#{inf_base_dir}/tf", 'tf')
45
+ workspace.add('lib/tf/modules')
46
+ workspace.add('ci/dsl')
47
+ workspace.add('backend.tf') if File.exist? 'backend.tf'
48
+
49
+ dest_zip = "./.pfm/#{@config[:application_name]}.#{REPO_VERSION}.infra.zip"
50
+ workspace.zip_folder(workspace.tmp_dir, dest_zip)
51
+ msg("packaged to #{dest_zip}")
52
+ end
53
+
54
+ def read_and_validate_params
55
+ arguments = parse_options(@params)
56
+
57
+ case arguments.size
58
+ when 0
59
+ @params_valid = true
60
+ else
61
+ @params_valid = false
62
+ end
63
+ end
64
+
65
+ def params_valid?
66
+ @params_valid
67
+ end
68
+ end
69
+ end
70
+ end
@@ -1,3 +1,3 @@
1
1
  module Pfm
2
- VERSION = '1.0.0.rc6'.freeze
2
+ VERSION = '1.0.0.rc7'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idlc-sdk-pfm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc6
4
+ version: 1.0.0.rc7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Cazell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-19 00:00:00.000000000 Z
11
+ date: 2017-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -340,6 +340,7 @@ files:
340
340
  - lib/idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/repo/gitignore.erb
341
341
  - lib/idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/resource.rb.erb
342
342
  - lib/idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/template.erb
343
+ - lib/idlc-sdk-pfm/command/package.rb
343
344
  - lib/idlc-sdk-pfm/command/plan.rb
344
345
  - lib/idlc-sdk-pfm/command/templates/app/files/config/client.rb.template
345
346
  - lib/idlc-sdk-pfm/command/templates/app/files/config/init.ps1.userdata