bridgetown-core 0.12.0 → 0.15.0.beta1

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.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -1
  3. data/bin/bridgetown +9 -48
  4. data/bridgetown-core.gemspec +10 -5
  5. data/lib/bridgetown-core.rb +20 -4
  6. data/lib/bridgetown-core/cleaner.rb +1 -0
  7. data/lib/bridgetown-core/commands/apply.rb +73 -0
  8. data/lib/bridgetown-core/commands/base.rb +45 -0
  9. data/lib/bridgetown-core/commands/build.rb +91 -86
  10. data/lib/bridgetown-core/commands/clean.rb +30 -29
  11. data/lib/bridgetown-core/commands/concerns/actions.rb +95 -0
  12. data/lib/bridgetown-core/commands/concerns/build_options.rb +76 -0
  13. data/lib/bridgetown-core/commands/concerns/configuration_overridable.rb +18 -0
  14. data/lib/bridgetown-core/commands/concerns/summarizable.rb +13 -0
  15. data/lib/bridgetown-core/commands/console.rb +46 -38
  16. data/lib/bridgetown-core/commands/doctor.rb +125 -135
  17. data/lib/bridgetown-core/commands/new.rb +120 -158
  18. data/lib/bridgetown-core/commands/plugins.rb +206 -0
  19. data/lib/bridgetown-core/commands/registrations.rb +16 -0
  20. data/lib/bridgetown-core/commands/serve.rb +214 -217
  21. data/lib/bridgetown-core/{convertible.rb → concerns/convertible.rb} +2 -2
  22. data/lib/bridgetown-core/concerns/site/configurable.rb +153 -0
  23. data/lib/bridgetown-core/concerns/site/content.rb +111 -0
  24. data/lib/bridgetown-core/concerns/site/extensible.rb +56 -0
  25. data/lib/bridgetown-core/concerns/site/processable.rb +74 -0
  26. data/lib/bridgetown-core/concerns/site/renderable.rb +50 -0
  27. data/lib/bridgetown-core/concerns/site/writable.rb +31 -0
  28. data/lib/bridgetown-core/configuration.rb +98 -108
  29. data/lib/bridgetown-core/converters/markdown/kramdown_parser.rb +0 -3
  30. data/lib/bridgetown-core/document.rb +1 -1
  31. data/lib/bridgetown-core/drops/bridgetown_drop.rb +6 -1
  32. data/lib/bridgetown-core/drops/site_drop.rb +1 -2
  33. data/lib/bridgetown-core/external.rb +17 -21
  34. data/lib/bridgetown-core/filters.rb +10 -0
  35. data/lib/bridgetown-core/generators/prototype_generator.rb +3 -1
  36. data/lib/bridgetown-core/hooks.rb +62 -62
  37. data/lib/bridgetown-core/layout.rb +10 -4
  38. data/lib/bridgetown-core/liquid_renderer.rb +2 -0
  39. data/lib/bridgetown-core/liquid_renderer/file_system.rb +5 -1
  40. data/lib/bridgetown-core/page.rb +9 -2
  41. data/lib/bridgetown-core/plugin.rb +2 -0
  42. data/lib/bridgetown-core/plugin_manager.rb +68 -14
  43. data/lib/bridgetown-core/reader.rb +5 -0
  44. data/lib/bridgetown-core/readers/data_reader.rb +15 -2
  45. data/lib/bridgetown-core/readers/layout_reader.rb +9 -2
  46. data/lib/bridgetown-core/readers/plugin_content_reader.rb +48 -0
  47. data/lib/bridgetown-core/renderer.rb +51 -32
  48. data/lib/bridgetown-core/site.rb +20 -449
  49. data/lib/bridgetown-core/static_file.rb +1 -5
  50. data/lib/bridgetown-core/tags/include.rb +12 -0
  51. data/lib/bridgetown-core/tags/render_content.rb +27 -16
  52. data/lib/bridgetown-core/tags/with.rb +15 -0
  53. data/lib/bridgetown-core/utils.rb +2 -27
  54. data/lib/bridgetown-core/utils/ruby_exec.rb +66 -0
  55. data/lib/bridgetown-core/version.rb +2 -2
  56. data/lib/bridgetown-core/watcher.rb +21 -10
  57. data/lib/site_template/Gemfile.erb +19 -0
  58. data/lib/site_template/plugins/{.keep → builders/.keep} +0 -0
  59. data/lib/site_template/plugins/site_builder.rb +4 -0
  60. data/lib/site_template/src/_components/footer.html +3 -0
  61. data/lib/site_template/src/_components/head.html +9 -0
  62. data/lib/site_template/src/{_includes → _components}/navbar.html +1 -0
  63. data/lib/site_template/src/_layouts/default.html +3 -3
  64. data/lib/site_template/src/{_components/.keep → favicon.ico} +0 -0
  65. data/lib/site_template/src/posts.md +15 -0
  66. data/lib/site_template/start.js +1 -1
  67. metadata +107 -19
  68. data/lib/bridgetown-core/command.rb +0 -106
  69. data/lib/bridgetown-core/commands/help.rb +0 -34
  70. data/lib/site_template/src/_includes/footer.html +0 -3
  71. data/lib/site_template/src/_includes/head.html +0 -9
