lono 7.1.0 → 7.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +3 -1
  3. data/.cody/acceptance.sh +2 -0
  4. data/.cody/buildspec.yml +3 -0
  5. data/.cody/project.rb +1 -1
  6. data/CHANGELOG.md +5 -0
  7. data/lib/lono/cli.rb +12 -0
  8. data/lib/lono/configset/combiner.rb +1 -1
  9. data/lib/lono/configset/meta/dsl.rb +1 -1
  10. data/lib/lono/configset/preparer.rb +5 -5
  11. data/lib/lono/configset/register/base.rb +2 -1
  12. data/lib/lono/configset/register/dsl.rb +2 -3
  13. data/lib/lono/configset/resolver.rb +1 -0
  14. data/lib/lono/extension.rb +9 -0
  15. data/lib/lono/extension/helper.rb +13 -0
  16. data/lib/lono/extension/list.rb +39 -0
  17. data/lib/lono/extension/new.rb +72 -0
  18. data/lib/lono/extensions.rb +18 -0
  19. data/lib/lono/extensions/dsl.rb +11 -0
  20. data/lib/lono/extensions/loader.rb +32 -0
  21. data/lib/lono/extensions/preparer.rb +23 -0
  22. data/lib/lono/extensions/register.rb +15 -0
  23. data/lib/lono/finder/base.rb +3 -3
  24. data/lib/lono/finder/extension.rb +11 -0
  25. data/lib/lono/help/user_data.md +0 -1
  26. data/lib/lono/jade.rb +24 -17
  27. data/lib/lono/jade/circular.rb +1 -1
  28. data/lib/lono/{configset/materializer/jade.rb → jade/materializer.rb} +3 -3
  29. data/lib/lono/{configset → jade}/materializer/final.rb +1 -1
  30. data/lib/lono/{configset → jade}/materializer/gems_builder.rb +3 -3
  31. data/lib/lono/{configset → jade}/materializer/source.rb +1 -1
  32. data/lib/lono/jade/registry.rb +55 -0
  33. data/lib/lono/template/context.rb +1 -2
  34. data/lib/lono/template/context/loader.rb +19 -13
  35. data/lib/lono/template/context/loader/load_files.rb +24 -0
  36. data/lib/lono/template/helper.rb +0 -42
  37. data/lib/lono/template/strategy/common/helpers.rb +44 -0
  38. data/lib/lono/template/strategy/dsl.rb +3 -8
  39. data/lib/lono/template/strategy/dsl/builder.rb +12 -17
  40. data/lib/lono/template/strategy/dsl/builder/helpers.rb +2 -0
  41. data/lib/lono/template/strategy/dsl/builder/helpers/file_helper.rb +2 -2
  42. data/lib/lono/template/strategy/dsl/builder/syntax.rb +2 -1
  43. data/lib/lono/template/strategy/dsl/builder/syntax/extend_with.rb +9 -0
  44. data/lib/lono/template/strategy/dsl/builder/{section/extensions.rb → syntax/parameter_group.rb} +2 -2
  45. data/lib/lono/version.rb +1 -1
  46. data/lib/templates/extension/%extension_name%.gemspec.tt +45 -0
  47. data/lib/templates/extension/.gitignore +17 -0
  48. data/lib/templates/extension/.rspec +3 -0
  49. data/lib/templates/extension/CHANGELOG.md +7 -0
  50. data/lib/templates/extension/Gemfile.tt +4 -0
  51. data/lib/templates/extension/Rakefile.tt +9 -0
  52. data/lib/templates/extension/lib/%extension_name%.rb.tt +5 -0
  53. data/lib/templates/extension/lib/%extension_name%/helpers/mappings.rb.tt +24 -0
  54. data/lib/templates/extension/lib/%extension_name%/helpers/outputs.rb.tt +7 -0
  55. data/lib/templates/extension/lib/%extension_name%/helpers/parameters.rb.tt +10 -0
  56. data/lib/templates/extension/lib/%extension_name%/helpers/resources/resource.rb.tt +4 -0
  57. data/lib/templates/extension/lib/%extension_name%/helpers/variables.rb.tt +6 -0
  58. data/lib/templates/extension/lib/%extension_name%/version.rb.tt +3 -0
  59. data/lib/templates/extension/spec/spec_helper.rb.tt +29 -0
  60. data/lono.gemspec +1 -0
  61. metadata +49 -8
  62. data/lib/lono/configset/registry.rb +0 -34
