lono 5.2.4 → 5.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/lono/blueprint/new.rb +9 -3
- data/lib/lono/cli.rb +2 -0
- data/lib/lono/help/new.md +7 -9
- data/lib/lono/new.rb +8 -8
- data/lib/lono/seed/base.rb +38 -31
- data/lib/lono/version.rb +1 -1
- data/lib/templates/blueprint/%blueprint_name%.gemspec.tt +1 -2
- data/lib/templates/blueprint_configs/configs/%blueprint_name%/params/development.txt +2 -0
- data/lib/templates/blueprint_configs/configs/%blueprint_name%/params/{base.txt → production.txt} +0 -0
- data/lib/templates/blueprint_configs/configs/%blueprint_name%/variables/development.rb +2 -0
- data/lib/templates/blueprint_configs/configs/%blueprint_name%/variables/{base.rb → production.rb} +0 -0
- data/lib/templates/skeleton/Gemfile +2 -1
- data/lono.gemspec +0 -1
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 798d555eb31a539699308dd7ef59af75a3fd2cd99e6d4ce101476e0fe2711a9b
|
4
|
+
data.tar.gz: 6c66d0ee14ce53ee16f2c39ade5fb0dfe0c5b0bc0ae59f6d65b92c0d5662732f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48b6f6152e99479a2460abb1edf02b44e639fa3dc7dce5a8458d4dbcfb75cdd8bc9a032946bc1df15cbbb4034985e92d515ddcfeb62b3a233fb3d1901ed4b36c
|
7
|
+
data.tar.gz: de0ee3979c84a09d89b494cfd0e358b8a24e2275adfd3b1271ef9513c55a9fc213d621d1057b5777ad6e1cc56542d85c9d2e04f05be63cd34772f03b9ac0a8fa
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,15 @@
|
|
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
|
+
## [5.2.5]
|
7
|
+
* #6 updates
|
8
|
+
* changes so `lono code import` can create full blueprint structure
|
9
|
+
* improve `lono seed` to prompt before overwriting
|
10
|
+
* improve starter configs params
|
11
|
+
* improve started Gemfile
|
12
|
+
- lono new --demo option to include starter demo blueprint
|
13
|
+
- lono seed: use Thor::Actions to prompt before overwriting
|
14
|
+
|
6
15
|
## [5.2.4]
|
7
16
|
- add description to lono managed stack
|
8
17
|
|
data/lib/lono/blueprint/new.rb
CHANGED
@@ -15,6 +15,7 @@ class Lono::Blueprint
|
|
15
15
|
[:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files."],
|
16
16
|
[:from_new, type: :boolean, desc: "Called from `lono new` command."],
|
17
17
|
[:project_name, default: '', desc: "Only used with from_new internally"],
|
18
|
+
[:import, type: :boolean, desc: "Flag for lono code import"],
|
18
19
|
[:type, default: "dsl", desc: "Blueprint type: dsl or erb"],
|
19
20
|
]
|
20
21
|
end
|
@@ -48,6 +49,7 @@ class Lono::Blueprint
|
|
48
49
|
end
|
49
50
|
|
50
51
|
def create_app_folder
|
52
|
+
return if @options[:import]
|
51
53
|
directory "../blueprint_types/#{@options[:type]}", "#{@cwd}/#{blueprint_name}"
|
52
54
|
end
|
53
55
|
|
@@ -58,6 +60,8 @@ class Lono::Blueprint
|
|
58
60
|
end
|
59
61
|
|
60
62
|
def create_starter_configs
|
63
|
+
return if @options[:import]
|
64
|
+
|
61
65
|
if options[:from_new] # lono new command
|
62
66
|
directory "../blueprint_configs", options[:project_name]
|
63
67
|
else # lono blueprint new command
|
@@ -73,7 +77,8 @@ class Lono::Blueprint
|
|
73
77
|
end
|
74
78
|
|
75
79
|
def bundle_install
|
76
|
-
return if options[:from_new]
|
80
|
+
return if options[:from_new] || options[:import]
|
81
|
+
|
77
82
|
return unless options[:bundle]
|
78
83
|
|
79
84
|
puts "=> Installing dependencies with: bundle install"
|
@@ -90,7 +95,7 @@ class Lono::Blueprint
|
|
90
95
|
|
91
96
|
Cd into your blueprint and check things out.
|
92
97
|
|
93
|
-
|
98
|
+
cd #{blueprint_name}
|
94
99
|
|
95
100
|
More info: https://lono.cloud/docs/core/blueprints
|
96
101
|
|
@@ -98,7 +103,8 @@ class Lono::Blueprint
|
|
98
103
|
end
|
99
104
|
|
100
105
|
def tree
|
101
|
-
return if options[:from_new]
|
106
|
+
return if options[:from_new] || options[:import]
|
107
|
+
|
102
108
|
tree_installed = system("type tree > /dev/null")
|
103
109
|
return unless tree_installed
|
104
110
|
|
data/lib/lono/cli.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Lono
|
2
2
|
class CLI < Command
|
3
|
+
include Thor::Actions # for add_runtime_options
|
3
4
|
|
4
5
|
long_desc Help.text(:new)
|
5
6
|
New.cli_options.each do |args|
|
@@ -52,6 +53,7 @@ module Lono
|
|
52
53
|
long_desc Help.text("seed")
|
53
54
|
option :param, desc: "override convention and specify the param file to use"
|
54
55
|
option :template, desc: "override convention and specify the template file to use"
|
56
|
+
add_runtime_options!
|
55
57
|
def seed(blueprint)
|
56
58
|
Seed.new(blueprint, options).create
|
57
59
|
end
|
data/lib/lono/help/new.md
CHANGED
@@ -40,21 +40,19 @@ By default, `lono new` generates a skeleton project. Use `TEMPLATE` to generate
|
|
40
40
|
|
41
41
|
cd infra
|
42
42
|
|
43
|
-
|
43
|
+
To create a new blueprint run:
|
44
44
|
|
45
|
-
|
45
|
+
lono blueprint new demo
|
46
46
|
|
47
|
-
|
47
|
+
To deploy the blueprint:
|
48
48
|
|
49
|
-
|
49
|
+
lono cfn deploy my-demo --blueprint demo
|
50
50
|
|
51
|
-
|
51
|
+
If you name the stack according to conventions, you can simply run:
|
52
52
|
|
53
|
-
|
53
|
+
lono cfn deploy demo
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
To list and create additional blueprints refer to https://lono.cloud/docs/core/blueprints
|
55
|
+
To list and create additional blueprints refer to https://lono.cloud/docs/core/blueprints
|
58
56
|
|
59
57
|
More info: http://lono.cloud/
|
60
58
|
$
|
data/lib/lono/new.rb
CHANGED
@@ -11,6 +11,7 @@ module Lono
|
|
11
11
|
def self.cli_options
|
12
12
|
[
|
13
13
|
[:bundle, type: :boolean, default: true, desc: "Runs bundle install on the project"],
|
14
|
+
[:demo, type: :boolean, default: false, desc: "Also generate demo blueprint"],
|
14
15
|
[:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files."],
|
15
16
|
[:git, type: :boolean, default: true, desc: "Git initialize the project"],
|
16
17
|
[:type, default: "dsl", desc: "Blueprint type: dsl or erb"],
|
@@ -32,6 +33,7 @@ module Lono
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def create_starter_blueprint
|
36
|
+
return unless @options[:demo]
|
35
37
|
# https://github.com/erikhuda/thor/wiki/Invocations
|
36
38
|
Lono::Blueprint::New.start(["demo", "--from-new", "--type", @options[:type], "--project-name", project_name])
|
37
39
|
end
|
@@ -71,21 +73,19 @@ module Lono
|
|
71
73
|
Congrats 🎉 You have successfully created a lono project. A starter demo blueprint was created
|
72
74
|
and is at blueprints/demo. Check things out by going into the created infra folder.
|
73
75
|
|
74
|
-
|
76
|
+
cd #{project_name}
|
75
77
|
|
76
|
-
To
|
78
|
+
To create a new blueprint run:
|
77
79
|
|
78
|
-
|
80
|
+
lono blueprint new demo
|
79
81
|
|
80
|
-
|
82
|
+
To deploy the blueprint:
|
81
83
|
|
82
|
-
|
83
|
-
|
84
|
-
lono cfn deploy my-demo --blueprint demo
|
84
|
+
lono cfn deploy my-demo --blueprint demo
|
85
85
|
|
86
86
|
If you name the stack according to conventions, you can simply run:
|
87
87
|
|
88
|
-
|
88
|
+
lono cfn deploy demo
|
89
89
|
|
90
90
|
To list and create additional blueprints refer to https://lono.cloud/docs/core/blueprints
|
91
91
|
|
data/lib/lono/seed/base.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "fileutils"
|
2
2
|
require "memoist"
|
3
|
+
require "thor"
|
3
4
|
require "yaml"
|
4
5
|
|
5
6
|
# Subclasses should implement:
|
@@ -15,8 +16,15 @@ class Lono::Seed
|
|
15
16
|
include Lono::Blueprint::Root
|
16
17
|
include Lono::AwsServices
|
17
18
|
include Lono::Conventions
|
19
|
+
|
20
|
+
# What's needed for a Thor::Group or "Sequence"
|
21
|
+
# Gives us Thor::Actions commands like create_file
|
22
|
+
include Thor::Actions
|
23
|
+
include Thor::Base
|
24
|
+
|
18
25
|
extend Memoist
|
19
26
|
|
27
|
+
# attr_reader :options
|
20
28
|
def initialize(blueprint, options)
|
21
29
|
@blueprint, @options = blueprint, options
|
22
30
|
@template, @param = template_param_convention(options)
|
@@ -25,14 +33,15 @@ class Lono::Seed
|
|
25
33
|
def run
|
26
34
|
check_dsl_type!
|
27
35
|
setup
|
36
|
+
self.destination_root = Dir.pwd # Thor::Actions require destination_root to be set
|
28
37
|
create_params
|
29
38
|
create_variables
|
30
39
|
finish
|
31
40
|
end
|
32
41
|
|
33
|
-
# Always create params files
|
34
42
|
def create_params
|
35
43
|
return unless params
|
44
|
+
|
36
45
|
# Only supporting the main blueprint for now
|
37
46
|
path = "#{Lono.config.templates_path}/#{@blueprint}.rb"
|
38
47
|
if File.exist?(path)
|
@@ -49,11 +58,37 @@ class Lono::Seed
|
|
49
58
|
true
|
50
59
|
end
|
51
60
|
|
61
|
+
def create_param_file(app_template_path)
|
62
|
+
parameters = parameters(app_template_path)
|
63
|
+
|
64
|
+
lines = []
|
65
|
+
required = required(parameters)
|
66
|
+
lines << "# Required parameters:" unless required.empty?
|
67
|
+
required.each do |name, data|
|
68
|
+
example = description_example(data["Description"])
|
69
|
+
lines << "#{name}=#{example}"
|
70
|
+
end
|
71
|
+
optional = optional(parameters)
|
72
|
+
lines << "# Optional parameters:" unless optional.empty?
|
73
|
+
optional.each do |name, data|
|
74
|
+
value = default_value(data)
|
75
|
+
lines << "# #{name}=#{value}"
|
76
|
+
end
|
77
|
+
|
78
|
+
if lines.empty?
|
79
|
+
puts "Template has no parameters."
|
80
|
+
return
|
81
|
+
end
|
82
|
+
|
83
|
+
content = lines.join("\n") + "\n"
|
84
|
+
dest_path = "configs/#{@blueprint}/params/#{Lono.env}.txt" # only support environment level parameters for now
|
85
|
+
create_file(dest_path, content) # Thor::Action
|
86
|
+
end
|
87
|
+
|
52
88
|
def create_variables
|
53
89
|
return unless variables
|
54
90
|
dest_path = "configs/#{@blueprint}/variables/#{Lono.env}.rb"
|
55
|
-
|
56
|
-
puts "Starter variables created: #{dest_path}"
|
91
|
+
create_file(dest_path, variables) # Thor::Action
|
57
92
|
end
|
58
93
|
|
59
94
|
def check_dsl_type!
|
@@ -83,34 +118,6 @@ class Lono::Seed
|
|
83
118
|
false
|
84
119
|
end
|
85
120
|
|
86
|
-
def create_param_file(app_template_path)
|
87
|
-
parameters = parameters(app_template_path)
|
88
|
-
|
89
|
-
lines = []
|
90
|
-
required = required(parameters)
|
91
|
-
lines << "# Required parameters:" unless required.empty?
|
92
|
-
required.each do |name, data|
|
93
|
-
example = description_example(data["Description"])
|
94
|
-
lines << "#{name}=#{example}"
|
95
|
-
end
|
96
|
-
optional = optional(parameters)
|
97
|
-
lines << "# Optional parameters:" unless optional.empty?
|
98
|
-
optional.each do |name, data|
|
99
|
-
value = default_value(data)
|
100
|
-
lines << "# #{name}=#{value}"
|
101
|
-
end
|
102
|
-
|
103
|
-
if lines.empty?
|
104
|
-
puts "Template has no parameters."
|
105
|
-
return
|
106
|
-
end
|
107
|
-
|
108
|
-
content = lines.join("\n") + "\n"
|
109
|
-
dest_path = "configs/#{@blueprint}/params/#{Lono.env}.txt" # only support environment level parameters for now
|
110
|
-
write(dest_path, content)
|
111
|
-
puts "Starter params created: #{dest_path}"
|
112
|
-
end
|
113
|
-
|
114
121
|
def write(path, content)
|
115
122
|
FileUtils.mkdir_p(File.dirname(path))
|
116
123
|
IO.write(path, content)
|
data/lib/lono/version.rb
CHANGED
@@ -26,8 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.metadata["changelog_uri"] = "https://github.com/user/repo/blob/master/CHANGELOG.md" # TODO: Change me
|
27
27
|
<% end -%>
|
28
28
|
else
|
29
|
-
raise "RubyGems 2.0 or newer is required to protect against "
|
30
|
-
"public gem pushes."
|
29
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
31
30
|
end
|
32
31
|
# Specify which files should be added to the gem when it is released.
|
33
32
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/lib/templates/blueprint_configs/configs/%blueprint_name%/params/{base.txt → production.txt}
RENAMED
File without changes
|
data/lib/templates/blueprint_configs/configs/%blueprint_name%/variables/{base.rb → production.rb}
RENAMED
File without changes
|
data/lono.gemspec
CHANGED
@@ -21,7 +21,6 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.license = "https://boltops.com/boltops-community-license"
|
22
22
|
|
23
23
|
gem.add_dependency "activesupport"
|
24
|
-
gem.add_dependency "awesome_print"
|
25
24
|
gem.add_dependency "aws-sdk-cloudformation"
|
26
25
|
gem.add_dependency "aws-sdk-ec2" # lono seed
|
27
26
|
gem.add_dependency "aws-sdk-iam" # lono seed
|
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: 5.2.
|
4
|
+
version: 5.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: awesome_print
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: aws-sdk-cloudformation
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -562,10 +548,10 @@ files:
|
|
562
548
|
- lib/templates/blueprint/README.md
|
563
549
|
- lib/templates/blueprint/Rakefile
|
564
550
|
- lib/templates/blueprint/seed/configs.rb
|
565
|
-
- lib/templates/blueprint_configs/configs/%blueprint_name%/params/base.txt
|
566
551
|
- lib/templates/blueprint_configs/configs/%blueprint_name%/params/development.txt
|
567
|
-
- lib/templates/blueprint_configs/configs/%blueprint_name%/
|
552
|
+
- lib/templates/blueprint_configs/configs/%blueprint_name%/params/production.txt
|
568
553
|
- lib/templates/blueprint_configs/configs/%blueprint_name%/variables/development.rb
|
554
|
+
- lib/templates/blueprint_configs/configs/%blueprint_name%/variables/production.rb
|
569
555
|
- lib/templates/blueprint_types/dsl/app/templates/%blueprint_name%.rb
|
570
556
|
- lib/templates/blueprint_types/dsl/app/user_data/bootstrap.sh
|
571
557
|
- lib/templates/blueprint_types/erb/app/definitions/base.rb.tt
|