Class: Bunto::Commands::Doctor
Class Method Summary
collapse
add_build_options, configuration_from_options, inherited, process_site, subclasses
Class Method Details
.conflicting_urls(site) ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/bunto/commands/doctor.rb', line 51
def conflicting_urls(site)
conflicting_urls = false
urls = {}
urls = collect_urls(urls, site.pages, site.dest)
urls = collect_urls(urls, site.posts.docs, site.dest)
urls.each do |url, paths|
next unless paths.size > 1
conflicting_urls = true
Bunto.logger.warn "Conflict:", "The URL '#{url}' is the destination" \
" for the following pages: #{paths.join(", ")}"
end
conflicting_urls
end
|
.deprecated_relative_permalinks(site) ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'lib/bunto/commands/doctor.rb', line 42
def deprecated_relative_permalinks(site)
if site.config["relative_permalinks"]
Bunto::Deprecator.deprecation_message "Your site still uses relative" \
" permalinks, which was removed in" \
" Bunto v3.0.0."
return true
end
end
|
.fsnotify_buggy?(_site) ⇒ Boolean
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/bunto/commands/doctor.rb', line 65
def fsnotify_buggy?(_site)
return true unless Utils::Platforms.osx?
if Dir.pwd != `pwd`.strip
Bunto.logger.error " " + <<-STR.strip.gsub(%r!\n\s+!, "\n ")
We have detected that there might be trouble using fsevent on your
operating system, you can read https://github.com/thibaudgg/rb-fsevent/wiki/no-fsevents-fired-(OSX-bug)
for possible work arounds or you can work around it immediately
with `--force-polling`.
STR
false
end
true
end
|
.healthy?(site) ⇒ Boolean
33
34
35
36
37
38
39
40
|
# File 'lib/bunto/commands/doctor.rb', line 33
def healthy?(site)
[
fsnotify_buggy?(site),
!deprecated_relative_permalinks(site),
!conflicting_urls(site),
!urls_only_differ_by_case(site)
].all?
end
|
.init_with_program(prog) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/bunto/commands/doctor.rb', line 5
def init_with_program(prog)
prog.command(:doctor) do |c|
c.syntax "doctor"
c.description "Search site and print specific deprecation warnings"
c.alias(:hyde)
c.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]", Array,
"Custom configuration file"
c.action do |_, options|
Bunto::Commands::Doctor.process(options)
end
end
end
|
.process(options) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/bunto/commands/doctor.rb', line 20
def process(options)
site = Bunto::Site.new(configuration_from_options(options))
site.reset
site.read
site.generate
if healthy?(site)
Bunto.logger.info "Your test results", "are in. Everything looks fine."
else
abort
end
end
|
.urls_only_differ_by_case(site) ⇒ Object
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/bunto/commands/doctor.rb', line 81
def urls_only_differ_by_case(site)
urls_only_differ_by_case = false
urls = case_insensitive_urls(site.pages + site.docs_to_write, site.dest)
urls.each do |_case_insensitive_url, real_urls|
next unless real_urls.uniq.size > 1
urls_only_differ_by_case = true
Bunto.logger.warn "Warning:", "The following URLs only differ" \
" by case. On a case-insensitive file system one of the URLs" \
" will be overwritten by the other: #{real_urls.join(", ")}"
end
urls_only_differ_by_case
end
|