@@ -7,5 +7,7 @@ class Lono::Template::Strategy::Dsl::Builder
7
7
  include LookupHelper
8
8
  include S3Helper
9
9
  include TagsHelper
10
+
11
+ include Lono::Template::Strategy::Common::Helpers
10
12
  end
11
13
  end
@@ -13,8 +13,8 @@ module Lono::Template::Strategy::Dsl::Builder::Helpers
13
13
  def user_data_script
14
14
  unless @user_data_script
15
15
  return <<~EOL
16
- # @user_data_script variable not set. IE: @user_data_script = "configs/#{@blueprint}/user-data/boostrap.sh"
17
- # Also, make sure that "configs/#{@blueprint}/user-data/boostrap.sh" path you're using exists.
16
+ # @user_data_script variable not set. IE: @user_data_script = "configs/#{@blueprint}/user_data/boostrap.sh"
17
+ # Also, make sure that "configs/#{@blueprint}/user_data/boostrap.sh" path you're using exists.
18
18
  EOL
19
19
  end
20
20
 
@@ -4,7 +4,8 @@ class Lono::Template::Strategy::Dsl::Builder
4
4
  include Fn
5
5
  include Lono::Template::Evaluate
6
6
  include Section::Methods
7
- include Section::Extensions
7
+ include ParameterGroup
8
+ include ExtendWith
8
9
  include Helpers # built-in helpers
9
10
  end
10
11
  end
@@ -0,0 +1,9 @@
1
+ module Lono::Template::Strategy::Dsl::Builder::Syntax
2
+ module ExtendWith
3
+ def extend_with(extension)
4
+ # Do nothing during the main DSL evaluation. The extend_with logical actual runs during during the
5
+ # pre_evalation stage before project helpers are loaded. This allows project helper to override extend helpers.
6
+ # Define the method here it does not error though.
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
- module Lono::Template::Strategy::Dsl::Builder::Section
2
- module Extensions
1
+ module Lono::Template::Strategy::Dsl::Builder::Syntax
2
+ module ParameterGroup
3
3
  def parameter_group(label)
4
4
  @group_label = label
5
5
  yield
data/lib/lono/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lono
2
- VERSION = "7.1.0"
2
+ VERSION = "7.2.0"
3
3
  end
