bunto 3.0.0 → 3.2.1
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/.rubocop.yml +124 -76
- data/README.markdown +49 -12
- data/{bin → exe}/bunto +18 -14
- data/lib/bunto.rb +83 -78
- data/lib/bunto/cleaner.rb +10 -8
- data/lib/bunto/collection.rb +33 -17
- data/lib/bunto/command.rb +19 -13
- data/lib/bunto/commands/build.rb +22 -14
- data/lib/bunto/commands/clean.rb +9 -8
- data/lib/bunto/commands/doctor.rb +10 -8
- data/lib/bunto/commands/help.rb +4 -3
- data/lib/bunto/commands/new.rb +30 -21
- data/lib/bunto/commands/new_theme.rb +36 -0
- data/lib/bunto/commands/serve.rb +26 -20
- data/lib/bunto/commands/serve/servlet.rb +4 -5
- data/lib/bunto/configuration.rb +187 -125
- data/lib/bunto/converters/markdown.rb +19 -9
- data/lib/bunto/converters/markdown/kramdown_parser.rb +12 -5
- data/lib/bunto/converters/markdown/rdiscount_parser.rb +4 -4
- data/lib/bunto/converters/markdown/redcarpet_parser.rb +90 -84
- data/lib/bunto/convertible.rb +38 -25
- data/lib/bunto/deprecator.rb +11 -6
- data/lib/bunto/desktop.ini +2 -0
- data/lib/bunto/document.rb +53 -51
- data/lib/bunto/drops/bunto_drop.rb +12 -0
- data/lib/bunto/drops/document_drop.rb +40 -5
- data/lib/bunto/drops/drop.rb +49 -10
- data/lib/bunto/drops/excerpt_drop.rb +15 -0
- data/lib/bunto/drops/site_drop.rb +4 -2
- data/lib/bunto/drops/url_drop.rb +4 -4
- data/lib/bunto/entry_filter.rb +64 -19
- data/lib/bunto/errors.rb +6 -3
- data/lib/bunto/excerpt.rb +4 -6
- data/lib/bunto/external.rb +4 -4
- data/lib/bunto/filters.rb +72 -39
- data/lib/bunto/frontmatter_defaults.rb +45 -38
- data/lib/bunto/hooks.rb +21 -21
- data/lib/bunto/layout.rb +4 -8
- data/lib/bunto/liquid_renderer.rb +14 -3
- data/lib/bunto/liquid_renderer/file.rb +5 -1
- data/lib/bunto/liquid_renderer/table.rb +11 -11
- data/lib/bunto/log_adapter.rb +2 -2
- data/lib/bunto/page.rb +10 -10
- data/lib/bunto/plugin.rb +5 -5
- data/lib/bunto/plugin_manager.rb +12 -8
- data/lib/bunto/publisher.rb +1 -1
- data/lib/bunto/reader.rb +11 -7
- data/lib/bunto/readers/data_reader.rb +9 -9
- data/lib/bunto/readers/layout_reader.rb +7 -7
- data/lib/bunto/readers/page_reader.rb +3 -1
- data/lib/bunto/readers/post_reader.rb +9 -10
- data/lib/bunto/readers/static_file_reader.rb +3 -1
- data/lib/bunto/regenerator.rb +50 -28
- data/lib/bunto/related_posts.rb +1 -1
- data/lib/bunto/renderer.rb +33 -23
- data/lib/bunto/site.rb +94 -51
- data/lib/bunto/static_file.rb +33 -26
- data/lib/bunto/stevenson.rb +6 -5
- data/lib/bunto/tags/highlight.rb +50 -35
- data/lib/bunto/tags/include.rb +42 -31
- data/lib/bunto/tags/link.rb +11 -4
- data/lib/bunto/tags/post_url.rb +8 -7
- data/lib/bunto/theme.rb +10 -8
- data/lib/bunto/theme_builder.rb +117 -0
- data/lib/bunto/url.rb +21 -14
- data/lib/bunto/utils.rb +57 -28
- data/lib/bunto/utils/ansi.rb +9 -9
- data/lib/bunto/utils/platforms.rb +2 -2
- data/lib/bunto/version.rb +1 -1
- data/lib/site_template/_config.yml +3 -1
- data/lib/site_template/_posts/0000-00-00-welcome-to-bunto.markdown.erb +3 -3
- data/lib/site_template/about.md +3 -3
- data/lib/site_template/css/main.scss +3 -17
- data/lib/theme_template/CODE_OF_CONDUCT.md.erb +74 -0
- data/lib/theme_template/Gemfile +2 -0
- data/lib/theme_template/LICENSE.txt.erb +21 -0
- data/lib/theme_template/README.md.erb +48 -0
- data/lib/theme_template/_layouts/default.html +1 -0
- data/lib/theme_template/_layouts/page.html +5 -0
- data/lib/theme_template/_layouts/post.html +5 -0
- data/lib/theme_template/example/_config.yml.erb +1 -0
- data/lib/theme_template/example/_post.md +12 -0
- data/lib/theme_template/example/index.html +14 -0
- data/lib/theme_template/example/style.scss +7 -0
- data/lib/theme_template/gitignore.erb +4 -0
- data/lib/theme_template/theme.gemspec.erb +18 -0
- metadata +40 -19
- data/lib/site_template/_includes/footer.html +0 -38
- data/lib/site_template/_includes/head.html +0 -12
- data/lib/site_template/_includes/header.html +0 -27
- data/lib/site_template/_includes/icon-github.html +0 -1
- data/lib/site_template/_includes/icon-github.svg +0 -1
- data/lib/site_template/_includes/icon-twitter.html +0 -1
- data/lib/site_template/_includes/icon-twitter.svg +0 -1
- data/lib/site_template/_layouts/default.html +0 -20
- data/lib/site_template/_layouts/page.html +0 -14
- data/lib/site_template/_layouts/post.html +0 -15
- data/lib/site_template/_sass/_base.scss +0 -200
- data/lib/site_template/_sass/_layout.scss +0 -242
- data/lib/site_template/_sass/_syntax-highlighting.scss +0 -71
data/lib/bunto/cleaner.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "set"
|
|
2
2
|
|
|
3
3
|
module Bunto
|
|
4
4
|
# Handles the cleanup of a site's destination before it is built.
|
|
5
5
|
class Cleaner
|
|
6
|
-
HIDDEN_FILE_REGEX =
|
|
6
|
+
HIDDEN_FILE_REGEX = %r!\/\.{1,2}$!
|
|
7
7
|
attr_reader :site
|
|
8
8
|
|
|
9
9
|
def initialize(site)
|
|
@@ -32,7 +32,8 @@ module Bunto
|
|
|
32
32
|
[site.regenerator.metadata_file]
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
# Private: The list of existing files, apart from those included in
|
|
35
|
+
# Private: The list of existing files, apart from those included in
|
|
36
|
+
# keep_files and hidden files.
|
|
36
37
|
#
|
|
37
38
|
# Returns a Set with the file paths
|
|
38
39
|
def existing_files
|
|
@@ -77,15 +78,16 @@ module Bunto
|
|
|
77
78
|
end
|
|
78
79
|
end
|
|
79
80
|
|
|
80
|
-
# Private: The list of existing files that will be replaced by a directory
|
|
81
|
+
# Private: The list of existing files that will be replaced by a directory
|
|
82
|
+
# during build
|
|
81
83
|
#
|
|
82
84
|
# Returns a Set with the file paths
|
|
83
85
|
def replaced_files
|
|
84
86
|
new_dirs.select { |dir| File.file?(dir) }.to_set
|
|
85
87
|
end
|
|
86
88
|
|
|
87
|
-
# Private: The list of directories that need to be kept because they are
|
|
88
|
-
# of files specified in keep_files
|
|
89
|
+
# Private: The list of directories that need to be kept because they are
|
|
90
|
+
# parent directories of files specified in keep_files
|
|
89
91
|
#
|
|
90
92
|
# Returns a Set with the directory paths
|
|
91
93
|
def keep_dirs
|
|
@@ -95,12 +97,12 @@ module Bunto
|
|
|
95
97
|
# Private: Creates a regular expression from the config's keep_files array
|
|
96
98
|
#
|
|
97
99
|
# Examples
|
|
98
|
-
# ['.git','.svn'] with site.dest "/myblog/_site" creates
|
|
100
|
+
# ['.git','.svn'] with site.dest "/myblog/_site" creates
|
|
99
101
|
# the following regex: /\A\/myblog\/_site\/(\.git|\/.svn)/
|
|
100
102
|
#
|
|
101
103
|
# Returns the regular expression
|
|
102
104
|
def keep_file_regex
|
|
103
|
-
|
|
105
|
+
%r!\A#{Regexp.quote(site.dest)}\/(#{Regexp.union(site.keep_files).source})!
|
|
104
106
|
end
|
|
105
107
|
end
|
|
106
108
|
end
|
data/lib/bunto/collection.rb
CHANGED
|
@@ -25,14 +25,15 @@ module Bunto
|
|
|
25
25
|
|
|
26
26
|
# Override of normal respond_to? to match method_missing's logic for
|
|
27
27
|
# looking in @data.
|
|
28
|
-
def
|
|
28
|
+
def respond_to_missing?(method, include_private = false)
|
|
29
29
|
docs.respond_to?(method.to_sym, include_private) || super
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
# Override of method_missing to check in @data for the key.
|
|
33
33
|
def method_missing(method, *args, &blck)
|
|
34
34
|
if docs.respond_to?(method.to_sym)
|
|
35
|
-
Bunto.logger.warn "Deprecation:", "#{label}.#{method} should be changed to
|
|
35
|
+
Bunto.logger.warn "Deprecation:", "#{label}.#{method} should be changed to" \
|
|
36
|
+
"#{label}.docs.#{method}."
|
|
36
37
|
Bunto.logger.warn "", "Called by #{caller.first}."
|
|
37
38
|
docs.public_send(method.to_sym, *args, &blck)
|
|
38
39
|
else
|
|
@@ -56,16 +57,9 @@ module Bunto
|
|
|
56
57
|
full_path = collection_dir(file_path)
|
|
57
58
|
next if File.directory?(full_path)
|
|
58
59
|
if Utils.has_yaml_header? full_path
|
|
59
|
-
|
|
60
|
-
doc.read
|
|
61
|
-
if site.publisher.publish?(doc) || !write?
|
|
62
|
-
docs << doc
|
|
63
|
-
else
|
|
64
|
-
Bunto.logger.debug "Skipped From Publishing:", doc.relative_path
|
|
65
|
-
end
|
|
60
|
+
read_document(full_path)
|
|
66
61
|
else
|
|
67
|
-
|
|
68
|
-
files << StaticFile.new(site, site.source, relative_dir, File.basename(full_path), self)
|
|
62
|
+
read_static_file(file_path, full_path)
|
|
69
63
|
end
|
|
70
64
|
end
|
|
71
65
|
docs.sort!
|
|
@@ -79,7 +73,7 @@ module Bunto
|
|
|
79
73
|
return [] unless exists?
|
|
80
74
|
@entries ||=
|
|
81
75
|
Utils.safe_glob(collection_dir, ["**", "*"]).map do |entry|
|
|
82
|
-
entry["#{collection_dir}/"] =
|
|
76
|
+
entry["#{collection_dir}/"] = ""
|
|
83
77
|
entry
|
|
84
78
|
end
|
|
85
79
|
end
|
|
@@ -161,7 +155,7 @@ module Bunto
|
|
|
161
155
|
#
|
|
162
156
|
# Returns a sanitized version of the label.
|
|
163
157
|
def sanitize_label(label)
|
|
164
|
-
label.gsub(
|
|
158
|
+
label.gsub(%r![^a-z0-9_\-\.]!i, "")
|
|
165
159
|
end
|
|
166
160
|
|
|
167
161
|
# Produce a representation of this Collection for use in Liquid.
|
|
@@ -179,14 +173,14 @@ module Bunto
|
|
|
179
173
|
#
|
|
180
174
|
# Returns true if the 'write' metadata is true, false otherwise.
|
|
181
175
|
def write?
|
|
182
|
-
!!metadata.fetch(
|
|
176
|
+
!!metadata.fetch("output", false)
|
|
183
177
|
end
|
|
184
178
|
|
|
185
179
|
# The URL template to render collection's documents at.
|
|
186
180
|
#
|
|
187
181
|
# Returns the URL template to render collection's documents at.
|
|
188
182
|
def url_template
|
|
189
|
-
@url_template ||= metadata.fetch(
|
|
183
|
+
@url_template ||= metadata.fetch("permalink") do
|
|
190
184
|
Utils.add_permalink_suffix("/:collection/:path", site.permalink_style)
|
|
191
185
|
end
|
|
192
186
|
end
|
|
@@ -195,11 +189,33 @@ module Bunto
|
|
|
195
189
|
#
|
|
196
190
|
# Returns the metadata for this collection
|
|
197
191
|
def extract_metadata
|
|
198
|
-
if site.config[
|
|
199
|
-
site.config[
|
|
192
|
+
if site.config["collections"].is_a?(Hash)
|
|
193
|
+
site.config["collections"][label] || {}
|
|
200
194
|
else
|
|
201
195
|
{}
|
|
202
196
|
end
|
|
203
197
|
end
|
|
198
|
+
|
|
199
|
+
private
|
|
200
|
+
def read_document(full_path)
|
|
201
|
+
doc = Bunto::Document.new(full_path, :site => site, :collection => self)
|
|
202
|
+
doc.read
|
|
203
|
+
if site.publisher.publish?(doc) || !write?
|
|
204
|
+
docs << doc
|
|
205
|
+
else
|
|
206
|
+
Bunto.logger.debug "Skipped From Publishing:", doc.relative_path
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
private
|
|
211
|
+
def read_static_file(file_path, full_path)
|
|
212
|
+
relative_dir = Bunto.sanitized_path(
|
|
213
|
+
relative_directory,
|
|
214
|
+
File.dirname(file_path)
|
|
215
|
+
).chomp("/.")
|
|
216
|
+
|
|
217
|
+
files << StaticFile.new(site, site.source, relative_dir,
|
|
218
|
+
File.basename(full_path), self)
|
|
219
|
+
end
|
|
204
220
|
end
|
|
205
221
|
end
|
data/lib/bunto/command.rb
CHANGED
|
@@ -46,19 +46,25 @@ module Bunto
|
|
|
46
46
|
#
|
|
47
47
|
# Returns nothing
|
|
48
48
|
def add_build_options(c)
|
|
49
|
-
c.option
|
|
50
|
-
|
|
51
|
-
c.option
|
|
52
|
-
|
|
53
|
-
c.option
|
|
54
|
-
c.option
|
|
55
|
-
c.option
|
|
56
|
-
|
|
57
|
-
c.option
|
|
58
|
-
c.option
|
|
59
|
-
|
|
60
|
-
c.option
|
|
61
|
-
c.option
|
|
49
|
+
c.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]",
|
|
50
|
+
Array, "Custom configuration file"
|
|
51
|
+
c.option "destination", "-d", "--destination DESTINATION",
|
|
52
|
+
"The current folder will be generated into DESTINATION"
|
|
53
|
+
c.option "source", "-s", "--source SOURCE", "Custom source directory"
|
|
54
|
+
c.option "future", "--future", "Publishes posts with a future date"
|
|
55
|
+
c.option "limit_posts", "--limit_posts MAX_POSTS", Integer,
|
|
56
|
+
"Limits the number of posts to parse and publish"
|
|
57
|
+
c.option "watch", "-w", "--[no-]watch", "Watch for changes and rebuild"
|
|
58
|
+
c.option "baseurl", "-b", "--baseurl URL",
|
|
59
|
+
"Serve the website from the given base URL"
|
|
60
|
+
c.option "force_polling", "--force_polling", "Force watch to use polling"
|
|
61
|
+
c.option "lsi", "--lsi", "Use LSI for improved related posts"
|
|
62
|
+
c.option "show_drafts", "-D", "--drafts", "Render posts in the _drafts folder"
|
|
63
|
+
c.option "unpublished", "--unpublished",
|
|
64
|
+
"Render posts that were marked as unpublished"
|
|
65
|
+
c.option "quiet", "-q", "--quiet", "Silence output."
|
|
66
|
+
c.option "verbose", "-V", "--verbose", "Print verbose output."
|
|
67
|
+
c.option "incremental", "-I", "--incremental", "Enable incremental rebuild."
|
|
62
68
|
end
|
|
63
69
|
end
|
|
64
70
|
end
|
data/lib/bunto/commands/build.rb
CHANGED
|
@@ -5,8 +5,8 @@ module Bunto
|
|
|
5
5
|
# Create the Mercenary command for the Bunto CLI for this Command
|
|
6
6
|
def init_with_program(prog)
|
|
7
7
|
prog.command(:build) do |c|
|
|
8
|
-
c.syntax
|
|
9
|
-
c.description
|
|
8
|
+
c.syntax "build [options]"
|
|
9
|
+
c.description "Build your site"
|
|
10
10
|
c.alias :b
|
|
11
11
|
|
|
12
12
|
add_build_options(c)
|
|
@@ -27,15 +27,17 @@ module Bunto
|
|
|
27
27
|
options = configuration_from_options(options)
|
|
28
28
|
site = Bunto::Site.new(options)
|
|
29
29
|
|
|
30
|
-
if options.fetch(
|
|
31
|
-
Bunto.logger.warn "Build Warning:", "Skipping the initial build.
|
|
30
|
+
if options.fetch("skip_initial_build", false)
|
|
31
|
+
Bunto.logger.warn "Build Warning:", "Skipping the initial build." \
|
|
32
|
+
" This may result in an out-of-date site."
|
|
32
33
|
else
|
|
33
34
|
build(site, options)
|
|
34
35
|
end
|
|
35
36
|
|
|
36
|
-
if options.fetch(
|
|
37
|
-
Bunto.logger.info "Auto-regeneration:",
|
|
38
|
-
|
|
37
|
+
if options.fetch("detach", false)
|
|
38
|
+
Bunto.logger.info "Auto-regeneration:",
|
|
39
|
+
"disabled when running server detached."
|
|
40
|
+
elsif options.fetch("watch", false)
|
|
39
41
|
watch(site, options)
|
|
40
42
|
else
|
|
41
43
|
Bunto.logger.info "Auto-regeneration:", "disabled. Use --watch to enable."
|
|
@@ -50,12 +52,13 @@ module Bunto
|
|
|
50
52
|
# Returns nothing.
|
|
51
53
|
def build(site, options)
|
|
52
54
|
t = Time.now
|
|
53
|
-
source = options[
|
|
54
|
-
destination = options[
|
|
55
|
-
incremental = options[
|
|
55
|
+
source = options["source"]
|
|
56
|
+
destination = options["destination"]
|
|
57
|
+
incremental = options["incremental"]
|
|
56
58
|
Bunto.logger.info "Source:", source
|
|
57
59
|
Bunto.logger.info "Destination:", destination
|
|
58
|
-
Bunto.logger.info "Incremental build:",
|
|
60
|
+
Bunto.logger.info "Incremental build:",
|
|
61
|
+
(incremental ? "enabled" : "disabled. Enable with --incremental")
|
|
59
62
|
Bunto.logger.info "Generating..."
|
|
60
63
|
process_site(site)
|
|
61
64
|
Bunto.logger.info "", "done in #{(Time.now - t).round(3)} seconds."
|
|
@@ -67,9 +70,14 @@ module Bunto
|
|
|
67
70
|
# options - A Hash of options passed to the command
|
|
68
71
|
#
|
|
69
72
|
# Returns nothing.
|
|
70
|
-
def watch(
|
|
71
|
-
External.require_with_graceful_fail
|
|
72
|
-
Bunto::Watcher.watch
|
|
73
|
+
def watch(site, options)
|
|
74
|
+
External.require_with_graceful_fail "bunto-watch"
|
|
75
|
+
watch_method = Bunto::Watcher.method(:watch)
|
|
76
|
+
if watch_method.parameters.size == 1
|
|
77
|
+
watch_method.call(options)
|
|
78
|
+
else
|
|
79
|
+
watch_method.call(options, site)
|
|
80
|
+
end
|
|
73
81
|
end
|
|
74
82
|
end # end of class << self
|
|
75
83
|
end
|
data/lib/bunto/commands/clean.rb
CHANGED
|
@@ -4,8 +4,9 @@ module Bunto
|
|
|
4
4
|
class << self
|
|
5
5
|
def init_with_program(prog)
|
|
6
6
|
prog.command(:clean) do |c|
|
|
7
|
-
c.syntax
|
|
8
|
-
c.description
|
|
7
|
+
c.syntax "clean [subcommand]"
|
|
8
|
+
c.description "Clean the site " \
|
|
9
|
+
"(removes site output and metadata file) without building."
|
|
9
10
|
|
|
10
11
|
add_build_options(c)
|
|
11
12
|
|
|
@@ -17,13 +18,13 @@ module Bunto
|
|
|
17
18
|
|
|
18
19
|
def process(options)
|
|
19
20
|
options = configuration_from_options(options)
|
|
20
|
-
destination = options[
|
|
21
|
-
metadata_file = File.join(options[
|
|
22
|
-
sass_cache = File.join(options[
|
|
21
|
+
destination = options["destination"]
|
|
22
|
+
metadata_file = File.join(options["source"], ".bunto-metadata")
|
|
23
|
+
sass_cache = File.join(options["source"], ".sass-cache")
|
|
23
24
|
|
|
24
|
-
remove(destination, checker_func
|
|
25
|
-
remove(metadata_file, checker_func
|
|
26
|
-
remove(sass_cache, checker_func
|
|
25
|
+
remove(destination, :checker_func => :directory?)
|
|
26
|
+
remove(metadata_file, :checker_func => :file?)
|
|
27
|
+
remove(sass_cache, :checker_func => :directory?)
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
def remove(filename, checker_func: :file?)
|
|
@@ -4,11 +4,12 @@ module Bunto
|
|
|
4
4
|
class << self
|
|
5
5
|
def init_with_program(prog)
|
|
6
6
|
prog.command(:doctor) do |c|
|
|
7
|
-
c.syntax
|
|
8
|
-
c.description
|
|
7
|
+
c.syntax "doctor"
|
|
8
|
+
c.description "Search site and print specific deprecation warnings"
|
|
9
9
|
c.alias(:hyde)
|
|
10
10
|
|
|
11
|
-
c.option
|
|
11
|
+
c.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]", Array,
|
|
12
|
+
"Custom configuration file"
|
|
12
13
|
|
|
13
14
|
c.action do |_, options|
|
|
14
15
|
Bunto::Commands::Doctor.process(options)
|
|
@@ -18,7 +19,9 @@ module Bunto
|
|
|
18
19
|
|
|
19
20
|
def process(options)
|
|
20
21
|
site = Bunto::Site.new(configuration_from_options(options))
|
|
22
|
+
site.reset
|
|
21
23
|
site.read
|
|
24
|
+
site.generate
|
|
22
25
|
|
|
23
26
|
if healthy?(site)
|
|
24
27
|
Bunto.logger.info "Your test results", "are in. Everything looks fine."
|
|
@@ -37,7 +40,7 @@ module Bunto
|
|
|
37
40
|
end
|
|
38
41
|
|
|
39
42
|
def deprecated_relative_permalinks(site)
|
|
40
|
-
if site.config[
|
|
43
|
+
if site.config["relative_permalinks"]
|
|
41
44
|
Bunto::Deprecator.deprecation_message "Your site still uses relative" \
|
|
42
45
|
" permalinks, which was removed in" \
|
|
43
46
|
" Bunto v3.0.0."
|
|
@@ -62,7 +65,7 @@ module Bunto
|
|
|
62
65
|
def fsnotify_buggy?(_site)
|
|
63
66
|
return true unless Utils::Platforms.osx?
|
|
64
67
|
if Dir.pwd != `pwd`.strip
|
|
65
|
-
Bunto.logger.error " " + <<-STR.strip.gsub(
|
|
68
|
+
Bunto.logger.error " " + <<-STR.strip.gsub(%r!\n\s+!, "\n ")
|
|
66
69
|
We have detected that there might be trouble using fsevent on your
|
|
67
70
|
operating system, you can read https://github.com/thibaudgg/rb-fsevent/wiki/no-fsevents-fired-(OSX-bug)
|
|
68
71
|
for possible work arounds or you can work around it immediately
|
|
@@ -78,7 +81,7 @@ module Bunto
|
|
|
78
81
|
def urls_only_differ_by_case(site)
|
|
79
82
|
urls_only_differ_by_case = false
|
|
80
83
|
urls = case_insensitive_urls(site.pages + site.docs_to_write, site.dest)
|
|
81
|
-
urls.each do |
|
|
84
|
+
urls.each do |_case_insensitive_url, real_urls|
|
|
82
85
|
next unless real_urls.uniq.size > 1
|
|
83
86
|
urls_only_differ_by_case = true
|
|
84
87
|
Bunto.logger.warn "Warning:", "The following URLs only differ" \
|
|
@@ -102,10 +105,9 @@ module Bunto
|
|
|
102
105
|
end
|
|
103
106
|
|
|
104
107
|
def case_insensitive_urls(things, destination)
|
|
105
|
-
things.
|
|
108
|
+
things.each_with_object({}) do |thing, memo|
|
|
106
109
|
dest = thing.destination(destination)
|
|
107
110
|
(memo[dest.downcase] ||= []) << dest
|
|
108
|
-
memo
|
|
109
111
|
end
|
|
110
112
|
end
|
|
111
113
|
end
|
data/lib/bunto/commands/help.rb
CHANGED
|
@@ -4,8 +4,8 @@ module Bunto
|
|
|
4
4
|
class << self
|
|
5
5
|
def init_with_program(prog)
|
|
6
6
|
prog.command(:help) do |c|
|
|
7
|
-
c.syntax
|
|
8
|
-
c.description
|
|
7
|
+
c.syntax "help [subcommand]"
|
|
8
|
+
c.description "Show the help message, optionally for a given subcommand."
|
|
9
9
|
|
|
10
10
|
c.action do |args, _|
|
|
11
11
|
cmd = (args.first || "").to_sym
|
|
@@ -22,7 +22,8 @@ module Bunto
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def invalid_command(prog, cmd)
|
|
25
|
-
Bunto.logger.error "Error:",
|
|
25
|
+
Bunto.logger.error "Error:",
|
|
26
|
+
"Hmm... we don't know what the '#{cmd}' command is."
|
|
26
27
|
Bunto.logger.info "Valid commands:", prog.commands.keys.join(", ")
|
|
27
28
|
end
|
|
28
29
|
end
|
data/lib/bunto/commands/new.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "erb"
|
|
2
2
|
|
|
3
3
|
module Bunto
|
|
4
4
|
module Commands
|
|
@@ -6,11 +6,11 @@ module Bunto
|
|
|
6
6
|
class << self
|
|
7
7
|
def init_with_program(prog)
|
|
8
8
|
prog.command(:new) do |c|
|
|
9
|
-
c.syntax
|
|
10
|
-
c.description
|
|
9
|
+
c.syntax "new PATH"
|
|
10
|
+
c.description "Creates a new Bunto site scaffold in PATH"
|
|
11
11
|
|
|
12
|
-
c.option
|
|
13
|
-
c.option
|
|
12
|
+
c.option "force", "--force", "Force creation even if PATH already exists"
|
|
13
|
+
c.option "blank", "--blank", "Creates scaffolding but with empty files"
|
|
14
14
|
|
|
15
15
|
c.action do |args, options|
|
|
16
16
|
Bunto::Commands::New.process(args, options)
|
|
@@ -19,26 +19,19 @@ module Bunto
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def process(args, options = {})
|
|
22
|
-
raise ArgumentError
|
|
22
|
+
raise ArgumentError, "You must specify a path." if args.empty?
|
|
23
23
|
|
|
24
24
|
new_blog_path = File.expand_path(args.join(" "), Dir.pwd)
|
|
25
25
|
FileUtils.mkdir_p new_blog_path
|
|
26
26
|
if preserve_source_location?(new_blog_path, options)
|
|
27
|
-
Bunto.logger.abort_with "Conflict:",
|
|
27
|
+
Bunto.logger.abort_with "Conflict:",
|
|
28
|
+
"#{new_blog_path} exists and is not empty."
|
|
28
29
|
end
|
|
29
30
|
|
|
30
31
|
if options["blank"]
|
|
31
32
|
create_blank_site new_blog_path
|
|
32
33
|
else
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
File.open(File.expand_path(initialized_post_name, new_blog_path), "w") do |f|
|
|
36
|
-
f.write(scaffold_post_content)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
File.open(File.expand_path("Gemfile", new_blog_path), "w") do |f|
|
|
40
|
-
f.write(gemfile_contents)
|
|
41
|
-
end
|
|
34
|
+
create_site new_blog_path
|
|
42
35
|
end
|
|
43
36
|
|
|
44
37
|
Bunto.logger.info "New bunto site installed in #{new_blog_path}."
|
|
@@ -59,15 +52,16 @@ module Bunto
|
|
|
59
52
|
#
|
|
60
53
|
# Returns the filename of the sample post, as a String
|
|
61
54
|
def initialized_post_name
|
|
62
|
-
"_posts/#{Time.now.strftime(
|
|
55
|
+
"_posts/#{Time.now.strftime("%Y-%m-%d")}-welcome-to-bunto.markdown"
|
|
63
56
|
end
|
|
64
57
|
|
|
65
58
|
private
|
|
66
|
-
|
|
59
|
+
|
|
67
60
|
def gemfile_contents
|
|
68
61
|
<<-RUBY
|
|
69
62
|
source "https://rubygems.org"
|
|
70
|
-
|
|
63
|
+
ruby RUBY_VERSION
|
|
64
|
+
|
|
71
65
|
# Hello! This is where you manage which Bunto version is used to run.
|
|
72
66
|
# When you want to use a different version, change it below, save the
|
|
73
67
|
# file and run `bundle install`. Run Bunto with `bundle exec`, like so:
|
|
@@ -78,10 +72,13 @@ source "https://rubygems.org"
|
|
|
78
72
|
# Happy Buntoing!
|
|
79
73
|
gem "bunto", "#{Bunto::VERSION}"
|
|
80
74
|
|
|
75
|
+
# This is the default theme for new Bunto sites. You may change this to anything you like.
|
|
76
|
+
gem "minima"
|
|
77
|
+
|
|
81
78
|
# If you want to use GitHub Pages, remove the "gem "bunto"" above and
|
|
82
79
|
# uncomment the line below. To upgrade, run `bundle update github-pages`.
|
|
83
80
|
# gem "github-pages", group: :bunto_plugins
|
|
84
|
-
|
|
81
|
+
|
|
85
82
|
# If you have any plugins, put them here!
|
|
86
83
|
# group :bunto_plugins do
|
|
87
84
|
# gem "bunto-github-metadata", "~> 1.0"
|
|
@@ -89,12 +86,24 @@ gem "bunto", "#{Bunto::VERSION}"
|
|
|
89
86
|
RUBY
|
|
90
87
|
end
|
|
91
88
|
|
|
89
|
+
def create_site(new_blog_path)
|
|
90
|
+
create_sample_files new_blog_path
|
|
91
|
+
|
|
92
|
+
File.open(File.expand_path(initialized_post_name, new_blog_path), "w") do |f|
|
|
93
|
+
f.write(scaffold_post_content)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
File.open(File.expand_path("Gemfile", new_blog_path), "w") do |f|
|
|
97
|
+
f.write(gemfile_contents)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
92
101
|
def preserve_source_location?(path, options)
|
|
93
102
|
!options["force"] && !Dir["#{path}/**/*"].empty?
|
|
94
103
|
end
|
|
95
104
|
|
|
96
105
|
def create_sample_files(path)
|
|
97
|
-
FileUtils.cp_r site_template +
|
|
106
|
+
FileUtils.cp_r site_template + "/.", path
|
|
98
107
|
FileUtils.rm File.expand_path(scaffold_path, path)
|
|
99
108
|
end
|
|
100
109
|
|