lono 5.1.0 → 5.1.1

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: 74d30f8bdd10b8530f8aef55dc52047b04d2c612f599bc353f9605e2609badd1
4
- data.tar.gz: 77d3c804e551daea9997b121af4462158e7fcfbaa19b00b6c015f637f226a2c0
3
+ metadata.gz: a36f1ee3d7076e1e93fa9a395c984978510b9961657de60b026cd4a666b46ab6
4
+ data.tar.gz: 9d4104ceab9f1673057374aa86d31800d75ebe89652348a400b6bd481ccac444
5
5
  SHA512:
6
- metadata.gz: 915c66c0c9d85bb9877f594bca34a1be9bb3ac0c13b949b2cf5bf26631d673a584247a3ea6b6f6d8ff01d77e30531fac1f7acc3e724ff9601f5143653a1cf66f
7
- data.tar.gz: 0a9e4ac8705aabdbc1d975dd6809290723c17215fe0668554684eec5e48e442e89a4292dfe4d8620424c2470b5772a3942af2796836ffd49bea4be8c7852d49f
6
+ metadata.gz: 40ad69f3970916114081b028085f5a55c65511793571466db2a7fa0229c804491742a5394106838204495432303090ae40b5476232bdcee8fdd7689d5282a180
7
+ data.tar.gz: 34e2fd774d94f30b594d7ba602d1d6f0597bedb1127f0821f223f383109c85f38ee332cc05f196ab5834fafb9e01fd2134b9d008c5f7c9e32074c6f69f18b68b
@@ -1,6 +1,3 @@
1
1
  [submodule "vendor/cfn-status"]
2
2
  path = vendor/cfn-status
3
3
  url = https://github.com/tongueroo/cfn-status
4
- [submodule "vendor/cfn_camelizer"]
5
- path = vendor/cfn_camelizer
6
- url = https://github.com/tongueroo/cfn_camelizer
@@ -3,6 +3,9 @@
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.1]
7
+ - use cfn_camelizer as gem
8
+
6
9
  ## [5.1.0]
7
10
  - change `lono blueprint` to subcommand: `lono blueprint new` and `lono blueprint list` commands
8
11
  - change `lono configure` to `lono seed`. Seed interface is the same but the path is different: `seed/configs.rb`
@@ -9,13 +9,12 @@ require 'plissken'
9
9
  require 'rainbow/ext/string'
10
10
  require 'render_me_pretty'
11
11
  require 'yaml'
12
+ require 'cfn_camelizer'
12
13
 
13
14
  gem_root = File.dirname(__dir__)
14
15
  $:.unshift("#{gem_root}/lib")
15
16
  $:.unshift("#{gem_root}/vendor/cfn-status/lib")
16
17
  require "cfn/status"
17
- $:.unshift("#{gem_root}/vendor/cfn_camelizer/lib")
18
- require "cfn_camelizer"
19
18
 
20
19
  require "lono/autoloader"
21
20
  Lono::Autoloader.setup
@@ -1,3 +1,3 @@
1
1
  module Lono
2
- VERSION = "5.1.0"
2
+ VERSION = "5.1.1"
3
3
  end
@@ -26,7 +26,7 @@ Gem::Specification.new do |gem|
26
26
  gem.add_dependency "aws-sdk-ec2" # lono seed
27
27
  gem.add_dependency "aws-sdk-iam" # lono seed
28
28
  gem.add_dependency "aws-sdk-s3"
29
- # gem.add_dependency "cfn_camelizer" # use vendor/cfn_camelizer instead for now
29
+ gem.add_dependency "cfn_camelizer"
30
30
  gem.add_dependency "filesize"
31
31
  gem.add_dependency "graph" # lono xgraph command dependency
32
32
  gem.add_dependency "guard"
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.1.0
4
+ version: 5.1.1
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-08 00:00:00.000000000 Z
11
+ date: 2019-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: cfn_camelizer
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: filesize
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -569,19 +583,6 @@ files:
569
583
  - vendor/cfn-status/spec/fixtures/cfn/stack-events-in-progress.json
570
584
  - vendor/cfn-status/spec/fixtures/cfn/stack-events-update-rollback-complete.json
571
585
  - vendor/cfn-status/spec/spec_helper.rb
