lono 7.1.0 → 7.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -1
- data/.cody/acceptance.sh +2 -0
- data/.cody/buildspec.yml +3 -0
- data/.cody/project.rb +1 -1
- data/CHANGELOG.md +5 -0
- data/lib/lono/cli.rb +12 -0
- data/lib/lono/configset/combiner.rb +1 -1
- data/lib/lono/configset/meta/dsl.rb +1 -1
- data/lib/lono/configset/preparer.rb +5 -5
- data/lib/lono/configset/register/base.rb +2 -1
- data/lib/lono/configset/register/dsl.rb +2 -3
- data/lib/lono/configset/resolver.rb +1 -0
- data/lib/lono/extension.rb +9 -0
- data/lib/lono/extension/helper.rb +13 -0
- data/lib/lono/extension/list.rb +39 -0
- data/lib/lono/extension/new.rb +72 -0
- data/lib/lono/extensions.rb +18 -0
- data/lib/lono/extensions/dsl.rb +11 -0
- data/lib/lono/extensions/loader.rb +32 -0
- data/lib/lono/extensions/preparer.rb +23 -0
- data/lib/lono/extensions/register.rb +15 -0
- data/lib/lono/finder/base.rb +3 -3
- data/lib/lono/finder/extension.rb +11 -0
- data/lib/lono/help/user_data.md +0 -1
- data/lib/lono/jade.rb +24 -17
- data/lib/lono/jade/circular.rb +1 -1
- data/lib/lono/{configset/materializer/jade.rb → jade/materializer.rb} +3 -3
- data/lib/lono/{configset → jade}/materializer/final.rb +1 -1
- data/lib/lono/{configset → jade}/materializer/gems_builder.rb +3 -3
- data/lib/lono/{configset → jade}/materializer/source.rb +1 -1
- data/lib/lono/jade/registry.rb +55 -0
- data/lib/lono/template/context.rb +1 -2
- data/lib/lono/template/context/loader.rb +19 -13
- data/lib/lono/template/context/loader/load_files.rb +24 -0
- data/lib/lono/template/helper.rb +0 -42
- data/lib/lono/template/strategy/common/helpers.rb +44 -0
- data/lib/lono/template/strategy/dsl.rb +3 -8
- data/lib/lono/template/strategy/dsl/builder.rb +12 -17
- data/lib/lono/template/strategy/dsl/builder/helpers.rb +2 -0
- data/lib/lono/template/strategy/dsl/builder/helpers/file_helper.rb +2 -2
- data/lib/lono/template/strategy/dsl/builder/syntax.rb +2 -1
- data/lib/lono/template/strategy/dsl/builder/syntax/extend_with.rb +9 -0
- data/lib/lono/template/strategy/dsl/builder/{section/extensions.rb → syntax/parameter_group.rb} +2 -2
- data/lib/lono/version.rb +1 -1
- data/lib/templates/extension/%extension_name%.gemspec.tt +45 -0
- data/lib/templates/extension/.gitignore +17 -0
- data/lib/templates/extension/.rspec +3 -0
- data/lib/templates/extension/CHANGELOG.md +7 -0
- data/lib/templates/extension/Gemfile.tt +4 -0
- data/lib/templates/extension/Rakefile.tt +9 -0
- data/lib/templates/extension/lib/%extension_name%.rb.tt +5 -0
- data/lib/templates/extension/lib/%extension_name%/helpers/mappings.rb.tt +24 -0
- data/lib/templates/extension/lib/%extension_name%/helpers/outputs.rb.tt +7 -0
- data/lib/templates/extension/lib/%extension_name%/helpers/parameters.rb.tt +10 -0
- data/lib/templates/extension/lib/%extension_name%/helpers/resources/resource.rb.tt +4 -0
- data/lib/templates/extension/lib/%extension_name%/helpers/variables.rb.tt +6 -0
- data/lib/templates/extension/lib/%extension_name%/version.rb.tt +3 -0
- data/lib/templates/extension/spec/spec_helper.rb.tt +29 -0
- data/lono.gemspec +1 -0
- metadata +49 -8
- data/lib/lono/configset/registry.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f556c131b651401e05e951dfd499f98bbcfb01e8e3dc912e2b4d3ec128068f93
|
4
|
+
data.tar.gz: fbc95989d2f2b84cdd8be923c91e05cb002a987050990e932f4355b8689eb058
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f26e2d765057d328e0c92888c7063a5e849770787928910c0e437a342260fd6e06a11e0d83688d37ab32fb4b22c4c04ccfbed452adecd19c7c7a51e77e333db
|
7
|
+
data.tar.gz: 801b6151a8a7635b94db55937bb387d00dabff728f3dd49a681201752b7a18664fae0508fdaf38d9e64ef9b53af89fe6437cf82f4f7a7417dad0728c817210bc
|
data/.circleci/config.yml
CHANGED
@@ -7,7 +7,7 @@ jobs:
|
|
7
7
|
build:
|
8
8
|
docker:
|
9
9
|
# specify the version you desire here
|
10
|
-
- image: circleci/ruby:2.5
|
10
|
+
- image: circleci/ruby:2.6.5-node-browsers
|
11
11
|
|
12
12
|
# Specify service dependencies here if necessary
|
13
13
|
# CircleCI maintains a library of pre-built images
|
@@ -35,6 +35,8 @@ jobs:
|
|
35
35
|
- run:
|
36
36
|
name: install dependencies
|
37
37
|
command: |
|
38
|
+
gem install bundler
|
39
|
+
gem update --system
|
38
40
|
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
39
41
|
|
40
42
|
- save_cache:
|
data/.cody/acceptance.sh
CHANGED
data/.cody/buildspec.yml
CHANGED
data/.cody/project.rb
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [7.2.0]
|
7
|
+
- #48 fix codebuild and circleci
|
8
|
+
- #49 lono extensions
|
9
|
+
- #50 lono extensions docs
|
10
|
+
|
6
11
|
## [7.1.0]
|
7
12
|
- #42 introduce configset dsl
|
8
13
|
- #43 improve layering behavior
|
data/lib/lono/cli.rb
CHANGED
@@ -23,6 +23,14 @@ module Lono
|
|
23
23
|
Configset::List.new(options.merge(blueprint: blueprint)).run
|
24
24
|
end
|
25
25
|
|
26
|
+
desc "extensions [BLUEPRINT]", "Lists extensions"
|
27
|
+
long_desc Help.text(:extensions)
|
28
|
+
opts.source
|
29
|
+
opts.stack
|
30
|
+
def extensions(blueprint=nil)
|
31
|
+
Extension::List.new(options.merge(blueprint: blueprint)).run
|
32
|
+
end
|
33
|
+
|
26
34
|
desc "generate BLUEPRINT", "Generate both CloudFormation templates and parameters files."
|
27
35
|
long_desc Help.text(:generate)
|
28
36
|
option :quiet, type: :boolean, desc: "silence the output"
|
@@ -124,6 +132,10 @@ module Lono
|
|
124
132
|
long_desc Help.text(:configset)
|
125
133
|
subcommand "configset", Configset
|
126
134
|
|
135
|
+
desc "extension SUBCOMMAND", "extension subcommands"
|
136
|
+
long_desc Help.text(:extension)
|
137
|
+
subcommand "extension", Extension
|
138
|
+
|
127
139
|
desc "param SUBCOMMAND", "param subcommands"
|
128
140
|
long_desc Help.text(:param)
|
129
141
|
subcommand "param", Param
|
@@ -55,7 +55,7 @@ class Lono::Configset
|
|
55
55
|
next unless init
|
56
56
|
|
57
57
|
data = {
|
58
|
-
registry: Lono::
|
58
|
+
registry: Lono::Jade::Registry.new(["#{logical_id}OriginalConfigset"], resource: logical_id),
|
59
59
|
metdata_configset: attributes["Metadata"]
|
60
60
|
}
|
61
61
|
configsets << data
|
@@ -2,7 +2,7 @@ class Lono::Configset::Meta
|
|
2
2
|
module Dsl
|
3
3
|
def depends_on(*args)
|
4
4
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
5
|
-
registry = Lono::
|
5
|
+
registry = Lono::Jade::Registry.new(args, options)
|
6
6
|
registry.depends_on = args.first
|
7
7
|
registry.parent = @jade
|
8
8
|
already_has = @jade.depends_ons.detect { |d| d.name == registry.name && d.args == registry.args }
|
@@ -10,7 +10,7 @@ class Lono::Configset
|
|
10
10
|
|
11
11
|
def run
|
12
12
|
register
|
13
|
-
resolve_dependencies
|
13
|
+
resolve_dependencies # also calls jade.materialize
|
14
14
|
register_dependencies
|
15
15
|
materialize
|
16
16
|
validate_all! # run after final materializer
|
@@ -23,8 +23,8 @@ class Lono::Configset
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def resolve_dependencies
|
26
|
-
jades = Lono::Jade.
|
27
|
-
@resolver.resolve(jades)
|
26
|
+
jades = Lono::Jade::Registry.tracked_configsets # at this point only top-level
|
27
|
+
@resolver.resolve(jades) # also calls jade.materialize
|
28
28
|
end
|
29
29
|
|
30
30
|
def register_dependencies
|
@@ -32,8 +32,8 @@ class Lono::Configset
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def materialize
|
35
|
-
jades = Lono::Jade.
|
36
|
-
Materializer::Final.new.build(jades)
|
35
|
+
jades = Lono::Jade::Registry.downloaded_configsets
|
36
|
+
Lono::Jade::Materializer::Final.new.build(jades)
|
37
37
|
end
|
38
38
|
|
39
39
|
def validate_all!
|
@@ -18,7 +18,8 @@ module Lono::Configset::Register
|
|
18
18
|
|
19
19
|
def jadify
|
20
20
|
self.class.configsets.each do |registry|
|
21
|
-
Lono::Jade.new(registry.name, jade_type, registry)
|
21
|
+
jade = Lono::Jade.new(registry.name, jade_type, registry)
|
22
|
+
Lono::Jade::Registry.tracked_configsets << jade
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module Lono::Configset::Register
|
2
2
|
module Dsl
|
3
|
-
def configset(*args)
|
4
|
-
|
5
|
-
registry = Lono::Configset::Registry.new(args, options)
|
3
|
+
def configset(*args, **options)
|
4
|
+
registry = Lono::Jade::Registry.register_configset(args, options)
|
6
5
|
self.class.append(registry)
|
7
6
|
store_for_validation(registry)
|
8
7
|
end
|
@@ -7,6 +7,7 @@ class Lono::Configset
|
|
7
7
|
@@resolving_message_shown = false
|
8
8
|
def resolve(*unresolved)
|
9
9
|
unresolved.flatten! # initially only top-level
|
10
|
+
unresolved.uniq! { |jade| jade.name }
|
10
11
|
puts "Resolving dependencies..." if !@@resolving_message_shown && !unresolved.empty?
|
11
12
|
puts "Resolving #{unresolved.map(&:name)}" if ENV['LONO_DEBUG_CONFIGSET']
|
12
13
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'cli-format'
|
2
|
+
|
3
|
+
class Lono::Extension
|
4
|
+
class List
|
5
|
+
def initialize(options={})
|
6
|
+
@options = options
|
7
|
+
@stack, @blueprint, @template, @param = Lono::Conventions.new(options).values
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
if @blueprint
|
12
|
+
blueprint_configsets
|
13
|
+
else
|
14
|
+
project_configsets
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def blueprint_configsets
|
19
|
+
Lono::Extensions::Preparer.new(@options).run # register and materialize gems
|
20
|
+
tracked_extension_names = Lono::Jade::Registry.tracked_extensions.map(&:name)
|
21
|
+
|
22
|
+
finder = Lono::Finder::Extension.new
|
23
|
+
jadespecs = finder.find_all
|
24
|
+
|
25
|
+
presenter = CliFormat::Presenter.new(@options)
|
26
|
+
presenter.header = %w[Name Path Type]
|
27
|
+
jadespecs.each do |j|
|
28
|
+
if tracked_extension_names.include?(j.name)
|
29
|
+
presenter.rows << [j.name, j.root, j.source_type]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
presenter.show
|
33
|
+
end
|
34
|
+
|
35
|
+
def project_configsets
|
36
|
+
Lono::Finder::Extension.list(filter_materialized: true, message: "Project extensions:")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
class Lono::Extension
|
2
|
+
class New < Lono::Sequence
|
3
|
+
include Lono::Blueprint::Helper # for user_info
|
4
|
+
include Lono::Extension::Helper
|
5
|
+
|
6
|
+
argument :extension_name
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
templates = File.expand_path("../../templates", File.dirname(__FILE__))
|
10
|
+
"#{templates}/extension"
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.cli_options
|
14
|
+
[
|
15
|
+
[:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files."],
|
16
|
+
]
|
17
|
+
end
|
18
|
+
|
19
|
+
cli_options.each do |args|
|
20
|
+
class_option(*args)
|
21
|
+
end
|
22
|
+
|
23
|
+
# for specs
|
24
|
+
def set_cwd
|
25
|
+
@cwd = ENV['LONO_TEST'] ? File.dirname(Lono.root) : "#{Dir.pwd}/app/extensions"
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_project
|
29
|
+
puts "=> Creating new extension called #{extension_name}."
|
30
|
+
directory ".", "#{@cwd}/#{extension_name}", options
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_license
|
34
|
+
return unless ENV['LONO_LICENSE_FILE']
|
35
|
+
copy_file ENV['LONO_LICENSE_FILE'], "#{@cwd}/#{extension_name}/LICENSE.txt"
|
36
|
+
end
|
37
|
+
|
38
|
+
# After this commands are executed with the newly created project
|
39
|
+
def set_destination_root
|
40
|
+
destination_root = "#{@cwd}/#{extension_name}"
|
41
|
+
self.destination_root = destination_root
|
42
|
+
@old_dir = Dir.pwd # for reset_current_dir
|
43
|
+
FileUtils.cd(self.destination_root)
|
44
|
+
end
|
45
|
+
|
46
|
+
def welcome_message
|
47
|
+
puts <<~EOL
|
48
|
+
#{"="*64}
|
49
|
+
Congrats 🎉 You have successfully created a lono extension.
|
50
|
+
|
51
|
+
Cd into your extension and check things out.
|
52
|
+
|
53
|
+
cd #{extension_name}
|
54
|
+
|
55
|
+
More info: https://lono.cloud/docs/extensions
|
56
|
+
|
57
|
+
EOL
|
58
|
+
end
|
59
|
+
|
60
|
+
def tree
|
61
|
+
tree_installed = system("type tree > /dev/null")
|
62
|
+
return unless tree_installed
|
63
|
+
|
64
|
+
structure = `tree .`
|
65
|
+
puts <<~EOL
|
66
|
+
Here is the structure of your extension:
|
67
|
+
|
68
|
+
#{structure}
|
69
|
+
EOL
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Lono
|
2
|
+
class Extensions
|
3
|
+
include Dsl
|
4
|
+
include Lono::Template::Evaluate
|
5
|
+
|
6
|
+
def initialize(template_path)
|
7
|
+
@template_path = template_path
|
8
|
+
end
|
9
|
+
|
10
|
+
def evaluate
|
11
|
+
evaluate_template_path(@template_path) # handle extend_with
|
12
|
+
end
|
13
|
+
|
14
|
+
# The extend_with methods are used in file as the normal DSL evaluation.
|
15
|
+
# We use method_missing so we dont have to redefine all the normal methods of the DSL.
|
16
|
+
def method_missing(name, *args, &block); end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class Lono::Extensions
|
2
|
+
class Loader < Lono::AbstractBase
|
3
|
+
include Lono::Template::Context::Loader::LoadFiles
|
4
|
+
|
5
|
+
def run
|
6
|
+
Lono::Jade::Registry.tracked_extensions.each do |registry|
|
7
|
+
load_extension_helpers(registry)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def load_extension_helpers(registry)
|
12
|
+
root = find_root(registry)
|
13
|
+
helpers_path = "#{root}/lib/#{registry.name}/helpers"
|
14
|
+
load_files(helpers_path)
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
# 1. vendor/extensions
|
19
|
+
# 2. normal gem
|
20
|
+
# 3. materialized gem
|
21
|
+
#
|
22
|
+
def find_root(registry)
|
23
|
+
jadespec = finder.find(registry.name)
|
24
|
+
jadespec.root
|
25
|
+
end
|
26
|
+
|
27
|
+
def finder
|
28
|
+
Lono::Finder::Extension.new
|
29
|
+
end
|
30
|
+
memoize :finder
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class Lono::Extensions
|
2
|
+
class Preparer < Lono::AbstractBase
|
3
|
+
def initialize(options={})
|
4
|
+
super
|
5
|
+
@register = Register.new(options)
|
6
|
+
@loader = Loader.new(options)
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
@register.run
|
11
|
+
materialize
|
12
|
+
# no need to validate because bundler will fail to install extension earlier and is a form of "validation already"
|
13
|
+
@loader.run
|
14
|
+
end
|
15
|
+
|
16
|
+
def materialize
|
17
|
+
Lono::Jade::Registry.tracked_extensions.each do |registry|
|
18
|
+
jade = Lono::Jade.new(registry.name, "extension", registry)
|
19
|
+
jade.materialize
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Lono::Extensions
|
2
|
+
class Register < Lono::AbstractBase
|
3
|
+
include Lono::Configset::EvaluateFile
|
4
|
+
|
5
|
+
def run
|
6
|
+
register_extensions # evaluates extend_with
|
7
|
+
end
|
8
|
+
|
9
|
+
# register_extensions and evaluate extend_with methods earlier than load_context so project helpers can override extensions
|
10
|
+
def register_extensions
|
11
|
+
template_path = "#{Lono.config.templates_path}/#{@template}.rb"
|
12
|
+
Lono::Extensions.new(template_path).evaluate # registers extensions
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/lono/finder/base.rb
CHANGED
@@ -24,7 +24,6 @@ module Lono::Finder
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
# overridden in finder/blueprint/configset.rb
|
28
27
|
def local
|
29
28
|
project + vendor + gems
|
30
29
|
end
|
@@ -43,7 +42,7 @@ module Lono::Finder
|
|
43
42
|
components(gem_roots, "gem")
|
44
43
|
end
|
45
44
|
|
46
|
-
# Folders that each materialized gems to tmp/
|
45
|
+
# Folders that each materialized gems to tmp/jades
|
47
46
|
def materialized
|
48
47
|
components(materialized_gem_roots, "materialized")
|
49
48
|
end
|
@@ -114,8 +113,9 @@ module Lono::Finder
|
|
114
113
|
memoize :gem_roots
|
115
114
|
|
116
115
|
def materialized_gem_roots
|
117
|
-
gemfile_lock = "#{Lono.root}/tmp/
|
116
|
+
gemfile_lock = "#{Lono.root}/tmp/jades/Gemfile.lock"
|
118
117
|
return [] unless File.exist?(gemfile_lock)
|
118
|
+
|
119
119
|
parser = Bundler::LockfileParser.new(Bundler.read_file(gemfile_lock))
|
120
120
|
specs = parser.specs
|
121
121
|
# __materialize__ only exists in Gem::LazySpecification and not in Gem::Specification
|