@@ -0,0 +1,45 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "<%= extension_name %>/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "<%= extension_name %>"
8
+ spec.version = <%= extension_class_name %>::VERSION
9
+ spec.authors = ["<%= user_info[:author] %>"]
10
+ spec.email = ["<%= ENV['LONO_EMAIL'] || user_info[:email] %>"]
11
+ spec.summary = "Lono extension: <%= extension_name %>"
12
+ spec.homepage = "<%= ENV['LONO_ORG'] || "https://github.com/USER" %>/<%= extension_name %>"
13
+ spec.license = "<%= ENV['LONO_LICENSE'] || 'MIT' %>"
14
+
15
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
16
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
17
+ if spec.respond_to?(:metadata)
18
+ spec.metadata["lono_type"] = "extension"
19
+ spec.metadata["allowed_push_host"] = "<%= ENV['LONO_ALLOWED_PUSH_HOST'] || "TODO: Set to 'http://mygemserver.com'"%>"
20
+
21
+ spec.metadata["homepage_uri"] = spec.homepage
22
+ <% if ENV['LONO_ORG'] -%>
23
+ spec.metadata["source_code_uri"] = "<%= ENV['LONO_ORG'] %>/<%= extension_name %>"
24
+ spec.metadata["changelog_uri"] = "<%= ENV['LONO_ORG'] %>/<%= extension_name %>/blob/master/CHANGELOG.md"
25
+ <% else -%>
26
+ spec.metadata["source_code_uri"] = "https://github.com/user/repo" # TODO: Change me
27
+ spec.metadata["changelog_uri"] = "https://github.com/user/repo/blob/master/CHANGELOG.md" # TODO: Change me
28
+ <% end -%>
29
+ else
30
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
31
+ end
32
+
33
+ spec.files = `git ls-files`.split($/)
34
+ spec.bindir = "exe"
35
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
37
+ spec.require_paths = ["lib"]
38
+
39
+ spec.add_dependency "activesupport"
40
+
41
+ spec.add_development_dependency "bundler"
42
+ spec.add_development_dependency "byebug"
43
+ spec.add_development_dependency "rake"
44
+ spec.add_development_dependency "rspec"
45
+ end
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ _yardoc
7
+ coverage
8
+ doc/
9
+ InstalledFiles
10
+ lib/bundler/man
11
+ pkg
12
+ rdoc
13
+ spec/reports
14
+ test/tmp
15
+ test/version_tmp
16
+ tmp
17
+ Gemfile.lock
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --color
3
+ --format documentation
@@ -0,0 +1,7 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
+
6
+ ## [0.1.0]
7
+ - Initial release.
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem dependencies in <%= extension_name %>.gemspec
4
+ gemspec
@@ -0,0 +1,9 @@
1
+ <% if ENV['LONO_ORG'] -%>
2
+ ENV['gem_push']='no'
3
+ <% end -%>
4
+ require "bundler/gem_tasks"
5
+ require "rspec/core/rake_task"
6
+
7
+ RSpec::Core::RakeTask.new
8
+
9
+ task default: :spec
@@ -0,0 +1,5 @@
1
+ $:.unshift(File.expand_path("../", __FILE__))
2
+ require "<%= extension_underscore_name %>/version"
3
+
4
+ module <%= extension_class_name %>
5
+ end
@@ -0,0 +1,24 @@
1
+ module <%= extension_class_name %>::Helpers
2
+ module Mappings
3
+ def ami_mappings
4
+ mapping("AmiMap",
5
+ "ap-northeast-1": { Ami: "ami-011facbea5ec0363b" },
6
+ "ap-northeast-2": { Ami: "ami-0bea7fd38fabe821a" },
7
+ "ap-south-1": { Ami: "ami-0217a85e28e625474" },
8
+ "ap-southeast-1": { Ami: "ami-05c64f7b4062b0a21" },
9
+ "ap-southeast-2": { Ami: "ami-0b8b10b5bf11f3a22" },
10
+ "ca-central-1": { Ami: "ami-0a269ca7cc3e3beff" },
11
+ "eu-central-1": { Ami: "ami-07cda0db070313c52" },
12
+ "eu-north-1": { Ami: "ami-0662eb9b9b8685935" },
13
+ "eu-west-1": { Ami: "ami-0713f98de93617bb4" },
14
+ "eu-west-2": { Ami: "ami-0089b31e09ac3fffc" },
15
+ "eu-west-3": { Ami: "ami-007fae589fdf6e955" },
16
+ "sa-east-1": { Ami: "ami-09de7b4017733e2af" },
17
+ "us-east-1": { Ami: "ami-062f7200baf2fa504" },
18
+ "us-east-2": { Ami: "ami-02ccb28830b645a41" },
19
+ "us-west-1": { Ami: "ami-03caa3f860895f82e" },
20
+ "us-west-2": { Ami: "ami-04590e7389a6e577c" }
21
+ )
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,7 @@
1
+ module <%= extension_class_name %>::Helpers
2
+ module Outputs
3
+ def resource1_output
4
+ output("Resource1")
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ module <%= extension_class_name %>::Helpers
2
+ module Parameters
3
+ def example_parameters
4
+ parameter_group("AWS::Service::Resource") do
5
+ parameter("Parameter1")
6
+ parameter("Parameter2")
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ module <%= extension_class_name %>::Helpers::Resources
2
+ module Resource
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module <%= extension_class_name %>::Helpers
2
+ module Variables
3
+ # AWS::Service::Resource example
4
+ attr_reader :property1, :property2
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module <%= extension_class_name %>
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,29 @@
1
+ ENV["<%= extension_underscore_name.upcase %>_TEST"] = "1"
2
+
3
+ # CodeClimate test coverage: https://docs.codeclimate.com/docs/configuring-test-coverage
4
+ # require 'simplecov'
5
+ # SimpleCov.start
6
+
7
+ require "pp"
8
+ require "byebug"
9
+ root = File.expand_path("../", File.dirname(__FILE__))
10
+ require "#{root}/lib/<%= extension_name %>"
11
+
12
+ module Helper
13
+ def execute(cmd)
14
+ puts "Running: #{cmd}" if show_command?
15
+ out = `#{cmd}`
16
+ puts out if show_command?
17
+ out
18
+ end
19
+
20
+ # Added SHOW_COMMAND because DEBUG is also used by other libraries like
21
+ # bundler and it shows its internal debugging logging also.
22
+ def show_command?
23
+ ENV['DEBUG'] || ENV['SHOW_COMMAND']
24
+ end
25
+ end
26
+
27
+ RSpec.configure do |c|
28
+ c.include Helper
29
+ end
data/lono.gemspec CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |gem|
29
29
  gem.add_dependency "aws-sdk-ssm"