@@ -2,40 +2,41 @@
2
2
 
3
3
  module Bridgetown
4
4
  module Commands
5
- class Clean < Command
6
- class << self
7
- def init_with_program(prog)
8
- prog.command(:clean) do |c|
9
- c.syntax "clean [subcommand]"
10
- c.description "Clean the site " \
11
- "(removes site output and metadata file) without building."
5
+ class Clean < Thor::Group
6
+ extend BuildOptions
7
+ extend Summarizable
8
+ include ConfigurationOverridable
12
9
 
13
- add_build_options(c)
10
+ Registrations.register do
11
+ register(Clean, "clean", "clean", Clean.summary)
12
+ end
14
13
 
15
- c.action do |_, options|
16
- Bridgetown::Commands::Clean.process(options)
17
- end
18
- end
19
- end
14
+ def self.banner
15
+ "bridgetown clean [options]"
16
+ end
17
+ summary "Clean the site (removes site output and metadata file) without building"
20
18
 
21
- def process(options)
22
- options = configuration_from_options(options)
23
- destination = options["destination"]
24
- metadata_file = File.join(options["source"], ".bridgetown-metadata")
25
- cache_dir = File.join(options["source"], options["cache_dir"])
19
+ def clean
20
+ config = configuration_with_overrides(options)
21
+ destination = config["destination"]
22
+ metadata_file = File.join(config["root_dir"], ".bridgetown-metadata")
23
+ cache_dir = File.join(config["root_dir"], config["cache_dir"])
24
+ webpack_dir = File.join(config["root_dir"], ".bridgetown-webpack")
26
25
 
27
- remove(destination, checker_func: :directory?)
28
- remove(metadata_file, checker_func: :file?)
29
- remove(cache_dir, checker_func: :directory?)
30
- end
26
+ remove(destination, checker_func: :directory?)
27
+ remove(metadata_file, checker_func: :file?)
28
+ remove(cache_dir, checker_func: :directory?)
29
+ remove(webpack_dir, checker_func: :directory?)
30
+ end
31
+
32
+ protected
31
33
 
32
- def remove(filename, checker_func: :file?)
33
- if File.public_send(checker_func, filename)
34
- Bridgetown.logger.info "Cleaner:", "Removing #{filename}..."
35
- FileUtils.rm_rf(filename)
36
- else
37
- Bridgetown.logger.info "Cleaner:", "Nothing to do for #{filename}."
38
- end
34
+ def remove(filename, checker_func: :file?)
35
+ if File.public_send(checker_func, filename)
36
+ Bridgetown.logger.info "Cleaner:", "Removing #{filename}..."
37
+ FileUtils.rm_rf(filename)
38
+ else
39
+ Bridgetown.logger.info "Cleaner:", "Nothing to do for #{filename}."
39
40
  end
40
41
  end
41
42
  end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Mostly not used here, but may come in handy in new automations
