lono 3.3.4 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f1b5263f718afe419807510969a58e1a7941c699
4
- data.tar.gz: 973753a128ac8bdc500b55236384d3105d1e72f9
2
+ SHA256:
3
+ metadata.gz: 929a3d81010c6295ed7567007f4a7f2bdd33cbe18e71ee5d25a570c368072eb6
4
+ data.tar.gz: 78a892de3fb67ffe9c18e5b1346b2c3f50d52a81f926f8a74e7c7d08637fbede
5
5
  SHA512:
6
- metadata.gz: d987aebfcba6f25a505eedf2d9be21ffa00d456492828fd8b5911253d33aaac705a0242caa95291abc5927e5771b959c62f59efb5b4133a0c29e092d9b49593b
7
- data.tar.gz: f7c37945a9135c67573c3dfc513978df26f02ba34bf4c1834959a13e69993987c635463651999448d3d295a5be53bd45f4dbd23ff9d8188fdda54af286b0b8c5
6
+ metadata.gz: 5bc80c3068c6fcd749698d8fd019dc2f51a7fb4dc6c93dae918852b679ee39e526aaa3fe4a78f15d223e9d5c8b088b1e12b73d222248ada2da4a3accd62ea97c
7
+ data.tar.gz: 6e1430a938e34c4ff3c6d0f03749f456870fc4c08b2870f58802b574df303fe3d35c02df07be68d20e9a49ad005189e34c1a324cd7723b6d5e711254ed09b52e
@@ -0,0 +1,65 @@
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
+ - v1-dependencies-{{ checksum "Gemfile.lock" }}
32
+ # fallback to using the latest cache if no exact match is found
33
+ - v1-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: v1-dependencies-{{ checksum "Gemfile.lock" }}
44
+
45
+ # run tests!
46
+ - run:
47
+ name: run tests
48
+ command: |
49
+ mkdir /tmp/test-results
50
+
51
+ cat >.rspec <<EOL
52
+ --format documentation
53
+ --exclude-pattern spec/fixtures/apps/**/*
54
+ --format RspecJunitFormatter \
55
+ --out /tmp/test-results/rspec.xml
56
+ EOL
57
+
58
+ bundle exec rspec
59
+
60
+ # collect reports
61
+ - store_test_results:
62
+ path: /tmp/test-results
63
+ - store_artifacts:
64
+ path: /tmp/test-results
65
+ destination: test-results
data/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
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
+ ## [3.4.0]
7
+ - fix lono project config settings
8
+ - upgrade to circleci 2.0
9
+ - add current_region helper
10
+ - update install notes
11
+
6
12
  ## [3.3.4]
7
13
  - require specific aws-sdk s3 and cloudformation dependencies to reduce size
8
14
 
data/README.md CHANGED
@@ -5,7 +5,6 @@
5
5
  [![Code Climate][3]][4]
