jekyll-admin 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +21 -21
- data/README.md +94 -94
- data/lib/jekyll-admin.rb +47 -47
- data/lib/jekyll-admin/apiable.rb +224 -224
- data/lib/jekyll-admin/data_file.rb +106 -106
- data/lib/jekyll-admin/directory.rb +72 -72
- data/lib/jekyll-admin/file_helper.rb +91 -91
- data/lib/jekyll-admin/path_helper.rb +87 -87
- data/lib/jekyll-admin/public/asset-manifest.json +27 -0
- data/lib/jekyll-admin/public/index.html +1 -13
- data/lib/jekyll-admin/public/precache-manifest.52de67482747a1012d0d27a209b930d0.js +78 -0
- data/lib/jekyll-admin/public/service-worker.js +39 -0
- data/lib/jekyll-admin/public/static/css/2.b74256fb.chunk.css +2 -0
- data/lib/jekyll-admin/public/static/css/2.b74256fb.chunk.css.map +1 -0
- data/lib/jekyll-admin/public/static/css/main.223e267c.chunk.css +5 -0
- data/lib/jekyll-admin/public/static/css/main.223e267c.chunk.css.map +1 -0
- data/lib/jekyll-admin/public/static/js/2.49911da2.chunk.js +3 -0
- data/lib/jekyll-admin/public/static/js/2.49911da2.chunk.js.LICENSE.txt +67 -0
- data/lib/jekyll-admin/public/static/js/2.49911da2.chunk.js.map +1 -0
- data/lib/jekyll-admin/public/static/js/main.dd81e877.chunk.js +2 -0
- data/lib/jekyll-admin/public/static/js/main.dd81e877.chunk.js.map +1 -0
- data/lib/jekyll-admin/public/static/js/runtime-main.95f94e60.js +2 -0
- data/lib/jekyll-admin/public/static/js/runtime-main.95f94e60.js.map +1 -0
- data/lib/jekyll-admin/public/{1dc35d25e61d819a9c357074014867ab.ttf → static/media/fontawesome-webfont.1dc35d25.ttf} +0 -0
- data/lib/jekyll-admin/public/{25a32416abee198dd821b0b17a198a8f.eot → static/media/fontawesome-webfont.25a32416.eot} +0 -0
- data/lib/jekyll-admin/public/{c8ddf1e5e5bf3682bc7bebf30f394148.woff → static/media/fontawesome-webfont.c8ddf1e5.woff} +0 -0
- data/lib/jekyll-admin/public/{24c601e721ebd8279d38e2cfa0d01bc6.svg → static/media/fontawesome-webfont.d7c63908.svg} +684 -684
- data/lib/jekyll-admin/public/{e6cf7c6ec7c2d6f670ae9d762604cb0b.woff2 → static/media/fontawesome-webfont.e6cf7c6e.woff2} +0 -0
- data/lib/jekyll-admin/public/{55131026930a0cd4539d1e2fdb92722d.ttf → static/media/lato-bold.55131026.ttf} +0 -0
- data/lib/jekyll-admin/public/{059514c92565e4045da1a69525dd9ec0.ttf → static/media/lato-regular.059514c9.ttf} +0 -0
- data/lib/jekyll-admin/public/{a770b6797b68e3f8920e473eb824bac0.gif → static/media/loader-big.a770b679.gif} +0 -0
- data/lib/jekyll-admin/public/{12f0820c451bdc75f4d1ef97732bf6e8.woff → static/media/rw-widgets.12f0820c.woff} +0 -0
- data/lib/jekyll-admin/public/{792dcd18baf5f544aabcad1883d673c2.svg → static/media/rw-widgets.792dcd18.svg} +0 -0
- data/lib/jekyll-admin/public/{bc7c4a59f924cf037aad6e1f9edba366.eot → static/media/rw-widgets.bc7c4a59.eot} +0 -0
- data/lib/jekyll-admin/public/{eceddf474df95d8d4a7e316668c3be85.ttf → static/media/rw-widgets.eceddf47.ttf} +0 -0
- data/lib/jekyll-admin/server.rb +108 -108
- data/lib/jekyll-admin/server/collections.rb +89 -89
- data/lib/jekyll-admin/server/configuration.rb +60 -60
- data/lib/jekyll-admin/server/data.rb +84 -84
- data/lib/jekyll-admin/server/drafts.rb +114 -114
- data/lib/jekyll-admin/server/pages.rb +109 -109
- data/lib/jekyll-admin/server/site_meta.rb +25 -25
- data/lib/jekyll-admin/server/static_files.rb +83 -83
- data/lib/jekyll-admin/static_server.rb +26 -26
- data/lib/jekyll-admin/urlable.rb +75 -75
- data/lib/jekyll-admin/version.rb +5 -5
- data/lib/jekyll/commands/serve.rb +30 -30
- metadata +30 -22
- data/lib/jekyll-admin/public/33a752211d05af6684e26ec63c2ed965.gif +0 -0
- data/lib/jekyll-admin/public/8b4968b70019a0551a72940c5a2020d3.png +0 -0
- data/lib/jekyll-admin/public/8ea28ca3bfdf27145068e81dd07a34c6.png +0 -0
- data/lib/jekyll-admin/public/bundle.js +0 -64
- data/lib/jekyll-admin/public/bundle.js.map +0 -1
- data/lib/jekyll-admin/public/styles.css +0 -106
- data/lib/jekyll-admin/public/styles.css.map +0 -1
@@ -1,25 +1,25 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module JekyllAdmin
|
4
|
-
class Server < Sinatra::Base
|
5
|
-
# Jekyll::Site instance method names that return a Hash.
|
6
|
-
META_KEYS = [:categories, :layouts, :tags].freeze
|
7
|
-
private_constant :META_KEYS
|
8
|
-
|
9
|
-
namespace "/site_meta" do
|
10
|
-
get "/?" do
|
11
|
-
json site_meta
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
# Stash a Hash generated with pre-determined keys.
|
17
|
-
def site_meta
|
18
|
-
@site_meta ||= META_KEYS.zip(META_KEYS.map { |k| site.send(k).keys }).to_h
|
19
|
-
end
|
20
|
-
|
21
|
-
# Reset memoization of `#site_meta` when the site regenerates
|
22
|
-
Jekyll::Hooks.register(:site, :after_reset) { @site_meta = nil }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JekyllAdmin
|
4
|
+
class Server < Sinatra::Base
|
5
|
+
# Jekyll::Site instance method names that return a Hash.
|
6
|
+
META_KEYS = [:categories, :layouts, :tags].freeze
|
7
|
+
private_constant :META_KEYS
|
8
|
+
|
9
|
+
namespace "/site_meta" do
|
10
|
+
get "/?" do
|
11
|
+
json site_meta
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
# Stash a Hash generated with pre-determined keys.
|
17
|
+
def site_meta
|
18
|
+
@site_meta ||= META_KEYS.zip(META_KEYS.map { |k| site.send(k).keys }).to_h
|
19
|
+
end
|
20
|
+
|
21
|
+
# Reset memoization of `#site_meta` when the site regenerates
|
22
|
+
Jekyll::Hooks.register(:site, :after_reset) { @site_meta = nil }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,83 +1,83 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module JekyllAdmin
|
4
|
-
class Server < Sinatra::Base
|
5
|
-
namespace "/static_files" do
|
6
|
-
# End-point to retrieve all static-files in site
|
7
|
-
get "/index" do
|
8
|
-
json site.static_files.map(&:to_api)
|
9
|
-
end
|
10
|
-
|
11
|
-
# End-point to retrieve individual directories that contain static-files
|
12
|
-
get "/?*" do
|
13
|
-
render_404 unless File.exist?(path)
|
14
|
-
|
15
|
-
if requested_file
|
16
|
-
json requested_file.to_api(:include_content => true)
|
17
|
-
else
|
18
|
-
json entries.map(&:to_api)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
put "/*" do
|
23
|
-
if renamed?
|
24
|
-
ensure_requested_file
|
25
|
-
delete_file_without_process path
|
26
|
-
end
|
27
|
-
|
28
|
-
write_file(write_path, static_file_body)
|
29
|
-
json written_file.to_api(:include_content => true)
|
30
|
-
end
|
31
|
-
|
32
|
-
delete "/*" do
|
33
|
-
ensure_requested_file
|
34
|
-
delete_file path
|
35
|
-
content_type :json
|
36
|
-
status 200
|
37
|
-
halt
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
# returns relative path of root level directories that contain static files
|
43
|
-
def dirs_at_root
|
44
|
-
static_files.map do |file|
|
45
|
-
File.dirname(file.path.sub("#{site.source}/", "")).split("/")[0]
|
46
|
-
end.uniq
|
47
|
-
end
|
48
|
-
|
49
|
-
def directory_files
|
50
|
-
static_files.find_all do |file|
|
51
|
-
sanitized_path(File.dirname(file.path)) == directory_path
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def entries
|
56
|
-
splat = params["splat"].first
|
57
|
-
args = {
|
58
|
-
:base => site.source,
|
59
|
-
:content_type => "static_files",
|
60
|
-
:splat => splat,
|
61
|
-
}
|
62
|
-
# get all directories inside the requested directory
|
63
|
-
directory = JekyllAdmin::Directory.new(directory_path, args)
|
64
|
-
directories = directory.directories
|
65
|
-
|
66
|
-
# exclude root level directories which do not have static files
|
67
|
-
directories = directories.select { |d| dirs_at_root.include? d.name.to_s } if splat.empty?
|
68
|
-
directories.concat(directory_files)
|
69
|
-
end
|
70
|
-
|
71
|
-
def static_file_body
|
72
|
-
raw_content = request_payload["raw_content"]
|
73
|
-
return raw_content if raw_content.is_a?(String) && raw_content != ""
|
74
|
-
|
75
|
-
Base64.decode64 request_payload["encoded_content"].to_s
|
76
|
-
end
|
77
|
-
|
78
|
-
def static_files
|
79
|
-
site.static_files.select { |f| f.path.start_with? site.source }
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JekyllAdmin
|
4
|
+
class Server < Sinatra::Base
|
5
|
+
namespace "/static_files" do
|
6
|
+
# End-point to retrieve all static-files in site
|
7
|
+
get "/index" do
|
8
|
+
json site.static_files.map(&:to_api)
|
9
|
+
end
|
10
|
+
|
11
|
+
# End-point to retrieve individual directories that contain static-files
|
12
|
+
get "/?*" do
|
13
|
+
render_404 unless File.exist?(path)
|
14
|
+
|
15
|
+
if requested_file
|
16
|
+
json requested_file.to_api(:include_content => true)
|
17
|
+
else
|
18
|
+
json entries.map(&:to_api)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
put "/*" do
|
23
|
+
if renamed?
|
24
|
+
ensure_requested_file
|
25
|
+
delete_file_without_process path
|
26
|
+
end
|
27
|
+
|
28
|
+
write_file(write_path, static_file_body)
|
29
|
+
json written_file.to_api(:include_content => true)
|
30
|
+
end
|
31
|
+
|
32
|
+
delete "/*" do
|
33
|
+
ensure_requested_file
|
34
|
+
delete_file path
|
35
|
+
content_type :json
|
36
|
+
status 200
|
37
|
+
halt
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
# returns relative path of root level directories that contain static files
|
43
|
+
def dirs_at_root
|
44
|
+
static_files.map do |file|
|
45
|
+
File.dirname(file.path.sub("#{site.source}/", "")).split("/")[0]
|
46
|
+
end.uniq
|
47
|
+
end
|
48
|
+
|
49
|
+
def directory_files
|
50
|
+
static_files.find_all do |file|
|
51
|
+
sanitized_path(File.dirname(file.path)) == directory_path
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def entries
|
56
|
+
splat = params["splat"].first
|
57
|
+
args = {
|
58
|
+
:base => site.source,
|
59
|
+
:content_type => "static_files",
|
60
|
+
:splat => splat,
|
61
|
+
}
|
62
|
+
# get all directories inside the requested directory
|
63
|
+
directory = JekyllAdmin::Directory.new(directory_path, args)
|
64
|
+
directories = directory.directories
|
65
|
+
|
66
|
+
# exclude root level directories which do not have static files
|
67
|
+
directories = directories.select { |d| dirs_at_root.include? d.name.to_s } if splat.empty?
|
68
|
+
directories.concat(directory_files)
|
69
|
+
end
|
70
|
+
|
71
|
+
def static_file_body
|
72
|
+
raw_content = request_payload["raw_content"]
|
73
|
+
return raw_content if raw_content.is_a?(String) && raw_content != ""
|
74
|
+
|
75
|
+
Base64.decode64 request_payload["encoded_content"].to_s
|
76
|
+
end
|
77
|
+
|
78
|
+
def static_files
|
79
|
+
site.static_files.select { |f| f.path.start_with? site.source }
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -1,26 +1,26 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module JekyllAdmin
|
4
|
-
class StaticServer < Sinatra::Base
|
5
|
-
set :public_dir, File.expand_path("./public", File.dirname(__FILE__))
|
6
|
-
|
7
|
-
MUST_BUILD_MESSAGE = "Front end not yet built. Run `script/build` to build."
|
8
|
-
|
9
|
-
# Allow `/admin` and `/admin/`, and `/admin/*` to serve `/public/dist/index.html`
|
10
|
-
get "/*" do
|
11
|
-
send_file index_path
|
12
|
-
end
|
13
|
-
|
14
|
-
# Provide a descriptive error message in dev. if frontend is not build
|
15
|
-
not_found do
|
16
|
-
status 404
|
17
|
-
MUST_BUILD_MESSAGE if settings.development? || settings.test?
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def index_path
|
23
|
-
@index_path ||= File.join(settings.public_folder, "index.html")
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JekyllAdmin
|
4
|
+
class StaticServer < Sinatra::Base
|
5
|
+
set :public_dir, File.expand_path("./public", File.dirname(__FILE__))
|
6
|
+
|
7
|
+
MUST_BUILD_MESSAGE = "Front end not yet built. Run `script/build` to build."
|
8
|
+
|
9
|
+
# Allow `/admin` and `/admin/`, and `/admin/*` to serve `/public/dist/index.html`
|
10
|
+
get "/*" do
|
11
|
+
send_file index_path
|
12
|
+
end
|
13
|
+
|
14
|
+
# Provide a descriptive error message in dev. if frontend is not build
|
15
|
+
not_found do
|
16
|
+
status 404
|
17
|
+
MUST_BUILD_MESSAGE if settings.development? || settings.test?
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def index_path
|
23
|
+
@index_path ||= File.join(settings.public_folder, "index.html")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/jekyll-admin/urlable.rb
CHANGED
@@ -1,75 +1,75 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module JekyllAdmin
|
4
|
-
# Abstract module to be included in Convertible and Document to provide
|
5
|
-
# additional, URL-specific functionality without duplicating logic
|
6
|
-
module URLable
|
7
|
-
# Absolute URL to the HTTP(S) rendered/served representation of this resource
|
8
|
-
def http_url
|
9
|
-
return if is_a?(Jekyll::Collection) || is_a?(JekyllAdmin::DataFile)
|
10
|
-
return if is_a?(Jekyll::Document) && !collection.write?
|
11
|
-
|
12
|
-
@http_url ||= Addressable::URI.new(
|
13
|
-
:scheme => scheme, :host => host, :port => port,
|
14
|
-
:path => path_with_base(JekyllAdmin.site.config["baseurl"], url)
|
15
|
-
).normalize.to_s
|
16
|
-
end
|
17
|
-
|
18
|
-
# Absolute URL to the API representation of this resource
|
19
|
-
def api_url
|
20
|
-
@api_url ||= Addressable::URI.new(
|
21
|
-
:scheme => scheme, :host => host, :port => port,
|
22
|
-
:path => path_with_base("/_api", resource_path)
|
23
|
-
).normalize.to_s
|
24
|
-
end
|
25
|
-
|
26
|
-
def entries_url
|
27
|
-
return unless is_a?(Jekyll::Collection)
|
28
|
-
|
29
|
-
"#{api_url}/entries"
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
# URL path relative to `_api/` to retreive the given resource via the API
|
35
|
-
# Note: we can't use a case statement here, because === doesn't like includes
|
36
|
-
#
|
37
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
38
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
39
|
-
def resource_path
|
40
|
-
if is_a?(Jekyll::Document) && draft?
|
41
|
-
"/#{relative_path.sub(%r!\A_!, "")}"
|
42
|
-
elsif is_a?(Jekyll::Document)
|
43
|
-
"/collections/#{relative_path.sub(%r!\A_!, "")}"
|
44
|
-
elsif is_a?(Jekyll::Collection)
|
45
|
-
"/collections/#{label}"
|
46
|
-
elsif is_a?(JekyllAdmin::DataFile)
|
47
|
-
"/data/#{relative_path}"
|
48
|
-
elsif is_a?(Jekyll::StaticFile)
|
49
|
-
"/static_files/#{relative_path}"
|
50
|
-
elsif is_a?(Jekyll::Page)
|
51
|
-
"/pages/#{relative_path}"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
55
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
56
|
-
|
57
|
-
# URI.join doesn't like joining two relative paths, and File.join may join
|
58
|
-
# with `\` rather than with `/` on windows
|
59
|
-
def path_with_base(base, path)
|
60
|
-
[base, path].join("/").squeeze("/")
|
61
|
-
end
|
62
|
-
|
63
|
-
def scheme
|
64
|
-
JekyllAdmin.site.config["scheme"] || "http"
|
65
|
-
end
|
66
|
-
|
67
|
-
def host
|
68
|
-
JekyllAdmin.site.config["host"].sub("127.0.0.1", "localhost")
|
69
|
-
end
|
70
|
-
|
71
|
-
def port
|
72
|
-
JekyllAdmin.site.config["port"]
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JekyllAdmin
|
4
|
+
# Abstract module to be included in Convertible and Document to provide
|
5
|
+
# additional, URL-specific functionality without duplicating logic
|
6
|
+
module URLable
|
7
|
+
# Absolute URL to the HTTP(S) rendered/served representation of this resource
|
8
|
+
def http_url
|
9
|
+
return if is_a?(Jekyll::Collection) || is_a?(JekyllAdmin::DataFile)
|
10
|
+
return if is_a?(Jekyll::Document) && !collection.write?
|
11
|
+
|
12
|
+
@http_url ||= Addressable::URI.new(
|
13
|
+
:scheme => scheme, :host => host, :port => port,
|
14
|
+
:path => path_with_base(JekyllAdmin.site.config["baseurl"], url)
|
15
|
+
).normalize.to_s
|
16
|
+
end
|
17
|
+
|
18
|
+
# Absolute URL to the API representation of this resource
|
19
|
+
def api_url
|
20
|
+
@api_url ||= Addressable::URI.new(
|
21
|
+
:scheme => scheme, :host => host, :port => port,
|
22
|
+
:path => path_with_base("/_api", resource_path)
|
23
|
+
).normalize.to_s
|
24
|
+
end
|
25
|
+
|
26
|
+
def entries_url
|
27
|
+
return unless is_a?(Jekyll::Collection)
|
28
|
+
|
29
|
+
"#{api_url}/entries"
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
# URL path relative to `_api/` to retreive the given resource via the API
|
35
|
+
# Note: we can't use a case statement here, because === doesn't like includes
|
36
|
+
#
|
37
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
38
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
39
|
+
def resource_path
|
40
|
+
if is_a?(Jekyll::Document) && draft?
|
41
|
+
"/#{relative_path.sub(%r!\A_!, "")}"
|
42
|
+
elsif is_a?(Jekyll::Document)
|
43
|
+
"/collections/#{relative_path.sub(%r!\A_!, "")}"
|
44
|
+
elsif is_a?(Jekyll::Collection)
|
45
|
+
"/collections/#{label}"
|
46
|
+
elsif is_a?(JekyllAdmin::DataFile)
|
47
|
+
"/data/#{relative_path}"
|
48
|
+
elsif is_a?(Jekyll::StaticFile)
|
49
|
+
"/static_files/#{relative_path}"
|
50
|
+
elsif is_a?(Jekyll::Page)
|
51
|
+
"/pages/#{relative_path}"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
55
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
56
|
+
|
57
|
+
# URI.join doesn't like joining two relative paths, and File.join may join
|
58
|
+
# with `\` rather than with `/` on windows
|
59
|
+
def path_with_base(base, path)
|
60
|
+
[base, path].join("/").squeeze("/")
|
61
|
+
end
|
62
|
+
|
63
|
+
def scheme
|
64
|
+
JekyllAdmin.site.config["scheme"] || "http"
|
65
|
+
end
|
66
|
+
|
67
|
+
def host
|
68
|
+
JekyllAdmin.site.config["host"].sub("127.0.0.1", "localhost")
|
69
|
+
end
|
70
|
+
|
71
|
+
def port
|
72
|
+
JekyllAdmin.site.config["port"]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
data/lib/jekyll-admin/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module JekyllAdmin
|
4
|
-
VERSION = "0.10.
|
5
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JekyllAdmin
|
4
|
+
VERSION = "0.10.1"
|
5
|
+
end
|
@@ -1,30 +1,30 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Jekyll
|
4
|
-
module Commands
|
5
|
-
class Serve < Command
|
6
|
-
class << self
|
7
|
-
private
|
8
|
-
|
9
|
-
def start_up_webrick(opts, destination)
|
10
|
-
@reload_reactor.start(opts) if opts["livereload"]
|
11
|
-
|
12
|
-
@server = WEBrick::HTTPServer.new(webrick_opts(opts)).tap { |o| o.unmount("") }
|
13
|
-
@server.mount(opts["baseurl"].to_s, Servlet, destination, file_handler_opts)
|
14
|
-
|
15
|
-
jekyll_admin_monkey_patch
|
16
|
-
|
17
|
-
Jekyll.logger.info "Server address:", server_address(@server, opts)
|
18
|
-
launch_browser @server, opts if opts["open_url"]
|
19
|
-
boot_or_detach @server, opts
|
20
|
-
end
|
21
|
-
|
22
|
-
def jekyll_admin_monkey_patch
|
23
|
-
@server.mount "/admin", Rack::Handler::WEBrick, JekyllAdmin::StaticServer
|
24
|
-
@server.mount "/_api", Rack::Handler::WEBrick, JekyllAdmin::Server
|
25
|
-
Jekyll.logger.info "JekyllAdmin mode:", ENV["RACK_ENV"] || "production"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Commands
|
5
|
+
class Serve < Command
|
6
|
+
class << self
|
7
|
+
private
|
8
|
+
|
9
|
+
def start_up_webrick(opts, destination)
|
10
|
+
@reload_reactor.start(opts) if opts["livereload"]
|
11
|
+
|
12
|
+
@server = WEBrick::HTTPServer.new(webrick_opts(opts)).tap { |o| o.unmount("") }
|
13
|
+
@server.mount(opts["baseurl"].to_s, Servlet, destination, file_handler_opts)
|
14
|
+
|
15
|
+
jekyll_admin_monkey_patch
|
16
|
+
|
17
|
+
Jekyll.logger.info "Server address:", server_address(@server, opts)
|
18
|
+
launch_browser @server, opts if opts["open_url"]
|
19
|
+
boot_or_detach @server, opts
|
20
|
+
end
|
21
|
+
|
22
|
+
def jekyll_admin_monkey_patch
|
23
|
+
@server.mount "/admin", Rack::Handler::WEBrick, JekyllAdmin::StaticServer
|
24
|
+
@server.mount "/_api", Rack::Handler::WEBrick, JekyllAdmin::Server
|
25
|
+
Jekyll.logger.info "JekyllAdmin mode:", ENV["RACK_ENV"] || "production"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|