572
- - vendor/cfn_camelizer/CHANGELOG.md
573
- - vendor/cfn_camelizer/Gemfile
574
- - vendor/cfn_camelizer/LICENSE.txt
575
- - vendor/cfn_camelizer/README.md
576
- - vendor/cfn_camelizer/Rakefile
577
- - vendor/cfn_camelizer/bin/console
578
- - vendor/cfn_camelizer/bin/setup
579
- - vendor/cfn_camelizer/cfn_camelizer.gemspec
580
- - vendor/cfn_camelizer/lib/camelizer.yml
581
- - vendor/cfn_camelizer/lib/cfn_camelizer.rb
582
- - vendor/cfn_camelizer/lib/cfn_camelizer/version.rb
583
- - vendor/cfn_camelizer/spec/cfn_camelizer_spec.rb
584
- - vendor/cfn_camelizer/spec/spec_helper.rb
585
586
  homepage: https://lono.cloud
586
587
  licenses:
587
588
  - https://boltops.com/boltops-community-license
@@ -1,20 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
-
6
- ## [0.4.0]
7
- - add AWS::ApiGateway::Authorizer cases
8
-
9
- ## [0.3.0]
10
- - camelizer.yml: scope camelizing rules more finely with resource_keys rule
11
- - add NotificationTargetARN
12
- - add AWS::Events::Rule RoleArn
13
- - add VpcZoneIdentifier
14
- - add ScalableTarget
15
-
16
- ## [0.2.0]
17
- - add AWS special key
18
-
19
- ## [0.1.0]
20
- - Initial release
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in cfn_camelizer.gemspec
4
- gemspec
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2019 Tung Nguyen
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,40 +0,0 @@
1
- # CfnCamelizer
2
-
3
- Camelizer for CloudFormation.
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'cfn_camelizer'
11
- ```
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install cfn_camelizer
20
-
21
- ## Usage
22
-
23
- ```ruby
24
- data = {my_data: 1}
25
- CfnCamelizer.transform(data) => {"MyData" => 1}
26
- ```
27
-
28
- ## Development
29
-
30
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
31
-
32
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
33
-
34
- ## Contributing
35
-
36
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cfn_camelizer.
37
-
38
- ## License
39
-
40
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "cfn_camelizer"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,32 +0,0 @@
1
-
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "cfn_camelizer/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "cfn_camelizer"
8
- spec.version = CfnCamelizer::VERSION
9
- spec.authors = ["Tung Nguyen"]
10
- spec.email = ["tongueroo@gmail.com"]
11
-
12
- spec.summary = "Cfn Camelizer"
13
- spec.homepage = "https://github.com/tongueroo/cfn_camelizer"
14
- spec.license = "MIT"
15
-
16
- # Specify which files should be added to the gem when it is released.
17
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
- end
21
- spec.bindir = "exe"
22
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
- spec.require_paths = ["lib"]
24
-
25
- spec.add_dependency "activesupport"
26
- spec.add_dependency "memoist"
27
- spec.add_dependency "rainbow"
28
-
29
- spec.add_development_dependency "bundler"
30
- spec.add_development_dependency "rake"
31
- spec.add_development_dependency "rspec"
32
- end
@@ -1,37 +0,0 @@
1
- ---
2
- special_keys:
3
- Aws: AWS
4
- # Very fine grain control, since these map rules are scoped to specific resources
5
- # After the special_keys map for backwards compatibility.
6
- resource_keys: # specific to resource types
7
- AWS::ApiGateway::Authorizer:
8
- ProviderArns: ProviderARNs
9
- AWS::ApplicationAutoScaling::ScalableTarget:
10
- RoleArn: RoleARN
11
- AWS::AutoScaling::AutoScalingGroup:
12
- ServiceLinkedRoleArn: ServiceLinkedRoleARN
13
- TargetGroupArns: TargetGroupARNs
14
- VpcZoneIdentifier: VPCZoneIdentifier
15
- AWS::AutoScaling::LifecycleHook:
16
- NotificationTargetArn: NotificationTargetARN
17
- RoleArn: RoleARN
18
- AWS::CloudFormation::Stack:
19
- NotificationArns: NotificationARNs
20
- TemplateUrl: TemplateURL
21
- AWS::Events::Rule:
22
- RoleARN: RoleArn
23
- AWS::Route53::RecordSet:
24
- Ttl: TTL
25
- AWS::RDS::DBSubnetGroup:
26
- DbSubnetGroupDescription: DBSubnetGroupDescription
27
- DbSubnetGroupName: DBSubnetGroupName
28
- AWS::SQS::Queue:
29
- DeadLetterTargetArn: deadLetterTargetArn # under RedrivePolicy
30
- MaxReceiveCount: maxReceiveCount # under RedrivePolicy
31
- AutoScaling::LaunchConfiguration:
32
- ClassicLinkVpcId: ClassicLinkVPCId
33
- ClassicLinkVpcSecurityGroups: ClassicLinkVPCSecurityGroups
34
- passthrough_parent_keys:
35
- - Fn::Sub # https://amzn.to/2HKwxri
36
- - ResponseParameters # API Gateway MethodResponse https://amzn.to/2HKw0Wk
37
- - Variables # Lambda Environment Variables https://amzn.to/2HLlttV
@@ -1,94 +0,0 @@
1
- require "cfn_camelizer/version"
2
- require "memoist"
3
- require "yaml"
4
- require "rainbow/ext/string"
5
- require "active_support/core_ext/string"
6
- require "active_support/core_ext/hash"
7
-
8
- # Custom Camelizer with CloudFormation specific handling.
9
- # Based on: https://stackoverflow.com/questions/8706930/converting-nested-hash-keys-from-camelcase-to-snake-case-in-ruby
10
- class CfnCamelizer
11
- class << self
12
- extend Memoist
13
-
14
- def transform(value, parent_keys=[], resource_type=nil)
15
- case value
16
- when Array
17
- value.map { |v| transform(v, parent_keys, resource_type) }
18
- when Hash
19
- if value.keys.include?(:type)
20
- resource_type ||= value[:type]
21
- end
22
-
23
- initializer = value.map do |k, v|
24
- new_key = camelize_key(k, parent_keys, resource_type)
25
- [new_key, transform(v, parent_keys+[new_key], resource_type)]
26
- end
27
- Hash[initializer]
28
- else
29
- value # do not transform values
30
- end
31
- end
32
-
33
- def camelize_key(k, parent_keys=[], resource_type=nil)
34
- k = k.to_s
35
-
36
- if passthrough?(k, parent_keys)
37
- k # pass through untouch
38
- elsif parent_keys.last == "EventPattern" # top-level
39
- k.dasherize
40
- elsif parent_keys.include?("EventPattern")
41
- # Any keys at 2nd level under EventPattern will be pascalized
42
- pascalize(k)
43
- else
44
- camelize(k, resource_type)
45
- end
46
- end
47
-
48
- def passthrough?(k, parent_keys)
49
- # Do not transform keys under certain parent keys or keys that contain - or /
50
- passthrough = camelizer_yaml["passthrough_parent_keys"]
51
- intersection = parent_keys & passthrough
52
- !intersection.empty? || k.include?('-') || k.include?('/')
53
- end
54
-
55
- def camelize(value, resource_type=nil)
56
- return value if value.is_a?(Integer)
57
-
58
- value = value.to_s.camelize
59
- v = special_map[value] || value # after the special_keys map
60
- resource_map(resource_type)[v] || v
61
- end
62
-
63
- def pascalize(value)
64
- new_value = value.camelize
65
- first_char = new_value[0..0].downcase
66
- new_value[0] = first_char
67
- new_value
68
- end
69
-
70
- # Some keys have special mappings
71
- def special_map
72
- camelizer_yaml["special_keys"]
73
- end
74
-
75
- def resource_map(resource_type)
76
- camelizer_yaml["resource_keys"][resource_type] || {}
77
- end
78
-
79
- def camelizer_yaml
80
- # default
81
- path = File.expand_path("camelizer.yml", File.dirname(__FILE__))
82
- default = YAML.load_file(path)
83
- # project specific
84
- path = "#{Dir.pwd}/configs/camelizer.yml"
85
- if File.exist?(path)
86
- project = YAML.load_file(path)
87
- default.deep_merge(project)
88
- else
89
- default
90
- end
91
- end
92
- memoize :camelizer_yaml
93
- end
94
- end
@@ -1,3 +0,0 @@
1
- class CfnCamelizer
2
- VERSION = "0.4.0"
3
- end
@@ -1,86 +0,0 @@
1
- RSpec.describe CfnCamelizer do
2
- let(:camelizer) { CfnCamelizer }
3
- context "not camelize the special cases" do
4
- it "transform should not transform keys under Fn::Sub" do
5
- data = {"UserData"=>{"Fn::Sub"=>["hello", {"k1"=>"v1", "k2"=>"v2"}]}}
6
- result = camelizer.transform(data)
7
- expect(result).to eq(data)
8
- end
9
- end
10
-
11
- it "simple string" do
12
- s = "foo_bar"
13
- s = camelizer.camelize(s)
14
- expect(s).to eq "FooBar"
15
- end
16
-
17
- it "transform keys" do
18
- h = {foo_bar: 1}
19
- result = camelizer.transform(h)
20
- result.keys == ["FooBar"]
21
- end
22
-
23
- it "do not pasalize anything under Variables" do
24
- h = {foo_bar: 1, variables: {dont_touch: 2}}
25
- result = camelizer.transform(h)
26
- # pp result
27
- expect(result).to eq("FooBar"=>1, "Variables"=>{"dont_touch"=>2})
28
- end
29
-
30
- # CloudWatch Event patterns have slightly different casing
31
- it "dasherize anything under EventPattern at the top level" do
32
- h = {foo_bar: 1, event_pattern: {dash_me: 2}}
33
- result = camelizer.transform(h)
34
- # pp result
35
- expect(result).to eq("FooBar"=>1, "EventPattern"=>{"dash-me"=>2})
36
- end
37
-
38
- it "camelize anything under EventPattern at any level beyond the top level" do
39
- h = {foo_bar: 1, event_pattern: {dash_me: {camelize_me: 3}}}
40
- result = camelizer.transform(h)
41
- # pp result
42
- expect(result).to eq("FooBar"=>1, "EventPattern"=>{"dash-me"=>{"camelizeMe"=>3}})
43
- end
44
-
45
- it "dont touch anything under ResponseParameters" do
46
- h = {foo_bar: 1, response_parameters: {dont_touch: 3}}
47
- result = camelizer.transform(h)
48
- # pp result
49
- expect(result).to eq("FooBar"=>1, "ResponseParameters"=>{"dont_touch"=>3})
50
- end
51
-
52
- it "dont touch anything with - or /" do
53
- h = {foo_bar: 1, "has-dash": 2, "has/slash": 3,"application/json":4}
54
- result = camelizer.transform(h)
55
- # pp result
56
- expect(result).to eq("FooBar"=>1, "has-dash"=>2,"has/slash"=>3,"application/json"=>4)
57
- end
58
-
59
- it "special map keys cloudformation stack" do
60
- h = {type: "AWS::CloudFormation::Stack", properties: {template_url: 1}}
61
- result = camelizer.transform(h)
62
- # pp result
63
- expect(result).to eq({"Type" => "AWS::CloudFormation::Stack", "Properties" => {"TemplateURL"=>1}})
64
- end
65
-
66
- it "special map keys cloudformation stack" do
67
- h = {type: "AWS::Route53::RecordSet", properties: {ttl: 60}}
68
- result = camelizer.transform(h)
69
- # pp result
70
- expect(result).to eq({"Type" => "AWS::Route53::RecordSet", "Properties" => {"TTL"=>60}})
71
- end
72
-
73
- it "role_arn property under AWS::Events::Rule type maintains normal RoleArn camelization" do
74
- h = {
75
- events_rule: {
76
- type: "AWS::Events::Rule",
77
- properties: {
78
- role_arn: "some.arn"
79
- }
80
- }
81
- }
82
- result = camelizer.transform(h)
83
- # pp result
84
- expect(result).to eq({"EventsRule"=>{"Type"=>"AWS::Events::Rule", "Properties"=>{"RoleArn"=>"some.arn"}}})
85
- end
86
- end
@@ -1,14 +0,0 @@
1
- require "bundler/setup"
2
- require "cfn_camelizer"
3
-
4
- RSpec.configure do |config|
5
- # Enable flags like --only-failures and --next-failure
6
- config.example_status_persistence_file_path = ".rspec_status"
7
-
8
- # Disable RSpec exposing methods globally on `Module` and `main`
9
- config.disable_monkey_patching!
10
-
11
- config.expect_with :rspec do |c|
12
- c.syntax = :expect
13
- end
14
- end