4
+ require "active_support/core_ext/array/extract_options"
5
+ require "active_support/core_ext/string/strip"
6
+ require "active_support/core_ext/string/indent"
7
+
8
+ module Bridgetown
9
+ module Commands
10
+ module Actions
11
+ def create_builder(filename, data = nil)
12
+ say_status :create_builder, filename
13
+ data ||= yield if block_given?
14
+ create_file("plugins/builders/#{filename}", data, verbose: false)
15
+ end
16
+
17
+ def javascript_import(data = nil, filename: "index.js")
18
+ data ||= yield if block_given?
19
+ data += "\n" unless data.chars.last == "\n"
20
+
21
+ say_status :javascript_import, filename
22
+
23
+ js_index = File.join("frontend", "javascript", filename)
24
+ if File.exist?(js_index)
25
+ index_file = File.read(js_index)
26
+
27
+ last_import = ""
28
+ index_file.each_line do |line|
29
+ line.start_with?("import ") ? last_import = line : break
30
+ end
31
+
32
+ if last_import == ""
33
+ # add to top of file
34
+ prepend_file js_index, data, verbose: false
35
+ else
36
+ # inject after the last import line
37
+ inject_into_file js_index, data, after: last_import, verbose: false, force: false
38
+ end
39
+ else
40
+ create_file(js_index, data, verbose: false)
41
+ end
42
+ end
43
+
44
+ def add_bridgetown_plugin(gemname, version: nil)
45
+ version = " -v \"#{version}\"" if version
46
+ run "bundle add #{gemname}#{version} -g bridgetown_plugins"
47
+ rescue SystemExit
48
+ say_status :run, "Gem not added due to bundler error", :red
49
+ end
50
+
51
+ def add_yarn_for_gem(gemname)
52
+ say_status :add_yarn, gemname
53
+
54
+ Bundler.reset!
55
+ available_gems = Bundler.setup Bridgetown::PluginManager::PLUGINS_GROUP
56
+ Bridgetown::PluginManager.install_yarn_dependencies(
57
+ available_gems.requested_specs, gemname
58
+ )
59
+ rescue SystemExit
60
+ say_status :add_yarn, "Package not added due to yarn error", :red
61
+ end
62
+
63
+ def apply_from_url(url)
64
+ apply transform_automation_url(url.dup)
65
+ end
66
+
67
+ private
68
+
69
+ def transform_automation_url(arg)
70
+ remote_file = if arg.end_with?(".rb")
71
+ arg.split("/").yield_self do |segments|
72
+ arg.sub!(%r!/#{segments.last}$!, "")
73
+ segments.last
74
+ end
75
+ else
76
+ "bridgetown.automation.rb"
77
+ end
78
+
79
+ if arg.start_with?("https://gist.github.com")
80
+ return arg.sub(
81
+ "https://gist.github.com", "https://gist.githubusercontent.com"
82
+ ) + "/raw/#{remote_file}"
83
+ elsif arg.start_with?("https://github.com")
84
+ return arg.sub(
85
+ "https://github.com", "https://raw.githubusercontent.com"
86
+ ) + "/master/#{remote_file}"
87
+ end
88
+
89
+ # TODO: option to download and confirm remote automation?
90
+
91
+ arg
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bridgetown
4
+ module Commands
5
+ module BuildOptions
6
+ def self.extended(klass)
7
+ klass.class_option :trace,
8
+ type: :boolean,
9
+ aliases: "-t",
10
+ desc: "Show the full backtrace when an error occurs during watch mode"
11
+
12
+ klass.class_option :config,
13
+ type: :array,
14
+ banner: "FILE1 FILE2",
15
+ desc: "Custom configuration file(s)"
16
+ klass.class_option :source,
17
+ aliases: "-s",
18
+ desc: "Source directory (defaults to src)"
19
+ klass.class_option :destination,
20
+ aliases: "-d",
21
+ desc: "Destination directory (defaults to output)"
22
+ klass.class_option :root_dir,
23
+ aliases: "-r",
24
+ desc: "The top-level root folder" \
25
+ " where config files are located"
26
+ klass.class_option :plugins_dir,
27
+ aliases: "-p",
28
+ type: :array,
29
+ banner: "DIR1 DIR2",
30
+ desc: "Plugins directory (defaults to plugins)"
31
+ klass.class_option :layouts_dir,
32
+ desc: "Layouts directory (defaults to src/_layouts)"
33
+ klass.class_option :future,
34
+ type: :boolean,
35
+ desc: "Publishes posts with a future date"
36
+ klass.class_option :limit_posts,
37
+ type: :numeric,
38
+ desc: "Limits the number of posts to parse and publish"
39
+ klass.class_option :baseurl,
40
+ aliases: "-b",
41
+ desc: "Serve the website from the given base URL"
42
+ klass.class_option :force_polling,
43
+ type: :boolean,
44
+ desc: "Force watch to use polling"
45
+ klass.class_option :lsi,
46
+ type: :boolean,
47
+ desc: "Use LSI for improved related posts"
48
+ klass.class_option :unpublished,
49
+ type: :boolean,
50
+ aliases: "-U",
51
+ desc: "Render posts that were marked as unpublished"
52
+ klass.class_option :disable_disk_cache,
53
+ type: :boolean,
54
+ desc: "Disable caching to disk"
55
+ klass.class_option :profile,
56
+ type: :boolean,
57
+ desc: "Generate a Liquid rendering profile"
58
+ klass.class_option :quiet,
59
+ aliases: "-q",
60
+ type: :boolean,
61
+ desc: "Silence output."
62
+ klass.class_option :verbose,
63
+ aliases: "-V",
64
+ type: :boolean,
65
+ desc: "Print verbose output."
66
+ klass.class_option :incremental,
67
+ aliases: "-I",
68
+ type: :boolean,
69
+ desc: "Enable incremental rebuild."
70
+ klass.class_option :strict_front_matter,
71
+ type: :boolean,
72
+ desc: "Fail if errors are present in front matter"
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bridgetown
4
+ module Commands
5
+ module ConfigurationOverridable
6
+ # Create a full Bridgetown configuration with the options passed in as overrides
7
+ #
8
+ # options - the configuration overrides
9
+ #
10
+ # Returns a full Bridgetown configuration
11
+ def configuration_with_overrides(options)
12
+ return options if options.is_a?(Bridgetown::Configuration)
13
+
14
+ Bridgetown.configuration(options)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bridgetown
4
+ module Commands
5
+ module Summarizable
6
+ def summary(description = nil)
7
+ return @desc.split("\n").last.strip unless description
8
+
9
+ desc "Description:\n #{description}"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -4,53 +4,61 @@ require "irb"
4
4
 
5
5
  module Bridgetown
6
6
  module Commands
7
- class Console < Command
8
- class << self
9
- def init_with_program(prog)
10
- prog.command(:console) do |c|
11
- c.syntax "console"
12
- c.description "Invoke an IRB console with the site loaded"
13
- c.alias :c
14
-
15
- c.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]", Array,
16
- "Custom configuration file"
17
-
18
- c.action do |_, options|
19
- Bridgetown::Commands::Console.process(options)
20
- end
21
- end
22
- end
7
+ class Console < Thor::Group
8
+ extend Summarizable
9
+ include ConfigurationOverridable
10
+
11
+ Registrations.register do
12
+ register(Console, "console", "console", Console.summary)
13
+ end
14
+
15
+ def self.banner
16
+ "bridgetown console [options]"
17
+ end
18
+ summary "Invoke an IRB console with the site loaded"
23
19
 
