humidifier 4.0.2 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,90 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ humidifier (4.1.1)
5
+ aws-sdk-cloudformation (~> 1.25)
6
+ aws-sdk-s3 (~> 1.48)
7
+ fast_underscore (~> 0.3)
8
+ nokogiri (~> 1.10)
9
+ thor (~> 1.0)
10
+ thor-hollaback (~> 0.2)
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ ast (2.4.2)
16
+ aws-eventstream (1.2.0)
17
+ aws-partitions (1.531.0)
18
+ aws-sdk-cloudformation (1.60.0)
19
+ aws-sdk-core (~> 3, >= 3.122.0)
20
+ aws-sigv4 (~> 1.1)
21
+ aws-sdk-core (3.122.1)
22
+ aws-eventstream (~> 1, >= 1.0.2)
23
+ aws-partitions (~> 1, >= 1.525.0)
24
+ aws-sigv4 (~> 1.1)
25
+ jmespath (~> 1.0)
26
+ aws-sdk-kms (1.51.0)
27
+ aws-sdk-core (~> 3, >= 3.122.0)
28
+ aws-sigv4 (~> 1.1)
29
+ aws-sdk-s3 (1.105.1)
30
+ aws-sdk-core (~> 3, >= 3.122.0)
31
+ aws-sdk-kms (~> 1)
32
+ aws-sigv4 (~> 1.4)
33
+ aws-sigv4 (1.4.0)
34
+ aws-eventstream (~> 1, >= 1.0.2)
35
+ docile (1.4.0)
36
+ fast_underscore (0.3.3)
37
+ hollaback (0.1.1)
38
+ jmespath (1.4.0)
39
+ mini_portile2 (2.6.1)
40
+ minitest (5.14.4)
41
+ nokogiri (1.12.5)
42
+ mini_portile2 (~> 2.6.1)
43
+ racc (~> 1.4)
44
+ parallel (1.21.0)
45
+ parser (3.0.2.0)
46
+ ast (~> 2.4.1)
47
+ racc (1.6.0)
48
+ rainbow (3.0.0)
49
+ rake (13.0.6)
50
+ regexp_parser (2.1.1)
51
+ rexml (3.2.5)
52
+ rubocop (1.23.0)
53
+ parallel (~> 1.10)
54
+ parser (>= 3.0.0.0)
55
+ rainbow (>= 2.2.2, < 4.0)
56
+ regexp_parser (>= 1.8, < 3.0)
57
+ rexml
58
+ rubocop-ast (>= 1.12.0, < 2.0)
59
+ ruby-progressbar (~> 1.7)
60
+ unicode-display_width (>= 1.4.0, < 3.0)
61
+ rubocop-ast (1.13.0)
62
+ parser (>= 3.0.1.1)
63
+ ruby-progressbar (1.11.0)
64
+ simplecov (0.21.2)
65
+ docile (~> 1.1)
66
+ simplecov-html (~> 0.11)
67
+ simplecov_json_formatter (~> 0.1)
68
+ simplecov-html (0.12.3)
69
+ simplecov_json_formatter (0.1.3)
70
+ thor (1.1.0)
71
+ thor-hollaback (0.2.0)
72
+ hollaback (~> 0.1.0)
73
+ thor (>= 0.19.1)
74
+ unicode-display_width (2.1.0)
75
+ yard (0.9.26)
76
+
77
+ PLATFORMS
78
+ ruby
79
+
80
+ DEPENDENCIES
81
+ bundler (~> 2.0)
82
+ humidifier!
83
+ minitest (~> 5.13)
84
+ rake (~> 13.0)
85
+ rubocop (~> 1.0)
86
+ simplecov (~> 0.17)
87
+ yard (~> 0.9)
88
+
89
+ BUNDLED WITH
90
+ 2.2.3
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016-present Kevin Deisz
3
+ Copyright (c) 2016-present Kevin Newton
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Humidifier
2
2
 
