k_director 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/CHANGELOG.md +12 -0
- data/lib/k_director/dsls/nuxt3_dsl.rb +288 -0
- data/lib/k_director/version.rb +1 -1
- data/lib/k_director.rb +1 -0
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +2 -2
- data/.builders/dsl/github_dsl.rb +0 -129
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5939eff40d316d1567818484e3d6bed5ebea38b6252e6f8413773fb3b6237483
|
4
|
+
data.tar.gz: f1ac410aab5054420f5d1ed8231167b9a7c3f5fbb7f3c6e921f1e3a585e3bcc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d22685499a5845dfe933e4d8f9bc2c6d8c4905c18f8e66cdae2c20a5c4fa9d57138c234dde2fe5a41d3ece4a874e1f0d18fe47159e17a623dcab8a7b435c18fe
|
7
|
+
data.tar.gz: 7eb329e8211d8fe6ea1eafdc4c52ee4da1b0fdfde538744625c2327379dd04c28bb346ec5fa3cb234f9efd314e1f53f209f64d522596e65de16e048f84a352b5
|
data/docs/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# [0.7.0](https://github.com/klueless-io/k_director/compare/v0.6.2...v0.7.0) (2022-02-03)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* apply cops ([3ed749b](https://github.com/klueless-io/k_director/commit/3ed749b504264f93dfcfbc7c57fb10e91c1aca36))
|
7
|
+
|
8
|
+
|
9
|
+
### Features
|
10
|
+
|
11
|
+
* add github dsll support and scenario tests ([ce9b0c8](https://github.com/klueless-io/k_director/commit/ce9b0c8ad6df9dc1154074e9e23c5310919bd112))
|
12
|
+
|
1
13
|
## [0.6.2](https://github.com/klueless-io/k_director/compare/v0.6.1...v0.6.2) (2022-02-01)
|
2
14
|
|
3
15
|
|
@@ -0,0 +1,288 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KDirector
|
4
|
+
module Dsls
|
5
|
+
# Nuxt3Dsl is a DSL for generating Nuxt3.x projects.
|
6
|
+
class Nuxt3Dsl < KDirector::Directors::BaseDirector
|
7
|
+
def default_template_base_folder
|
8
|
+
'nuxt3'
|
9
|
+
end
|
10
|
+
|
11
|
+
def github(**opts, &block)
|
12
|
+
github = Dsl::Github.new(self, **opts)
|
13
|
+
github.instance_eval(&block)
|
14
|
+
|
15
|
+
self
|
16
|
+
end
|
17
|
+
|
18
|
+
def blueprint(**opts, &block)
|
19
|
+
blueprint = Dsl::RubyGemBlueprint.new(self, **opts)
|
20
|
+
blueprint.instance_eval(&block)
|
21
|
+
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
25
|
+
# def blueprint(**opts, &block)
|
26
|
+
# blueprint = Dsl::Blueprint.new(self, **opts)
|
27
|
+
# blueprint.instance_eval(&block)
|
28
|
+
|
29
|
+
# self
|
30
|
+
# end
|
31
|
+
|
32
|
+
# def app(**opts, &block)
|
33
|
+
# app = Dsl::Nuxt3App.new(self, **opts)
|
34
|
+
# app.instance_eval(&block)
|
35
|
+
|
36
|
+
# self
|
37
|
+
# end
|
38
|
+
|
39
|
+
# def layouts(**opts, &block)
|
40
|
+
# layouts = Dsl::Nuxt3Layout.new(self, **opts)
|
41
|
+
# layouts.instance_eval(&block)
|
42
|
+
|
43
|
+
# self
|
44
|
+
# end
|
45
|
+
|
46
|
+
# def pages(**opts, &block)
|
47
|
+
# pages = Dsl::Nuxt3Page.new(self, **opts)
|
48
|
+
# pages.instance_eval(&block)
|
49
|
+
|
50
|
+
# self
|
51
|
+
# end
|
52
|
+
|
53
|
+
# def components(**opts, &block)
|
54
|
+
# components = Dsl::Nuxt3Component.new(self, **opts)
|
55
|
+
# components.instance_eval(&block)
|
56
|
+
|
57
|
+
# self
|
58
|
+
# end
|
59
|
+
|
60
|
+
# def stories(**opts, &block)
|
61
|
+
# stories = Dsl::Nuxt3Story.new(self, **opts)
|
62
|
+
# stories.instance_eval(&block)
|
63
|
+
|
64
|
+
# self
|
65
|
+
# end
|
66
|
+
|
67
|
+
# def apis(**opts, &block)
|
68
|
+
# apis = Dsl::Nuxt3Api.new(self, **opts)
|
69
|
+
# apis.instance_eval(&block)
|
70
|
+
|
71
|
+
# self
|
72
|
+
# end
|
73
|
+
end
|
74
|
+
|
75
|
+
# class Nuxt3App < KDirector::Directors::ChildDirector
|
76
|
+
|
77
|
+
# def setup_tailwind
|
78
|
+
# run_command('yarn add -D tailwindcss@latest')
|
79
|
+
# run_command('yarn add -D postcss@^8.3.11') # @latest
|
80
|
+
# run_command('yarn add -D autoprefixer@latest')
|
81
|
+
# run_command('npx tailwindcss init -p')
|
82
|
+
# end
|
83
|
+
|
84
|
+
# def setup_storybook
|
85
|
+
# run_command('yarn add -D @storybook/vue3')
|
86
|
+
# run_command('yarn add -D @storybook/addon-docs')
|
87
|
+
# run_command('yarn add -D @storybook/addon-essentials')
|
88
|
+
# run_command('yarn add -D @storybook/addon-storysource')
|
89
|
+
# run_command('yarn add -D @storybook/addon-postcss')
|
90
|
+
# run_command('yarn add -D storybook-builder-vite')
|
91
|
+
# end
|
92
|
+
# # >> "postcss": "^8.4.5", // Post CSS 8.4.5 does not work with storybook
|
93
|
+
# end
|
94
|
+
|
95
|
+
# class Nuxt3Layout < KDirector::Directors::ChildDirector
|
96
|
+
# # @param [Hash] **opts The options
|
97
|
+
# # @option opts [String] :variant Template variant name
|
98
|
+
# # @option opts [String] :template_subfolder Template subfolder
|
99
|
+
# def layout(name, **opts)
|
100
|
+
# variant = opts[:variant] || name
|
101
|
+
# template_filename = "#{dasherize.parse(variant.to_s)}.vue"
|
102
|
+
# template_file = resolve_template_file("nuxt3/layouts", template_filename, **opts)
|
103
|
+
# output_filename = "#{dasherize.parse(name.to_s)}.vue"
|
104
|
+
# output_file = File.join('layouts', output_filename)
|
105
|
+
|
106
|
+
# opts = {
|
107
|
+
# template_file: template_file
|
108
|
+
# }.merge(opts)
|
109
|
+
|
110
|
+
# add_file(output_file, **opts)
|
111
|
+
# end
|
112
|
+
|
113
|
+
# def olayout(name, **opts); layout(name, **{ open: true }.merge(opts)); end
|
114
|
+
# def tlayout(name, **opts); layout(name, **{ open_template: true }.merge(opts)); end
|
115
|
+
# def flayout(name, **opts); layout(name, **{ on_exist: :write }.merge(opts)); end
|
116
|
+
|
117
|
+
# def sample_layout(name, **opts)
|
118
|
+
# layout(name, template_subfolder: 'samples', **opts)
|
119
|
+
# end
|
120
|
+
|
121
|
+
# def osample_layout(name, **opts); sample_layout(name, **{ open: true }.merge(opts)); end
|
122
|
+
# def tsample_layout(name, **opts); sample_layout(name, **{ open_template: true }.merge(opts)); end
|
123
|
+
# def fsample_layout(name, **opts); sample_layout(name, **{ on_exist: :write }.merge(opts)); end
|
124
|
+
|
125
|
+
# end
|
126
|
+
|
127
|
+
# class Nuxt3Page < KDirector::Directors::ChildDirector
|
128
|
+
# # @param [Hash] **opts The options
|
129
|
+
# # @option opts [String] :subfolder Output subfolder
|
130
|
+
# # @option opts [String] :variant Template variant name
|
131
|
+
# # @option opts [String] :template_subfolder Template subfolder
|
132
|
+
# def page(name, **opts)
|
133
|
+
# variant = opts[:variant] || name
|
134
|
+
# template_filename = "#{dasherize.parse(variant.to_s)}.vue"
|
135
|
+
# template_file = resolve_template_file("nuxt3/pages", template_filename, **opts)
|
136
|
+
# output_filename = "#{dasherize.parse(name.to_s)}.vue"
|
137
|
+
# parts = ['pages', opts[:subfolder], output_filename].reject(&:blank?).map(&:to_s)
|
138
|
+
# output_file = File.join(*parts)
|
139
|
+
|
140
|
+
# opts = {
|
141
|
+
# template_file: template_file,
|
142
|
+
# dom: {
|
143
|
+
# page_name: opts[:page_name] || name,
|
144
|
+
# main_key: opts[:main_key] || :sample
|
145
|
+
# }
|
146
|
+
# }.merge(opts)
|
147
|
+
|
148
|
+
# add_file(output_file, **opts)
|
149
|
+
# end
|
150
|
+
# def opage(name, **opts); page(name, **{ open: true }.merge(opts)); end
|
151
|
+
# def tpage(name, **opts); page(name, **{ open_template: true }.merge(opts)); end
|
152
|
+
# def fpage(name, **opts); page(name, **{ on_exist: :write }.merge(opts)); end
|
153
|
+
|
154
|
+
# def sample_page(name, **opts)
|
155
|
+
# page(name, template_subfolder: 'samples', **opts)
|
156
|
+
# end
|
157
|
+
|
158
|
+
# def osample_page(name, **opts); sample_page(name, **{ open: true }.merge(opts)); end
|
159
|
+
# def tsample_page(name, **opts); sample_page(name, **{ open_template: true }.merge(opts)); end
|
160
|
+
# def fsample_page(name, **opts); sample_page(name, **{ on_exist: :write }.merge(opts)); end
|
161
|
+
|
162
|
+
# def tw_page(name, element, element_name, **opts)
|
163
|
+
# options = {
|
164
|
+
# subfolder: "tailwind/#{element}",
|
165
|
+
# variant: 'one-component',
|
166
|
+
# dom: {
|
167
|
+
# page_name: "#{opts[:page_name] || name}",
|
168
|
+
# vue_component: "<#{camel.parse(element.to_s)}#{camel.parse(element_name.to_s)} />"
|
169
|
+
# }
|
170
|
+
# }.merge(opts)
|
171
|
+
|
172
|
+
# page(name, **options)
|
173
|
+
# end
|
174
|
+
# end
|
175
|
+
|
176
|
+
# class Nuxt3Component < KDirector::Directors::ChildDirector
|
177
|
+
# # @param [Hash] **opts The options
|
178
|
+
# # @option opts [String] :variant Template variant name
|
179
|
+
# # @option opts [String] :template_subfolder Template subfolder
|
180
|
+
# def component(name, **opts)
|
181
|
+
# variant = opts[:variant] || name
|
182
|
+
# template_filename = "#{camel.parse(variant.to_s)}.vue"
|
183
|
+
# template_file = resolve_template_file("nuxt3/components", template_filename, **opts)
|
184
|
+
# output_filename = "#{camel.parse(name.to_s)}.vue"
|
185
|
+
# parts = ['components', opts[:subfolder], output_filename].reject(&:blank?).map(&:to_s)
|
186
|
+
# output_file = File.join(*parts)
|
187
|
+
|
188
|
+
# opts = {
|
189
|
+
# template_file: template_file,
|
190
|
+
# dom: {
|
191
|
+
# component_name: opts[:component_name] || name
|
192
|
+
# }
|
193
|
+
# }.merge(opts)
|
194
|
+
|
195
|
+
# add_file(output_file, **opts)
|
196
|
+
# end
|
197
|
+
# def ocomponent(name, **opts); component(name, **{ open: true }.merge(opts)); end
|
198
|
+
# def tcomponent(name, **opts); component(name, **{ open_template: true }.merge(opts)); end
|
199
|
+
# def fcomponent(name, **opts); component(name, **{ on_exist: :write }.merge(opts)); end
|
200
|
+
|
201
|
+
# def sample_component(name, **opts)
|
202
|
+
# component(name, template_subfolder: 'samples', **opts)
|
203
|
+
# end
|
204
|
+
|
205
|
+
# def osample_component(name, **opts); sample_component(name, **{ open: true }.merge(opts)); end
|
206
|
+
# def tsample_component(name, **opts); sample_component(name, **{ open_template: true }.merge(opts)); end
|
207
|
+
# def fsample_component(name, **opts); sample_component(name, **{ on_exist: :write }.merge(opts)); end
|
208
|
+
|
209
|
+
# def tw_component(name, element, element_name, **opts)
|
210
|
+
# tw_element_file = k_builder.target_file(element.to_s, "#{element_name}.html", folder_key: :tailwind_elements)
|
211
|
+
# tw_element = File.exist?(tw_element_file) ? File.read(tw_element_file) : "element not found: #{tw_element_file}"
|
212
|
+
|
213
|
+
# options = {
|
214
|
+
# subfolder: element,
|
215
|
+
# variant: :tw_html_component,
|
216
|
+
# dom: {
|
217
|
+
# component_name: "#{opts[:component_name] || name}",
|
218
|
+
# tailwind_element: tw_element
|
219
|
+
# }
|
220
|
+
# }.merge(opts)
|
221
|
+
|
222
|
+
# component(name, **options)
|
223
|
+
# end
|
224
|
+
# end
|
225
|
+
|
226
|
+
# class Nuxt3Story < KDirector::Directors::ChildDirector
|
227
|
+
# # @param [Hash] **opts The options
|
228
|
+
# # @option opts [String] :variant Template variant name
|
229
|
+
# # @option opts [String] :template_subfolder Template subfolder
|
230
|
+
# def component_story(name, **opts)
|
231
|
+
# variant = opts[:variant] || name
|
232
|
+
# template_filename = "#{variant.to_s}.stories.js"
|
233
|
+
# template_file = resolve_template_file("nuxt3/stories", template_filename, **opts)
|
234
|
+
# output_filename = "#{camel.parse(name.to_s)}.stories.js"
|
235
|
+
# output_file = File.join('stories', output_filename)
|
236
|
+
|
237
|
+
# opts = {
|
238
|
+
# template_file: template_file,
|
239
|
+
# }.merge(opts)
|
240
|
+
|
241
|
+
# add_file(output_file, **opts)
|
242
|
+
# end
|
243
|
+
|
244
|
+
# def ocomponent_story(name, **opts); component_story(name, **{ open: true }.merge(opts)); end
|
245
|
+
# def tcomponent_story(name, **opts); component_story(name, **{ open_template: true }.merge(opts)); end
|
246
|
+
# def fcomponent_story(name, **opts); component_story(name, **{ on_exist: :write }.merge(opts)); end
|
247
|
+
|
248
|
+
# def sample_component_story(name, **opts)
|
249
|
+
# component_story(name, template_subfolder: 'samples', **opts)
|
250
|
+
# end
|
251
|
+
|
252
|
+
# def osample_component_story(name, **opts); component_story(name, **{ open: true }.merge(opts)); end
|
253
|
+
# def tsample_component_story(name, **opts); component_story(name, **{ open_template: true }.merge(opts)); end
|
254
|
+
# def fsample_component_story(name, **opts); component_story(name, **{ on_exist: :write }.merge(opts)); end
|
255
|
+
# end
|
256
|
+
|
257
|
+
# class Nuxt3Api < KDirector::Directors::ChildDirector
|
258
|
+
# # @param [Hash] **opts The options
|
259
|
+
# # @option opts [String] :variant Template variant name
|
260
|
+
# # @option opts [String] :template_subfolder Template subfolder
|
261
|
+
# def api(name, **opts)
|
262
|
+
# variant = opts[:variant] || name
|
263
|
+
# template_filename = "#{dasherize.parse(variant.to_s)}.ts"
|
264
|
+
# template_file = resolve_template_file("nuxt3/server/api", template_filename, **opts)
|
265
|
+
# output_filename = "#{dasherize.parse(name.to_s)}.ts"
|
266
|
+
# output_file = File.join('server/api', output_filename)
|
267
|
+
|
268
|
+
# opts = {
|
269
|
+
# template_file: template_file,
|
270
|
+
# }.merge(opts)
|
271
|
+
|
272
|
+
# add_file(output_file, **opts)
|
273
|
+
# end
|
274
|
+
|
275
|
+
# def oapi(name, **opts); api(name, **{ open: true }.merge(opts)); end
|
276
|
+
# def tapi(name, **opts); api(name, **{ open_template: true }.merge(opts)); end
|
277
|
+
# def fapi(name, **opts); api(name, **{ on_exist: :write }.merge(opts)); end
|
278
|
+
|
279
|
+
# def sample_api(name, **opts)
|
280
|
+
# api(name, template_subfolder: 'samples', **opts)
|
281
|
+
# end
|
282
|
+
|
283
|
+
# def osample_api(name, **opts); sample_api(name, **{ open: true }.merge(opts)); end
|
284
|
+
# def tsample_api(name, **opts); sample_api(name, **{ open_template: true }.merge(opts)); end
|
285
|
+
# def fsample_api(name, **opts); sample_api(name, **{ on_exist: :write }.merge(opts)); end
|
286
|
+
# end
|
287
|
+
end
|
288
|
+
end
|
data/lib/k_director/version.rb
CHANGED
data/lib/k_director.rb
CHANGED
@@ -12,6 +12,7 @@ require_relative 'k_director/directors/child_director'
|
|
12
12
|
require_relative 'k_director/directors/data'
|
13
13
|
require_relative 'k_director/dsls/children/blueprint'
|
14
14
|
require_relative 'k_director/dsls/children/github'
|
15
|
+
require_relative 'k_director/dsls/nuxt3_dsl'
|
15
16
|
|
16
17
|
module KDirector
|
17
18
|
# raise KDirector::Error, 'Sample message'
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "k_director",
|
3
|
-
"version": "0.7.
|
3
|
+
"version": "0.7.1",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "k_director",
|
9
|
-
"version": "0.7.
|
9
|
+
"version": "0.7.1",
|
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,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: k_director
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
@@ -76,7 +76,6 @@ extra_rdoc_files: []
|
|
76
76
|
files:
|
77
77
|
- ".builders/_.rb"
|
78
78
|
- ".builders/boot.rb"
|
79
|
-
- ".builders/dsl/github_dsl.rb"
|
80
79
|
- ".builders/dsl/ruby_gem_dsl.rb"
|
81
80
|
- ".builders/generators/01-bootstrap.rb"
|
82
81
|
- ".builders/run.rb"
|
@@ -104,6 +103,7 @@ files:
|
|
104
103
|
- lib/k_director/directors/data.rb
|
105
104
|
- lib/k_director/dsls/children/blueprint.rb
|
106
105
|
- lib/k_director/dsls/children/github.rb
|
106
|
+
- lib/k_director/dsls/nuxt3_dsl.rb
|
107
107
|
- lib/k_director/version.rb
|
108
108
|
- package-lock.json
|
109
109
|
- package.json
|
data/.builders/dsl/github_dsl.rb
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Dsl
|
4
|
-
class Github < Dsl::Directors::ChildDirector
|
5
|
-
def initialize(parent, **opts)
|
6
|
-
super(parent, **opts)
|
7
|
-
|
8
|
-
@options.repo_name ||= parent.options.repo_name
|
9
|
-
@options.repo_organization ||= parent.options.repo_organization
|
10
|
-
end
|
11
|
-
|
12
|
-
def repo_name
|
13
|
-
@options.repo_name
|
14
|
-
end
|
15
|
-
|
16
|
-
def repo_organization
|
17
|
-
@options.repo_organization
|
18
|
-
end
|
19
|
-
|
20
|
-
def list_repositories
|
21
|
-
repos = api.all_repositories
|
22
|
-
|
23
|
-
KExt::Github::Printer::repositories_as_table repos
|
24
|
-
|
25
|
-
log.kv 'Repository count', repos.length
|
26
|
-
rescue StandardError => error
|
27
|
-
log.exception(error)
|
28
|
-
end
|
29
|
-
|
30
|
-
def open_repository(**opts)
|
31
|
-
info = repo_info(**opts)
|
32
|
-
|
33
|
-
system("open -a 'Google Chrome' #{info.link}")
|
34
|
-
end
|
35
|
-
|
36
|
-
def create_repository(**opts)
|
37
|
-
info = repo_info(**opts)
|
38
|
-
|
39
|
-
repo = api.all_repositories.find { |r| r.full_name == info.full_name }
|
40
|
-
|
41
|
-
if repo.nil?
|
42
|
-
log.heading 'Repository create'
|
43
|
-
log.kv 'Repository Name', info.name
|
44
|
-
log.kv 'Repository Full Name', info.full_name
|
45
|
-
log.kv 'Organization Name', info.organization if info.organization
|
46
|
-
success = api.create_repository(info.name, organization: info.organization)
|
47
|
-
log.info "Repository: #{info.full_name} created" if success
|
48
|
-
log.error "Repository: #{info.full_name} was not created" unless success
|
49
|
-
|
50
|
-
system("open -a 'Google Chrome' #{info.link}") if opts[:open]
|
51
|
-
else
|
52
|
-
log.warn 'Repository already exists, nothing to create'
|
53
|
-
end
|
54
|
-
|
55
|
-
log_repo_info(info)
|
56
|
-
rescue StandardError => error
|
57
|
-
log.exception(error)
|
58
|
-
end
|
59
|
-
|
60
|
-
def delete_repository(**opts)
|
61
|
-
info = repo_info(**opts)
|
62
|
-
|
63
|
-
repo = api.all_repositories.find { |r| r.full_name == info.full_name }
|
64
|
-
|
65
|
-
if repo.present?
|
66
|
-
log.heading 'Repository delete'
|
67
|
-
log.kv 'Repository Name', info.name
|
68
|
-
log.kv 'Repository Full Name', info.full_name
|
69
|
-
log.kv 'Organization Name', info.organization if info.organization
|
70
|
-
success = delete_api.delete_repository(info.full_name, organization: info.organization)
|
71
|
-
log.info "Repository: #{info.full_name} deleted" if success
|
72
|
-
log.error "Repository: #{info.full_name} was not deleted" unless success
|
73
|
-
# system("open -a 'Google Chrome' #{info.link}") if opts[:open]
|
74
|
-
else
|
75
|
-
log.warn 'Repository does not exist, nothing to delete'
|
76
|
-
end
|
77
|
-
|
78
|
-
log_repo_info(info)
|
79
|
-
rescue StandardError => error
|
80
|
-
log.exception(error)
|
81
|
-
end
|
82
|
-
|
83
|
-
def repo_info(**opts)
|
84
|
-
name = opts[:name] || self.repo_name
|
85
|
-
name = name.to_s
|
86
|
-
username = opts[:username] || self.username
|
87
|
-
organization = opts[:organization] || self.repo_organization
|
88
|
-
account = organization || username
|
89
|
-
full_name = [account, name].compact.join("/")
|
90
|
-
link = "https://github.com/#{full_name}"
|
91
|
-
ssh_link = "git@github.com:#{full_name}.git"
|
92
|
-
|
93
|
-
OpenStruct.new(
|
94
|
-
name: name,
|
95
|
-
full_name: full_name,
|
96
|
-
link: link,
|
97
|
-
ssh_link: ssh_link,
|
98
|
-
username: username,
|
99
|
-
organization: organization
|
100
|
-
)
|
101
|
-
end
|
102
|
-
|
103
|
-
private
|
104
|
-
|
105
|
-
|
106
|
-
def username
|
107
|
-
KExt::Github.configuration.user
|
108
|
-
end
|
109
|
-
|
110
|
-
def api
|
111
|
-
token = KExt::Github.configuration.personal_access_token
|
112
|
-
KExt::Github::Api.instance(token)
|
113
|
-
end
|
114
|
-
|
115
|
-
def delete_api
|
116
|
-
token = KExt::Github.configuration.personal_access_token_delete
|
117
|
-
KExt::Github::Api.instance(token)
|
118
|
-
end
|
119
|
-
|
120
|
-
def log_repo_info(info)
|
121
|
-
log.kv 'SSH', info.ssh_link
|
122
|
-
log.kv 'HTTPS', info.git_link
|
123
|
-
log.kv 'GITHUB', KUtil.console.hyperlink(info.link, info.link)
|
124
|
-
|
125
|
-
# log.json repo.to_h
|
126
|
-
end
|
127
|
-
|
128
|
-
end
|
129
|
-
end
|