24
- # TODO: is there a way to add a unit test for this command?
25
- # rubocop:disable Style/GlobalVars, Metrics/AbcSize, Metrics/MethodLength
26
- def process(options)
27
- Bridgetown.logger.info "Starting:", "Bridgetown v#{Bridgetown::VERSION}" \
28
- " (codename \"#{Bridgetown::CODE_NAME}\")" \
29
- " console…"
30
- site = Bridgetown::Site.new(configuration_from_options(options))
20
+ class_option :config,
21
+ type: :array,
22
+ banner: "FILE1 FILE2",
23
+ desc: "Custom configuration file(s)"
24
+ class_option :blank,
25
+ type: :boolean,
26
+ desc: "Skip reading content and running generators before opening console"
27
+
28
+ def console
29
+ Bridgetown.logger.info "Starting:", "Bridgetown v#{Bridgetown::VERSION.magenta}" \
30
+ " (codename \"#{Bridgetown::CODE_NAME.yellow}\")" \
31
+ " console…"
32
+ Bridgetown.logger.info "Environment:", Bridgetown.environment.cyan
33
+ site = Bridgetown::Site.new(configuration_with_overrides(options))
34
+
35
+ unless options[:blank]
31
36
  site.reset
37
+ Bridgetown.logger.info "Reading files..."
32
38
  site.read