3
- [![Build Status](https://travis-ci.com/kddeisz/humidifier.svg?branch=master)](https://travis-ci.com/kddeisz/humidifier)
4
- [![Gem Version](https://img.shields.io/gem/v/humidifier.svg?maxAge=3600)](https://rubygems.org/gems/humidifier)
3
+ [![Build Status](https://github.com/kddnewton/humidifier/workflows/Main/badge.svg)](https://github.com/kddnewton/humidifier/actions)
4
+ [![Gem Version](https://img.shields.io/gem/v/humidifier.svg)](https://rubygems.org/gems/humidifier)
5
5
 
6
6
  Humidifier is a ruby tool for managing [AWS CloudFormation](https://aws.amazon.com/cloudformation/) stacks. You can use it to build and manage stacks programmatically or you can use it as a command line tool to manage stacks through configuration files.
7
7
 
@@ -22,6 +22,7 @@ Humidifier is a ruby tool for managing [AWS CloudFormation](https://aws.amazon.c
22
22
  - [`deploy [?stack] [*parameters]`](#deploy-stack-parameters)
23
23
  - [`display [stack] [?pattern]`](#display-stack-pattern)
24
24
  - [`stacks`](#stacks)
25
+ - [`upgrade`](#upgrade)
25
26
  - [`upload [?stack]`](#upload-stack)
26
27
  - [`validate [?stack]`](#validate-stack)
27
28
  - [Parameters](#parameters)
@@ -190,7 +191,7 @@ AdminUser:
190
191
  - Administration
191
192
  ```
192
193
 
193
- The top-level keys are the logical resource names that will be displayed in the CloudFormation screen. They point to a map of key/value pairs that will be passed on to `humidifier`. Any `humidifier` (and therefore any CloudFormation) attribute may be specified. For more information on CloudFormation templates and which attributes may be specified, see both the [`humidifier` docs](http://kddeisz.github.io/humidifier) and the [CloudFormation docs](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-guide.html).
194
+ The top-level keys are the logical resource names that will be displayed in the CloudFormation screen. They point to a map of key/value pairs that will be passed on to `humidifier`. Any `humidifier` (and therefore any CloudFormation) attribute may be specified. For more information on CloudFormation templates and which attributes may be specified, see both the [`humidifier` docs](http://kddnewton.github.io/humidifier) and the [CloudFormation docs](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-guide.html).
194
195
 
195
196
  ### Mappers
196
197
 
@@ -259,6 +260,10 @@ Displays the specified stack in JSON format on the command line. If you optional
259
260
 
260
261
  Displays the names of all of the stacks that `humidifier` is managing.
261
262
 
263
+ #### `upgrade`
264
+
265
+ Downloads the latest CloudFormation resource specification. Periodically AWS will update the file that `humidifier` is based on, in which case the attributes of the resources that were changed could change. This gem usually stays relatively in sync, but if you need to use the latest specs and this gem has not yet released a new version containing them, then you can run this command to download the latest specs onto your system.
266
+
262
267
  #### `upload [?stack]`
263
268
 
264
269
  Upload one or all stacks in the repo to S3 for reference later. Note that this must be combined with the `humidifier` `s3_bucket` configuration option.
@@ -397,7 +402,7 @@ The specs pulled from the CFN docs is saved to `CloudFormationResourceSpecificat
397
402
 
398
403
  ### Contributing
399
404
 
400
- Bug reports and pull requests are welcome on GitHub at https://github.com/kddeisz/humidifier.
405
+ Bug reports and pull requests are welcome on GitHub at https://github.com/kddnewton/humidifier.
401
406
 
402
407
  ### License
403
408
 
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'fileutils'
5
+ require 'rake/testtask'
6
+ require 'yard'
7
+
8
+ Rake::TestTask.new(:test) do |t|
9
+ t.libs << 'test'
10
+ t.libs << 'lib'
11
+ t.test_files = FileList['test/**/*_test.rb']
12
+ t.warning = false
13
+ end
14
+
15
+ task default: :test
16
+
17
+ YARD::Rake::YardocTask.new(:yard) do |t|
18
+ filepath = File.join('lib', 'humidifier', 'magic.rb')
19
+
20
+ t.stats_options = ['--list-undoc']
21
+ t.before = lambda do
22
+ require 'humidifier'
23
+ require_relative 'yard/dynamic'
24
+ Dynamic.generate(filepath)
25
+ end
26
+ t.after = -> { FileUtils.rm(filepath) }
27
+ end
data/exe/humidifier ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # If there is a `bin/humidifier` file, then swap out execution of this default
5
+ # CLI with the custom CLI instead.
6
+ if File.file?(File.join('bin', 'humidifier'))
7
+ exec(File.join('bin', 'humidifier'))
8
+ end
9
+
10
+ require 'bundler/setup'
11
+
12
+ $LOAD_PATH.unshift File.expand_path(File.join('..', 'lib'), __dir__)
13
+ require 'humidifier'
14
+
15
+ Humidifier::CLI.start(ARGV)
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/humidifier/version'
4
+
5
+ version = Humidifier::VERSION
6
+ repository = 'https://github.com/kddnewton/humidifier'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = 'humidifier'
10
+ spec.version = version
11
+ spec.authors = ['Kevin Newton']
12
+ spec.email = ['kddnewton@gmail.com']
13
+
14
+ spec.summary = 'CloudFormation made easy'
15
+ spec.description = 'Programmatically generate and manage AWS ' \
16
+ 'CloudFormation templates, stacks, and change sets.'
17
+ spec.homepage = repository
18
+ spec.license = 'MIT'
19
+
20
+ spec.metadata = {
21
+ 'bug_tracker_uri' => "#{repository}/issues",
22
+ 'changelog_uri' => "#{repository}/blob/v#{version}/CHANGELOG.md",
23
+ 'source_code_uri' => repository,
24
+ 'rubygems_mfa_required' => 'true'
25
+ }
26
+
27
+ spec.files = Dir.chdir(__dir__) do
28
+ `git ls-files -z`.split("\x0").reject do |f|
29
+ f.match(%r{^(bin|docs|example|test|yard)/})
30
+ end
31
+ end
32
+
33
+ spec.bindir = 'exe'
34
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
35
+ spec.require_paths = ['lib']
36
+
37
+ spec.add_dependency 'aws-sdk-cloudformation', '~> 1.25'
38
+ spec.add_dependency 'aws-sdk-s3', '~> 1.48'
39
+ spec.add_dependency 'fast_underscore', '~> 0.3'
40
+ spec.add_dependency 'nokogiri', '~> 1.10'
41
+ spec.add_dependency 'thor', '~> 1.0'
42
+ spec.add_dependency 'thor-hollaback', '~> 0.2'
43
+
44
+ spec.add_development_dependency 'bundler', '~> 2.0'
45
+ spec.add_development_dependency 'minitest', '~> 5.13'
46
+ spec.add_development_dependency 'rake', '~> 13.0'
47
+ spec.add_development_dependency 'rubocop', '~> 1.0'
48
+ spec.add_development_dependency 'simplecov', '~> 0.17'
49
+ spec.add_development_dependency 'yard', '~> 0.9'
50
+ end
@@ -48,10 +48,18 @@ module Humidifier
48
48
 
49
49
  desc 'stacks', 'List the stacks known to Humidifier'
50
50
  def stacks
51
- puts '🗒 Listing stacks'
51
+ puts '🗒 Listing stacks'
52
52
  puts Humidifier.config.stack_names.sort.map { |name| "- #{name}" }
53
53
  end
54
54
 
55
+ desc 'upgrade', 'Download the latest CloudFormation resource specification'
56
+ def upgrade
57
+ print '💾 Downloading...'
58
+
59
+ version = Upgrade.perform
60
+ puts " upgraded to v#{version}"
61
+ end
62
+
55
63
  desc 'upload [?stack]', 'Upload one or all stacks to S3'
56
64
  def upload(name = nil)
57
65
  authorize
@@ -31,8 +31,9 @@ module Humidifier
31
31
  # loop through the specs and register each class
32
32
  def load
33
33
  parsed = parse_spec
34
- types = PropertyTypes.new(parsed['PropertyTypes'])
34
+ return unless parsed
35
35
 
36
+ types = PropertyTypes.new(parsed['PropertyTypes'])
36
37
  parsed['ResourceTypes'].each do |key, spec|
37
38
  match = key.match(/\A(\w+)::(\w+)::(\w+)\z/)
38
39
  register(match[1], match[2], match[3], spec, types.search(key))
@@ -55,10 +56,10 @@ module Humidifier
55
56
  end
56
57
 
57
58
  def parse_spec
58
- relative =
59
- File.join('..', '..', 'CloudFormationResourceSpecification.json')
59
+ path = File.expand_path(File.join('..', '..', SPECIFICATION), __dir__)
60
+ return unless File.file?(path)
60
61
 
61
- JSON.parse(File.read(File.expand_path(relative, __dir__)))
62
+ JSON.parse(File.read(path))
62
63
  end
63
64
 
64
65
  def register(top, group, resource, spec, substructs)
@@ -5,7 +5,7 @@ module Humidifier
5
5
  class Serializer
6
6
  class << self
7
7
  # dumps the given object out to CFN syntax recursively
8
- def dump(node)
8
+ def dump(node) # rubocop:disable Metrics/CyclomaticComplexity
9
9
  case node
10
10
  when Hash then node.map { |key, value| [key, dump(value)] }.to_h
11
11
  when Array then node.map { |value| dump(value) }
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Humidifier
4
+ class Upgrade
5
+ PATH = -File.expand_path(File.join('..', '..', SPECIFICATION), __dir__)
6
+ URL = 'https://docs.aws.amazon.com/AWSCloudFormation/latest' \
7
+ '/UserGuide/cfn-resource-specification.html'
8
+
9
+ def perform
10
+ require 'net/http'
11
+ require 'nokogiri'
12
+
13
+ response = Net::HTTP.get_response(uri).body
14
+ parsed = JSON.parse(response)
15
+
16
+ File.write(PATH, JSON.pretty_generate(parsed))
17
+ parsed['ResourceSpecificationVersion']
18
+ end
19
+
20
+ def self.perform
21
+ new.perform
22
+ end
23
+
24
+ private
25
+
26
+ def page
27
+ Net::HTTP.get_response(URI.parse(URL)).body
28
+ end
29
+
30
+ def uri
31
+ Nokogiri::HTML(page).css('table tr').detect do |tr|
32
+ name = tr.at_css('td:first-child p')
33
+ next if !name || name.text.strip != 'US East (N. Virginia)'
34
+
35
+ break URI.parse(tr.at_css('td:nth-child(3) p a').attr('href'))
36
+ end
37
+ end
38
+ end
39
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Humidifier
4
- VERSION = '4.0.2'
4
+ VERSION = '4.1.1'
5
5
  end
data/lib/humidifier.rb CHANGED
@@ -22,6 +22,9 @@ String.prepend(
22
22
 
23
23
  # container module for all gem classes
24
24
  module Humidifier
25
+ # The file name of the specification for consistency.
26
+ SPECIFICATION = 'CloudFormationResourceSpecification.json'
27
+
25
28
  # A parent class for all Humidifier errors for easier rescuing.
26
29
  class Error < StandardError; end
27
30
 
@@ -77,6 +80,7 @@ require 'humidifier/parameter'
77
80
  require 'humidifier/resource'
78
81
  require 'humidifier/serializer'
79
82
  require 'humidifier/stack'
83
+ require 'humidifier/upgrade'
80
84
  require 'humidifier/version'
81
85
 
82
86
  require 'humidifier/config'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: humidifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.2
4
+ version: 4.1.1
5
5
  platform: ruby
6
6
  authors:
7
- - Kevin Deisz
8
- autorequire:
9
- bindir: bin
7
+ - Kevin Newton
8
+ autorequire:
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-11 00:00:00.000000000 Z
11
+ date: 2021-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-cloudformation
@@ -53,75 +53,75 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.3'
55
55
  - !ruby/object:Gem::Dependency
56
- name: thor
56
+ name: nokogiri
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.20'
61
+ version: '1.10'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.20'
68
+ version: '1.10'
69
69
  - !ruby/object:Gem::Dependency
70
- name: thor-hollaback
70
+ name: thor
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.1'
75
+ version: '1.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.1'
82
+ version: '1.0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: bundler
84
+ name: thor-hollaback
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '2.0'
90
- type: :development
89
+ version: '0.2'
90
+ type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '2.0'
96
+ version: '0.2'
97
97
  - !ruby/object:Gem::Dependency
98
- name: minitest
98
+ name: bundler
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '5.13'
103
+ version: '2.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '5.13'
110
+ version: '2.0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: nokogiri
112
+ name: minitest
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '1.10'
117
+ version: '5.13'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '1.10'
124
+ version: '5.13'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rake
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0.77'
145
+ version: '1.0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '0.77'
152
+ version: '1.0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: simplecov
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -181,14 +181,27 @@ dependencies:
181
181
  description: Programmatically generate and manage AWS CloudFormation templates, stacks,
182
182
  and change sets.
183
183
  email:
184
- - kevin.deisz@gmail.com
185
- executables: []
184
+ - kddnewton@gmail.com
185
+ executables:
186
+ - humidifier
186
187
  extensions: []
187
188
  extra_rdoc_files: []
188
189
  files:
190
+ - ".github/dependabot.yml"
191
+ - ".github/workflows/main.yml"
192
+ - ".gitignore"
193
+ - ".rubocop.yml"
194
+ - ".yardopts"
195
+ - CHANGELOG.md
196
+ - CODE_OF_CONDUCT.md
189
197
  - CloudFormationResourceSpecification.json
198
+ - Gemfile
199
+ - Gemfile.lock
190
200
  - LICENSE
191
201
  - README.md
202
+ - Rakefile
203
+ - exe/humidifier
204
+ - humidifier.gemspec
192
205
  - lib/humidifier.rb
193
206
  - lib/humidifier/cli.rb
194
207
  - lib/humidifier/condition.rb
@@ -206,12 +219,17 @@ files:
206
219
  - lib/humidifier/resource.rb
207
220
  - lib/humidifier/serializer.rb
208
221
  - lib/humidifier/stack.rb
222
+ - lib/humidifier/upgrade.rb
209
223
  - lib/humidifier/version.rb
210
- homepage: https://github.com/kddeisz/humidifier
224
+ homepage: https://github.com/kddnewton/humidifier
211
225
  licenses:
212
226
  - MIT
213
- metadata: {}
214
- post_install_message:
227
+ metadata:
228
+ bug_tracker_uri: https://github.com/kddnewton/humidifier/issues
229
+ changelog_uri: https://github.com/kddnewton/humidifier/blob/v4.1.1/CHANGELOG.md
230
+ source_code_uri: https://github.com/kddnewton/humidifier
231
+ rubygems_mfa_required: 'true'
232
+ post_install_message:
215
233
  rdoc_options: []
216
234
  require_paths:
217
235
  - lib
@@ -219,15 +237,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
219
237
  requirements:
220
238
  - - ">="
221
239
  - !ruby/object:Gem::Version
222
- version: '2.4'
240
+ version: '0'
223
241
  required_rubygems_version: !ruby/object:Gem::Requirement
224
242
  requirements:
225
243
  - - ">="
226
244
  - !ruby/object:Gem::Version
227
245
  version: '0'
228
246
  requirements: []
229
- rubygems_version: 3.0.6
230
- signing_key:
247
+ rubygems_version: 3.2.3
248
+ signing_key:
231
249
  specification_version: 4
232
250
  summary: CloudFormation made easy
233
251
  test_files: []