6
6
  [![Dependency Status](https://gemnasium.com/tongueroo/lono.png)](https://gemnasium.com/tongueroo/lono)
7
7
  [![Coverage Status](https://coveralls.io/repos/tongueroo/lono/badge.png)](https://coveralls.io/r/tongueroo/lono)
8
- [![ReadmeCI](http://www.readmeci.com/images/readmeci-badge.svg)](http://www.readmeci.com/tongueroo/lono)
9
8
  [![Join the chat at https://gitter.im/tongueroo/lono](https://badges.gitter.im/tongueroo/lono.svg)](https://gitter.im/tongueroo/lono?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
10
9
  [![Support](https://img.shields.io/badge/get-support-blue.svg)](https://boltops.com?utm_source=badge&utm_medium=badge&utm_campaign=lono)
11
10
 
@@ -33,7 +32,7 @@ These blog posts also cover lono:
33
32
  It only takes a couple of commands to start using lono.
34
33
 
35
34
  ```sh
36
- brew cask install boltopslabs/software/bolts
35
+ gem install lono
37
36
  lono new infra
38
37
  cd infra
39
38
  lono generate # not needed but showing for explanation
data/lib/lono.rb CHANGED
@@ -26,6 +26,7 @@ module Lono
26
26
  autoload :Settings, 'lono/settings'
27
27
  autoload :Importer, 'lono/importer'
28
28
  autoload :Inspector, 'lono/inspector'
29
+ autoload :CurrentRegion, 'lono/current_region'
29
30
  end
30
31
 
31
32
  Lono::Env.setup!
@@ -0,0 +1,42 @@
1
+ require 'aws-sdk-core'
2
+
3
+ module Lono::CurrentRegion
4
+ def current_region
5
+ region = Aws.config[:region]
6
+ region ||= ENV['AWS_REGION']
7
+ return region if region
8
+
9
+ if ENV['AWS_PROFILE']
10
+ path = "#{ENV['HOME']}/.aws/config"
11
+ if File.exist?(path)
12
+ lines = IO.readlines(path)
13
+ capture_default, capture_current = false, false
14
+ lines.each do | line|
15
+ if line.include?('[default]')
16
+ capture_default = true # next line
17
+ next
18
+ end
19
+ if capture_default && line.match(/region = /)
20
+ default_region = line.split(' = ').last.strip
21
+ capture_default = false
22
+ end
23
+
24
+ md = line.match(/\[profile (.*)\]/)
25
+ if md && md[1] == ENV['AWS_PROFILE']
26
+ capture_current = true
27
+ next
28
+ end
29
+ if capture_current && line.match(/region = /)
30
+ region = line.split(' = ').last.strip
31
+ capture_current = false
32
+ end
33
+ end
34
+ end
35
+
36
+ region ||= default_region
37
+ return region if region
38
+ end
39
+
40
+ 'us-east-1' # default
41
+ end
42
+ end
@@ -1,4 +1,6 @@
1
1
  class Lono::Param::Generator
2
+ include Lono::CurrentRegion
3
+
2
4
  def self.generate_all(options)
3
5
  puts "Generating params files"
4
6
  project_root = options[:project_root] || '.'
@@ -208,5 +210,4 @@ class Lono::Param::Generator
208
210
  instance_eval(IO.read(path))
209
211
  end
210
212
  end
211
-
212
213
  end
data/lib/lono/settings.rb CHANGED
@@ -13,7 +13,7 @@ class Lono::Settings
13
13
  def data
14
14
  return @settings_yaml if @settings_yaml
15
15
 
16
- project_file = "#{@project_root}/.lono/settings.yml"
16
+ project_file = "#{@project_root}/config/settings.yml"
17
17
  project = File.exist?(project_file) ? YAML.load_file(project_file) : {}
18
18
 
19
19
  user_file = "#{ENV['HOME']}/.lono/settings.yml"
@@ -25,11 +25,25 @@ class Lono::Settings
25
25
  @settings_yaml = default.merge(user.merge(project))
26
26
  end
27
27
 
28
-
28
+ # Examples:
29
+ #
30
+ # Using the LONO_ENV
31
+ # s3:
32
+ # path:
33
+ # production: s3://infrastructure-prod/cloudformation
34
+ # staging: s3://infrastructure-dev/cloudformation
35
+ #
36
+ # Using the AWS_PROFILE
37
+ # s3:
38
+ # path:
39
+ # my-prod-profile: s3://infrastructure-prod/cloudformation
40
+ # my-stag-profile: s3://infrastructure-dev/cloudformation
41
+ #
29
42
  def s3_path
30
43
  s3 = data['s3']
31
- # s3['default']['path'] - key will always exist because of default lono/settings.yml
32
- # defauult value is nil though
33
- s3['path'][LONO_ENV] || s3['path']['default']
44
+ s3_path = s3['path']
45
+ # s3_path['default'] - key will always exist because of default lono/settings.yml
46
+ # default value is nil though
47
+ s3_path[ENV['AWS_PROFILE']] || s3_path[LONO_ENV] || s3_path['default']
34
48
  end
35
49
  end
@@ -4,6 +4,7 @@ require 'base64'
4
4
 
5
5
  class Lono::Template::Template
6
6
  include Lono::Template::Helpers
7
+ include Lono::CurrentRegion
7
8
  include ERB::Util
8
9
 
9
10
  def initialize(name, block=nil, options={})
@@ -68,7 +69,6 @@ class Lono::Template::Template
68
69
  require path
69
70
  self.class.send :include, module_name.constantize
70
71
  end
71
-
72
72
  end
73
73
 
74
74
  def source(path)
data/lib/lono/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lono
2
- VERSION = "3.3.4"
2
+ VERSION = "3.4.0"
3
3
  end
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: 3.3.4
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-26 00:00:00.000000000 Z
11
+ date: 2018-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -257,11 +257,11 @@ executables:
257
257
  extensions: []
258
258
  extra_rdoc_files: []
259
259
  files:
260
+ - ".circleci/config.yml"
260
261
  - ".coveralls.yml"
261
262
  - ".gitignore"
262
263
  - ".gitmodules"
263
264
  - ".rspec"
264
- - ".travis.yml"
265
265
  - CHANGELOG.md
266
266
  - CONTRIBUTING.md
267
267
  - Gemfile
@@ -270,7 +270,6 @@ files:
270
270
  - README.md
271
271
  - Rakefile
272
272
  - bin/lono
273
- - circle.yml
274
273
  - lib/lono.rb
275
274
  - lib/lono/cfn.rb
276
275
  - lib/lono/cfn/aws_services.rb
@@ -286,6 +285,7 @@ files:
286
285
  - lib/lono/clean.rb
287
286
  - lib/lono/cli.rb
288
287
  - lib/lono/command.rb
288
+ - lib/lono/current_region.rb
289
289
  - lib/lono/default/settings.yml
290
290
  - lib/lono/env.rb
291
291
  - lib/lono/help.rb
@@ -399,7 +399,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
399
399
  version: '0'
400
400
  requirements: []
401
401
  rubyforge_project:
402
- rubygems_version: 2.6.14
402
+ rubygems_version: 2.7.3
403
403
  signing_key:
404
404
  specification_version: 4
405
405
  summary: Lono is a CloudFormation Template ruby generator. Lono generates CloudFormation
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- rvm:
4
- - 2.2.5
5
- - 2.3.3
data/circle.yml DELETED
@@ -1,4 +0,0 @@
1
- checkout:
2
- post:
3
- - git submodule sync --recursive
4
- - git submodule update --init --recursive