30
30
  gem.add_dependency "bundler", "~> 2"
31
31
  gem.add_dependency "cfn_camelizer"
32
+ gem.add_dependency "cli-format"
32
33
  gem.add_dependency "filesize"
33
34
  gem.add_dependency "graph" # lono xgraph command dependency
34
35
  gem.add_dependency "hashie"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lono
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.0
4
+ version: 7.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-17 00:00:00.000000000 Z
11
+ date: 2020-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: cli-format
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: filesize
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -479,10 +493,6 @@ files:
479
493
  - lib/lono/configset/evaluate_file.rb
480
494
  - lib/lono/configset/generator.rb
481
495
  - lib/lono/configset/list.rb
482
- - lib/lono/configset/materializer/final.rb
483
- - lib/lono/configset/materializer/gems_builder.rb
484
- - lib/lono/configset/materializer/jade.rb
485
- - lib/lono/configset/materializer/source.rb
486
496
  - lib/lono/configset/meta.rb
487
497
  - lib/lono/configset/meta/dsl.rb
488
498
  - lib/lono/configset/new.rb
@@ -491,7 +501,6 @@ files:
491
501
  - lib/lono/configset/register/blueprint.rb
492
502
  - lib/lono/configset/register/dsl.rb
493
503
  - lib/lono/configset/register/project.rb
494
- - lib/lono/configset/registry.rb
495
504
  - lib/lono/configset/resolver.rb
496
505
  - lib/lono/configset/strategy/base.rb
497
506
  - lib/lono/configset/strategy/dsl.rb
@@ -504,11 +513,21 @@ files:
504
513
  - lib/lono/core/config.rb
505
514
  - lib/lono/default/settings.yml
506
515
  - lib/lono/ext/bundler.rb
516
+ - lib/lono/extension.rb
517
+ - lib/lono/extension/helper.rb
518
+ - lib/lono/extension/list.rb
519
+ - lib/lono/extension/new.rb
520
+ - lib/lono/extensions.rb
521
+ - lib/lono/extensions/dsl.rb
522
+ - lib/lono/extensions/loader.rb
523
+ - lib/lono/extensions/preparer.rb
524
+ - lib/lono/extensions/register.rb
507
525
  - lib/lono/file_uploader.rb
508
526
  - lib/lono/finder/base.rb
509
527
  - lib/lono/finder/blueprint.rb
510
528
  - lib/lono/finder/blueprint/configset.rb
511
529
  - lib/lono/finder/configset.rb
530
+ - lib/lono/finder/extension.rb
512
531
  - lib/lono/generate.rb
513
532
  - lib/lono/help.rb
514
533
  - lib/lono/help/blueprint/new.md
@@ -562,6 +581,11 @@ files:
562
581
  - lib/lono/inspector/summary.rb
563
582
  - lib/lono/jade.rb
564
583
  - lib/lono/jade/circular.rb
584
+ - lib/lono/jade/materializer.rb
585
+ - lib/lono/jade/materializer/final.rb
586
+ - lib/lono/jade/materializer/gems_builder.rb
587
+ - lib/lono/jade/materializer/source.rb
588
+ - lib/lono/jade/registry.rb
565
589
  - lib/lono/jadespec.rb
566
590
  - lib/lono/layering.rb
567
591
  - lib/lono/md5.rb
@@ -624,12 +648,14 @@ files:
624
648
  - lib/lono/template/context.rb
625
649
  - lib/lono/template/context/helpers.rb
626
650
  - lib/lono/template/context/loader.rb
