k_builder 0.0.68 → 0.0.73
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/a.txt +0 -0
- data/hooks/pre-commit +2 -2
- data/hooks/update-version +1 -1
- data/k_builder.gemspec +2 -2
- data/lib/k_builder/base_builder.rb +93 -17
- data/lib/k_builder/configuration_extension.rb +44 -0
- data/lib/k_builder/version.rb +1 -1
- data/lib/k_builder.rb +3 -2
- metadata +19 -9
- data/lib/k_builder/assets/a.html +0 -235
- data/lib/k_builder/assets/b.html +0 -109
- data/lib/k_builder/assets/highlight.min.js +0 -1120
- data/lib/k_builder/assets/highlight_css +0 -1
- data/lib/k_builder/assets/ruby.min.js +0 -7
- data/lib/k_builder/base_configuration.rb +0 -64
- data/lib/k_builder/configuration.rb +0 -72
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71d70294c1dc49e1fc67dd77f71414019a3814f44057831273bc79d815146f05
|
4
|
+
data.tar.gz: 5d18531c4d7f4ddb2c1cafb8297bf7d2e0c3f708526464d2d700ea7750eb048f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f5059460b2ab02d3708de1019a7ca2a9b4974c13e7f6da9b0c1d0aa720cdbdaabd29e3d9cb1451ce3b3db11211bd3fc9fd76edf4d284f12e48d0287ee328289
|
7
|
+
data.tar.gz: b02df37b1b11213b71e364d2c881de6df3e09ce355ada72807d30d6a37cca4a3fa263c8539e05cd582a64e3456c10b0ef74fed0a64de711c20bcf4c217fe546d
|
data/a.txt
ADDED
File without changes
|
data/hooks/pre-commit
CHANGED
@@ -8,8 +8,8 @@ require 'English'
|
|
8
8
|
|
9
9
|
exit 0 if ARGV.include?('--no-verify')
|
10
10
|
|
11
|
-
warning_keywords = %w[
|
12
|
-
keywords = %w[binding.pry console.dir byebug
|
11
|
+
warning_keywords = %w[]
|
12
|
+
keywords = %w[binding.pry console.dir byebug]
|
13
13
|
files_changed = `git diff-index --name-only HEAD --`.split
|
14
14
|
|
15
15
|
# puts '----------------------------------------------------------------------'
|
data/hooks/update-version
CHANGED
data/k_builder.gemspec
CHANGED
@@ -38,11 +38,11 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.require_paths = ['lib']
|
39
39
|
# spec.extensions = ['ext/k_builder/extconf.rb']
|
40
40
|
spec.add_dependency 'handlebars-helpers', '~> 0'
|
41
|
+
spec.add_dependency 'k_config', '~> 0'
|
41
42
|
spec.add_dependency 'k_log', '~> 0'
|
42
43
|
spec.add_dependency 'k_type', '~> 0'
|
43
44
|
spec.add_dependency 'k_util', '~> 0'
|
44
45
|
spec.add_dependency 'rubocop', '~> 1.8'
|
45
46
|
|
46
|
-
|
47
|
-
# spec.add_dependency "config" , ">= 3.0.0"
|
47
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
48
48
|
end
|
@@ -54,7 +54,7 @@ module KBuilder
|
|
54
54
|
|
55
55
|
# assigns a builder hash and defines builder methods
|
56
56
|
def initialize(configuration = nil)
|
57
|
-
configuration =
|
57
|
+
configuration = KConfig.configuration if configuration.nil?
|
58
58
|
|
59
59
|
@configuration = configuration
|
60
60
|
|
@@ -121,15 +121,16 @@ module KBuilder
|
|
121
121
|
# Extra options will be used as data for templates, e.g
|
122
122
|
# @option opts [String] :to Recipient email
|
123
123
|
# @option opts [String] :body The email's body
|
124
|
-
def
|
124
|
+
def add_file_action(file, **opts)
|
125
125
|
{
|
126
126
|
action: :add_file,
|
127
|
+
played: false,
|
127
128
|
file: file,
|
128
129
|
opts: opts
|
129
130
|
}
|
130
131
|
end
|
131
132
|
|
132
|
-
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
133
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
133
134
|
def add_file(file, **opts)
|
134
135
|
# move to command
|
135
136
|
full_file = target_file(file, **opts) # opts.key?(:folder_key) || opts.key?(:folder) ? target_file(file, folder: opts[:folder], folder_key: opts[:folder_key]) : target_file(file)
|
@@ -145,6 +146,8 @@ module KBuilder
|
|
145
146
|
run_prettier file if opts.key?(:pretty)
|
146
147
|
# TODO: Add test
|
147
148
|
run_cop(full_file, fix_safe: true) if opts.key?(:cop) || opts.key?(:ruby_cop)
|
149
|
+
# TODO: Add test
|
150
|
+
run_command(file) if opts.key?(:run)
|
148
151
|
|
149
152
|
# Need support for rubocop -a
|
150
153
|
open_file(last_output_file) if opts.key?(:open)
|
@@ -154,26 +157,49 @@ module KBuilder
|
|
154
157
|
|
155
158
|
self
|
156
159
|
end
|
157
|
-
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
160
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
158
161
|
|
159
|
-
def
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
162
|
+
def play_actions(actions)
|
163
|
+
actions.reject { |action| action[:played] }.each do |action|
|
164
|
+
play_action(action)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def play_action(action)
|
169
|
+
run_action(action)
|
170
|
+
action[:played] = true
|
171
|
+
end
|
172
|
+
|
173
|
+
# certain actions (e.g. set_current_folder) will run independently to play
|
174
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
175
|
+
def run_action(action)
|
176
|
+
case action[:action]
|
177
|
+
when :add_file
|
178
|
+
add_file(action[:file], action[:opts])
|
179
|
+
when :delete_file
|
180
|
+
delete_file(action[:file], action[:opts])
|
181
|
+
when :vscode
|
182
|
+
vscode(action[:file_parts], action[:opts])
|
183
|
+
when :browse
|
184
|
+
browse(action[:file_parts], action[:opts])
|
185
|
+
when :set_current_folder
|
186
|
+
set_current_folder(action[:folder_key])
|
187
|
+
when :run_command
|
188
|
+
run_command(action[:command])
|
189
|
+
when :run_script
|
190
|
+
run_script(action[:script])
|
191
|
+
else
|
192
|
+
log.error "Unknown action: #{action[:action]}"
|
169
193
|
end
|
170
194
|
end
|
195
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
171
196
|
|
172
197
|
alias touch add_file # it is expected that you would not supply any options, just a file name
|
173
198
|
|
174
|
-
def
|
199
|
+
def delete_file_action(file, **opts)
|
175
200
|
{
|
176
201
|
action: :delete_file,
|
202
|
+
played: false,
|
177
203
|
file: file,
|
178
204
|
opts: opts
|
179
205
|
}
|
@@ -241,9 +267,10 @@ module KBuilder
|
|
241
267
|
end
|
242
268
|
alias clipboard_copy add_clipboard
|
243
269
|
|
244
|
-
def
|
270
|
+
def vscode_action(*file_parts, folder_key: current_folder_key, file: nil)
|
245
271
|
{
|
246
272
|
action: :vscode,
|
273
|
+
played: false,
|
247
274
|
file_parts: file_parts,
|
248
275
|
opts: { folder_key: folder_key, file: file }
|
249
276
|
}
|
@@ -258,9 +285,10 @@ module KBuilder
|
|
258
285
|
self
|
259
286
|
end
|
260
287
|
|
261
|
-
def
|
288
|
+
def browse_action(*file_parts, folder_key: current_folder_key, file: nil)
|
262
289
|
{
|
263
290
|
action: :browse,
|
291
|
+
played: false,
|
264
292
|
file_parts: file_parts,
|
265
293
|
opts: { folder_key: folder_key, file: file }
|
266
294
|
}
|
@@ -330,6 +358,14 @@ module KBuilder
|
|
330
358
|
# Target folders and files
|
331
359
|
# ----------------------------------------------------------------------
|
332
360
|
|
361
|
+
def set_current_folder_action(folder_key)
|
362
|
+
{
|
363
|
+
action: :set_current_folder,
|
364
|
+
played: false,
|
365
|
+
folder_key: folder_key
|
366
|
+
}
|
367
|
+
end
|
368
|
+
|
333
369
|
def set_current_folder(folder_key)
|
334
370
|
target_folders.current = folder_key
|
335
371
|
|
@@ -503,9 +539,49 @@ module KBuilder
|
|
503
539
|
# need to support the fork process options as I was not able to run
|
504
540
|
# k_builder_watch -n because it hid all the following output
|
505
541
|
system(build_command)
|
542
|
+
|
543
|
+
# FROM k_dsl
|
544
|
+
# system "/usr/local/bin/zsh #{output_file}" if execution_context == :system
|
545
|
+
# fork { exec("/usr/local/bin/zsh #{output_file}") } if execution_context == :fork
|
506
546
|
end
|
507
547
|
alias rc run_command
|
508
548
|
|
549
|
+
def run_command_action(command)
|
550
|
+
{
|
551
|
+
action: :run_command,
|
552
|
+
played: false,
|
553
|
+
command: command
|
554
|
+
}
|
555
|
+
end
|
556
|
+
|
557
|
+
# NOT TESTED, and not working with opts, this code needs rewrite
|
558
|
+
def run_script(script)
|
559
|
+
# Deep path create if needed
|
560
|
+
tf = target_folder
|
561
|
+
|
562
|
+
mkdir_p(tf)
|
563
|
+
|
564
|
+
Dir.chdir(tf) do
|
565
|
+
output, status = Open3.capture2(script) # , **opts)
|
566
|
+
|
567
|
+
unless status.success?
|
568
|
+
log.error('Script failed')
|
569
|
+
puts script
|
570
|
+
return nil
|
571
|
+
end
|
572
|
+
|
573
|
+
return output
|
574
|
+
end
|
575
|
+
end
|
576
|
+
|
577
|
+
def run_script_action(script)
|
578
|
+
{
|
579
|
+
action: :run_script,
|
580
|
+
played: false,
|
581
|
+
script: script
|
582
|
+
}
|
583
|
+
end
|
584
|
+
|
509
585
|
def file_write(file, content, on_exist: :skip)
|
510
586
|
self.last_output_file = file # if file not found, we still want to record this as the last_output_file
|
511
587
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Attach configuration to the KBuilder module
|
4
|
+
module KBuilder
|
5
|
+
module ConfigurationExtension
|
6
|
+
# Target folders provide a set of named folders that can be written to
|
7
|
+
def target_folders=(value)
|
8
|
+
@target_folders = value
|
9
|
+
end
|
10
|
+
|
11
|
+
def target_folders
|
12
|
+
@target_folders ||= KType::NamedFolders.new
|
13
|
+
end
|
14
|
+
|
15
|
+
# Template folders provides layered folders that templates can exist within
|
16
|
+
def template_folders=(value)
|
17
|
+
@template_folders = value
|
18
|
+
end
|
19
|
+
|
20
|
+
def template_folders
|
21
|
+
@template_folders ||= KType::LayeredFolders.new
|
22
|
+
end
|
23
|
+
|
24
|
+
# Custom debug method for k_builder
|
25
|
+
#
|
26
|
+
# usage:
|
27
|
+
# config.debug(:k_builder_debug)
|
28
|
+
def k_builder_debug
|
29
|
+
target_folders.debug(title: 'target_folders')
|
30
|
+
|
31
|
+
template_folders.debug(title: 'template folders (search order)')
|
32
|
+
''
|
33
|
+
end
|
34
|
+
|
35
|
+
# Custom initialize_copy method for k_builder. This is called during clone
|
36
|
+
def k_builder_initialize_copy(orig)
|
37
|
+
@target_folders = orig.target_folders.clone
|
38
|
+
@template_folders = orig.template_folders.clone
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
puts 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
|
44
|
+
KConfig::Configuration.register(:k_builder, KBuilder::ConfigurationExtension)
|
data/lib/k_builder/version.rb
CHANGED
data/lib/k_builder.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'rubocop'
|
4
|
+
require 'open3'
|
4
5
|
|
6
|
+
require 'k_config'
|
5
7
|
require 'k_log'
|
6
8
|
require 'k_util'
|
7
9
|
require 'k_type'
|
8
10
|
require 'k_builder/version'
|
9
11
|
require 'k_builder/base_builder'
|
10
|
-
require 'k_builder/
|
11
|
-
require 'k_builder/configuration'
|
12
|
+
require 'k_builder/configuration_extension'
|
12
13
|
require 'k_builder/file_segments'
|
13
14
|
|
14
15
|
# should commands be in their own gem?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: k_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.73
|
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-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: handlebars-helpers
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: k_config
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: k_log
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,6 +117,7 @@ files:
|
|
103
117
|
- Sample.drawio
|
104
118
|
- Sample.xml
|
105
119
|
- USAGE.md
|
120
|
+
- a.txt
|
106
121
|
- bin/console
|
107
122
|
- bin/k
|
108
123
|
- bin/kgitsync
|
@@ -112,17 +127,11 @@ files:
|
|
112
127
|
- hooks/update-version
|
113
128
|
- k_builder.gemspec
|
114
129
|
- lib/k_builder.rb
|
115
|
-
- lib/k_builder/assets/a.html
|
116
|
-
- lib/k_builder/assets/b.html
|
117
|
-
- lib/k_builder/assets/highlight.min.js
|
118
|
-
- lib/k_builder/assets/highlight_css
|
119
|
-
- lib/k_builder/assets/ruby.min.js
|
120
130
|
- lib/k_builder/base_builder.rb
|
121
|
-
- lib/k_builder/base_configuration.rb
|
122
131
|
- lib/k_builder/commands/base_command.rb
|
123
132
|
- lib/k_builder/commands/code_syntax_highlighter_command.rb
|
124
133
|
- lib/k_builder/commands/rubo_cop_command.rb
|
125
|
-
- lib/k_builder/
|
134
|
+
- lib/k_builder/configuration_extension.rb
|
126
135
|
- lib/k_builder/file_segments.rb
|
127
136
|
- lib/k_builder/version.rb
|
128
137
|
- usage/_out1.png
|
@@ -139,6 +148,7 @@ metadata:
|
|
139
148
|
homepage_uri: http://appydave.com
|
140
149
|
source_code_uri: https://github.com/klueless-io/k_builder
|
141
150
|
changelog_uri: https://github.com/klueless-io/k_builder/commits/master
|
151
|
+
rubygems_mfa_required: 'true'
|
142
152
|
post_install_message:
|
143
153
|
rdoc_options: []
|
144
154
|
require_paths:
|
data/lib/k_builder/assets/a.html
DELETED
@@ -1,235 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8">
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7
|
-
<title>David</title>
|
8
|
-
<script src="highlight.min.js"></script>
|
9
|
-
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.0.1/styles/default.min.css"> -->
|
10
|
-
<script src="https://cdn.jsdelivr.net/npm/html2canvas@1.0.0-rc.5/dist/html2canvas.min.js"></script>
|
11
|
-
<script src="//cdn.jsdelivr.net/gh/TRSasasusu/highlightjs-highlight-lines.js@1.1.6/highlightjs-highlight-lines.min.js"></script>
|
12
|
-
<script src="//cdn.jsdelivr.net/npm/highlightjs-line-numbers.js@2.8.0/dist/highlightjs-line-numbers.min.js"></script>
|
13
|
-
|
14
|
-
<link rel="stylesheet" href="highlight_css/a11y-light.css">
|
15
|
-
|
16
|
-
<style>
|
17
|
-
pre > code {
|
18
|
-
font-family: "Sans Mono", "Consolas", "Courier", monospace;
|
19
|
-
}
|
20
|
-
|
21
|
-
|
22
|
-
/*
|
23
|
-
color: white; */
|
24
|
-
|
25
|
-
.animated-box {
|
26
|
-
font-family: 'Lato';
|
27
|
-
color: #ffffff;
|
28
|
-
padding: 30px;
|
29
|
-
text-align: center;
|
30
|
-
border-radius: 4px;
|
31
|
-
}
|
32
|
-
|
33
|
-
.animated-box {
|
34
|
-
position: relative;
|
35
|
-
}
|
36
|
-
|
37
|
-
.animated-box:after {
|
38
|
-
content: '';
|
39
|
-
position: absolute;
|
40
|
-
top: 0;
|
41
|
-
left: 0;
|
42
|
-
right: 0;
|
43
|
-
bottom: 0;
|
44
|
-
border-radius: 4px;
|
45
|
-
background: linear-gradient(120deg, #00F260, #0575E6, #00F260);
|
46
|
-
background-size: 300% 300%;
|
47
|
-
clip-path: polygon(0% 100%, 3px 100%, 3px 3px, calc(100% - 3px) 3px, calc(100% - 3px) calc(100% - 3px), 3px calc(100% - 3px), 3px 100%, 100% 100%, 100% 0%, 0% 0%);
|
48
|
-
}
|
49
|
-
|
50
|
-
.animated-box.in:after {
|
51
|
-
animation: frame-enter 1s forwards ease-in-out reverse, gradient-animation 4s ease-in-out infinite;
|
52
|
-
}
|
53
|
-
|
54
|
-
#box {
|
55
|
-
position: absolute;
|
56
|
-
top: 170px;
|
57
|
-
left: 70px;
|
58
|
-
width: 600px;
|
59
|
-
height: 465px;
|
60
|
-
display: flex;
|
61
|
-
align-items: center;
|
62
|
-
justify-content: center;
|
63
|
-
color: white;
|
64
|
-
font-family: 'Raleway';
|
65
|
-
font-size: 2.5rem;
|
66
|
-
/* background-color: rgba(255,255,225,0); */
|
67
|
-
}
|
68
|
-
|
69
|
-
.with-linear-gradient {
|
70
|
-
--borderWidth: 13px;
|
71
|
-
background: transparent;
|
72
|
-
position: relative;
|
73
|
-
border-radius: var(--borderWidth);
|
74
|
-
}
|
75
|
-
.with-linear-gradient:after {
|
76
|
-
content: '';
|
77
|
-
position: absolute;
|
78
|
-
top: calc(-1 * var(--borderWidth));
|
79
|
-
left: calc(-1 * var(--borderWidth));
|
80
|
-
height: calc(100% + var(--borderWidth) * 2);
|
81
|
-
width: calc(100% + var(--borderWidth) * 2);
|
82
|
-
border-radius: calc(2 * var(--borderWidth));
|
83
|
-
background: linear-gradient(60deg, #f79533, #f37055, #ef4e7b, #a166ab, #5073b8);
|
84
|
-
z-index: -1;
|
85
|
-
animation: animatedgradient 3s ease alternate infinite;
|
86
|
-
background-size: 300% 300%;
|
87
|
-
}
|
88
|
-
.animated-box {
|
89
|
-
position: relative;
|
90
|
-
}
|
91
|
-
|
92
|
-
.animated-box:after {
|
93
|
-
content: '';
|
94
|
-
position: absolute;
|
95
|
-
top: 0;
|
96
|
-
left: 0;
|
97
|
-
right: 0;
|
98
|
-
bottom: 0;
|
99
|
-
border-radius: 4px;
|
100
|
-
background: linear-gradient(120deg, #00F260, #0575E6, #00F260);
|
101
|
-
background-size: 300% 300%;
|
102
|
-
clip-path: polygon(0% 100%, 3px 100%, 3px 3px, calc(100% - 3px) 3px, calc(100% - 3px) calc(100% - 3px), 3px calc(100% - 3px), 3px 100%, 100% 100%, 100% 0%, 0% 0%);
|
103
|
-
}
|
104
|
-
|
105
|
-
.animated-box.in:after {
|
106
|
-
animation: frame-enter 1s forwards ease-in-out reverse, gradient-animation 4s ease-in-out infinite;
|
107
|
-
}
|
108
|
-
|
109
|
-
|
110
|
-
@keyframes animatedgradient {
|
111
|
-
0% {
|
112
|
-
background-position: 0% 50%;
|
113
|
-
}
|
114
|
-
50% {
|
115
|
-
background-position: 100% 50%;
|
116
|
-
}
|
117
|
-
100% {
|
118
|
-
background-position: 0% 50%;
|
119
|
-
}
|
120
|
-
}
|
121
|
-
|
122
|
-
*/
|
123
|
-
/* for block of numbers */
|
124
|
-
.hljs-ln-numbers {
|
125
|
-
-webkit-touch-callout: none;
|
126
|
-
-webkit-user-select: none;
|
127
|
-
-khtml-user-select: none;
|
128
|
-
-moz-user-select: none;
|
129
|
-
-ms-user-select: none;
|
130
|
-
user-select: none;
|
131
|
-
|
132
|
-
text-align: center;
|
133
|
-
color: #ccc;
|
134
|
-
border-right: 1px solid #CCC;
|
135
|
-
vertical-align: top;
|
136
|
-
padding-right: 5px;
|
137
|
-
|
138
|
-
/* your custom style here */
|
139
|
-
}
|
140
|
-
|
141
|
-
/* for block of code */
|
142
|
-
.hljs-ln-code {
|
143
|
-
padding-left: 100px;
|
144
|
-
}
|
145
|
-
|
146
|
-
.borderexample {
|
147
|
-
border-style:solid;
|
148
|
-
border-color:#287EC7;
|
149
|
-
}
|
150
|
-
</style>
|
151
|
-
</head>
|
152
|
-
<body>
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
<div id="myBlock">
|
157
|
-
<pre><code class="ruby">
|
158
|
-
# frozen_string_literal: true
|
159
|
-
|
160
|
-
module KBuilder
|
161
|
-
module Commands
|
162
|
-
# Base command for single responsibility actions that can be fired
|
163
|
-
# from methods in the builder.
|
164
|
-
#
|
165
|
-
# Uses the command pattern
|
166
|
-
class BaseCommand
|
167
|
-
include KLog::Logging
|
168
|
-
|
169
|
-
attr_accessor :builder
|
170
|
-
attr_accessor :valid
|
171
|
-
|
172
|
-
def initialize(**opts)
|
173
|
-
@builder = opts[:builder]
|
174
|
-
@valid = true
|
175
|
-
end
|
176
|
-
|
177
|
-
def guard(message)
|
178
|
-
# THIS SHOULD ONLY LOG IF DEBUGGING IS TURNED ON
|
179
|
-
log.error(message)
|
180
|
-
@valid = false
|
181
|
-
end
|
182
|
-
|
183
|
-
def valid?
|
184
|
-
@valid
|
185
|
-
end
|
186
|
-
|
187
|
-
def debug(title: nil)
|
188
|
-
log.section_heading(title) if title
|
189
|
-
debug_values if respond_to?(:debug_values)
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
</code></pre>
|
195
|
-
are go
|
196
|
-
<a id='x' href="" download="name.jpg"></a>
|
197
|
-
|
198
|
-
<div id='box' class='animated-box in' xclass="with-linear-gradient">
|
199
|
-
|
200
|
-
</div>
|
201
|
-
</body>
|
202
|
-
<script>hljs.highlightAll();</script>
|
203
|
-
|
204
|
-
<button onclick="takeshot()">
|
205
|
-
Take Screenshot
|
206
|
-
</button>
|
207
|
-
|
208
|
-
<div id="output"></div>
|
209
|
-
|
210
|
-
<script>
|
211
|
-
|
212
|
-
const screenshotTarget = document.getElementById('myBlock');
|
213
|
-
|
214
|
-
let div = document.getElementById('myBlock');
|
215
|
-
|
216
|
-
setTimeout(function(){
|
217
|
-
|
218
|
-
html2canvas(div).then(
|
219
|
-
function (canvas) {
|
220
|
-
document
|
221
|
-
.getElementById('output')
|
222
|
-
.appendChild(canvas);
|
223
|
-
});
|
224
|
-
|
225
|
-
}, 1000);
|
226
|
-
|
227
|
-
hljs.initHighlightingOnLoad();
|
228
|
-
hljs.initLineNumbersOnLoad();
|
229
|
-
hljs.initHighlightLinesOnLoad([
|
230
|
-
[{start: 1, end: 3, color: '#555'}, {start: 6, end: 6, color: 'yellow'},], // Highlight some lines in the first code block.
|
231
|
-
[{start: 2, end: 3, color: 'rgba(255, 255, 255, 0.2)'},], // Highlight some lines in the second code block.
|
232
|
-
]);
|
233
|
-
|
234
|
-
</script>
|
235
|
-
</html>
|