39
+ Bridgetown.logger.info "", "done!"
40
+ Bridgetown.logger.info "Running generators..."
33
41
  site.generate
42
+ Bridgetown.logger.info "", "done!"
43
+ end
34
44
 
35
- $BRIDGETOWN_SITE = site
36
- IRB.setup(nil)
37
- workspace = IRB::WorkSpace.new
38
- irb = IRB::Irb.new(workspace)
39
- IRB.conf[:MAIN_CONTEXT] = irb.context
40
- eval("site = $BRIDGETOWN_SITE", workspace.binding, __FILE__, __LINE__)
41
- Bridgetown.logger.info "Console:", "Now loaded as " + "site".cyan + " variable."
45
+ $BRIDGETOWN_SITE = site
46
+ IRB.setup(nil)
47
+ workspace = IRB::WorkSpace.new
48
+ irb = IRB::Irb.new(workspace)
49
+ IRB.conf[:MAIN_CONTEXT] = irb.context
50
+ eval("site = $BRIDGETOWN_SITE", workspace.binding, __FILE__, __LINE__)
51
+ Bridgetown.logger.info "Console:", "Now loaded as " + "site".cyan + " variable."
42
52
 
43
- trap("SIGINT") do
44
- irb.signal_handle
45
- end
53
+ trap("SIGINT") do
54
+ irb.signal_handle
55
+ end
46
56
 
47
- begin
48
- catch(:IRB_EXIT) do
49
- irb.eval_input
50
- end
57
+ begin
58
+ catch(:IRB_EXIT) do
59
+ irb.eval_input
51
60
  end
52
61
  end
53
- # rubocop:enable Style/GlobalVars, Metrics/AbcSize, Metrics/MethodLength
54
62
  end
55
63
  end
56
64
  end
@@ -2,170 +2,160 @@
2
2
 
3
3
  module Bridgetown
4
4
  module Commands
5
- class Doctor < Command
6
- class << self
7
- def init_with_program(prog)
8
- prog.command(:doctor) do |c|
9
- c.syntax "doctor"
10
- c.description "Search site and print specific deprecation warnings"
11
-
12
- c.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]", Array,
13
- "Custom configuration file"
14
-
15
- c.action do |_, options|
16
- Bridgetown::Commands::Doctor.process(options)
17
- end
18
- end
19
- end
5
+ class Doctor < Thor::Group
6
+ extend BuildOptions
7
+ extend Summarizable
8
+ include ConfigurationOverridable
20
9
 
21
- def process(options)
22
- site = Bridgetown::Site.new(configuration_from_options(options))
23
- site.reset
24
- site.read
25
- site.generate
10
+ Registrations.register do
11
+ register(Doctor, "doctor", "doctor", Doctor.summary)
12
+ end
26
13
 
27
- if healthy?(site)
28
- Bridgetown.logger.info "Your test results", "are in. Everything looks fine."
29
- else
30
- abort
31
- end
14
+ def self.banner
15
+ "bridgetown doctor [options]"
16
+ end
17
+ summary "Search site and print specific deprecation warnings"
18
+
19
+ def doctor
20
+ site = Bridgetown::Site.new(configuration_with_overrides(options))
21
+ site.reset
22
+ site.read
23
+ site.generate
24
+
25
+ if healthy?(site)
26
+ Bridgetown.logger.info "Your test results", "are in. Everything looks fine."
27
+ else
28
+ abort
32
29
  end
30
+ end
33
31
 
34
- def healthy?(site)
35
- [
36
- fsnotify_buggy?(site),
37
- !deprecated_relative_permalinks(site),
38
- !conflicting_urls(site),
39
- !urls_only_differ_by_case(site),
40
- proper_site_url?(site),
41
- properly_gathered_posts?(site),
42
- ].all?
43
- end
32
+ protected
44
33
 
45
- def properly_gathered_posts?(site)
46
- return true if site.config["collections_dir"].empty?
34
+ def healthy?(site)
35
+ [
36
+ fsnotify_buggy?(site),
37
+ !conflicting_urls(site),
38
+ !urls_only_differ_by_case(site),
39
+ proper_site_url?(site),
40
+ properly_gathered_posts?(site),
41
+ ].all?
42
+ end
47
43
 