651
+ - lib/lono/template/context/loader/load_files.rb
627
652
  - lib/lono/template/context/ssm_fetcher.rb
628
653
  - lib/lono/template/evaluate.rb
629
654
  - lib/lono/template/generator.rb
630
655
  - lib/lono/template/helper.rb
631
656
  - lib/lono/template/post_processor.rb
632
657
  - lib/lono/template/strategy/base.rb
658
+ - lib/lono/template/strategy/common/helpers.rb
633
659
  - lib/lono/template/strategy/dsl.rb
634
660
  - lib/lono/template/strategy/dsl/builder.rb
635
661
  - lib/lono/template/strategy/dsl/builder/fn.rb
@@ -641,7 +667,6 @@ files:
641
667
  - lib/lono/template/strategy/dsl/builder/helpers/tags_helper.rb
642
668
  - lib/lono/template/strategy/dsl/builder/section/base.rb
643
669
  - lib/lono/template/strategy/dsl/builder/section/condition.rb
644
- - lib/lono/template/strategy/dsl/builder/section/extensions.rb
645
670
  - lib/lono/template/strategy/dsl/builder/section/mapping.rb
646
671
  - lib/lono/template/strategy/dsl/builder/section/methods.rb
647
672
  - lib/lono/template/strategy/dsl/builder/section/output.rb
@@ -652,6 +677,8 @@ files:
652
677
  - lib/lono/template/strategy/dsl/builder/squeezer.rb
653
678
  - lib/lono/template/strategy/dsl/builder/stringify.rb
654
679
  - lib/lono/template/strategy/dsl/builder/syntax.rb
680
+ - lib/lono/template/strategy/dsl/builder/syntax/extend_with.rb
681
+ - lib/lono/template/strategy/dsl/builder/syntax/parameter_group.rb
655
682
  - lib/lono/template/strategy/dsl/finalizer.rb
656
683
  - lib/lono/template/strategy/dsl/finalizer/parameter_groups.rb
657
684
  - lib/lono/template/strategy/erb.rb
@@ -688,6 +715,20 @@ files:
688
715
  - lib/templates/configset/README.md.tt
689
716
  - lib/templates/configset/Rakefile.tt
690
717
  - lib/templates/configset/lib/configset.rb
718
+ - lib/templates/extension/%extension_name%.gemspec.tt
719
+ - lib/templates/extension/.gitignore
720
+ - lib/templates/extension/.rspec
721
+ - lib/templates/extension/CHANGELOG.md
722
+ - lib/templates/extension/Gemfile.tt
723
+ - lib/templates/extension/Rakefile.tt
724
+ - lib/templates/extension/lib/%extension_name%.rb.tt
725
+ - lib/templates/extension/lib/%extension_name%/helpers/mappings.rb.tt
726
+ - lib/templates/extension/lib/%extension_name%/helpers/outputs.rb.tt
727
+ - lib/templates/extension/lib/%extension_name%/helpers/parameters.rb.tt
728
+ - lib/templates/extension/lib/%extension_name%/helpers/resources/resource.rb.tt
729
+ - lib/templates/extension/lib/%extension_name%/helpers/variables.rb.tt
730
+ - lib/templates/extension/lib/%extension_name%/version.rb.tt
731
+ - lib/templates/extension/spec/spec_helper.rb.tt
691
732
  - lib/templates/skeleton/.gitignore
692
733
  - lib/templates/skeleton/Gemfile
693
734
  - lib/templates/skeleton/README.md
@@ -1,34 +0,0 @@
1
- class Lono::Configset
2
- class Registry
3
- attr_reader :args, :options
4
- attr_accessor :caller_line, :parent, :depends_on
5
- def initialize(args, options)
6
- @args, @options = args, options
7
- end
8
-
9
- def name
10
- @args.first
11
- end
12
-
13
- def resource
14
- @options[:resource]
15
- end
16
-
17
- def resource=(v)
18
- @options[:resource] = v
19
- end
20
-
21
- def gem_options
22
- options = @options.dup
23
- # Delete special options that is not supported by bundler Gemfile
24
- options.delete(:repo)
25
- options.delete(:resource)
26
- options.delete(:vars)
27
- options
28
- end
29
-
30
- def vars
31
- options[:vars] || {}
32
- end
33
- end
34
- end