k_director 0.5.0 → 0.7.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/.builders/generators/01-bootstrap.rb +1 -0
- data/.github/workflows/main.yml +52 -14
- data/docs/CHANGELOG.md +48 -0
- data/k_director.gemspec +1 -0
- data/lib/k_director/builders/actions_builder.rb +13 -4
- data/lib/k_director/directors/base_director.rb +12 -0
- data/lib/k_director/directors/data.rb +9 -49
- data/lib/k_director/dsls/children/github.rb +133 -9
- data/lib/k_director/version.rb +1 -1
- data/lib/k_director.rb +2 -0
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +16 -3
- data/.github/workflows/semver.yml +0 -54
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0672ad44c4bedc02e26c444b2d2dd018d12e6d979a8d87fe751c30544e77b878
|
|
4
|
+
data.tar.gz: a58c986bc9d6b969368e423b124710726b59f9f3a7157f1c61ae9119bef6433b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 98a1a2ffa7ebfb543395ec9362d2c05721d98fb2158b51daf8af4040297abbd0a2209ce31b59ac637fb598caaaa6af17c7c246e2ae0c5be90023f93666e305d8
|
|
7
|
+
data.tar.gz: 187c6b3e7b2be6f0f51994741771cae2399f87db17fba890afb042035235698627110a9aa43696591de970c2b9d32c21fce68d82dd2a3cc23054cd6be17d4100
|
|
@@ -35,6 +35,7 @@ KManager.action :bootstrap do
|
|
|
35
35
|
# list_repositories
|
|
36
36
|
# open_repository # (:k_director)
|
|
37
37
|
# run_command('git init')
|
|
38
|
+
# k_director git:(main) gh repo edit -d "KDirector provides domain specific language (DSL) implementations for code generation"
|
|
38
39
|
end
|
|
39
40
|
.blueprint(
|
|
40
41
|
name: :bin_hook,
|
data/.github/workflows/main.yml
CHANGED
|
@@ -7,7 +7,7 @@ on:
|
|
|
7
7
|
branches: [ main ]
|
|
8
8
|
|
|
9
9
|
jobs:
|
|
10
|
-
|
|
10
|
+
build:
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
name: Ruby ${{ matrix.ruby }}
|
|
13
13
|
strategy:
|
|
@@ -22,32 +22,70 @@ jobs:
|
|
|
22
22
|
ruby-version: ${{ matrix.ruby }}
|
|
23
23
|
bundler-cache: true
|
|
24
24
|
|
|
25
|
-
-
|
|
26
|
-
|
|
25
|
+
- id: lint
|
|
26
|
+
name: Run rubocop
|
|
27
|
+
run: bundle exec rubocop
|
|
27
28
|
|
|
28
|
-
- name: Slack
|
|
29
|
-
if: failure
|
|
29
|
+
- name: Slack notification on rubocop error
|
|
30
|
+
if: steps.lint.conclusion == 'failure'
|
|
30
31
|
uses: rtCamp/action-slack-notify@v2
|
|
31
32
|
env:
|
|
32
33
|
SLACK_CHANNEL: klueless-repos
|
|
33
34
|
SLACK_COLOR: '#ff0000'
|
|
34
35
|
SLACK_ICON: https://avatars.githubusercontent.com/u/2956762?s=64&v=4
|
|
35
|
-
SLACK_TITLE: '
|
|
36
|
-
SLACK_MESSAGE: '
|
|
36
|
+
SLACK_TITLE: 'Rubocop failure on $ - try:'
|
|
37
|
+
SLACK_MESSAGE: 'cop -a'
|
|
37
38
|
SLACK_USERNAME: klueless-io
|
|
38
|
-
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
|
39
|
+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
|
39
40
|
|
|
40
|
-
-
|
|
41
|
-
|
|
41
|
+
- id: rspec
|
|
42
|
+
name: Run tests
|
|
43
|
+
run: bundle exec rspec
|
|
42
44
|
|
|
43
|
-
- name: Slack
|
|
44
|
-
if: failure
|
|
45
|
+
- name: Slack notify on rspec error
|
|
46
|
+
if: steps.rspec.conclusion == 'failure'
|
|
45
47
|
uses: rtCamp/action-slack-notify@v2
|
|
46
48
|
env:
|
|
47
49
|
SLACK_CHANNEL: klueless-repos
|
|
48
50
|
SLACK_COLOR: '#ff0000'
|
|
49
51
|
SLACK_ICON: https://avatars.githubusercontent.com/u/2956762?s=64&v=4
|
|
50
|
-
SLACK_TITLE: '
|
|
51
|
-
SLACK_MESSAGE: '
|
|
52
|
+
SLACK_TITLE: 'RSpec failure on ${{github.repository}} - try:'
|
|
53
|
+
SLACK_MESSAGE: 'rspec'
|
|
52
54
|
SLACK_USERNAME: klueless-io
|
|
53
55
|
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
|
56
|
+
|
|
57
|
+
release:
|
|
58
|
+
needs: build
|
|
59
|
+
name: Update version and publish to RubyGems
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/checkout@v2
|
|
63
|
+
- uses: actions/setup-node@v2
|
|
64
|
+
with:
|
|
65
|
+
node-version: '16'
|
|
66
|
+
|
|
67
|
+
# - uses: hmarr/debug-action@v2 # TURN on ENV DEBUG
|
|
68
|
+
|
|
69
|
+
- name: Cache node modules
|
|
70
|
+
uses: actions/cache@v2
|
|
71
|
+
id: cache-node-modules
|
|
72
|
+
env:
|
|
73
|
+
cache-name: cache-node-modules
|
|
74
|
+
with:
|
|
75
|
+
path: ~/.npm
|
|
76
|
+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
77
|
+
restore-keys: |
|
|
78
|
+
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
79
|
+
${{ runner.os }}-build-
|
|
80
|
+
${{ runner.os }}-
|
|
81
|
+
|
|
82
|
+
- name: Install semantic-release dependencies
|
|
83
|
+
if: steps.cache.outputs.cache-hit != 'true'
|
|
84
|
+
run: npm ci
|
|
85
|
+
|
|
86
|
+
# SEE MORE: https://github.com/semantic-release/semantic-release/issues/753
|
|
87
|
+
- name: Run SemVer
|
|
88
|
+
run: npm run release
|
|
89
|
+
env:
|
|
90
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
91
|
+
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
|
data/docs/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
|
+
## [0.6.2](https://github.com/klueless-io/k_director/compare/v0.6.1...v0.6.2) (2022-02-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* merge main and semver gha workflows ([5c3a9e4](https://github.com/klueless-io/k_director/commit/5c3a9e4a6f01129cc513760b86453a4201835765))
|
|
7
|
+
* merge main and semver gha workflows - final ([0c5eb76](https://github.com/klueless-io/k_director/commit/0c5eb76d8008d5ec869fdb9c9adcc306e6a51604))
|
|
8
|
+
* merge main and semver gha workflows [#2](https://github.com/klueless-io/k_director/issues/2) ([f20f719](https://github.com/klueless-io/k_director/commit/f20f719f5f82d5761b9886b1d294750a761a7376))
|
|
9
|
+
* merge main and semver gha workflows [#2](https://github.com/klueless-io/k_director/issues/2) ([2102bca](https://github.com/klueless-io/k_director/commit/2102bca3ebe67d75e4d8d6c12cf962420371264c))
|
|
10
|
+
* merge main and semver gha workflows [#2](https://github.com/klueless-io/k_director/issues/2) ([9f384fd](https://github.com/klueless-io/k_director/commit/9f384fd88ab7ec39fd15b256b61c146e113f4a8d))
|
|
11
|
+
* merge main and semver gha workflows [#2](https://github.com/klueless-io/k_director/issues/2) ([bd4dbcd](https://github.com/klueless-io/k_director/commit/bd4dbcd842f5dee4dabc7eb9495a6f143a02d3ef))
|
|
12
|
+
* merge main and semver gha workflows [#2](https://github.com/klueless-io/k_director/issues/2) ([79c793d](https://github.com/klueless-io/k_director/commit/79c793d46accb10dc81a0bc0b9f8bbc451f03df7))
|
|
13
|
+
* merge main and semver gha workflows [#2](https://github.com/klueless-io/k_director/issues/2) ([353bc81](https://github.com/klueless-io/k_director/commit/353bc81eab7759fba7be3d12ca73293699c70146))
|
|
14
|
+
* merge main and semver gha workflows [#2](https://github.com/klueless-io/k_director/issues/2) ([61f4772](https://github.com/klueless-io/k_director/commit/61f4772cac5400b0085f9081a46f8fbc68471534))
|
|
15
|
+
* merge main and semver gha workflows [#3](https://github.com/klueless-io/k_director/issues/3) ([ee13161](https://github.com/klueless-io/k_director/commit/ee131618a66dea1a0996f4be897bcfe6b902482f))
|
|
16
|
+
* merge main and semver gha workflows [#3](https://github.com/klueless-io/k_director/issues/3) ([074b65c](https://github.com/klueless-io/k_director/commit/074b65cfd95d1e6fc355f8ec0d47f03ec6c9b867))
|
|
17
|
+
* merge main and semver gha workflows [#4](https://github.com/klueless-io/k_director/issues/4) ([8001aa5](https://github.com/klueless-io/k_director/commit/8001aa5be830197baaa5e956c6b5bd010479fd60))
|
|
18
|
+
* merge main and semver gha workflows [#5](https://github.com/klueless-io/k_director/issues/5) ([6ba2432](https://github.com/klueless-io/k_director/commit/6ba2432126c8c1fe5e157d470e6c8609cea174d6))
|
|
19
|
+
* merge main and semver gha workflows [#6](https://github.com/klueless-io/k_director/issues/6) ([62eb60e](https://github.com/klueless-io/k_director/commit/62eb60e55dbfed3aa16faf17e137b39505e2e8a8))
|
|
20
|
+
* merge main and semver gha workflows [#7](https://github.com/klueless-io/k_director/issues/7) ([30fba4b](https://github.com/klueless-io/k_director/commit/30fba4b7da6aced100dfd68a750e051f6ddc0da8))
|
|
21
|
+
* merge main and semver gha workflows [#8](https://github.com/klueless-io/k_director/issues/8) ([e6a55f7](https://github.com/klueless-io/k_director/commit/e6a55f73235a556861140358592f6b5d031dec24))
|
|
22
|
+
|
|
23
|
+
## [0.6.1](https://github.com/klueless-io/k_director/compare/v0.6.0...v0.6.1) (2022-01-31)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* add data to base (plus settings) to director ([bee18a1](https://github.com/klueless-io/k_director/commit/bee18a1eda36d802611c5cf354031963daa82c69))
|
|
29
|
+
|
|
30
|
+
# [0.6.0](https://github.com/klueless-io/k_director/compare/v0.5.0...v0.6.0) (2022-01-31)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* add improve group_set on action_builder ([b11ff25](https://github.com/klueless-io/k_director/commit/b11ff25475d48c07af67f3e82bff58ab903ae4a5))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Features
|
|
39
|
+
|
|
40
|
+
* add data director class ([510d970](https://github.com/klueless-io/k_director/commit/510d9701480a57580b0cc4f4a58398ce7752a431))
|
|
41
|
+
|
|
42
|
+
# [0.5.0](https://github.com/klueless-io/k_director/compare/v0.4.1...v0.5.0) (2022-01-31)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Features
|
|
46
|
+
|
|
47
|
+
* add group_set to action_builder ([62d87ed](https://github.com/klueless-io/k_director/commit/62d87ed27cb1479cf5ba3a2fa8cac70fa71f63fd))
|
|
48
|
+
|
|
1
49
|
## [0.4.1](https://github.com/klueless-io/k_director/compare/v0.4.0...v0.4.1) (2022-01-30)
|
|
2
50
|
|
|
3
51
|
|
data/k_director.gemspec
CHANGED
|
@@ -44,5 +44,6 @@ Gem::Specification.new do |spec|
|
|
|
44
44
|
spec.add_dependency 'k_log', '~> 0.0.0'
|
|
45
45
|
# spec.add_dependency 'k_type', '~> 0.0.0'
|
|
46
46
|
spec.add_dependency 'k_builder', '~> 0.0.0'
|
|
47
|
+
spec.add_dependency 'k_ext-github', '~> 0.0.0'
|
|
47
48
|
spec.add_dependency 'k_util', '~> 0.0.0'
|
|
48
49
|
end
|
|
@@ -26,10 +26,19 @@ module KDirector
|
|
|
26
26
|
# Set many key/value pairs gainst a group
|
|
27
27
|
#
|
|
28
28
|
# example:
|
|
29
|
-
# set_many(:github,
|
|
30
|
-
def group_set(group, **opts)
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
# set_many(:github, repo_name: 'repo-name', organization: 'org-name')
|
|
30
|
+
def group_set(group = nil, **opts)
|
|
31
|
+
return if group.nil? && opts.empty?
|
|
32
|
+
|
|
33
|
+
if group.nil?
|
|
34
|
+
opts.each do |key, value|
|
|
35
|
+
set(key, value)
|
|
36
|
+
end
|
|
37
|
+
else
|
|
38
|
+
dom[group] = {} if opts.empty? # initialize the group name if no options are provided
|
|
39
|
+
opts.each do |key, value|
|
|
40
|
+
set(group, key, value)
|
|
41
|
+
end
|
|
33
42
|
end
|
|
34
43
|
end
|
|
35
44
|
|
|
@@ -34,6 +34,18 @@ module KDirector
|
|
|
34
34
|
@options.on_action ||= :queue # %i[queue execute]
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
+
def data(name = nil, **opts)
|
|
38
|
+
KDirector::Directors::Data.new(self, name, **opts)
|
|
39
|
+
|
|
40
|
+
self
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def settings(**opts)
|
|
44
|
+
KDirector::Directors::Data.new(self, :settings, **opts)
|
|
45
|
+
|
|
46
|
+
self
|
|
47
|
+
end
|
|
48
|
+
|
|
37
49
|
def dom
|
|
38
50
|
builder.dom
|
|
39
51
|
end
|
|
@@ -1,57 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module KDirector
|
|
4
|
-
module
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class Blueprint < KDirector::Directors::ChildDirector
|
|
10
|
-
# Add a single file into the code base
|
|
11
|
-
#
|
|
12
|
-
# @param [String] output_filename The output file name, this can be a relative path
|
|
13
|
-
# @param [Hash] **opts The options
|
|
14
|
-
# @option opts [String] :template_filename Template filename can be set or it will default to the same value as the output file name
|
|
15
|
-
# @option opts [String] :template_subfolder Template subfolder
|
|
16
|
-
def add(output_file, **opts)
|
|
17
|
-
template_file = opts[:template_file] || output_file
|
|
18
|
-
template_parts = [template_base_folder, opts[:template_subfolder], template_file].reject(&:blank?)
|
|
19
|
-
template_path = File.join(*template_parts)
|
|
4
|
+
module Directors
|
|
5
|
+
# Data can update the underlying ActionBuilder DOM.
|
|
6
|
+
class Data
|
|
7
|
+
attr_reader :parent
|
|
8
|
+
attr_reader :name
|
|
20
9
|
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
def initialize(parent, name, **opts)
|
|
11
|
+
@parent = parent
|
|
12
|
+
@name = name
|
|
23
13
|
|
|
24
|
-
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def oadd(name, **opts)
|
|
28
|
-
add(name, **{ open: true }.merge(opts))
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def tadd(name, **opts)
|
|
32
|
-
add(name, **{ open_template: true }.merge(opts))
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def fadd(name, **opts)
|
|
36
|
-
add(name, **{ on_exist: :write }.merge(opts))
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
# def template_content(template_file, **opts)
|
|
40
|
-
# template_parts = [template_base_folder, opts[:template_subfolder], template_file].reject(&:blank?)
|
|
41
|
-
# template_file = File.join(*template_parts)
|
|
42
|
-
|
|
43
|
-
# file = k_builder.find_template_file(template_file)
|
|
44
|
-
# File.read(file)
|
|
45
|
-
# end
|
|
46
|
-
|
|
47
|
-
def run_template_script(template_file, **opts)
|
|
48
|
-
template_parts = [template_base_folder, opts[:template_subfolder], template_file].reject(&:blank?)
|
|
49
|
-
template_path = File.join(*template_parts)
|
|
50
|
-
|
|
51
|
-
script = k_builder.process_any_content(template_file: template_path, **opts)
|
|
52
|
-
|
|
53
|
-
run_script(script)
|
|
54
|
-
end
|
|
14
|
+
parent.builder.group_set(name, **opts)
|
|
55
15
|
end
|
|
56
16
|
end
|
|
57
17
|
end
|
|
@@ -12,22 +12,146 @@ module KDirector
|
|
|
12
12
|
def initialize(parent, **opts)
|
|
13
13
|
super(parent, **opts)
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
defaults = {
|
|
16
|
+
repo_name: opts[:repo_name], # || parent.builder.dom&[:github]&[:repo_name]
|
|
17
|
+
user: opts[:user] || default_github_user, # || parent.builder.dom&[:github]&[:user]
|
|
18
|
+
organization: opts[:organization] # || parent.builder.dom&[:github]&[:organization]
|
|
19
|
+
}
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
parent.builder.group_set(:github, **defaults)
|
|
22
|
+
end
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
def repo_name
|
|
25
|
+
parent.builder.dom[:github][:repo_name]
|
|
23
26
|
end
|
|
24
27
|
|
|
25
|
-
def
|
|
26
|
-
|
|
28
|
+
def user
|
|
29
|
+
parent.builder.dom[:github][:user]
|
|
27
30
|
end
|
|
28
31
|
|
|
29
32
|
def organization
|
|
30
|
-
|
|
33
|
+
parent.builder.dom[:github][:organization]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def list_repositories
|
|
37
|
+
repos = create_api.all_repositories
|
|
38
|
+
|
|
39
|
+
KExt::Github::Printer.repositories_as_table repos
|
|
40
|
+
|
|
41
|
+
log.kv 'Repository count', repos.length
|
|
42
|
+
rescue StandardError => e
|
|
43
|
+
log.exception(e)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def open_repository(**opts)
|
|
47
|
+
info = repo_info(**opts)
|
|
48
|
+
|
|
49
|
+
system("open -a 'Google Chrome' #{info.link}")
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
53
|
+
def create_repository(**opts)
|
|
54
|
+
info = repo_info(**opts)
|
|
55
|
+
|
|
56
|
+
if info.repo_name.blank?
|
|
57
|
+
log.error 'Repository name is required'
|
|
58
|
+
return
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
repo = create_api.all_repositories.find { |r| r.full_name == info.full_name }
|
|
62
|
+
|
|
63
|
+
if repo.nil?
|
|
64
|
+
log.heading 'Repository create'
|
|
65
|
+
log.kv 'Repository Name', info.repo_name
|
|
66
|
+
log.kv 'Repository Full Name', info.full_name
|
|
67
|
+
log.kv 'Organization Name', info.organization if info.organization
|
|
68
|
+
success = create_api.create_repository(info.repo_name, organization: info.organization)
|
|
69
|
+
log.info "Repository: #{info.full_name} created" if success
|
|
70
|
+
log.error "Repository: #{info.full_name} was not created" unless success
|
|
71
|
+
|
|
72
|
+
system("open -a 'Google Chrome' #{info.link}") if opts[:open]
|
|
73
|
+
else
|
|
74
|
+
log.warn 'Repository already exists, nothing to create'
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
log_repo_info(info)
|
|
78
|
+
rescue StandardError => e
|
|
79
|
+
log.exception(e)
|
|
80
|
+
end
|
|
81
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
82
|
+
|
|
83
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
84
|
+
def delete_repository(**opts)
|
|
85
|
+
info = repo_info(**opts)
|
|
86
|
+
|
|
87
|
+
if info.repo_name.blank?
|
|
88
|
+
log.error 'Repository name is required'
|
|
89
|
+
return
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
repo = create_api.all_repositories.find { |r| r.full_name == info.full_name }
|
|
93
|
+
|
|
94
|
+
if repo.present?
|
|
95
|
+
log.heading 'Repository delete'
|
|
96
|
+
log.kv 'Repository Name', info.repo_name
|
|
97
|
+
log.kv 'Repository Full Name', info.full_name
|
|
98
|
+
log.kv 'Organization Name', info.organization if info.organization
|
|
99
|
+
success = delete_api.delete_repository(info.full_name, organization: info.organization)
|
|
100
|
+
log.info "Repository: #{info.full_name} deleted" if success
|
|
101
|
+
log.error "Repository: #{info.full_name} was not deleted" unless success
|
|
102
|
+
# system("open -a 'Google Chrome' #{info.link}") if opts[:open]
|
|
103
|
+
else
|
|
104
|
+
log.warn 'Repository does not exist, nothing to delete'
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
log_repo_info(info)
|
|
108
|
+
rescue StandardError => e
|
|
109
|
+
log.exception(e)
|
|
110
|
+
end
|
|
111
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
112
|
+
|
|
113
|
+
def repo_info(**opts)
|
|
114
|
+
repo_name = opts[:name] || self.repo_name
|
|
115
|
+
repo_name = repo_name.to_s
|
|
116
|
+
username = opts[:username] || user
|
|
117
|
+
organization = opts[:organization] || self.organization
|
|
118
|
+
account = organization || username
|
|
119
|
+
full_name = [account, repo_name].compact.join('/')
|
|
120
|
+
link = "https://github.com/#{full_name}"
|
|
121
|
+
ssh_link = "git@github.com:#{full_name}.git"
|
|
122
|
+
|
|
123
|
+
OpenStruct.new(
|
|
124
|
+
repo_name: repo_name,
|
|
125
|
+
full_name: full_name,
|
|
126
|
+
link: link,
|
|
127
|
+
ssh_link: ssh_link,
|
|
128
|
+
username: username,
|
|
129
|
+
organization: organization
|
|
130
|
+
)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
private
|
|
134
|
+
|
|
135
|
+
def default_github_user
|
|
136
|
+
KExt::Github.configuration.user
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def create_api
|
|
140
|
+
token = KExt::Github.configuration.personal_access_token
|
|
141
|
+
KExt::Github::Api.instance(token)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def delete_api
|
|
145
|
+
token = KExt::Github.configuration.personal_access_token_delete
|
|
146
|
+
KExt::Github::Api.instance(token)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
def log_repo_info(info)
|
|
150
|
+
log.kv 'SSH', info.ssh_link
|
|
151
|
+
log.kv 'HTTPS', info.git_link
|
|
152
|
+
log.kv 'GITHUB', KUtil.console.hyperlink(info.link, info.link)
|
|
153
|
+
|
|
154
|
+
# log.json repo.to_h
|
|
31
155
|
end
|
|
32
156
|
end
|
|
33
157
|
end
|
data/lib/k_director/version.rb
CHANGED
data/lib/k_director.rb
CHANGED
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
require 'k_log'
|
|
4
4
|
require 'k_util'
|
|
5
5
|
require 'k_builder'
|
|
6
|
+
require 'k_ext/github'
|
|
6
7
|
|
|
7
8
|
require_relative 'k_director/version'
|
|
8
9
|
require_relative 'k_director/builders/actions_builder'
|
|
9
10
|
require_relative 'k_director/directors/base_director'
|
|
10
11
|
require_relative 'k_director/directors/child_director'
|
|
12
|
+
require_relative 'k_director/directors/data'
|
|
11
13
|
require_relative 'k_director/dsls/children/blueprint'
|
|
12
14
|
require_relative 'k_director/dsls/children/github'
|
|
13
15
|
|
data/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "k_director",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "k_director",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.7.0",
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
|
|
12
12
|
"@semantic-release/changelog": "^6.0.1",
|
data/package.json
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: k_director
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Cruwys
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-02-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: k_log
|
|
@@ -38,6 +38,20 @@ dependencies:
|
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: 0.0.0
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: k_ext-github
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 0.0.0
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 0.0.0
|
|
41
55
|
- !ruby/object:Gem::Dependency
|
|
42
56
|
name: k_util
|
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -69,7 +83,6 @@ files:
|
|
|
69
83
|
- ".githooks/commit-msg"
|
|
70
84
|
- ".githooks/pre-commit"
|
|
71
85
|
- ".github/workflows/main.yml"
|
|
72
|
-
- ".github/workflows/semver.yml"
|
|
73
86
|
- ".gitignore"
|
|
74
87
|
- ".releaserc.json"
|
|
75
88
|
- ".rspec"
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
name: SemVer
|
|
2
|
-
on:
|
|
3
|
-
workflow_run:
|
|
4
|
-
workflows: ["Build Application"]
|
|
5
|
-
branches: [main]
|
|
6
|
-
types:
|
|
7
|
-
- completed
|
|
8
|
-
jobs:
|
|
9
|
-
release:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v2
|
|
14
|
-
- uses: actions/setup-node@v2
|
|
15
|
-
with:
|
|
16
|
-
node-version: '16'
|
|
17
|
-
|
|
18
|
-
# - uses: hmarr/debug-action@v2 # TURN on ENV DEBUG
|
|
19
|
-
|
|
20
|
-
- name: Cache node modules
|
|
21
|
-
uses: actions/cache@v2
|
|
22
|
-
id: cache-node-modules
|
|
23
|
-
env:
|
|
24
|
-
cache-name: cache-node-modules
|
|
25
|
-
with:
|
|
26
|
-
path: ~/.npm
|
|
27
|
-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
28
|
-
restore-keys: |
|
|
29
|
-
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
30
|
-
${{ runner.os }}-build-
|
|
31
|
-
${{ runner.os }}-
|
|
32
|
-
|
|
33
|
-
- name: Install semantic-release dependencies
|
|
34
|
-
if: steps.cache.outputs.cache-hit != 'true'
|
|
35
|
-
run: npm ci
|
|
36
|
-
|
|
37
|
-
# SEE MORE: https://github.com/semantic-release/semantic-release/issues/753
|
|
38
|
-
- name: Run SemVer
|
|
39
|
-
run: npm run release
|
|
40
|
-
env:
|
|
41
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
42
|
-
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
|
|
43
|
-
|
|
44
|
-
# - name: Slack notify new version created
|
|
45
|
-
# if: success()
|
|
46
|
-
# uses: rtCamp/action-slack-notify@v2
|
|
47
|
-
# env:
|
|
48
|
-
# SLACK_CHANNEL: klueless-repos
|
|
49
|
-
# SLACK_COLOR: '#00ff00'
|
|
50
|
-
# SLACK_ICON: https://avatars.githubusercontent.com/u/2956762?s=64&v=4
|
|
51
|
-
# SLACK_TITLE: 'New version released on ${{github.repository}}'
|
|
52
|
-
# SLACK_MESSAGE: 'git pull'
|
|
53
|
-
# SLACK_USERNAME: klueless-io
|
|
54
|
-
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|