48
- posts_at_root = site.in_source_dir("_posts")
49
- return true unless File.directory?(posts_at_root)
44
+ def properly_gathered_posts?(site)
45
+ return true if site.config["collections_dir"].empty?
50
46
 
51
- Bridgetown.logger.warn "Warning:",
52
- "Detected '_posts' directory outside custom `collections_dir`!"
53
- Bridgetown.logger.warn "",
54
- "Please move '#{posts_at_root}' into the custom directory at " \
55
- "'#{site.in_source_dir(site.config["collections_dir"])}'"
56
- false
57
- end
47
+ posts_at_root = site.in_source_dir("_posts")
48
+ return true unless File.directory?(posts_at_root)
58
49
 
59
- def deprecated_relative_permalinks(site)
60
- if site.config["relative_permalinks"]
61
- Bridgetown::Deprecator.deprecation_message "Your site still uses relative permalinks," \
62
- " which was removed in Bridgetown v0.1"
63
- true
64
- end
65
- end
50
+ Bridgetown.logger.warn "Warning:",
51
+ "Detected '_posts' directory outside custom `collections_dir`!"
52
+ Bridgetown.logger.warn "",
53
+ "Please move '#{posts_at_root}' into the custom directory at " \
54
+ "'#{site.in_source_dir(site.config["collections_dir"])}'"
55
+ false
56
+ end
66
57
 
67
- def conflicting_urls(site)
68
- conflicting_urls = false
69
- urls = {}
70
- urls = collect_urls(urls, site.pages, site.dest)
71
- urls = collect_urls(urls, site.posts.docs, site.dest)
72
- urls.each do |url, paths|
73
- next unless paths.size > 1
74
-
75
- conflicting_urls = true
76
- Bridgetown.logger.warn "Conflict:", "The URL '#{url}' is the destination" \
77
- " for the following pages: #{paths.join(", ")}"
78
- end
79
- conflicting_urls
58
+ def conflicting_urls(site)
59
+ conflicting_urls = false
60
+ urls = {}
61
+ urls = collect_urls(urls, site.pages, site.dest)
62
+ urls = collect_urls(urls, site.posts.docs, site.dest)
63
+ urls.each do |url, paths|
64
+ next unless paths.size > 1
65
+
66
+ conflicting_urls = true
67
+ Bridgetown.logger.warn "Conflict:", "The URL '#{url}' is the destination" \
68
+ " for the following pages: #{paths.join(", ")}"
80
69
  end
70
+ conflicting_urls
71
+ end
81
72
 
82
- def fsnotify_buggy?(_site)
83
- return true unless Utils::Platforms.osx?
84
-
85
- if Dir.pwd != `pwd`.strip
86
- Bridgetown.logger.error " " + <<-STR.strip.gsub(%r!\n\s+!, "\n ")
87
- We have detected that there might be trouble using fsevent on your
88
- operating system, you can read https://github.com/thibaudgg/rb-fsevent/wiki/no-fsevents-fired-(OSX-bug)
89
- for possible work arounds or you can work around it immediately
90
- with `--force-polling`.
91
- STR
73
+ def fsnotify_buggy?(_site)
74
+ return true unless Utils::Platforms.osx?
92
75
 
93
- false
94
- end
76
+ if Dir.pwd != `pwd`.strip
77
+ Bridgetown.logger.error " " + <<-STR.strip.gsub(%r!\n\s+!, "\n ")
78
+ We have detected that there might be trouble using fsevent on your
79
+ operating system, you can read https://github.com/thibaudgg/rb-fsevent/wiki/no-fsevents-fired-(OSX-bug)
80
+ for possible work arounds or you can work around it immediately
81
+ with `--force-polling`.
82
+ STR
95
83
 
96
- true
84
+ false
97
85
  end
98
86
 
99
- def urls_only_differ_by_case(site)
100
- urls_only_differ_by_case = false
101
- urls = case_insensitive_urls(site.pages + site.docs_to_write, site.dest)
102
- urls.each_value do |real_urls|
103
- next unless real_urls.uniq.size > 1
87
+ true
88
+ end
104
89
 
