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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e5273c020cc1b450ac452c7528f37dcef84d8d390ff9f4cad7c239bc39059fa
4
- data.tar.gz: dc05377524507ac767ba84954742d2e99ecf2cec638f642e26adc2b28df73eec
3
+ metadata.gz: 798d555eb31a539699308dd7ef59af75a3fd2cd99e6d4ce101476e0fe2711a9b
4
+ data.tar.gz: 6c66d0ee14ce53ee16f2c39ade5fb0dfe0c5b0bc0ae59f6d65b92c0d5662732f
5
5
  SHA512:
6
- metadata.gz: aaecbe4f433f3c46d01140614f59b1d0d4a2cffc52d7ce012a79add4c7653414ebb41fe7e6c40d79b79328ccd8510084b40df7eaa613c0ce4d64b8ef9ebcdcc8
7
- data.tar.gz: bb415b8ed4dc7e1a71a98213f16b7829761f6014b89a0ffcefb5cd6c317e6bb2959da00d39490bc8025f90d1553a6b083a02846ab47baaab6357e4404cd95e7a
6
+ metadata.gz: 48b6f6152e99479a2460abb1edf02b44e639fa3dc7dce5a8458d4dbcfb75cdd8bc9a032946bc1df15cbbb4034985e92d515ddcfeb62b3a233fb3d1901ed4b36c
7
+ data.tar.gz: de0ee3979c84a09d89b494cfd0e358b8a24e2275adfd3b1271ef9513c55a9fc213d621d1057b5777ad6e1cc56542d85c9d2e04f05be63cd34772f03b9ac0a8fa
@@ -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
 
@@ -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
- cd #{blueprint_name}
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
 
@@ -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
@@ -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
- To generate the blueprint templates without launching a stack, you can run:
43
+ To create a new blueprint run:
44
44
 
45
- lono generate demo
45
+ lono blueprint new demo
46
46
 
47
- The generated files are created at `output/demo/templates` and `output/demo/params`.
47
+ To deploy the blueprint:
48
48
 
49
- To deploy the CloudFormation stack:
49
+ lono cfn deploy my-demo --blueprint demo
50
50
 
51
- lono cfn deploy my-demo --blueprint demo
51
+ If you name the stack according to conventions, you can simply run:
52
52
 
53
- If you name the stack according to conventions, you can simply run:
53
+ lono cfn deploy demo
54
54
 
55
- lono cfn deploy demo
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
  $
@@ -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
- cd #{project_name}
76
+ cd #{project_name}
75
77
 
76
- To generate the blueprint templates without launching a stack, you can run:
78
+ To create a new blueprint run:
77
79
 
78
- lono generate demo
80
+ lono blueprint new demo
79
81
 
80
- The generated files are created at `output/demo/templates` and `output/demo/params`.
82
+ To deploy the blueprint:
81
83
 
82
- To deploy the CloudFormation stack:
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
- lono cfn deploy demo
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
 
@@ -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
- write(dest_path, variables)
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)
@@ -1,3 +1,3 @@
1
1
  module Lono
2
- VERSION = "5.2.4"
2
+ VERSION = "5.2.5"
3
3
  end
@@ -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.
@@ -0,0 +1,2 @@
1
+ # Starter Example
2
+ # InstanceType=t3.micro
@@ -0,0 +1,2 @@
1
+ # Starter Example
2
+ # @variable = "value"
@@ -1,3 +1,4 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- # gem "lono-pro" # optional
3
+ gem "lono" # optional
4
+ gem "lono-pro" # optional
@@ -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
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-22 00:00:00.000000000 Z
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%/variables/base.rb
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