kurgan 0.2.2 → 0.3.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 +4 -4
- data/.github/workflows/build-gem.yml +25 -0
- data/.github/workflows/release-gem.yml +24 -0
- data/Gemfile.lock +2 -2
- data/kurgan.gemspec +2 -2
- data/lib/kurgan/init.rb +3 -1
- data/lib/kurgan/templates/github_actions.yaml.tt +25 -0
- data/lib/kurgan/templates/test.spec.tt +31 -0
- data/lib/kurgan/test.rb +12 -1
- data/lib/kurgan/version.rb +1 -1
- metadata +10 -7
- data/.travis.yml +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ed9790e405062d96996a8ee171a7d3ac0cfdaf675b458f3cb38015e936c01b3
|
4
|
+
data.tar.gz: '09e6b0290f9ad301146292353f5235dafd1023f2198ea5d160a1ddba3ca74b11'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b7bdf67f194e510c687775b3c1a89b5b24aee7aca3fc93b2ecd61ae05efe19861b60935d6c8e99666f6b18ad4f922556bee3f7a27c9020f2df7c05801c044d2
|
7
|
+
data.tar.gz: 9aaceb7c925e2e7cfbfb389b157348d4b4d6aff625962415430547d709e3699d0b6b7a5f1d421d6c7ae4e5c62f4ef74e824d4c0440393fa0bd8bf0e752bd1d48
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: test and build gem
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches: [ master ]
|
5
|
+
pull_request:
|
6
|
+
branches: [ master ]
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
name: test + build
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- name: set up ruby 2.7
|
16
|
+
uses: actions/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: 2.7.x
|
19
|
+
- name: rspec
|
20
|
+
run: |
|
21
|
+
gem install rspec
|
22
|
+
rspec
|
23
|
+
- name: build gem
|
24
|
+
run: |
|
25
|
+
gem build kurgan.gemspec
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: release gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
release:
|
5
|
+
types: [published]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
name: Build and publish gem
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
|
12
|
+
steps:
|
13
|
+
- name: Check out the repo
|
14
|
+
uses: actions/checkout@v2
|
15
|
+
|
16
|
+
- name: Set up ruby 2.7
|
17
|
+
uses: actions/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: 2.7.x
|
20
|
+
|
21
|
+
- name: Publish gem
|
22
|
+
uses: dawidd6/action-publish-gem@v1
|
23
|
+
with:
|
24
|
+
api_key: ${{secrets.RUBYGEMS_API_KEY}}
|
data/Gemfile.lock
CHANGED
@@ -7,7 +7,7 @@ PATH
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
rake (
|
10
|
+
rake (13.0.1)
|
11
11
|
thor (0.20.3)
|
12
12
|
|
13
13
|
PLATFORMS
|
@@ -16,7 +16,7 @@ PLATFORMS
|
|
16
16
|
DEPENDENCIES
|
17
17
|
bundler (~> 2.0)
|
18
18
|
kurgan!
|
19
|
-
rake (~>
|
19
|
+
rake (~> 13.0)
|
20
20
|
|
21
21
|
BUNDLED WITH
|
22
22
|
2.0.1
|
data/kurgan.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
18
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
19
|
if spec.respond_to?(:metadata)
|
20
|
-
spec.metadata["allowed_push_host"] = "
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
21
21
|
else
|
22
22
|
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
23
|
"public gem pushes."
|
@@ -33,5 +33,5 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_dependency "thor", "~> 0.19"
|
34
34
|
|
35
35
|
spec.add_development_dependency "bundler", "~> 2.0"
|
36
|
-
spec.add_development_dependency "rake", "~>
|
36
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
37
37
|
end
|
data/lib/kurgan/init.rb
CHANGED
@@ -55,8 +55,10 @@ module Kurgan
|
|
55
55
|
|
56
56
|
def ci_init
|
57
57
|
if yes?("Setup a CI pipeline?")
|
58
|
-
ci = ask "CI flavour", limited_to: ['jenkins', 'travis', 'codebuild']
|
58
|
+
ci = ask "CI flavour", limited_to: ['github', 'jenkins', 'travis', 'codebuild']
|
59
59
|
case ci
|
60
|
+
when 'github'
|
61
|
+
template('templates/github_actions.yaml.tt', "#{@dir}/.github/workflows/rspec.yaml")
|
60
62
|
when 'jenkins'
|
61
63
|
template('templates/Jenkinsfile.tt', "#{@dir}/Jenkinsfile")
|
62
64
|
when 'travis'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: cftest
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
name: test
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v2
|
12
|
+
- name: set up ruby 2.7
|
13
|
+
uses: actions/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
ruby-version: 2.7.x
|
16
|
+
- name: install gems
|
17
|
+
run: gem install cfhighlander rspec
|
18
|
+
- name: set cfndsl spec
|
19
|
+
run: cfndsl -u
|
20
|
+
- name: cftest
|
21
|
+
run: rspec
|
22
|
+
env:
|
23
|
+
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
|
24
|
+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
25
|
+
AWS_REGION: ap-southeast-2
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
describe 'compiled component <%= @component_name %>' do
|
4
|
+
|
5
|
+
context 'cftest' do
|
6
|
+
it 'compiles test' do
|
7
|
+
expect(system("cfhighlander cftest #{@validate} --tests tests/<%= @test_name %>.test.yaml")).to be_truthy
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:template) { YAML.load_file("#{File.dirname(__FILE__)}/../out/tests/<%= @test_name %>/<%= @component_name %>.compiled.yaml") }
|
12
|
+
|
13
|
+
context "Resource" do
|
14
|
+
|
15
|
+
<% config['Resources'].each do |resource, details| %>
|
16
|
+
context "<%= resource %>" do
|
17
|
+
let(:resource) { template["Resources"]["<%= resource %>"] }
|
18
|
+
|
19
|
+
it "is of type <%= details['Type'] %>" do
|
20
|
+
expect(resource["Type"]).to eq("<%= details['Type'] %>")
|
21
|
+
end
|
22
|
+
<% if details.has_key?('Properties')%><% details['Properties'].each do |property, value| %>
|
23
|
+
it "to have property <%= property %>" do
|
24
|
+
expect(resource["Properties"]["<%= property %>"]).to eq(<%= value.is_a?(String) ? "\"#{value}\"" : value %>)
|
25
|
+
end
|
26
|
+
<% end %><% end %>
|
27
|
+
end
|
28
|
+
<% end %>
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/lib/kurgan/test.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
1
3
|
module Kurgan
|
2
4
|
class Test < Thor::Group
|
3
5
|
include Thor::Actions
|
4
6
|
|
5
7
|
argument :test_name
|
6
8
|
|
7
|
-
class_option :type, aliases: :t, type: :string, enum: %w(config), default: 'config'
|
9
|
+
class_option :type, aliases: :t, type: :string, enum: %w(config spec), default: 'config'
|
8
10
|
class_option :directory, aliases: :d, type: :string, default: 'tests'
|
9
11
|
|
10
12
|
def self.source_root
|
@@ -16,6 +18,7 @@ module Kurgan
|
|
16
18
|
if @cfhighlander_template.nil?
|
17
19
|
raise "No cfhighlander.rb file found in #{Dir.pwd}"
|
18
20
|
end
|
21
|
+
@component_name = @cfhighlander_template.split('.').first
|
19
22
|
end
|
20
23
|
|
21
24
|
def create_test
|
@@ -23,6 +26,14 @@ module Kurgan
|
|
23
26
|
when 'config'
|
24
27
|
template('templates/test.yaml.tt', "#{options[:directory]}/#{test_name}.test.yaml")
|
25
28
|
say "created config test case #{options[:directory]}/#{test_name}.test.yaml", :green
|
29
|
+
when 'spec'
|
30
|
+
output_file = "#{Dir.pwd}/out/tests/#{test_name}/#{@component_name}.compiled.yaml"
|
31
|
+
if !File.file?(output_file)
|
32
|
+
error "compile cloudformation test output file #{output_file} not found.\nRun `cfhighlander cftest -t #{options[:directory]}/#{test_name}.test.yaml`"
|
33
|
+
end
|
34
|
+
compiled_test = YAML.load_file("#{Dir.pwd}/out/tests/#{test_name}/#{@component_name}.compiled.yaml")
|
35
|
+
template('templates/test.spec.tt', "spec/#{test_name}_spec.rb", compiled_test)
|
36
|
+
say "created spec test spec/#{test_name}_spec.rb", :green
|
26
37
|
else
|
27
38
|
error "#{options[:type]} is not a supported test type yet", :red
|
28
39
|
end
|
data/lib/kurgan/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kurgan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guslington
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
description: Manage a cfhighalnder project
|
56
56
|
email:
|
57
57
|
- theonestackcfhighlander@gmail.com
|
@@ -60,8 +60,9 @@ executables:
|
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
+
- ".github/workflows/build-gem.yml"
|
64
|
+
- ".github/workflows/release-gem.yml"
|
63
65
|
- ".gitignore"
|
64
|
-
- ".travis.yml"
|
65
66
|
- Gemfile
|
66
67
|
- Gemfile.lock
|
67
68
|
- LICENSE.txt
|
@@ -83,7 +84,9 @@ files:
|
|
83
84
|
- lib/kurgan/templates/cfndsl.rb.tt
|
84
85
|
- lib/kurgan/templates/codebuild.yaml.tt
|
85
86
|
- lib/kurgan/templates/config.yaml.tt
|
87
|
+
- lib/kurgan/templates/github_actions.yaml.tt
|
86
88
|
- lib/kurgan/templates/gitignore.tt
|
89
|
+
- lib/kurgan/templates/test.spec.tt
|
87
90
|
- lib/kurgan/templates/test.yaml.tt
|
88
91
|
- lib/kurgan/templates/travis.yml.tt
|
89
92
|
- lib/kurgan/test.rb
|
@@ -92,7 +95,7 @@ homepage: http://iamkurgan.com
|
|
92
95
|
licenses:
|
93
96
|
- MIT
|
94
97
|
metadata:
|
95
|
-
allowed_push_host:
|
98
|
+
allowed_push_host: https://rubygems.org
|
96
99
|
post_install_message:
|
97
100
|
rdoc_options: []
|
98
101
|
require_paths:
|
@@ -108,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
111
|
- !ruby/object:Gem::Version
|
109
112
|
version: '0'
|
110
113
|
requirements: []
|
111
|
-
rubygems_version: 3.
|
114
|
+
rubygems_version: 3.1.6
|
112
115
|
signing_key:
|
113
116
|
specification_version: 4
|
114
117
|
summary: Manage a cfhighalnder project
|
data/.travis.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
sudo: required
|
2
|
-
dist: trusty
|
3
|
-
language: ruby
|
4
|
-
rvm:
|
5
|
-
- 2.5
|
6
|
-
script:
|
7
|
-
- bundle install
|
8
|
-
- gem build kurgan.gemspec
|
9
|
-
- gem install kurgan-*.gem
|
10
|
-
- kurgan help
|
11
|
-
deploy:
|
12
|
-
provider: rubygems
|
13
|
-
api_key: "${RUBYGEMS_API_KEY}"
|
14
|
-
gem: kurgan
|
15
|
-
on:
|
16
|
-
all_branches: true
|
17
|
-
condition: $TRAVIS_BRANCH =~ ^develop|master && $TRAVIS_EVENT_TYPE =~ ^push|api$ && $TRAVIS_REPO_SLUG == "theonestack/kurgan"
|