blackboard 3.1.6 → 3.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +132 -0
- data/exe/jekyll +55 -0
- data/lib/jekyll.rb +179 -0
- data/lib/jekyll/cleaner.rb +105 -0
- data/lib/jekyll/collection.rb +205 -0
- data/lib/jekyll/command.rb +65 -0
- data/lib/jekyll/commands/build.rb +77 -0
- data/lib/jekyll/commands/clean.rb +42 -0
- data/lib/jekyll/commands/doctor.rb +114 -0
- data/lib/jekyll/commands/help.rb +31 -0
- data/lib/jekyll/commands/new.rb +82 -0
- data/lib/jekyll/commands/serve.rb +205 -0
- data/lib/jekyll/commands/serve/servlet.rb +61 -0
- data/lib/jekyll/configuration.rb +348 -0
- data/lib/jekyll/converter.rb +48 -0
- data/lib/jekyll/converters/identity.rb +21 -0
- data/lib/jekyll/converters/markdown.rb +92 -0
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +117 -0
- data/lib/jekyll/converters/markdown/rdiscount_parser.rb +33 -0
- data/lib/jekyll/converters/markdown/redcarpet_parser.rb +102 -0
- data/lib/jekyll/converters/smartypants.rb +34 -0
- data/lib/jekyll/convertible.rb +300 -0
- data/lib/jekyll/deprecator.rb +46 -0
- data/lib/jekyll/document.rb +447 -0
- data/lib/jekyll/drops/collection_drop.rb +22 -0
- data/lib/jekyll/drops/document_drop.rb +60 -0
- data/lib/jekyll/drops/drop.rb +200 -0
- data/lib/jekyll/drops/excerpt_drop.rb +15 -0
- data/lib/jekyll/drops/jekyll_drop.rb +33 -0
- data/lib/jekyll/drops/site_drop.rb +38 -0
- data/lib/jekyll/drops/unified_payload_drop.rb +25 -0
- data/lib/jekyll/drops/url_drop.rb +83 -0
- data/lib/jekyll/entry_filter.rb +72 -0
- data/lib/jekyll/errors.rb +10 -0
- data/lib/jekyll/excerpt.rb +124 -0
- data/lib/jekyll/external.rb +59 -0
- data/lib/jekyll/filters.rb +367 -0
- data/lib/jekyll/frontmatter_defaults.rb +188 -0
- data/lib/jekyll/generator.rb +3 -0
- data/lib/jekyll/hooks.rb +101 -0
- data/lib/jekyll/layout.rb +49 -0
- data/lib/jekyll/liquid_extensions.rb +22 -0
- data/lib/jekyll/liquid_renderer.rb +39 -0
- data/lib/jekyll/liquid_renderer/file.rb +50 -0
- data/lib/jekyll/liquid_renderer/table.rb +94 -0
- data/lib/jekyll/log_adapter.rb +115 -0
- data/lib/jekyll/mime.types +800 -0
- data/lib/jekyll/page.rb +180 -0
- data/lib/jekyll/plugin.rb +96 -0
- data/lib/jekyll/plugin_manager.rb +95 -0
- data/lib/jekyll/publisher.rb +21 -0
- data/lib/jekyll/reader.rb +126 -0
- data/lib/jekyll/readers/collection_reader.rb +20 -0
- data/lib/jekyll/readers/data_reader.rb +69 -0
- data/lib/jekyll/readers/layout_reader.rb +53 -0
- data/lib/jekyll/readers/page_reader.rb +21 -0
- data/lib/jekyll/readers/post_reader.rb +62 -0
- data/lib/jekyll/readers/static_file_reader.rb +21 -0
- data/lib/jekyll/regenerator.rb +175 -0
- data/lib/jekyll/related_posts.rb +56 -0
- data/lib/jekyll/renderer.rb +194 -0
- data/lib/jekyll/site.rb +392 -0
- data/lib/jekyll/static_file.rb +141 -0
- data/lib/jekyll/stevenson.rb +58 -0
- data/lib/jekyll/tags/highlight.rb +122 -0
- data/lib/jekyll/tags/include.rb +190 -0
- data/lib/jekyll/tags/post_url.rb +88 -0
- data/lib/jekyll/url.rb +136 -0
- data/lib/jekyll/utils.rb +300 -0
- data/lib/jekyll/utils/ansi.rb +59 -0
- data/lib/jekyll/utils/platforms.rb +30 -0
- data/lib/jekyll/version.rb +3 -0
- data/lib/site_template/.gitignore +3 -0
- data/lib/site_template/_config.yml +24 -0
- data/lib/site_template/_includes/footer.html +38 -0
- data/lib/site_template/_includes/head.html +12 -0
- data/lib/site_template/_includes/header.html +27 -0
- data/lib/site_template/_includes/icon-github.html +1 -0
- data/lib/site_template/_includes/icon-github.svg +1 -0
- data/lib/site_template/_includes/icon-twitter.html +1 -0
- data/lib/site_template/_includes/icon-twitter.svg +1 -0
- data/lib/site_template/_layouts/default.html +20 -0
- data/lib/site_template/_layouts/page.html +14 -0
- data/lib/site_template/_layouts/post.html +15 -0
- data/lib/site_template/_pages/about.md +15 -0
- data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +25 -0
- data/lib/site_template/_sass/_base.scss +206 -0
- data/lib/site_template/_sass/_layout.scss +242 -0
- data/lib/site_template/_sass/_syntax-highlighting.scss +71 -0
- data/lib/site_template/css/main.scss +53 -0
- data/lib/site_template/feed.xml +30 -0
- data/lib/site_template/index.html +23 -0
- 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 +46 -0
- data/lib/theme_template/Rakefile.erb +74 -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 +22 -0
- metadata +109 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b07878a1bec45459501de9f7dc600d4b5f299e4b
|
4
|
+
data.tar.gz: bae4f77020a641de6714b20e16a6b2f49681531d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cc98b08a52900b5c16e4be075535aa97b72101ea9d09519fcb83849703c35830d531f4ac84bcf480fc6eb7b604512bd5b5f78964c5cf7bc6e3b633844b5317a
|
7
|
+
data.tar.gz: 144f30992fb665acf9c07d5ed050fa27c08c79c8f36e848067c4de352a51157735cdeb028644787ec0c49d3192e36189fbc5aabb325b3be1e52c4ae71f4d4f57
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
---
|
2
|
+
AllCops:
|
3
|
+
TargetRubyVersion: 2.0
|
4
|
+
Include:
|
5
|
+
- lib/**/*.rb
|
6
|
+
Exclude:
|
7
|
+
- lib/jekyll/collection.rb
|
8
|
+
- lib/jekyll/configuration.rb
|
9
|
+
- lib/jekyll/convertible.rb
|
10
|
+
- lib/jekyll/document.rb
|
11
|
+
- lib/jekyll/regenerator.rb
|
12
|
+
- lib/jekyll/renderer.rb
|
13
|
+
- lib/jekyll/utils.rb
|
14
|
+
- bin/**/*
|
15
|
+
- benchmark/**/*
|
16
|
+
- script/**/*
|
17
|
+
- vendor/**/*
|
18
|
+
Lint/EndAlignment:
|
19
|
+
Severity: error
|
20
|
+
Lint/UnreachableCode:
|
21
|
+
Severity: error
|
22
|
+
Lint/UselessAccessModifier:
|
23
|
+
Enabled: false
|
24
|
+
Metrics/AbcSize:
|
25
|
+
Max: 20
|
26
|
+
Metrics/ClassLength:
|
27
|
+
Max: 300
|
28
|
+
Exclude:
|
29
|
+
- !ruby/regexp /features\/.*.rb$/
|
30
|
+
- !ruby/regexp /test\/.*.rb$/
|
31
|
+
Metrics/CyclomaticComplexity:
|
32
|
+
Max: 8
|
33
|
+
Metrics/LineLength:
|
34
|
+
Max: 90
|
35
|
+
Severity: warning
|
36
|
+
Exclude:
|
37
|
+
- !ruby/regexp /features\/.*.rb/
|
38
|
+
Metrics/MethodLength:
|
39
|
+
Max: 20
|
40
|
+
CountComments: false
|
41
|
+
Severity: error
|
42
|
+
Metrics/ModuleLength:
|
43
|
+
Max: 240
|
44
|
+
Metrics/ParameterLists:
|
45
|
+
Max: 4
|
46
|
+
Metrics/PerceivedComplexity:
|
47
|
+
Max: 8
|
48
|
+
Style/Alias:
|
49
|
+
Enabled: false
|
50
|
+
Style/AlignArray:
|
51
|
+
Enabled: false
|
52
|
+
Style/AlignHash:
|
53
|
+
EnforcedHashRocketStyle: table
|
54
|
+
Style/AlignParameters:
|
55
|
+
EnforcedStyle: with_fixed_indentation
|
56
|
+
Enabled: false
|
57
|
+
Style/AndOr:
|
58
|
+
Severity: error
|
59
|
+
Style/Attr:
|
60
|
+
Enabled: false
|
61
|
+
Style/BracesAroundHashParameters:
|
62
|
+
Enabled: false
|
63
|
+
Style/ClassAndModuleChildren:
|
64
|
+
Enabled: false
|
65
|
+
Style/Documentation:
|
66
|
+
Enabled: false
|
67
|
+
Exclude:
|
68
|
+
- !ruby/regexp /features\/.*.rb$/
|
69
|
+
Style/DoubleNegation:
|
70
|
+
Enabled: false
|
71
|
+
Style/EmptyLinesAroundAccessModifier:
|
72
|
+
Enabled: false
|
73
|
+
Style/EmptyLinesAroundModuleBody:
|
74
|
+
Enabled: false
|
75
|
+
Style/ExtraSpacing:
|
76
|
+
AllowForAlignment: true
|
77
|
+
Style/FileName:
|
78
|
+
Enabled: false
|
79
|
+
Style/FirstParameterIndentation:
|
80
|
+
EnforcedStyle: consistent
|
81
|
+
Style/GuardClause:
|
82
|
+
Enabled: false
|
83
|
+
Style/HashSyntax:
|
84
|
+
EnforcedStyle: hash_rockets
|
85
|
+
Severity: error
|
86
|
+
Style/IfUnlessModifier:
|
87
|
+
Enabled: false
|
88
|
+
Style/IndentArray:
|
89
|
+
EnforcedStyle: consistent
|
90
|
+
Style/IndentHash:
|
91
|
+
EnforcedStyle: consistent
|
92
|
+
Style/IndentationWidth:
|
93
|
+
Severity: error
|
94
|
+
Style/ModuleFunction:
|
95
|
+
Enabled: false
|
96
|
+
Style/MultilineMethodCallIndentation:
|
97
|
+
EnforcedStyle: indented
|
98
|
+
Style/MultilineOperationIndentation:
|
99
|
+
EnforcedStyle: indented
|
100
|
+
Style/MultilineTernaryOperator:
|
101
|
+
Severity: error
|
102
|
+
Style/PercentLiteralDelimiters:
|
103
|
+
PreferredDelimiters:
|
104
|
+
"%q": "{}"
|
105
|
+
"%Q": "{}"
|
106
|
+
"%r": "!!"
|
107
|
+
"%s": "()"
|
108
|
+
"%w": "()"
|
109
|
+
"%W": "()"
|
110
|
+
"%x": "()"
|
111
|
+
Style/RedundantReturn:
|
112
|
+
Enabled: false
|
113
|
+
Style/RedundantSelf:
|
114
|
+
Enabled: false
|
115
|
+
Style/RegexpLiteral:
|
116
|
+
EnforcedStyle: percent_r
|
117
|
+
Style/RescueModifier:
|
118
|
+
Enabled: false
|
119
|
+
Style/SignalException:
|
120
|
+
EnforcedStyle: only_raise
|
121
|
+
Style/SingleLineMethods:
|
122
|
+
Enabled: false
|
123
|
+
Style/SpaceAroundOperators:
|
124
|
+
Enabled: false
|
125
|
+
Style/SpaceInsideBrackets:
|
126
|
+
Enabled: false
|
127
|
+
Style/StringLiterals:
|
128
|
+
EnforcedStyle: double_quotes
|
129
|
+
Style/StringLiteralsInInterpolation:
|
130
|
+
EnforcedStyle: double_quotes
|
131
|
+
Style/UnneededCapitalW:
|
132
|
+
Enabled: false
|
data/exe/jekyll
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
STDOUT.sync = true
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w( .. lib )))
|
5
|
+
|
6
|
+
require "jekyll"
|
7
|
+
require "mercenary"
|
8
|
+
|
9
|
+
Jekyll::PluginManager.require_from_bundler
|
10
|
+
|
11
|
+
Jekyll::Deprecator.process(ARGV)
|
12
|
+
|
13
|
+
Mercenary.program(:jekyll) do |p|
|
14
|
+
p.version Jekyll::VERSION
|
15
|
+
p.description "Jekyll is a blog-aware, static site generator in Ruby"
|
16
|
+
p.syntax "jekyll <subcommand> [options]"
|
17
|
+
|
18
|
+
p.option "source", "-s", "--source [DIR]", "Source directory (defaults to ./)"
|
19
|
+
p.option "destination", "-d", "--destination [DIR]",
|
20
|
+
"Destination directory (defaults to ./_site)"
|
21
|
+
p.option "safe", "--safe", "Safe mode (defaults to false)"
|
22
|
+
p.option "plugins_dir", "-p", "--plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]", Array,
|
23
|
+
"Plugins directory (defaults to ./_plugins)"
|
24
|
+
p.option "layouts_dir", "--layouts DIR", String,
|
25
|
+
"Layouts directory (defaults to ./_layouts)"
|
26
|
+
p.option "profile", "--profile", "Generate a Liquid rendering profile"
|
27
|
+
|
28
|
+
Jekyll::External.require_if_present(Jekyll::External.blessed_gems) do |g|
|
29
|
+
cmd = g.split("-").last
|
30
|
+
p.command(cmd.to_sym) do |c|
|
31
|
+
c.syntax cmd
|
32
|
+
c.action do
|
33
|
+
Jekyll.logger.abort_with "You must install the '#{g}' gem" \
|
34
|
+
" to use the 'jekyll #{cmd}' command."
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
Jekyll::Command.subclasses.each { |c| c.init_with_program(p) }
|
40
|
+
|
41
|
+
p.action do |args, _|
|
42
|
+
if args.empty?
|
43
|
+
Jekyll.logger.error "A subcommand is required."
|
44
|
+
puts p
|
45
|
+
abort
|
46
|
+
else
|
47
|
+
subcommand = args.first
|
48
|
+
unless p.has_command? subcommand
|
49
|
+
Jekyll.logger.abort_with "fatal: 'jekyll #{args.first}' could not" \
|
50
|
+
" be found. You may need to install the jekyll-#{args.first} gem" \
|
51
|
+
" or a related gem to be able to use this subcommand."
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/jekyll.rb
ADDED
@@ -0,0 +1,179 @@
|
|
1
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
|
2
|
+
|
3
|
+
# Require all of the Ruby files in the given directory.
|
4
|
+
#
|
5
|
+
# path - The String relative path from here to the directory.
|
6
|
+
#
|
7
|
+
# Returns nothing.
|
8
|
+
def require_all(path)
|
9
|
+
glob = File.join(File.dirname(__FILE__), path, '*.rb')
|
10
|
+
Dir[glob].sort.each do |f|
|
11
|
+
require f
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# rubygems
|
16
|
+
require 'rubygems'
|
17
|
+
|
18
|
+
# stdlib
|
19
|
+
require 'forwardable'
|
20
|
+
require 'fileutils'
|
21
|
+
require 'time'
|
22
|
+
require 'English'
|
23
|
+
require 'pathname'
|
24
|
+
require 'logger'
|
25
|
+
require 'set'
|
26
|
+
|
27
|
+
# 3rd party
|
28
|
+
require 'safe_yaml/load'
|
29
|
+
require 'liquid'
|
30
|
+
require 'kramdown'
|
31
|
+
require 'colorator'
|
32
|
+
|
33
|
+
SafeYAML::OPTIONS[:suppress_warnings] = true
|
34
|
+
|
35
|
+
module Jekyll
|
36
|
+
# internal requires
|
37
|
+
autoload :Cleaner, 'jekyll/cleaner'
|
38
|
+
autoload :Collection, 'jekyll/collection'
|
39
|
+
autoload :Configuration, 'jekyll/configuration'
|
40
|
+
autoload :Convertible, 'jekyll/convertible'
|
41
|
+
autoload :Deprecator, 'jekyll/deprecator'
|
42
|
+
autoload :Document, 'jekyll/document'
|
43
|
+
autoload :Draft, 'jekyll/draft'
|
44
|
+
autoload :EntryFilter, 'jekyll/entry_filter'
|
45
|
+
autoload :Errors, 'jekyll/errors'
|
46
|
+
autoload :Excerpt, 'jekyll/excerpt'
|
47
|
+
autoload :External, 'jekyll/external'
|
48
|
+
autoload :Filters, 'jekyll/filters'
|
49
|
+
autoload :FrontmatterDefaults, 'jekyll/frontmatter_defaults'
|
50
|
+
autoload :Hooks, 'jekyll/hooks'
|
51
|
+
autoload :Layout, 'jekyll/layout'
|
52
|
+
autoload :CollectionReader, 'jekyll/readers/collection_reader'
|
53
|
+
autoload :DataReader, 'jekyll/readers/data_reader'
|
54
|
+
autoload :LayoutReader, 'jekyll/readers/layout_reader'
|
55
|
+
autoload :PostReader, 'jekyll/readers/post_reader'
|
56
|
+
autoload :PageReader, 'jekyll/readers/page_reader'
|
57
|
+
autoload :StaticFileReader, 'jekyll/readers/static_file_reader'
|
58
|
+
autoload :LogAdapter, 'jekyll/log_adapter'
|
59
|
+
autoload :Page, 'jekyll/page'
|
60
|
+
autoload :PluginManager, 'jekyll/plugin_manager'
|
61
|
+
autoload :Publisher, 'jekyll/publisher'
|
62
|
+
autoload :Reader, 'jekyll/reader'
|
63
|
+
autoload :Regenerator, 'jekyll/regenerator'
|
64
|
+
autoload :RelatedPosts, 'jekyll/related_posts'
|
65
|
+
autoload :Renderer, 'jekyll/renderer'
|
66
|
+
autoload :LiquidRenderer, 'jekyll/liquid_renderer'
|
67
|
+
autoload :Site, 'jekyll/site'
|
68
|
+
autoload :StaticFile, 'jekyll/static_file'
|
69
|
+
autoload :Stevenson, 'jekyll/stevenson'
|
70
|
+
autoload :URL, 'jekyll/url'
|
71
|
+
autoload :Utils, 'jekyll/utils'
|
72
|
+
autoload :VERSION, 'jekyll/version'
|
73
|
+
|
74
|
+
# extensions
|
75
|
+
require 'jekyll/plugin'
|
76
|
+
require 'jekyll/converter'
|
77
|
+
require 'jekyll/generator'
|
78
|
+
require 'jekyll/command'
|
79
|
+
require 'jekyll/liquid_extensions'
|
80
|
+
|
81
|
+
class << self
|
82
|
+
# Public: Tells you which Jekyll environment you are building in so you can skip tasks
|
83
|
+
# if you need to. This is useful when doing expensive compression tasks on css and
|
84
|
+
# images and allows you to skip that when working in development.
|
85
|
+
|
86
|
+
def env
|
87
|
+
ENV["JEKYLL_ENV"] || "development"
|
88
|
+
end
|
89
|
+
|
90
|
+
# Public: Generate a Jekyll configuration Hash by merging the default
|
91
|
+
# options with anything in _config.yml, and adding the given options on top.
|
92
|
+
#
|
93
|
+
# override - A Hash of config directives that override any options in both
|
94
|
+
# the defaults and the config file. See Jekyll::Configuration::DEFAULTS for a
|
95
|
+
# list of option names and their defaults.
|
96
|
+
#
|
97
|
+
# Returns the final configuration Hash.
|
98
|
+
def configuration(override = Hash.new)
|
99
|
+
config = Configuration.new
|
100
|
+
unless override.delete('skip_config_files')
|
101
|
+
config = config.read_config_files(config.config_files(override))
|
102
|
+
end
|
103
|
+
|
104
|
+
# Merge DEFAULTS < _config.yml < override
|
105
|
+
Configuration.from(Utils.deep_merge_hashes(config, override)).tap do |config|
|
106
|
+
set_timezone(config['timezone']) if config['timezone']
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# Public: Set the TZ environment variable to use the timezone specified
|
111
|
+
#
|
112
|
+
# timezone - the IANA Time Zone
|
113
|
+
#
|
114
|
+
# Returns nothing
|
115
|
+
def set_timezone(timezone)
|
116
|
+
ENV['TZ'] = timezone
|
117
|
+
end
|
118
|
+
|
119
|
+
# Public: Fetch the logger instance for this Jekyll process.
|
120
|
+
#
|
121
|
+
# Returns the LogAdapter instance.
|
122
|
+
def logger
|
123
|
+
@logger ||= LogAdapter.new(Stevenson.new, (ENV["JEKYLL_LOG_LEVEL"] || :info).to_sym)
|
124
|
+
end
|
125
|
+
|
126
|
+
# Public: Set the log writer.
|
127
|
+
# New log writer must respond to the same methods
|
128
|
+
# as Ruby's interal Logger.
|
129
|
+
#
|
130
|
+
# writer - the new Logger-compatible log transport
|
131
|
+
#
|
132
|
+
# Returns the new logger.
|
133
|
+
def logger=(writer)
|
134
|
+
@logger = LogAdapter.new(writer, (ENV["JEKYLL_LOG_LEVEL"] || :info).to_sym)
|
135
|
+
end
|
136
|
+
|
137
|
+
# Public: An array of sites
|
138
|
+
#
|
139
|
+
# Returns the Jekyll sites created.
|
140
|
+
def sites
|
141
|
+
@sites ||= []
|
142
|
+
end
|
143
|
+
|
144
|
+
# Public: Ensures the questionable path is prefixed with the base directory
|
145
|
+
# and prepends the questionable path with the base directory if false.
|
146
|
+
#
|
147
|
+
# base_directory - the directory with which to prefix the questionable path
|
148
|
+
# questionable_path - the path we're unsure about, and want prefixed
|
149
|
+
#
|
150
|
+
# Returns the sanitized path.
|
151
|
+
def sanitized_path(base_directory, questionable_path)
|
152
|
+
return base_directory if base_directory.eql?(questionable_path)
|
153
|
+
|
154
|
+
questionable_path.insert(0, '/') if questionable_path.start_with?('~')
|
155
|
+
clean_path = File.expand_path(questionable_path, "/")
|
156
|
+
clean_path.sub!(/\A\w\:\//, '/')
|
157
|
+
|
158
|
+
if clean_path.start_with?(base_directory.sub(/\A\w\:\//, '/'))
|
159
|
+
clean_path
|
160
|
+
else
|
161
|
+
File.join(base_directory, clean_path)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
# Conditional optimizations
|
166
|
+
Jekyll::External.require_if_present('liquid-c')
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
require "jekyll/drops/drop"
|
171
|
+
require "jekyll/drops/document_drop"
|
172
|
+
require_all 'jekyll/commands'
|
173
|
+
require_all 'jekyll/converters'
|
174
|
+
require_all 'jekyll/converters/markdown'
|
175
|
+
require_all 'jekyll/drops'
|
176
|
+
require_all 'jekyll/generators'
|
177
|
+
require_all 'jekyll/tags'
|
178
|
+
|
179
|
+
require 'jekyll-sass-converter'
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'set'
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
# Handles the cleanup of a site's destination before it is built.
|
5
|
+
class Cleaner
|
6
|
+
HIDDEN_FILE_REGEX = /\/\.{1,2}$/
|
7
|
+
attr_reader :site
|
8
|
+
|
9
|
+
def initialize(site)
|
10
|
+
@site = site
|
11
|
+
end
|
12
|
+
|
13
|
+
# Cleans up the site's destination directory
|
14
|
+
def cleanup!
|
15
|
+
FileUtils.rm_rf(obsolete_files)
|
16
|
+
FileUtils.rm_rf(metadata_file) unless @site.incremental?
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
# Private: The list of files and directories to be deleted during cleanup process
|
22
|
+
#
|
23
|
+
# Returns an Array of the file and directory paths
|
24
|
+
def obsolete_files
|
25
|
+
(existing_files - new_files - new_dirs + replaced_files).to_a
|
26
|
+
end
|
27
|
+
|
28
|
+
# Private: The metadata file storing dependency tree and build history
|
29
|
+
#
|
30
|
+
# Returns an Array with the metdata file as the only item
|
31
|
+
def metadata_file
|
32
|
+
[site.regenerator.metadata_file]
|
33
|
+
end
|
34
|
+
|
35
|
+
# Private: The list of existing files, apart from those included in keep_files and hidden files.
|
36
|
+
#
|
37
|
+
# Returns a Set with the file paths
|
38
|
+
def existing_files
|
39
|
+
files = Set.new
|
40
|
+
regex = keep_file_regex
|
41
|
+
dirs = keep_dirs
|
42
|
+
|
43
|
+
Utils.safe_glob(site.in_dest_dir, ["**", "*"], File::FNM_DOTMATCH).each do |file|
|
44
|
+
next if file =~ HIDDEN_FILE_REGEX || file =~ regex || dirs.include?(file)
|
45
|
+
files << file
|
46
|
+
end
|
47
|
+
|
48
|
+
files
|
49
|
+
end
|
50
|
+
|
51
|
+
# Private: The list of files to be created when site is built.
|
52
|
+
#
|
53
|
+
# Returns a Set with the file paths
|
54
|
+
def new_files
|
55
|
+
files = Set.new
|
56
|
+
site.each_site_file { |item| files << item.destination(site.dest) }
|
57
|
+
files
|
58
|
+
end
|
59
|
+
|
60
|
+
# Private: The list of directories to be created when site is built.
|
61
|
+
# These are the parent directories of the files in #new_files.
|
62
|
+
#
|
63
|
+
# Returns a Set with the directory paths
|
64
|
+
def new_dirs
|
65
|
+
new_files.map { |file| parent_dirs(file) }.flatten.to_set
|
66
|
+
end
|
67
|
+
|
68
|
+
# Private: The list of parent directories of a given file
|
69
|
+
#
|
70
|
+
# Returns an Array with the directory paths
|
71
|
+
def parent_dirs(file)
|
72
|
+
parent_dir = File.dirname(file)
|
73
|
+
if parent_dir == site.dest
|
74
|
+
[]
|
75
|
+
else
|
76
|
+
[parent_dir] + parent_dirs(parent_dir)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Private: The list of existing files that will be replaced by a directory during build
|
81
|
+
#
|
82
|
+
# Returns a Set with the file paths
|
83
|
+
def replaced_files
|
84
|
+
new_dirs.select { |dir| File.file?(dir) }.to_set
|
85
|
+
end
|
86
|
+
|
87
|
+
# Private: The list of directories that need to be kept because they are parent directories
|
88
|
+
# of files specified in keep_files
|
89
|
+
#
|
90
|
+
# Returns a Set with the directory paths
|
91
|
+
def keep_dirs
|
92
|
+
site.keep_files.map { |file| parent_dirs(site.in_dest_dir(file)) }.flatten.to_set
|
93
|
+
end
|
94
|
+
|
95
|
+
# Private: Creates a regular expression from the config's keep_files array
|
96
|
+
#
|
97
|
+
# Examples
|
98
|
+
# ['.git','.svn'] creates the following regex: /\/(\.git|\/.svn)/
|
99
|
+
#
|
100
|
+
# Returns the regular expression
|
101
|
+
def keep_file_regex
|
102
|
+
Regexp.union(site.keep_files)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|