105
- urls_only_differ_by_case = true
106
- Bridgetown.logger.warn "Warning:", "The following URLs only differ" \
107
- " by case. On a case-insensitive file system one of the URLs" \
108
- " will be overwritten by the other: #{real_urls.join(", ")}"
109
- end
110
- urls_only_differ_by_case
111
- end
90
+ def urls_only_differ_by_case(site)
91
+ urls_only_differ_by_case = false
92
+ urls = case_insensitive_urls(site.pages + site.docs_to_write, site.dest)
93
+ urls.each_value do |real_urls|
94
+ next unless real_urls.uniq.size > 1
112
95
 
113
- def proper_site_url?(site)
114
- url = site.config["url"]
115
- [
116
- url_exists?(url),
117
- url_valid?(url),
118
- url_absolute(url),
119
- ].all?
96
+ urls_only_differ_by_case = true
97
+ Bridgetown.logger.warn "Warning:", "The following URLs only differ" \
98
+ " by case. On a case-insensitive file system one of the URLs" \
99
+ " will be overwritten by the other: #{real_urls.join(", ")}"
120
100
  end
101
+ urls_only_differ_by_case
102
+ end
121
103
 
122
- private
104
+ def proper_site_url?(site)
105
+ url = site.config["url"]
106
+ [
107
+ url_exists?(url),
108
+ url_valid?(url),
109
+ url_absolute(url),
110
+ ].all?
111
+ end
123
112
 
124
- def collect_urls(urls, things, destination)
125
- things.each do |thing|
126
- dest = thing.destination(destination)
127
- if urls[dest]
128
- urls[dest] << thing.path
129
- else
130
- urls[dest] = [thing.path]
131
- end
113
+ private
114
+
115
+ def collect_urls(urls, things, destination)
116
+ things.each do |thing|
117
+ dest = thing.destination(destination)
118
+ if urls[dest]
119
+ urls[dest] << thing.path
120
+ else
121
+ urls[dest] = [thing.path]
132
122
  end
133
- urls
134
123
  end
124
+ urls
125
+ end
135
126
 
136
- def case_insensitive_urls(things, destination)
137
- things.each_with_object({}) do |thing, memo|
138
- dest = thing.destination(destination)
139
- (memo[dest.downcase] ||= []) << dest
140
- end
127
+ def case_insensitive_urls(things, destination)
128
+ things.each_with_object({}) do |thing, memo|
129
+ dest = thing.destination(destination)
130
+ (memo[dest.downcase] ||= []) << dest
141
131
  end
132
+ end
142
133
 
143
- def url_exists?(url)
144
- return true unless url.nil? || url.empty?
134
+ def url_exists?(url)
135
+ return true unless url.nil? || url.empty?
145
136
 
146
- Bridgetown.logger.warn "Warning:", "You didn't set an URL in the config file, "\
147
- "you may encounter problems with some plugins."
148
- false
149
- end
137
+ Bridgetown.logger.warn "Warning:", "You didn't set an URL in the config file, "\
138
+ "you may encounter problems with some plugins."
139
+ false
140
+ end
150
141
 
151
- def url_valid?(url)
152
- Addressable::URI.parse(url)
153
- true
154
- # Addressable::URI#parse only raises a TypeError
155
- # https://git.io/vFfbx
156
- rescue TypeError
157
- Bridgetown.logger.warn "Warning:", "The site URL does not seem to be valid, "\
158
- "check the value of `url` in your config file."
159
- false
160
- end
142
+ def url_valid?(url)
143
+ Addressable::URI.parse(url)
144
+ true
145
+ # Addressable::URI#parse only raises a TypeError
146
+ # https://git.io/vFfbx
147
+ rescue TypeError
148
+ Bridgetown.logger.warn "Warning:", "The site URL does not seem to be valid, "\
149
+ "check the value of `url` in your config file."
150
+ false
151
+ end
161
152
 
162
- def url_absolute(url)
163
- return true if url.is_a?(String) && Addressable::URI.parse(url).absolute?
153
+ def url_absolute(url)
154
+ return true if url.is_a?(String) && Addressable::URI.parse(url).absolute?
164
155
 
165
- Bridgetown.logger.warn "Warning:", "Your site URL does not seem to be absolute, "\
166
- "check the value of `url` in your config file."
167
- false
168
- end
156
+ Bridgetown.logger.warn "Warning:", "Your site URL does not seem to be absolute, "\
157
+ "check the value of `url` in your config file."
158
+ false
169
159
  end
170
160
  end
171
161
  end