j1-template 2022.0.15 → 2022.0.16
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/exe/j1 +31 -11
- data/lib/j1/commands/generate.rb +37 -36
- data/lib/j1/commands/help.rb +35 -0
- data/lib/j1/commands/patch.rb +81 -0
- data/lib/j1/commands/reset.rb +36 -0
- data/lib/j1/commands/setup.rb +126 -0
- data/lib/j1/commands/site.rb +27 -0
- data/lib/j1/external.rb +1 -1
- data/lib/j1/utils/exec_until_trap.rb +28 -0
- data/lib/j1/utils.rb +31 -0
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +1 -1
- data/lib/starter_web/_config.yml +1 -1
- data/lib/starter_web/_includes/attributes.asciidoc +1 -1
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/package.json +5 -1
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6747e12e42b4cbc106beb6bbef14dbc74b7e43c050d88371bcbd814d62bf76e0
|
4
|
+
data.tar.gz: e4d94adc0891fc86bc5f53f702534aeb74caeca9ebf1f51d101271317b244278
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2743934801254b32fcba41d44183c5f94580f5bcf5460cc816277359fdf81127c1b47e95600b2856e8152e9db0e3c862e9d0cecffa2a7db06b9350467a0db8cc
|
7
|
+
data.tar.gz: 752db1543f50ca13e4b1ce9477796b588bf1bb8447ba0e8fb47f0bf1ffba1daa4f39b40536ababd655d7cc4cf529fd615ebbb89931614bcabc4913c03d74fd2c
|
data/exe/j1
CHANGED
@@ -11,17 +11,37 @@ Mercenary.program(:j1) do |p|
|
|
11
11
|
p.description 'J1 Template is a gem-based Template made for Jekyll'
|
12
12
|
p.syntax 'j1 <subcommand> [options]'
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
# available options for all subcommands
|
15
|
+
#
|
16
|
+
# p.option 'force', '--force'
|
17
|
+
# p.option 'skip-bundle', '--skip-bundle'
|
18
|
+
# p.option 'skip-patches', '--skip-patches'
|
19
|
+
# p.option 'system', '--system'
|
20
|
+
|
21
|
+
# J1::External.require_if_present(J1::External.blessed_gems) do |g, ver_constraint|
|
22
|
+
# cmd = g.split("-").last
|
23
|
+
# p.command(cmd.to_sym) do |c|
|
24
|
+
# c.syntax cmd
|
25
|
+
# c.action do
|
26
|
+
# J1.logger.abort_with "You must install the '#{g}' gem" \
|
27
|
+
# " version #{ver_constraint} to use the 'jekyll #{cmd}' command."
|
28
|
+
# end
|
29
|
+
# end
|
30
|
+
# end
|
31
|
+
|
32
|
+
J1::Command.subclasses.each { |c| c.init_with_program(p) }
|
33
|
+
|
34
|
+
p.action do |args, _|
|
35
|
+
if args.empty?
|
36
|
+
J1.logger.error "A subcommand is required."
|
37
|
+
puts p
|
38
|
+
abort
|
39
|
+
else
|
40
|
+
subcommand = args.first
|
41
|
+
unless p.has_command? subcommand
|
42
|
+
J1.logger.abort_with "fatal: 'j1 #{args.first}' failed." \
|
43
|
+
" No subcommand '#{args.first}' available."
|
44
|
+
end
|
23
45
|
end
|
24
46
|
end
|
25
|
-
|
26
|
-
p.default_command(:generate)
|
27
47
|
end
|
data/lib/j1/commands/generate.rb
CHANGED
@@ -1,36 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'erb'
|
2
|
-
require 'rbconfig'
|
3
|
-
require 'fileutils'
|
4
4
|
|
5
5
|
module J1
|
6
6
|
module Commands
|
7
7
|
class Generate < Command
|
8
8
|
class << self
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
# end
|
23
|
-
|
24
|
-
def is_windows?
|
25
|
-
RbConfig::CONFIG["host_os"] =~ %r!mswin|mingw|cygwin!i
|
10
|
+
def init_with_program(prog)
|
11
|
+
prog.command(:generate) do |c|
|
12
|
+
c.description 'Generates a J1 project scaffold in PATH'
|
13
|
+
c.syntax 'generate PATH'
|
14
|
+
c.option 'force', '--force', 'Force a site to be created even the PATH already exists'
|
15
|
+
c.option 'skip-bundle', '--skip-bundle', 'Skip bundle install'
|
16
|
+
c.option 'skip-patches', '--skip-patches', 'Skip install any PATCHES build-in with J1'
|
17
|
+
c.option 'system', '--system', 'Run "bundle install" for the Ruby SYSTEM gem folder'
|
18
|
+
c.action do |args, options|
|
19
|
+
J1::Commands::Generate.process(args, options)
|
20
|
+
end
|
21
|
+
end
|
26
22
|
end
|
27
23
|
|
28
24
|
def process(args, options = {})
|
29
|
-
raise ArgumentError, 'You must specify a path.' if args.empty?
|
25
|
+
raise ArgumentError, 'GENERATE: You must specify a path.' if args.empty?
|
26
|
+
|
30
27
|
new_blog_path = File.expand_path(args.join(' '), Dir.pwd)
|
31
28
|
FileUtils.mkdir_p new_blog_path
|
32
29
|
if preserve_source_location?(new_blog_path, options)
|
33
|
-
J1.logger.abort_with 'Conflict:', "#{new_blog_path} exists and is not empty."
|
30
|
+
J1.logger.abort_with 'GENERATE: Conflict:', "#{new_blog_path} exists and is not empty."
|
34
31
|
end
|
35
32
|
|
36
33
|
if options['blank']
|
@@ -61,6 +58,10 @@ module J1
|
|
61
58
|
|
62
59
|
private
|
63
60
|
|
61
|
+
def is_windows?
|
62
|
+
RbConfig::CONFIG["host_os"] =~ %r!mswin|mingw|cygwin!i
|
63
|
+
end
|
64
|
+
|
64
65
|
def create_site(new_blog_path)
|
65
66
|
create_sample_files new_blog_path
|
66
67
|
|
@@ -92,33 +93,33 @@ module J1
|
|
92
93
|
def after_install(path, options = {})
|
93
94
|
unless options['skip-bundle']
|
94
95
|
bundle_install(path, options)
|
95
|
-
|
96
|
-
|
96
|
+
if options['skip-patches']
|
97
|
+
J1.logger.info "GENERATE: Install build-in patches skipped ..."
|
97
98
|
else
|
98
|
-
|
99
|
+
patch_install(options)
|
99
100
|
end
|
100
101
|
end
|
101
|
-
|
102
|
-
J1.logger.info "Generated Jekyll site installed in folder #{path}"
|
102
|
+
if options['force']
|
103
|
+
J1.logger.info "GENERATE: Generated Jekyll site force installed in folder #{path}"
|
103
104
|
else
|
104
|
-
J1.logger.info "Generated Jekyll site
|
105
|
+
J1.logger.info "GENERATE: Generated Jekyll site installed in folder #{path}"
|
105
106
|
end
|
106
|
-
J1.logger.info 'Installation (bundle) of RubyGems skipped' if options['skip-bundle']
|
107
|
+
J1.logger.info 'GENERATE: Installation (bundle) of RubyGems skipped' if options['skip-bundle']
|
107
108
|
end
|
108
109
|
|
109
110
|
def bundle_install(path, options)
|
110
111
|
J1::External.require_with_graceful_fail 'bundler'
|
111
|
-
J1.logger.info "Running bundle install in #{path} ..."
|
112
|
+
J1.logger.info "GENERATE: Running bundle install in #{path} ..."
|
112
113
|
Dir.chdir(path) do
|
113
114
|
if options['system']
|
114
|
-
J1.logger.info "Install bundle in Ruby gem SYSTEM folder ..."
|
115
|
+
J1.logger.info "GENERATE: Install bundle in Ruby gem SYSTEM folder ..."
|
115
116
|
else
|
116
|
-
J1.logger.info "Install bundle in USER gem folder ~/.gem ..."
|
117
|
+
J1.logger.info "GENERATE: Install bundle in USER gem folder ~/.gem ..."
|
117
118
|
process, output = J1::Utils::Exec.run('bundle', 'config', 'set', '--local', 'path', '~/.gem')
|
118
119
|
end
|
119
120
|
process, output = J1::Utils::Exec.run('bundle', 'install')
|
120
121
|
output.to_s.each_line do |line|
|
121
|
-
J1.logger.info('
|
122
|
+
J1.logger.info('BUNDLE:', line.strip) unless line.to_s.empty?
|
122
123
|
end
|
123
124
|
raise SystemExit unless process.success?
|
124
125
|
end
|
@@ -142,12 +143,12 @@ module J1
|
|
142
143
|
system_path = result[1]
|
143
144
|
|
144
145
|
if options['system']
|
145
|
-
J1.logger.info "Install patches in SYSTEM folder ..."
|
146
|
-
J1.logger.info "Install patches on path #{system_path} ..."
|
146
|
+
J1.logger.info "GENERATE: Install patches in SYSTEM folder ..."
|
147
|
+
J1.logger.info "GENERATE: Install patches on path #{system_path} ..."
|
147
148
|
dest = system_path + '/gems/' + patch_gem_eventmachine + '/lib'
|
148
149
|
else
|
149
|
-
J1.logger.info "Install patches in USER gem folder ~/.gem ..."
|
150
|
-
J1.logger.info "Install patches on path #{user_path} ..."
|
150
|
+
J1.logger.info "GENERATE: Install patches in USER gem folder ~/.gem ..."
|
151
|
+
J1.logger.info "GENERATE: Install patches on path #{user_path} ..."
|
151
152
|
dest = user_path + '/gems/' + patch_gem_eventmachine + '/lib'
|
152
153
|
end
|
153
154
|
src = patch_eventmachine_source_path
|
@@ -163,7 +164,7 @@ module J1
|
|
163
164
|
if Dir.exist?(dest)
|
164
165
|
FileUtils.cp(src, dest)
|
165
166
|
else
|
166
|
-
J1.logger.info "Skipped install patches for execjs-2.7.0 ..."
|
167
|
+
J1.logger.info "GENERATE: Skipped install patches for execjs-2.7.0 ..."
|
167
168
|
end
|
168
169
|
end
|
169
170
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module J1
|
4
|
+
module Commands
|
5
|
+
class Help < Command
|
6
|
+
class << self
|
7
|
+
|
8
|
+
def init_with_program(prog)
|
9
|
+
prog.command(:help) do |c|
|
10
|
+
c.syntax "help [subcommand]"
|
11
|
+
c.description "Show the help message, optionally for a given subcommand"
|
12
|
+
|
13
|
+
c.action do |args, _|
|
14
|
+
cmd = (args.first || "").to_sym
|
15
|
+
if args.empty?
|
16
|
+
J1.logger.info prog.to_s
|
17
|
+
elsif prog.has_command? cmd
|
18
|
+
J1.logger.info prog.commands[cmd].to_s
|
19
|
+
else
|
20
|
+
invalid_command(prog, cmd)
|
21
|
+
abort
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def invalid_command(prog, cmd)
|
28
|
+
J1.logger.error "Error:",
|
29
|
+
"Hmm... we don't know what the '#{cmd}' command is."
|
30
|
+
J1.logger.info "Valid commands:", prog.commands.keys.join(", ")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module J1
|
4
|
+
module Commands
|
5
|
+
class Patch < Command
|
6
|
+
#noinspection MissingYardParamTag
|
7
|
+
class << self
|
8
|
+
|
9
|
+
def init_with_program(prog)
|
10
|
+
prog.command(:patch) do |c|
|
11
|
+
c.description 'Install patches available for J1 projects'
|
12
|
+
c.syntax 'patch'
|
13
|
+
c.option 'force', '--force', 'Force to install patches even already exists'
|
14
|
+
c.option 'system', '--system', 'Install patches on the Ruby SYSTEM gem folder'
|
15
|
+
c.action do |args, options|
|
16
|
+
J1::Commands::Patch.process(args, options)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def process(args, options = {})
|
22
|
+
patch_install(options)
|
23
|
+
@args = args
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def is_windows?
|
29
|
+
#noinspection RubyResolve
|
30
|
+
RbConfig::CONFIG["host_os"] =~ %r!mswin|mingw|cygwin!i
|
31
|
+
end
|
32
|
+
|
33
|
+
def patch_install(options)
|
34
|
+
if is_windows?
|
35
|
+
major, minor = RUBY_VERSION.split('.')
|
36
|
+
lib_version = major + '.' + minor
|
37
|
+
curr_path = File.expand_path(File.dirname(File.dirname(__FILE__)))
|
38
|
+
patch_gem_eventmachine = 'eventmachine-1.2.7-x64-mingw32'
|
39
|
+
patch_gem_execjs = 'execjs-2.7.0'
|
40
|
+
patch_eventmachine_source_path = curr_path + '/patches/rubygems' + '/' + patch_gem_eventmachine + '/lib/' + lib_version
|
41
|
+
patch_execjs_source_path = curr_path + '/patches/rubygems' + '/' + patch_gem_execjs + '/lib/execjs/external_runtime.rb'
|
42
|
+
|
43
|
+
process, output = J1::Utils::Exec.run('gem', 'env', 'gempath')
|
44
|
+
raise SystemExit unless process.success?
|
45
|
+
|
46
|
+
result = output.split(';')
|
47
|
+
user_path = result[0]
|
48
|
+
system_path = result[1]
|
49
|
+
|
50
|
+
if options['system']
|
51
|
+
J1.logger.info "PATCH: Install patches in SYSTEM folder ..."
|
52
|
+
J1.logger.info "PATCH: Install patches on path #{system_path} ..."
|
53
|
+
dest = system_path + '/gems/' + patch_gem_eventmachine + '/lib'
|
54
|
+
else
|
55
|
+
J1.logger.info "PATCH: Install patches in USER gem folder ~/.gem ..."
|
56
|
+
J1.logger.info "PATCH: Install patches on path #{user_path} ..."
|
57
|
+
dest = user_path + '/gems/' + patch_gem_eventmachine + '/lib'
|
58
|
+
end
|
59
|
+
src = patch_eventmachine_source_path
|
60
|
+
FileUtils.cp_r(src, dest)
|
61
|
+
|
62
|
+
if lib_version === '2.7'
|
63
|
+
if options['system']
|
64
|
+
dest = system_path + '/gems/' + patch_gem_execjs + '/lib/execjs'
|
65
|
+
else
|
66
|
+
dest = user_path + '/gems/' + patch_gem_execjs + '/lib/execjs'
|
67
|
+
end
|
68
|
+
src = patch_execjs_source_path
|
69
|
+
if Dir.exist?(dest)
|
70
|
+
FileUtils.cp(src, dest)
|
71
|
+
else
|
72
|
+
J1.logger.info "PATCH: Skipped install patches for execjs-2.7.0 ..."
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module J1
|
4
|
+
module Commands
|
5
|
+
class Reset < Command
|
6
|
+
#noinspection MissingYardParamTag
|
7
|
+
class << self
|
8
|
+
|
9
|
+
def init_with_program(prog)
|
10
|
+
prog.command(:reset) do |c|
|
11
|
+
c.description 'Reset a J1 project to factory state'
|
12
|
+
c.syntax 'reset'
|
13
|
+
c.action do |args, options|
|
14
|
+
J1::Commands::Reset.process(args, options)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def process(args, options = {})
|
20
|
+
J1.logger.info "RESET: Reset the project to factory state ..."
|
21
|
+
J1.logger.info "RESET: Be patient, this will take a while ..."
|
22
|
+
process, output = J1::Utils::Exec.run('npm', 'run', 'reset')
|
23
|
+
output.to_s.each_line do |line|
|
24
|
+
J1.logger.info('RESET:', line.strip) unless line.to_s.empty?
|
25
|
+
end
|
26
|
+
if process.success?
|
27
|
+
J1.logger.info "RESET: The project reset finished successfully."
|
28
|
+
else
|
29
|
+
raise SystemExit
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module J1
|
4
|
+
module Commands
|
5
|
+
class Setup < Command
|
6
|
+
#noinspection MissingYardParamTag
|
7
|
+
class << self
|
8
|
+
|
9
|
+
def init_with_program(prog)
|
10
|
+
prog.command(:setup) do |c|
|
11
|
+
c.description 'Initialize a J1 project for first use'
|
12
|
+
c.syntax 'setup'
|
13
|
+
c.option 'force', '--force', ' Force to install patches even already exists'
|
14
|
+
c.option 'system', '--system', ' Install patches on the Ruby SYSTEM gem folder'
|
15
|
+
c.option 'skip-patches', '--skip-patches', 'Skip install any PATCHES build-in with J1'
|
16
|
+
c.action do |args, options|
|
17
|
+
J1::Commands::Setup.process(args, options)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def process(args, options = {})
|
23
|
+
@args = args
|
24
|
+
path = File.expand_path(Dir.getwd)
|
25
|
+
if is_project?
|
26
|
+
bundle_install(path, options)
|
27
|
+
if options['skip-patches']
|
28
|
+
J1.logger.info "SETUP: Install build-in patches skipped ..."
|
29
|
+
else
|
30
|
+
patch_install(options)
|
31
|
+
end
|
32
|
+
J1.logger.info "SETUP: Initialize the project ..."
|
33
|
+
J1.logger.info "SETUP: Be patient, this will take a while ..."
|
34
|
+
process, output = J1::Utils::Exec.run('npm', 'run', 'setup')
|
35
|
+
output.to_s.each_line do |line|
|
36
|
+
J1.logger.info('SETUP:', line.strip) unless line.to_s.empty?
|
37
|
+
end
|
38
|
+
if process.success?
|
39
|
+
J1.logger.info "SETUP: Initializing the project finished successfully."
|
40
|
+
J1.logger.info "SETUP: To open your site, run: j1 site"
|
41
|
+
else
|
42
|
+
raise SystemExit
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def is_project?
|
50
|
+
path = File.expand_path(File.dirname(File.dirname(__FILE__)))
|
51
|
+
J1.logger.info "Check consistency of the project ..."
|
52
|
+
return true
|
53
|
+
end
|
54
|
+
|
55
|
+
def is_windows?
|
56
|
+
#noinspection RubyResolve
|
57
|
+
RbConfig::CONFIG["host_os"] =~ %r!mswin|mingw|cygwin!i
|
58
|
+
end
|
59
|
+
|
60
|
+
def bundle_install(path, options)
|
61
|
+
J1::External.require_with_graceful_fail 'bundler'
|
62
|
+
J1.logger.info "Running bundle install in #{path} ..."
|
63
|
+
Dir.chdir(path) do
|
64
|
+
if options['system']
|
65
|
+
J1.logger.info "Install bundle in Ruby gem SYSTEM folder ..."
|
66
|
+
else
|
67
|
+
J1.logger.info "Install bundle in USER gem folder ~/.gem ..."
|
68
|
+
process, output = J1::Utils::Exec.run('bundle', 'config', 'set', '--local', 'path', '~/.gem')
|
69
|
+
end
|
70
|
+
process, output = J1::Utils::Exec.run('bundle', 'install')
|
71
|
+
output.to_s.each_line do |line|
|
72
|
+
J1.logger.info('Bundler:', line.strip) unless line.to_s.empty?
|
73
|
+
end
|
74
|
+
raise SystemExit unless process.success?
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def patch_install(options)
|
79
|
+
if is_windows?
|
80
|
+
major, minor = RUBY_VERSION.split('.')
|
81
|
+
lib_version = major + '.' + minor
|
82
|
+
curr_path = File.expand_path(File.dirname(File.dirname(__FILE__)))
|
83
|
+
patch_gem_eventmachine = 'eventmachine-1.2.7-x64-mingw32'
|
84
|
+
patch_gem_execjs = 'execjs-2.7.0'
|
85
|
+
patch_eventmachine_source_path = curr_path + '/patches/rubygems' + '/' + patch_gem_eventmachine + '/lib/' + lib_version
|
86
|
+
patch_execjs_source_path = curr_path + '/patches/rubygems' + '/' + patch_gem_execjs + '/lib/execjs/external_runtime.rb'
|
87
|
+
|
88
|
+
process, output = J1::Utils::Exec.run('gem', 'env', 'gempath')
|
89
|
+
raise SystemExit unless process.success?
|
90
|
+
|
91
|
+
result = output.split(';')
|
92
|
+
user_path = result[0]
|
93
|
+
system_path = result[1]
|
94
|
+
|
95
|
+
if options['system']
|
96
|
+
J1.logger.info "Install patches in SYSTEM folder ..."
|
97
|
+
J1.logger.info "Install patches on path #{system_path} ..."
|
98
|
+
dest = system_path + '/gems/' + patch_gem_eventmachine + '/lib'
|
99
|
+
else
|
100
|
+
J1.logger.info "Install patches in USER gem folder ~/.gem ..."
|
101
|
+
J1.logger.info "Install patches on path #{user_path} ..."
|
102
|
+
dest = user_path + '/gems/' + patch_gem_eventmachine + '/lib'
|
103
|
+
end
|
104
|
+
src = patch_eventmachine_source_path
|
105
|
+
FileUtils.cp_r(src, dest)
|
106
|
+
|
107
|
+
if lib_version === '2.7'
|
108
|
+
if options['system']
|
109
|
+
dest = system_path + '/gems/' + patch_gem_execjs + '/lib/execjs'
|
110
|
+
else
|
111
|
+
dest = user_path + '/gems/' + patch_gem_execjs + '/lib/execjs'
|
112
|
+
end
|
113
|
+
src = patch_execjs_source_path
|
114
|
+
if Dir.exist?(dest)
|
115
|
+
FileUtils.cp(src, dest)
|
116
|
+
else
|
117
|
+
J1.logger.info "Skipped install patches for execjs-2.7.0 ..."
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module J1
|
4
|
+
module Commands
|
5
|
+
class Site < Command
|
6
|
+
#noinspection MissingYardParamTag
|
7
|
+
class << self
|
8
|
+
|
9
|
+
def init_with_program(prog)
|
10
|
+
prog.command(:site) do |c|
|
11
|
+
c.description 'Run the website of a J1 project'
|
12
|
+
c.syntax 'site'
|
13
|
+
c.action do |args, options|
|
14
|
+
J1::Commands::Site.process(args, options)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def process(args, options = {})
|
20
|
+
J1.logger.info "SITE: Starting up your site ..."
|
21
|
+
J1::Utils::ExecUntilTrap.run('SITE','npm', 'run', 'j1-site')
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/j1/external.rb
CHANGED
@@ -50,7 +50,7 @@ The full error message from Ruby is: '#{e.message}'
|
|
50
50
|
|
51
51
|
If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
|
52
52
|
MSG
|
53
|
-
raise
|
53
|
+
raise J1::Errors::MissingDependencyException, name
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "open3"
|
2
|
+
|
3
|
+
module J1
|
4
|
+
module Utils
|
5
|
+
module ExecUntilTrap
|
6
|
+
extend self
|
7
|
+
|
8
|
+
# Runs a program in a sub-shell and exits on Ctrl+C.
|
9
|
+
#
|
10
|
+
# title - Trailing line title for the output on stdout
|
11
|
+
# *args - a list of strings containing the program name and (followed by) arguments
|
12
|
+
#
|
13
|
+
def run(title, *args)
|
14
|
+
Open3.popen3(*args) do |stdin, stdout, stderr|
|
15
|
+
trap('INT') {
|
16
|
+
puts "#{title}: Received Ctrl-C to stop"
|
17
|
+
raise SystemExit
|
18
|
+
}
|
19
|
+
stdout.each_line do |line|
|
20
|
+
puts "#{title}: #{line}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
[stdin, stdout, stderr].each(&:close)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/j1/utils.rb
CHANGED
@@ -1,11 +1,42 @@
|
|
1
|
+
require "singleton"
|
2
|
+
|
1
3
|
module J1
|
2
4
|
module Utils
|
3
5
|
extend self
|
4
6
|
autoload :Ansi, "j1/utils/ansi"
|
5
7
|
autoload :Exec, "j1/utils/exec"
|
8
|
+
autoload :ExecUntilTrap, "j1/utils/exec_until_trap"
|
6
9
|
autoload :Platforms, "j1/utils/platforms"
|
7
10
|
autoload :WinTZ, "j1/utils/win_tz"
|
8
11
|
|
12
|
+
class GracefulQuit
|
13
|
+
include Singleton
|
14
|
+
|
15
|
+
attr_accessor :breaker
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
self.breaker = false
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.enable
|
22
|
+
trap('INT') {
|
23
|
+
yield if block_given?
|
24
|
+
self.instance.breaker = true
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.check(message = "Quitting")
|
29
|
+
if self.instance.breaker
|
30
|
+
yield if block_given?
|
31
|
+
puts message
|
32
|
+
exit
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
|
9
40
|
# Constants for use in #slugify
|
10
41
|
SLUGIFY_MODES = %w(raw default pretty ascii).freeze
|
11
42
|
SLUGIFY_RAW_REGEXP = Regexp.new('\\s+').freeze
|
data/lib/j1/version.rb
CHANGED
data/lib/starter_web/Gemfile
CHANGED
@@ -53,7 +53,7 @@ gem 'jekyll', '~> 4.2'
|
|
53
53
|
|
54
54
|
# Theme Rubies, default: J1 Template (NOT used for the development system)
|
55
55
|
#
|
56
|
-
gem 'j1-template', '~> 2022.0.
|
56
|
+
gem 'j1-template', '~> 2022.0.16'
|
57
57
|
|
58
58
|
# ------------------------------------------------------------------------------
|
59
59
|
# PRODUCTION: Gem needed for the Jekyll and J1 prod environment
|
data/lib/starter_web/_config.yml
CHANGED
@@ -53,7 +53,7 @@ environment: development
|
|
53
53
|
# ------------------------------------------------------------------------------
|
54
54
|
# Sets the build version of J1 Template Gem
|
55
55
|
#
|
56
|
-
version: 2022.0.
|
56
|
+
version: 2022.0.16
|
57
57
|
|
58
58
|
# version
|
59
59
|
# ------------------------------------------------------------------------------
|
@@ -437,7 +437,7 @@ end::tables[]
|
|
437
437
|
// -----------------------------------------------------------------------------
|
438
438
|
tag::products[]
|
439
439
|
:j1--license: MIT License
|
440
|
-
:j1--version: 2022.0.
|
440
|
+
:j1--version: 2022.0.16
|
441
441
|
:j1--site-name: Jekyll One
|
442
442
|
end::products[]
|
443
443
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"private": true,
|
3
3
|
"name": "j1_starter",
|
4
|
-
"version": "2022.0.
|
4
|
+
"version": "2022.0.16",
|
5
5
|
"description": "J1 Template Starter Web",
|
6
6
|
"homepage": "https://your.site",
|
7
7
|
"author": {
|
@@ -129,6 +129,10 @@
|
|
129
129
|
"site:jekyll": "echo Startup the site .. && cross-env SINATRA_ACTIVESUPPORT_WARNING=false bundle exec jekyll s --incremental --livereload --livereload-port $npm_package_jekyll_opt_livereload_port --open",
|
130
130
|
"site:utilsrv": "npm --prefix ./utilsrv --silent run utilsrv",
|
131
131
|
|
132
|
+
"j1-site": "run-p -s j1-site:*",
|
133
|
+
"j1-site:jekyll": "bundle exec jekyll s --incremental --livereload --open",
|
134
|
+
"j1-site:utilsrv": "npm --prefix ./utilsrv --silent run utilsrv",
|
135
|
+
|
132
136
|
"bump": "run-s -s ver && run-s -s bump:* && run-s -s ver",
|
133
137
|
"ver": "cross-var cross-env echo \"Project version: $npm_package_version\"",
|
134
138
|
"bump:project": "cross-var cross-env npm version $npm_package_config_bumplevel",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: j1-template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2022.0.
|
4
|
+
version: 2022.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- juergen_jekyll_one
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -1455,6 +1455,11 @@ files:
|
|
1455
1455
|
- lib/j1.rb
|
1456
1456
|
- lib/j1/command.rb
|
1457
1457
|
- lib/j1/commands/generate.rb
|
1458
|
+
- lib/j1/commands/help.rb
|
1459
|
+
- lib/j1/commands/patch.rb
|
1460
|
+
- lib/j1/commands/reset.rb
|
1461
|
+
- lib/j1/commands/setup.rb
|
1462
|
+
- lib/j1/commands/site.rb
|
1458
1463
|
- lib/j1/external.rb
|
1459
1464
|
- lib/j1/log_adapter.rb
|
1460
1465
|
- lib/j1/log_helper.rb
|
@@ -1466,6 +1471,7 @@ files:
|
|
1466
1471
|
- lib/j1/utils.rb
|
1467
1472
|
- lib/j1/utils/ansi.rb
|
1468
1473
|
- lib/j1/utils/exec.rb
|
1474
|
+
- lib/j1/utils/exec_until_trap.rb
|
1469
1475
|
- lib/j1/utils/platforms.rb
|
1470
1476
|
- lib/j1/utils/win_tz.rb
|
1471
1477
|
- lib/j1/version.rb
|