lono 5.0.1 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/README.md +3 -0
- data/.circleci/config.yml +56 -0
- data/.cody/README.md +27 -4
- data/.cody/acceptance.sh +9 -9
- data/.cody/buildspec.yml +1 -16
- data/.cody/project.rb +5 -11
- data/.cody/role.rb +7 -1
- data/CHANGELOG.md +5 -0
- data/README.md +14 -14
- data/lib/lono/blueprint.rb +9 -107
- data/lib/lono/blueprint/list.rb +1 -1
- data/lib/lono/blueprint/new.rb +113 -0
- data/lib/lono/cli.rb +8 -10
- data/lib/lono/command.rb +15 -0
- data/lib/lono/help/blueprint.md +11 -11
- data/lib/lono/help/new.md +1 -1
- data/lib/lono/help/xgraph.md +1 -1
- data/lib/lono/new.rb +1 -1
- data/lib/lono/{configure.rb → seed.rb} +3 -3
- data/lib/lono/version.rb +1 -1
- data/lib/templates/blueprint/README.md +3 -3
- data/lib/templates/blueprint/{setup → seed}/configs.rb +1 -1
- data/lib/templates/blueprint_types/dsl/app/templates/%blueprint_name%.rb +9 -9
- data/lib/templates/skeleton/Gemfile +1 -1
- data/lono.gemspec +2 -2
- metadata +7 -5
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74d30f8bdd10b8530f8aef55dc52047b04d2c612f599bc353f9605e2609badd1
|
4
|
+
data.tar.gz: 77d3c804e551daea9997b121af4462158e7fcfbaa19b00b6c015f637f226a2c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 915c66c0c9d85bb9877f594bca34a1be9bb3ac0c13b949b2cf5bf26631d673a584247a3ea6b6f6d8ff01d77e30531fac1f7acc3e724ff9601f5143653a1cf66f
|
7
|
+
data.tar.gz: 0a9e4ac8705aabdbc1d975dd6809290723c17215fe0668554684eec5e48e442e89a4292dfe4d8620424c2470b5772a3942af2796836ffd49bea4be8c7852d49f
|
data/.circleci/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Ruby CircleCI 2.0 configuration file
|
2
|
+
#
|
3
|
+
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
+
#
|
5
|
+
version: 2
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
docker:
|
9
|
+
# specify the version you desire here
|
10
|
+
- image: circleci/ruby:2.5.0-node-browsers
|
11
|
+
|
12
|
+
# Specify service dependencies here if necessary
|
13
|
+
# CircleCI maintains a library of pre-built images
|
14
|
+
# documented at https://circleci.com/docs/2.0/circleci-images/
|
15
|
+
# - image: circleci/postgres:9.4
|
16
|
+
|
17
|
+
working_directory: ~/repo
|
18
|
+
|
19
|
+
steps:
|
20
|
+
- checkout
|
21
|
+
|
22
|
+
- run:
|
23
|
+
name: submodule sync
|
24
|
+
command: |
|
25
|
+
git submodule sync
|
26
|
+
git submodule update --init
|
27
|
+
|
28
|
+
# Download and cache dependencies
|
29
|
+
- restore_cache:
|
30
|
+
keys:
|
31
|
+
- v2-dependencies-{{ checksum "lono.gemspec" }}
|
32
|
+
# fallback to using the latest cache if no exact match is found
|
33
|
+
- v2-dependencies-
|
34
|
+
|
35
|
+
- run:
|
36
|
+
name: install dependencies
|
37
|
+
command: |
|
38
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
39
|
+
|
40
|
+
- save_cache:
|
41
|
+
paths:
|
42
|
+
- ./vendor/bundle
|
43
|
+
key: v2-dependencies-{{ checksum "lono.gemspec" }}
|
44
|
+
|
45
|
+
# run tests!
|
46
|
+
- run:
|
47
|
+
name: run tests
|
48
|
+
command: |
|
49
|
+
bundle exec rspec
|
50
|
+
|
51
|
+
# collect reports
|
52
|
+
- store_test_results:
|
53
|
+
path: /tmp/test-results
|
54
|
+
- store_artifacts:
|
55
|
+
path: /tmp/test-results
|
56
|
+
destination: test-results
|
data/.cody/README.md
CHANGED
@@ -1,6 +1,29 @@
|
|
1
|
-
#
|
1
|
+
# Overview
|
2
2
|
|
3
|
-
|
3
|
+
CodeBuild is used to run **acceptance-level tests**.
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
## Cody Files
|
6
|
+
|
7
|
+
The files in folder are used by cody to build AWS CodeBuild projects. For more info, check out the [cody docs](https://cody.run). Here's a quick start.
|
8
|
+
|
9
|
+
## Install Tool
|
10
|
+
|
11
|
+
gem install cody
|
12
|
+
|
13
|
+
This installs the `cody` command to manage the AWS CodeBuild project.
|
14
|
+
|
15
|
+
## Update Project
|
16
|
+
|
17
|
+
To update the CodeBuild project that handles deployment:
|
18
|
+
|
19
|
+
cody deploy lono
|
20
|
+
|
21
|
+
## Start a Deploy
|
22
|
+
|
23
|
+
To start a CodeBuild build:
|
24
|
+
|
25
|
+
cody start lono
|
26
|
+
|
27
|
+
To specify a branch:
|
28
|
+
|
29
|
+
cody start lono -b feature
|
data/.cody/acceptance.sh
CHANGED
@@ -4,27 +4,27 @@ set -exu
|
|
4
4
|
|
5
5
|
# https://unix.stackexchange.com/questions/1496/why-doesnt-my-bash-script-recognize-aliases
|
6
6
|
shopt -s expand_aliases
|
7
|
-
alias
|
7
|
+
alias lono="$(pwd)/exe/lono"
|
8
8
|
|
9
9
|
bundle install --without development test
|
10
10
|
|
11
11
|
rm -rf infra
|
12
12
|
|
13
|
-
|
13
|
+
lono new infra
|
14
14
|
# Very simply template with just a security group
|
15
|
-
cp .
|
15
|
+
cp .cody/demo.rb infra/blueprints/demo/app/templates/demo.rb
|
16
16
|
cd infra
|
17
17
|
|
18
|
-
# Rewrite the Gemfile to use the local
|
18
|
+
# Rewrite the Gemfile to use the local lono gem for testing
|
19
19
|
cat << EOF > Gemfile
|
20
20
|
source "https://rubygems.org"
|
21
|
-
gem "
|
21
|
+
gem "lono", path: "$CODEBUILD_SRC_DIR", submodules: true
|
22
22
|
EOF
|
23
23
|
|
24
|
-
bundle # install
|
24
|
+
bundle # install lono gem in the infra project
|
25
25
|
|
26
26
|
STACK_NAME="demo-$(date +%Y%m%d%H%M%S)"
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
lono cfn deploy $STACK_NAME --blueprint demo
|
29
|
+
lono cfn status $STACK_NAME
|
30
|
+
lono cfn delete $STACK_NAME --sure
|
data/.cody/buildspec.yml
CHANGED
@@ -1,21 +1,6 @@
|
|
1
1
|
version: 0.2
|
2
2
|
|
3
3
|
phases:
|
4
|
-
pre_build:
|
5
|
-
commands:
|
6
|
-
- uname -a
|
7
|
-
- pwd
|
8
|
-
- ls
|
9
|
-
- env
|
10
|
-
- ls /etc/*release*
|
11
|
-
- cat /etc/*release*
|
12
|
-
- whoami
|
13
4
|
build:
|
14
5
|
commands:
|
15
|
-
-
|
16
|
-
- echo Building project...
|
17
|
-
- uptime
|
18
|
-
- .codebuild/acceptance.sh
|
19
|
-
artifacts:
|
20
|
-
files:
|
21
|
-
- result.txt
|
6
|
+
- .cody/acceptance.sh
|
data/.cody/project.rb
CHANGED
@@ -1,12 +1,6 @@
|
|
1
|
-
|
2
|
-
# For convenience methods, refer to the source https://github.com/tongueroo/codebuild/blob/master/lib/codebuild/dsl/project.rb
|
3
|
-
|
4
|
-
github_url("https://github.com/boltopspro/bolt.git")
|
1
|
+
github_url("https://github.com/tongueroo/lono")
|
5
2
|
linux_image("aws/codebuild/ruby:2.5.3-1.7.0")
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
# Shorthand to enable all local cache modes
|
12
|
-
# local_cache(true)
|
3
|
+
triggers(
|
4
|
+
webhook: true,
|
5
|
+
filter_groups: [[{type: "EVENT", pattern: "PUSH"}]]
|
6
|
+
)
|
data/.cody/role.rb
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
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.1.0]
|
7
|
+
- change `lono blueprint` to subcommand: `lono blueprint new` and `lono blueprint list` commands
|
8
|
+
- change `lono configure` to `lono seed`. Seed interface is the same but the path is different: `seed/configs.rb`
|
9
|
+
|
6
10
|
## [5.0.1]
|
7
11
|
- Introduce lono DSL and set as default mode
|
8
12
|
- Introduce blueprints concept
|
@@ -12,6 +16,7 @@ This project *tries* to adhere to [Semantic Versioning](http://semver.org/), eve
|
|
12
16
|
- Restructure project structure
|
13
17
|
- Remove aws\_profiles settings.yml in favor of aws_profile
|
14
18
|
- lono upgrade v4to5 command
|
19
|
+
- License update: https://www.boltops.com/boltops-community-license
|
15
20
|
|
16
21
|
## [4.2.7]
|
17
22
|
- retain tag values on cfn update operations
|
data/README.md
CHANGED
@@ -4,7 +4,8 @@
|
|
4
4
|
|
5
5
|
# Lono
|
6
6
|
|
7
|
-
![CodeBuild](https://codebuild.us-west-2.amazonaws.com/badges?uuid=
|
7
|
+
![CodeBuild](https://codebuild.us-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiYTloZ3dBZkZTYnlTaU1ZZTMvenROM1dmY2lDZzE0MDRVZ2d6NXdqb2JmSXNrQ3pkVGpKRTJMMnhTNDlOYUNOUlZZUmR6TktGcXRWMVFoYzhrSXFZWVZNPSIsIml2UGFyYW1ldGVyU3BlYyI6IkkrSGlFcTBWUjMzbk5xVGYiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master)
|
8
|
+
[![CircleCI](https://circleci.com/gh/tongueroo/lono.svg?style=svg)](https://circleci.com/gh/tongueroo/lono)
|
8
9
|
[![Support](https://img.shields.io/badge/get-support-blue.svg)](https://boltops.com?utm_source=badge&utm_medium=badge&utm_campaign=lono)
|
9
10
|
|
10
11
|
Lono is a powerful CloudFormation framework. Lono handles the entire CloudFormation lifecycle. It builds, manages and deploys CloudFormation templates.
|
@@ -37,25 +38,25 @@ Here's an example of what the Lono CloudFormation DSL looks like:
|
|
37
38
|
```ruby
|
38
39
|
description "Demo stack"
|
39
40
|
|
40
|
-
parameter(
|
41
|
+
parameter("InstanceType", "t3.micro")
|
41
42
|
|
42
|
-
mapping(
|
43
|
+
mapping("AmiMap",
|
43
44
|
"us-east-1": { ami: "ami-0de53d8956e8dcf80" },
|
44
45
|
"us-west-2": { ami: "ami-061392db613a6357b" }
|
45
46
|
)
|
46
47
|
|
47
|
-
resource(
|
48
|
-
instance_type: ref(
|
49
|
-
image_id: find_in_map(
|
50
|
-
security_group_ids: [get_att("
|
48
|
+
resource("Instance", "AWS::EC2::Instance",
|
49
|
+
instance_type: ref("InstanceType"),
|
50
|
+
image_id: find_in_map("AmiMap", ref("AWS::Region"), :ami),
|
51
|
+
security_group_ids: [get_att("SecurityGroup.GroupId")],
|
51
52
|
user_data: base64(user_data("bootstrap.sh"))
|
52
53
|
)
|
53
|
-
resource(
|
54
|
+
resource("SecurityGroup", "AWS::EC2::SecurityGroup",
|
54
55
|
group_description: "demo security group",
|
55
56
|
)
|
56
57
|
|
57
|
-
output(
|
58
|
-
output(
|
58
|
+
output("Instance")
|
59
|
+
output("SecurityGroup", get_att("SecurityGroup.GroupId"))
|
59
60
|
```
|
60
61
|
|
61
62
|
### Lono Cfn Lifecycle Commands
|
@@ -68,10 +69,9 @@ The above command will generate files to `output/infra/templates/demo.yml` and `
|
|
68
69
|
|
69
70
|
lono cfn deploy demo # shorthand if blueprint, template and params file matches.
|
70
71
|
lono cfn deploy demo-$(date +%Y%m%d%H%M%S) --blueprint demo --template demo --param demo
|
71
|
-
lono cfn diff demo
|
72
|
-
lono cfn preview demo
|
73
|
-
lono cfn
|
74
|
-
lono cfn delete demo-1493859659
|
72
|
+
lono cfn diff demo
|
73
|
+
lono cfn preview demo
|
74
|
+
lono cfn delete demo
|
75
75
|
lono cfn deploy -h # getting help
|
76
76
|
|
77
77
|
See [lono.cloud](http://lono.cloud) for full lono documentation.
|
data/lib/lono/blueprint.rb
CHANGED
@@ -1,113 +1,15 @@
|
|
1
1
|
module Lono
|
2
|
-
class Blueprint <
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def self.source_root
|
8
|
-
templates = File.expand_path("../templates", File.dirname(__FILE__))
|
9
|
-
"#{templates}/blueprint"
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.cli_options
|
13
|
-
[
|
14
|
-
[:bundle, type: :boolean, default: true, desc: "Runs bundle install on the project"],
|
15
|
-
[:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files."],
|
16
|
-
[:from_new, type: :boolean, desc: "Called from `lono new` command."],
|
17
|
-
[:project_name, default: '', desc: "Only used with from_new internally"],
|
18
|
-
[:type, default: "dsl", desc: "Blueprint type: dsl or erb"],
|
19
|
-
]
|
20
|
-
end
|
21
|
-
|
22
|
-
cli_options.each do |args|
|
23
|
-
class_option(*args)
|
24
|
-
end
|
25
|
-
|
26
|
-
# for specs
|
27
|
-
def set_cwd
|
28
|
-
@cwd = ENV['TEST'] ? File.dirname(Lono.root) : "#{Dir.pwd}/blueprints"
|
29
|
-
|
30
|
-
if options[:from_new]
|
31
|
-
# At this point @cwd will have the project_name from `lono new`
|
32
|
-
# Yup, it's confusing. Here's an example to explain:
|
33
|
-
#
|
34
|
-
# lono new my-infra - sets @cwd = my-infra
|
35
|
-
#
|
36
|
-
# Then within the new Thor::Group this is called
|
37
|
-
#
|
38
|
-
# Lono::Blueprint.start(["ec2", "--from-new"])
|
39
|
-
#
|
40
|
-
# So @cwd = my-infra/blueprints
|
41
|
-
@cwd = "#{options[:project_name]}/blueprints"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def create_project
|
46
|
-
puts "=> Creating new blueprint called #{blueprint_name}."
|
47
|
-
directory ".", "#{@cwd}/#{blueprint_name}"
|
48
|
-
end
|
49
|
-
|
50
|
-
def create_app_folder
|
51
|
-
directory "../blueprint_types/#{@options[:type]}", "#{@cwd}/#{blueprint_name}"
|
52
|
-
end
|
53
|
-
|
54
|
-
def create_empty_directories
|
55
|
-
# Note: Not using Lono::Core::Config::PATHS.keys to create all of them because
|
56
|
-
# think it is more common to not have all the folders. Instead create them explicitly.
|
57
|
-
empty_directory "#{@cwd}/#{blueprint_name}/app/templates"
|
2
|
+
class Blueprint < Command
|
3
|
+
long_desc Help.text("blueprint/new")
|
4
|
+
New.cli_options.each do |args|
|
5
|
+
option(*args)
|
58
6
|
end
|
7
|
+
register(New, "new", "new NAME", "Generates new lono blueprint.")
|
59
8
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
directory "../blueprint_configs", "."
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
# After this commands are executed with the newly created project
|
69
|
-
def set_destination_root
|
70
|
-
destination_root = "#{@cwd}/#{blueprint_name}"
|
71
|
-
self.destination_root = destination_root
|
72
|
-
FileUtils.cd(self.destination_root)
|
73
|
-
end
|
74
|
-
|
75
|
-
def bundle_install
|
76
|
-
return if options[:from_new]
|
77
|
-
return unless options[:bundle]
|
78
|
-
|
79
|
-
puts "=> Installing dependencies with: bundle install"
|
80
|
-
Bundler.with_clean_env do
|
81
|
-
system("BUNDLE_IGNORE_CONFIG=1 bundle install")
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def welcome_message
|
86
|
-
return if options[:from_new]
|
87
|
-
puts <<~EOL
|
88
|
-
#{"="*64}
|
89
|
-
Congrats 🎉 You have successfully created a lono blueprint.
|
90
|
-
|
91
|
-
Cd into your blueprint and check things out.
|
92
|
-
|
93
|
-
cd #{blueprint_name}
|
94
|
-
|
95
|
-
More info: https://lono.cloud/docs/core/blueprints
|
96
|
-
|
97
|
-
EOL
|
98
|
-
end
|
99
|
-
|
100
|
-
def tree
|
101
|
-
return if options[:from_new]
|
102
|
-
tree_installed = system("type tree > /dev/null")
|
103
|
-
return unless tree_installed
|
104
|
-
|
105
|
-
structure = `tree .`
|
106
|
-
puts <<~EOL
|
107
|
-
Here's the structure of your blueprint:
|
108
|
-
|
109
|
-
#{structure}
|
110
|
-
EOL
|
9
|
+
desc "list", "Lists project blueprints"
|
10
|
+
long_desc Help.text("blueprint/new")
|
11
|
+
def list
|
12
|
+
List.available
|
111
13
|
end
|
112
14
|
end
|
113
15
|
end
|
data/lib/lono/blueprint/list.rb
CHANGED
@@ -0,0 +1,113 @@
|
|
1
|
+
class Lono::Blueprint
|
2
|
+
class New < Lono::Sequence
|
3
|
+
include Helper
|
4
|
+
|
5
|
+
argument :blueprint_name
|
6
|
+
|
7
|
+
def self.source_root
|
8
|
+
templates = File.expand_path("../../templates", File.dirname(__FILE__))
|
9
|
+
"#{templates}/blueprint"
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.cli_options
|
13
|
+
[
|
14
|
+
[:bundle, type: :boolean, default: true, desc: "Runs bundle install on the project"],
|
15
|
+
[:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files."],
|
16
|
+
[:from_new, type: :boolean, desc: "Called from `lono new` command."],
|
17
|
+
[:project_name, default: '', desc: "Only used with from_new internally"],
|
18
|
+
[:type, default: "dsl", desc: "Blueprint type: dsl or erb"],
|
19
|
+
]
|
20
|
+
end
|
21
|
+
|
22
|
+
cli_options.each do |args|
|
23
|
+
class_option(*args)
|
24
|
+
end
|
25
|
+
|
26
|
+
# for specs
|
27
|
+
def set_cwd
|
28
|
+
@cwd = ENV['TEST'] ? File.dirname(Lono.root) : "#{Dir.pwd}/blueprints"
|
29
|
+
|
30
|
+
if options[:from_new]
|
31
|
+
# At this point @cwd will have the project_name from `lono new`
|
32
|
+
# Yup, it's confusing. Here's an example to explain:
|
33
|
+
#
|
34
|
+
# lono new my-infra - sets @cwd = my-infra
|
35
|
+
#
|
36
|
+
# Then within the new Thor::Group this is called
|
37
|
+
#
|
38
|
+
# Lono::Blueprint::New.start(["ec2", "--from-new"])
|
39
|
+
#
|
40
|
+
# So @cwd = my-infra/blueprints
|
41
|
+
@cwd = "#{options[:project_name]}/blueprints"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def create_project
|
46
|
+
puts "=> Creating new blueprint called #{blueprint_name}."
|
47
|
+
directory ".", "#{@cwd}/#{blueprint_name}"
|
48
|
+
end
|
49
|
+
|
50
|
+
def create_app_folder
|
51
|
+
directory "../blueprint_types/#{@options[:type]}", "#{@cwd}/#{blueprint_name}"
|
52
|
+
end
|
53
|
+
|
54
|
+
def create_empty_directories
|
55
|
+
# Note: Not using Lono::Core::Config::PATHS.keys to create all of them because
|
56
|
+
# think it is more common to not have all the folders. Instead create them explicitly.
|
57
|
+
empty_directory "#{@cwd}/#{blueprint_name}/app/templates"
|
58
|
+
end
|
59
|
+
|
60
|
+
def create_starter_configs
|
61
|
+
if options[:from_new] # lono new command
|
62
|
+
directory "../blueprint_configs", options[:project_name]
|
63
|
+
else # lono blueprint new command
|
64
|
+
directory "../blueprint_configs", "."
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# After this commands are executed with the newly created project
|
69
|
+
def set_destination_root
|
70
|
+
destination_root = "#{@cwd}/#{blueprint_name}"
|
71
|
+
self.destination_root = destination_root
|
72
|
+
FileUtils.cd(self.destination_root)
|
73
|
+
end
|
74
|
+
|
75
|
+
def bundle_install
|
76
|
+
return if options[:from_new]
|
77
|
+
return unless options[:bundle]
|
78
|
+
|
79
|
+
puts "=> Installing dependencies with: bundle install"
|
80
|
+
Bundler.with_clean_env do
|
81
|
+
system("BUNDLE_IGNORE_CONFIG=1 bundle install")
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def welcome_message
|
86
|
+
return if options[:from_new]
|
87
|
+
puts <<~EOL
|
88
|
+
#{"="*64}
|
89
|
+
Congrats 🎉 You have successfully created a lono blueprint.
|
90
|
+
|
91
|
+
Cd into your blueprint and check things out.
|
92
|
+
|
93
|
+
cd #{blueprint_name}
|
94
|
+
|
95
|
+
More info: https://lono.cloud/docs/core/blueprints
|
96
|
+
|
97
|
+
EOL
|
98
|
+
end
|
99
|
+
|
100
|
+
def tree
|
101
|
+
return if options[:from_new]
|
102
|
+
tree_installed = system("type tree > /dev/null")
|
103
|
+
return unless tree_installed
|
104
|
+
|
105
|
+
structure = `tree .`
|
106
|
+
puts <<~EOL
|
107
|
+
Here's the structure of your blueprint:
|
108
|
+
|
109
|
+
#{structure}
|
110
|
+
EOL
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
data/lib/lono/cli.rb
CHANGED
@@ -7,13 +7,7 @@ module Lono
|
|
7
7
|
end
|
8
8
|
register(New, "new", "new NAME", "Generates new lono project.")
|
9
9
|
|
10
|
-
|
11
|
-
Blueprint.cli_options.each do |args|
|
12
|
-
option(*args)
|
13
|
-
end
|
14
|
-
register(Blueprint, "blueprint", "blueprint NAME", "Generates new lono blueprint.")
|
15
|
-
|
16
|
-
desc "blueprints", "Lists available blueprints in the project."
|
10
|
+
desc "blueprints", "Lists project blueprints"
|
17
11
|
long_desc Help.text(:blueprints)
|
18
12
|
def blueprints
|
19
13
|
Blueprint::List.available
|
@@ -54,13 +48,13 @@ module Lono
|
|
54
48
|
Lono::Inspector::Graph.new(blueprint, template, options).run
|
55
49
|
end
|
56
50
|
|
57
|
-
desc "
|
51
|
+
desc "seed", "Seed blueprint configs with starter values."
|
58
52
|
option :defaults, type: :boolean, desc: "Bypass prompt and use the blueprints configure default values."
|
59
53
|
option :param, desc: "override convention and specify the param file to use"
|
60
54
|
option :seed, default: :convention, desc: "path to seed file to allow prompts bypass. yaml format."
|
61
55
|
option :template, desc: "override convention and specify the template file to use"
|
62
|
-
def
|
63
|
-
|
56
|
+
def seed(blueprint)
|
57
|
+
Seed.new(blueprint, options).run
|
64
58
|
end
|
65
59
|
|
66
60
|
desc "clean", "Removes `output` folder."
|
@@ -109,5 +103,9 @@ module Lono
|
|
109
103
|
desc "s3 SUBCOMMAND", "s3 subcommands"
|
110
104
|
long_desc Help.text(:s3)
|
111
105
|
subcommand "s3", S3
|
106
|
+
|
107
|
+
desc "blueprint SUBCOMMAND", "blueprint subcommands"
|
108
|
+
long_desc Help.text(:blueprint)
|
109
|
+
subcommand "blueprint", Blueprint
|
112
110
|
end
|
113
111
|
end
|
data/lib/lono/command.rb
CHANGED
@@ -11,6 +11,21 @@ class Thor
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
14
|
+
|
15
|
+
module Util
|
16
|
+
# Hack to fix issue when -h produces extra lono command in help. IE:
|
17
|
+
#
|
18
|
+
# $ bundle exec lono blueprint -h
|
19
|
+
# Commands:
|
20
|
+
# ...
|
21
|
+
# lono lono:blueprint:new BLUEPRINT_NAME <= weird
|
22
|
+
#
|
23
|
+
# It looks like thor_classes_in is only used to generate the help menu.
|
24
|
+
#
|
25
|
+
def self.thor_classes_in(*)
|
26
|
+
[]
|
27
|
+
end
|
28
|
+
end
|
14
29
|
end
|
15
30
|
|
16
31
|
module Lono
|
data/lib/lono/help/blueprint.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
## Examples
|
2
2
|
|
3
|
-
lono blueprint ec2 # skeleton blueprint with barebones structure
|
3
|
+
lono blueprint new ec2 # skeleton blueprint with barebones structure
|
4
4
|
|
5
5
|
## Example Output
|
6
6
|
|
7
|
-
$ lono blueprint ec2
|
7
|
+
$ lono blueprint new ec2
|
8
8
|
=> Creating new blueprint called ec2.
|
9
9
|
create ec2
|
10
10
|
create ec2/ec2.gemspec
|
@@ -12,23 +12,23 @@
|
|
12
12
|
create ec2/Gemfile
|
13
13
|
create ec2/README.md
|
14
14
|
create ec2/app/definitions/base.rb
|
15
|
-
create ec2/
|
15
|
+
create ec2/seed/configs.rb
|
16
16
|
create ec2/app/templates
|
17
17
|
=> Initialize git repo
|
18
18
|
run git init from "."
|
19
|
-
Initialized empty Git repository in /home/ec2-user/environment/
|
19
|
+
Initialized empty Git repository in /home/ec2-user/environment/infra/blueprints/ec2/.git/
|
20
20
|
=> Installing dependencies with: bundle install
|
21
21
|
================================================================
|
22
22
|
Congrats You have successfully created a lono blueprint.
|
23
|
-
|
23
|
+
|
24
24
|
Cd into your blueprint and check things out.
|
25
|
-
|
25
|
+
|
26
26
|
cd ec2
|
27
|
-
|
27
|
+
|
28
28
|
More info: https://lono.cloud/docs/core/blueprints
|
29
|
-
|
29
|
+
|
30
30
|
Here's the structure your blueprint:
|
31
|
-
|
31
|
+
|
32
32
|
.
|
33
33
|
├── app
|
34
34
|
│ ├── definitions
|
@@ -40,7 +40,7 @@
|
|
40
40
|
├── README.md
|
41
41
|
└── setup
|
42
42
|
└── configs.rb
|
43
|
-
|
43
|
+
|
44
44
|
4 directories, 6 files
|
45
|
-
|
45
|
+
|
46
46
|
$
|
data/lib/lono/help/new.md
CHANGED
@@ -21,7 +21,7 @@ By default, `lono new` generates a skeleton project. Use `TEMPLATE` to generate
|
|
21
21
|
create infra/blueprints/demo/.meta/config.yml
|
22
22
|
create infra/blueprints/demo/Gemfile
|
23
23
|
create infra/blueprints/demo/README.md
|
24
|
-
create infra/blueprints/demo/
|
24
|
+
create infra/blueprints/demo/seed/configs.rb
|
25
25
|
exist infra/blueprints/demo
|
26
26
|
create infra/blueprints/demo/app/templates/demo.rb
|
27
27
|
create infra/blueprints/demo/app/user_data/bootstrap.sh
|
data/lib/lono/help/xgraph.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
With more complex CloudFormation templates, the dependency can get difficult to follow. Visualizing the dependencies is helpful.
|
4
4
|
|
5
|
-
lono import https://s3.amazonaws.com/solutions-reference/aws-waf-security-automations/latest/aws-waf-security-automations.template --blueprint waf
|
5
|
+
lono code import https://s3.amazonaws.com/solutions-reference/aws-waf-security-automations/latest/aws-waf-security-automations.template --blueprint waf
|
6
6
|
lono xgraph waf
|
7
7
|
|
8
8
|
This above command generates a dependency chart. The command uses the DependsOn attribute specified in each resource to figure this out. It does not show implied dependencies that CloudFormaton automatically computes for us. The chart looks like this:
|
data/lib/lono/new.rb
CHANGED
@@ -33,7 +33,7 @@ module Lono
|
|
33
33
|
|
34
34
|
def create_starter_blueprint
|
35
35
|
# https://github.com/erikhuda/thor/wiki/Invocations
|
36
|
-
Lono::Blueprint.start(["demo", "--from-new", "--type", @options[:type], "--project-name", project_name])
|
36
|
+
Lono::Blueprint::New.start(["demo", "--from-new", "--type", @options[:type], "--project-name", project_name])
|
37
37
|
end
|
38
38
|
|
39
39
|
# After this commands are executed with the newly created project
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "fileutils"
|
2
2
|
|
3
3
|
module Lono
|
4
|
-
class
|
4
|
+
class Seed
|
5
5
|
include Blueprint::Root
|
6
6
|
|
7
7
|
def initialize(blueprint, options)
|
@@ -18,7 +18,7 @@ module Lono
|
|
18
18
|
exit 1
|
19
19
|
end
|
20
20
|
|
21
|
-
configs_path = "#{blueprint_root}/
|
21
|
+
configs_path = "#{blueprint_root}/seed/configs.rb"
|
22
22
|
unless File.exist?(configs_path)
|
23
23
|
puts "No #{configs_path} file found. Nothing to configure."
|
24
24
|
exit
|
@@ -30,7 +30,7 @@ module Lono
|
|
30
30
|
exit 1
|
31
31
|
end
|
32
32
|
configs = Configs.new(@blueprint, @options)
|
33
|
-
# The Configs class implements:
|
33
|
+
# The Configs class implements: seed, params, and variables
|
34
34
|
configs.run # setup the instance variables
|
35
35
|
end
|
36
36
|
end
|
data/lib/lono/version.rb
CHANGED
@@ -9,13 +9,13 @@
|
|
9
9
|
|
10
10
|
First you want to configure the `configs/BLUEPRINT/params` and `configs/BLUEPRINT/variables` files.
|
11
11
|
|
12
|
-
If the blueprint has implemented it, you can use `lono
|
12
|
+
If the blueprint has implemented it, you can use `lono seed` to quickly configure starter values for these `config/BLUEPRINT` files.
|
13
13
|
|
14
|
-
LONO_ENV=development lono
|
14
|
+
LONO_ENV=development lono seed BLUEPRINT --args key1:value1 key2:value2
|
15
15
|
|
16
16
|
To additional environments:
|
17
17
|
|
18
|
-
LONO_ENV=production lono
|
18
|
+
LONO_ENV=production lono seed BLUEPRINT --args key1:value1 key2:value2
|
19
19
|
|
20
20
|
The generated files in `config/BLUEPRINT` folder look something like this:
|
21
21
|
|
@@ -2,9 +2,9 @@
|
|
2
2
|
aws_template_format_version "2010-09-09"
|
3
3
|
description "Demo stack"
|
4
4
|
|
5
|
-
parameter(
|
5
|
+
parameter("InstanceType", "t3.micro")
|
6
6
|
|
7
|
-
mapping(
|
7
|
+
mapping("AmiMap",
|
8
8
|
"ap-northeast-1": { ami: "ami-0f9ae750e8274075b" },
|
9
9
|
"ap-northeast-2": { ami: "ami-047f7b46bd6dd5d84" },
|
10
10
|
"ap-south-1": { ami: "ami-0889b8a448de4fc44" },
|
@@ -23,15 +23,15 @@ mapping(:ami_map,
|
|
23
23
|
"us-west-2": { ami: "ami-061392db613a6357b" }
|
24
24
|
)
|
25
25
|
|
26
|
-
resource(
|
27
|
-
instance_type: ref(
|
28
|
-
image_id: find_in_map(
|
29
|
-
security_group_ids: [get_att("
|
26
|
+
resource("Instance", "AWS::EC2::Instance",
|
27
|
+
instance_type: ref("InstanceType"),
|
28
|
+
image_id: find_in_map("AmiMap", ref("AWS::Region"), :ami),
|
29
|
+
security_group_ids: [get_att("SecurityGroup.GroupId")],
|
30
30
|
user_data: base64(user_data("bootstrap.sh"))
|
31
31
|
)
|
32
|
-
resource(
|
32
|
+
resource("SecurityGroup", "AWS::EC2::SecurityGroup",
|
33
33
|
group_description: "demo security group",
|
34
34
|
)
|
35
35
|
|
36
|
-
output(
|
37
|
-
output(
|
36
|
+
output("Instance")
|
37
|
+
output("SecurityGroup", get_att("SecurityGroup.GroupId"))
|
data/lono.gemspec
CHANGED
@@ -23,8 +23,8 @@ Gem::Specification.new do |gem|
|
|
23
23
|
gem.add_dependency "activesupport"
|
24
24
|
gem.add_dependency "awesome_print"
|
25
25
|
gem.add_dependency "aws-sdk-cloudformation"
|
26
|
-
gem.add_dependency "aws-sdk-ec2" # lono
|
27
|
-
gem.add_dependency "aws-sdk-iam" # lono
|
26
|
+
gem.add_dependency "aws-sdk-ec2" # lono seed
|
27
|
+
gem.add_dependency "aws-sdk-iam" # lono seed
|
28
28
|
gem.add_dependency "aws-sdk-s3"
|
29
29
|
# gem.add_dependency "cfn_camelizer" # use vendor/cfn_camelizer instead for now
|
30
30
|
gem.add_dependency "filesize"
|
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.0
|
4
|
+
version: 5.1.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: 2019-10-
|
11
|
+
date: 2019-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -382,6 +382,8 @@ executables:
|
|
382
382
|
extensions: []
|
383
383
|
extra_rdoc_files: []
|
384
384
|
files:
|
385
|
+
- ".circleci/README.md"
|
386
|
+
- ".circleci/config.yml"
|
385
387
|
- ".cody/README.md"
|
386
388
|
- ".cody/acceptance.sh"
|
387
389
|
- ".cody/buildspec.yml"
|
@@ -391,7 +393,6 @@ files:
|
|
391
393
|
- ".gitignore"
|
392
394
|
- ".gitmodules"
|
393
395
|
- ".rspec"
|
394
|
-
- ".travis.yml"
|
395
396
|
- CHANGELOG.md
|
396
397
|
- CONTRIBUTING.md
|
397
398
|
- Gemfile
|
@@ -415,6 +416,7 @@ files:
|
|
415
416
|
- lib/lono/blueprint/helper.rb
|
416
417
|
- lib/lono/blueprint/info.rb
|
417
418
|
- lib/lono/blueprint/list.rb
|
419
|
+
- lib/lono/blueprint/new.rb
|
418
420
|
- lib/lono/blueprint/root.rb
|
419
421
|
- lib/lono/cfn.rb
|
420
422
|
- lib/lono/cfn/aws_service.rb
|
@@ -438,7 +440,6 @@ files:
|
|
438
440
|
- lib/lono/completer/script.rb
|
439
441
|
- lib/lono/completer/script.sh
|
440
442
|
- lib/lono/completion.rb
|
441
|
-
- lib/lono/configure.rb
|
442
443
|
- lib/lono/configure/aws_services.rb
|
443
444
|
- lib/lono/configure/base.rb
|
444
445
|
- lib/lono/configure/helpers.rb
|
@@ -490,6 +491,7 @@ files:
|
|
490
491
|
- lib/lono/script/base.rb
|
491
492
|
- lib/lono/script/build.rb
|
492
493
|
- lib/lono/script/upload.rb
|
494
|
+
- lib/lono/seed.rb
|
493
495
|
- lib/lono/sequence.rb
|
494
496
|
- lib/lono/setting.rb
|
495
497
|
- lib/lono/template.rb
|
@@ -532,7 +534,7 @@ files:
|
|
532
534
|
- lib/templates/blueprint/Gemfile
|
533
535
|
- lib/templates/blueprint/README.md
|
534
536
|
- lib/templates/blueprint/Rakefile
|
535
|
-
- lib/templates/blueprint/
|
537
|
+
- lib/templates/blueprint/seed/configs.rb
|
536
538
|
- lib/templates/blueprint_configs/configs/%blueprint_name%/params/base.txt
|
537
539
|
- lib/templates/blueprint_configs/configs/%blueprint_name%/params/development.txt
|
538
540
|
- lib/templates/blueprint_configs/configs/%blueprint_name%/variables/base.rb
|