jekyllplusadmin 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +80 -0
  3. data/LICENSE +21 -0
  4. data/README.markdown +60 -0
  5. data/bin/jekyll +51 -0
  6. data/lib/jekyll.rb +180 -0
  7. data/lib/jekyll/cleaner.rb +105 -0
  8. data/lib/jekyll/collection.rb +205 -0
  9. data/lib/jekyll/command.rb +65 -0
  10. data/lib/jekyll/commands/build.rb +77 -0
  11. data/lib/jekyll/commands/clean.rb +42 -0
  12. data/lib/jekyll/commands/doctor.rb +114 -0
  13. data/lib/jekyll/commands/help.rb +31 -0
  14. data/lib/jekyll/commands/new.rb +82 -0
  15. data/lib/jekyll/commands/serve.rb +235 -0
  16. data/lib/jekyll/commands/serve/servlet.rb +61 -0
  17. data/lib/jekyll/configuration.rb +323 -0
  18. data/lib/jekyll/converter.rb +48 -0
  19. data/lib/jekyll/converters/identity.rb +21 -0
  20. data/lib/jekyll/converters/markdown.rb +92 -0
  21. data/lib/jekyll/converters/markdown/kramdown_parser.rb +117 -0
  22. data/lib/jekyll/converters/markdown/rdiscount_parser.rb +33 -0
  23. data/lib/jekyll/converters/markdown/redcarpet_parser.rb +102 -0
  24. data/lib/jekyll/converters/smartypants.rb +34 -0
  25. data/lib/jekyll/convertible.rb +297 -0
  26. data/lib/jekyll/deprecator.rb +46 -0
  27. data/lib/jekyll/document.rb +444 -0
  28. data/lib/jekyll/drops/collection_drop.rb +22 -0
  29. data/lib/jekyll/drops/document_drop.rb +27 -0
  30. data/lib/jekyll/drops/drop.rb +176 -0
  31. data/lib/jekyll/drops/jekyll_drop.rb +21 -0
  32. data/lib/jekyll/drops/site_drop.rb +38 -0
  33. data/lib/jekyll/drops/unified_payload_drop.rb +25 -0
  34. data/lib/jekyll/drops/url_drop.rb +83 -0
  35. data/lib/jekyll/entry_filter.rb +72 -0
  36. data/lib/jekyll/errors.rb +10 -0
  37. data/lib/jekyll/excerpt.rb +127 -0
  38. data/lib/jekyll/external.rb +59 -0
  39. data/lib/jekyll/filters.rb +367 -0
  40. data/lib/jekyll/frontmatter_defaults.rb +188 -0
  41. data/lib/jekyll/generator.rb +3 -0
  42. data/lib/jekyll/hooks.rb +101 -0
  43. data/lib/jekyll/layout.rb +49 -0
  44. data/lib/jekyll/liquid_extensions.rb +22 -0
  45. data/lib/jekyll/liquid_renderer.rb +39 -0
  46. data/lib/jekyll/liquid_renderer/file.rb +50 -0
  47. data/lib/jekyll/liquid_renderer/table.rb +94 -0
  48. data/lib/jekyll/log_adapter.rb +115 -0
  49. data/lib/jekyll/mime.types +800 -0
  50. data/lib/jekyll/page.rb +180 -0
  51. data/lib/jekyll/plugin.rb +96 -0
  52. data/lib/jekyll/plugin_manager.rb +95 -0
  53. data/lib/jekyll/publisher.rb +21 -0
  54. data/lib/jekyll/reader.rb +126 -0
  55. data/lib/jekyll/readers/collection_reader.rb +20 -0
  56. data/lib/jekyll/readers/data_reader.rb +69 -0
  57. data/lib/jekyll/readers/layout_reader.rb +53 -0
  58. data/lib/jekyll/readers/page_reader.rb +21 -0
  59. data/lib/jekyll/readers/post_reader.rb +62 -0
  60. data/lib/jekyll/readers/static_file_reader.rb +21 -0
  61. data/lib/jekyll/regenerator.rb +175 -0
  62. data/lib/jekyll/related_posts.rb +56 -0
  63. data/lib/jekyll/renderer.rb +191 -0
  64. data/lib/jekyll/site.rb +391 -0
  65. data/lib/jekyll/static_file.rb +141 -0
  66. data/lib/jekyll/stevenson.rb +58 -0
  67. data/lib/jekyll/tags/highlight.rb +122 -0
  68. data/lib/jekyll/tags/include.rb +190 -0
  69. data/lib/jekyll/tags/post_url.rb +88 -0
  70. data/lib/jekyll/url.rb +136 -0
  71. data/lib/jekyll/utils.rb +287 -0
  72. data/lib/jekyll/utils/ansi.rb +59 -0
  73. data/lib/jekyll/utils/platforms.rb +30 -0
  74. data/lib/jekyll/version.rb +3 -0
  75. data/lib/site_template/.gitignore +3 -0
  76. data/lib/site_template/_config.yml +21 -0
  77. data/lib/site_template/_includes/footer.html +38 -0
  78. data/lib/site_template/_includes/head.html +12 -0
  79. data/lib/site_template/_includes/header.html +27 -0
  80. data/lib/site_template/_includes/icon-github.html +1 -0
  81. data/lib/site_template/_includes/icon-github.svg +1 -0
  82. data/lib/site_template/_includes/icon-twitter.html +1 -0
  83. data/lib/site_template/_includes/icon-twitter.svg +1 -0
  84. data/lib/site_template/_layouts/default.html +20 -0
  85. data/lib/site_template/_layouts/page.html +14 -0
  86. data/lib/site_template/_layouts/post.html +15 -0
  87. data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +25 -0
  88. data/lib/site_template/_sass/_base.scss +206 -0
  89. data/lib/site_template/_sass/_layout.scss +242 -0
  90. data/lib/site_template/_sass/_syntax-highlighting.scss +71 -0
  91. data/lib/site_template/about.md +15 -0
  92. data/lib/site_template/css/main.scss +53 -0
  93. data/lib/site_template/feed.xml +30 -0
  94. data/lib/site_template/index.html +23 -0
  95. metadata +252 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6c0045a4668d8ec935e836fd190f639235776cb0
4
+ data.tar.gz: 5c1410fef41efbc8b17c192e62369adae4d5e772
5
+ SHA512:
6
+ metadata.gz: c72b38d645e478c8aa7495f429a7da8cd46baf728dd73519f63521d597b5a8fd71471fc49c574b3eb6fb8ad41486b8404f543f34f7dde2cd897d1a555ab0a9e9
7
+ data.tar.gz: 70c732b463a4e343bb60950a4a11ff17ac77aafbbf79671d25770447ffd2af3797fa8c32dda56dbf21a5d2a316a7cbe474e12c535652b785ef7737c028f26587
data/.rubocop.yml ADDED
@@ -0,0 +1,80 @@
1
+ Metrics/MethodLength: { Max: 24 }
2
+ Metrics/ClassLength: { Max: 240 }
3
+ Metrics/ModuleLength: { Max: 240 }
4
+ Metrics/LineLength: { Max: 112 }
5
+ Metrics/CyclomaticComplexity: { Max: 8 }
6
+ Metrics/PerceivedComplexity: { Max: 8 }
7
+ Metrics/ParameterLists: { Max: 4 }
8
+ Metrics/MethodLength: { Max: 24 }
9
+ Metrics/AbcSize: { Max: 20 }
10
+
11
+ Style/IndentHash: { EnforcedStyle: consistent }
12
+ Style/HashSyntax: { EnforcedStyle: hash_rockets }
13
+ Style/SignalException: { EnforcedStyle: only_raise }
14
+ Style/AlignParameters: { EnforcedStyle: with_fixed_indentation }
15
+ Style/StringLiteralsInInterpolation: { EnforcedStyle: double_quotes }
16
+ Style/MultilineMethodCallIndentation: { EnforcedStyle: indented }
17
+ Style/MultilineOperationIndentation: { EnforcedStyle: indented }
18
+ Style/FirstParameterIndentation: { EnforcedStyle: consistent }
19
+ Style/StringLiterals: { EnforcedStyle: double_quotes }
20
+ Style/RegexpLiteral: { EnforcedStyle: slashes }
21
+ Style/IndentArray: { EnforcedStyle: consistent }
22
+ Style/ExtraSpacing: { AllowForAlignment: true }
23
+
24
+ Style/PercentLiteralDelimiters:
25
+ PreferredDelimiters:
26
+ '%q': '{}'
27
+ '%Q': '{}'
28
+ '%r': '!!'
29
+ '%s': '()'
30
+ '%w': '()'
31
+ '%W': '()'
32
+ '%x': '()'
33
+
34
+ Style/AlignArray: { Enabled: false }
35
+ Style/StringLiterals: { Enabled: false }
36
+ Style/Documentation: { Enabled: false }
37
+ Style/DoubleNegation: { Enabled: false }
38
+ Style/UnneededCapitalW: { Enabled: false }
39
+ Style/EmptyLinesAroundModuleBody: { Enabled: false }
40
+ Style/EmptyLinesAroundAccessModifier: { Enabled: false }
41
+ Style/BracesAroundHashParameters: { Enabled: false }
42
+ Style/SpaceInsideBrackets: { Enabled: false }
43
+ Style/IfUnlessModifier: { Enabled: false }
44
+ Style/ModuleFunction: { Enabled: false }
45
+ Style/RescueModifier: { Enabled: false }
46
+ Style/GuardClause: { Enabled: false }
47
+ Style/FileName: { Enabled: false }
48
+ Lint/UselessAccessModifier: { Enabled: false }
49
+ Style/SpaceAroundOperators: { Enabled: false }
50
+ Style/RedundantReturn: { Enabled: false }
51
+ Style/SingleLineMethods: { Enabled: false }
52
+
53
+ AllCops:
54
+ TargetRubyVersion: 2.0
55
+ Include:
56
+ - lib/**/*.rb
57
+
58
+ Exclude:
59
+ - .rubocop.yml
60
+ - .codeclimate.yml
61
+ - .travis.yml
62
+ - .gitignore
63
+ - .rspec
64
+
65
+ - Gemfile.lock
66
+ - CHANGELOG.{md,markdown,txt,textile}
67
+ - CONTRIBUTING.{md,markdown,txt,textile}
68
+ - readme.{md,markdown,txt,textile}
69
+ - README.{md,markdown,txt,textile}
70
+ - Readme.{md,markdown,txt,textile}
71
+ - ReadMe.{md,markdown,txt,textile}
72
+ - COPYING
73
+ - LICENSE
74
+
75
+ - site/**/*
76
+ - test/**/*
77
+ - vendor/**/*
78
+ - features/**/*
79
+ - script/**/*
80
+ - spec/**/*
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2008-2016 Tom Preston-Werner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,60 @@
1
+ # [Jekyll](http://jekyllrb.com/)
2
+
3
+ [![Gem Version](https://img.shields.io/gem/v/jekyll.svg)][ruby-gems]
4
+ [![Build Status](https://travis-ci.org/jekyll/jekyll.svg?branch=master)][travis]
5
+ [![Test Coverage](https://codeclimate.com/github/jekyll/jekyll/badges/coverage.svg)][coverage]
6
+ [![Code Climate](https://codeclimate.com/github/jekyll/jekyll/badges/gpa.svg)][codeclimate]
7
+ [![Dependency Status](https://gemnasium.com/jekyll/jekyll.svg)][gemnasium]
8
+ [![Security](https://hakiri.io/github/jekyll/jekyll/master.svg)][hakiri]
9
+
10
+ [ruby-gems]: https://rubygems.org/gems/jekyll
11
+ [gemnasium]: https://gemnasium.com/jekyll/jekyll
12
+ [codeclimate]: https://codeclimate.com/github/jekyll/jekyll
13
+ [coverage]: https://codeclimate.com/github/jekyll/jekyll/coverage
14
+ [hakiri]: https://hakiri.io/github/jekyll/jekyll/master
15
+ [travis]: https://travis-ci.org/jekyll/jekyll
16
+
17
+ By Tom Preston-Werner, Nick Quaranto, Parker Moore, and many [awesome contributors](https://github.com/jekyll/jekyll/graphs/contributors)!
18
+
19
+ Jekyll is a simple, blog-aware, static site generator perfect for personal, project, or organization sites. Think of it like a file-based CMS, without all the complexity. Jekyll takes your content, renders Markdown and Liquid templates, and spits out a complete, static website ready to be served by Apache, Nginx or another web server. Jekyll is the engine behind [GitHub Pages](http://pages.github.com), which you can use to host sites right from your GitHub repositories.
20
+
21
+ ## Philosophy
22
+
23
+ Jekyll does what you tell it to do — no more, no less. It doesn't try to outsmart users by making bold assumptions, nor does it burden them with needless complexity and configuration. Put simply, Jekyll gets out of your way and allows you to concentrate on what truly matters: your content.
24
+
25
+ ## Having trouble with OS X El Capitan?
26
+
27
+ See: http://jekyllrb.com/docs/troubleshooting/#jekyll-amp-mac-os-x-1011
28
+
29
+ ## Getting Started
30
+
31
+ * [Install](http://jekyllrb.com/docs/installation/) the gem
32
+ * Read up about its [Usage](http://jekyllrb.com/docs/usage/) and [Configuration](http://jekyllrb.com/docs/configuration/)
33
+ * Take a gander at some existing [Sites](https://wiki.github.com/jekyll/jekyll/sites)
34
+ * Fork and [Contribute](http://jekyllrb.com/docs/contributing/) your own modifications
35
+ * Have questions? Check out our official forum community [Jekyll Talk](https://talk.jekyllrb.com/) or [`#jekyll` on irc.freenode.net](https://botbot.me/freenode/jekyll/)
36
+
37
+ ## Code of Conduct
38
+
39
+ In order to have a more open and welcoming community, Jekyll adheres to a
40
+ [code of conduct](CONDUCT.markdown) adapted from the Ruby on Rails code of
41
+ conduct.
42
+
43
+ Please adhere to this code of conduct in any interactions you have in the
44
+ Jekyll community. It is strictly enforced on all official Jekyll
45
+ repositories, websites, and resources. If you encounter someone violating
46
+ these terms, please let a maintainer (@parkr, @envygeeks, or @mattr-) know
47
+ and we will address it as soon as possible.
48
+
49
+ ## Diving In
50
+
51
+ * [Migrate](http://import.jekyllrb.com/docs/home/) from your previous system
52
+ * Learn how the [YAML Front Matter](http://jekyllrb.com/docs/frontmatter/) works
53
+ * Put information on your site with [Variables](http://jekyllrb.com/docs/variables/)
54
+ * Customize the [Permalinks](http://jekyllrb.com/docs/permalinks/) your posts are generated with
55
+ * Use the built-in [Liquid Extensions](http://jekyllrb.com/docs/templates/) to make your life easier
56
+ * Use custom [Plugins](http://jekyllrb.com/docs/plugins/) to generate content specific to your site
57
+
58
+ ## License
59
+
60
+ See [LICENSE](https://github.com/jekyll/jekyll/blob/master/LICENSE).
data/bin/jekyll ADDED
@@ -0,0 +1,51 @@
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]', 'Destination directory (defaults to ./_site)'
20
+ p.option 'safe', '--safe', 'Safe mode (defaults to false)'
21
+ p.option 'plugins_dir', '-p', '--plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]', Array, 'Plugins directory (defaults to ./_plugins)'
22
+ p.option 'layouts_dir', '--layouts DIR', String, 'Layouts directory (defaults to ./_layouts)'
23
+ p.option 'profile', '--profile', 'Generate a Liquid rendering profile'
24
+
25
+ Jekyll::External.require_if_present(Jekyll::External.blessed_gems) do |g|
26
+ cmd = g.split('-').last
27
+ p.command(cmd.to_sym) do |c|
28
+ c.syntax cmd
29
+ c.action do
30
+ Jekyll.logger.abort_with "You must install the '#{g}' gem to use the 'jekyll #{cmd}' command."
31
+ end
32
+ end
33
+ end
34
+
35
+ Jekyll::Command.subclasses.each { |c| c.init_with_program(p) }
36
+
37
+ p.action do |args, _|
38
+ if args.empty?
39
+ Jekyll.logger.error "A subcommand is required."
40
+ puts p
41
+ abort
42
+ else
43
+ subcommand = args.first
44
+ unless p.has_command? subcommand
45
+ Jekyll.logger.abort_with "fatal: 'jekyll #{args.first}' could not" \
46
+ " be found. You may need to install the jekyll-#{args.first} gem" \
47
+ " or a related gem to be able to use this subcommand."
48
+ end
49
+ end
50
+ end
51
+ end
data/lib/jekyll.rb ADDED
@@ -0,0 +1,180 @@
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].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 = {})
99
+ config = Configuration[Configuration::DEFAULTS]
100
+ override = Configuration[override].stringify_keys
101
+ unless override.delete('skip_config_files')
102
+ config = config.read_config_files(config.config_files(override))
103
+ end
104
+
105
+ # Merge DEFAULTS < _config.yml < override
106
+ config = Utils.deep_merge_hashes(config, override).stringify_keys
107
+ set_timezone(config['timezone']) if config['timezone']
108
+
109
+ config
110
+ end
111
+
112
+ # Public: Set the TZ environment variable to use the timezone specified
113
+ #
114
+ # timezone - the IANA Time Zone
115
+ #
116
+ # Returns nothing
117
+ def set_timezone(timezone)
118
+ ENV['TZ'] = timezone
119
+ end
120
+
121
+ # Public: Fetch the logger instance for this Jekyll process.
122
+ #
123
+ # Returns the LogAdapter instance.
124
+ def logger
125
+ @logger ||= LogAdapter.new(Stevenson.new, (ENV["JEKYLL_LOG_LEVEL"] || :info).to_sym)
126
+ end
127
+
128
+ # Public: Set the log writer.
129
+ # New log writer must respond to the same methods
130
+ # as Ruby's interal Logger.
131
+ #
132
+ # writer - the new Logger-compatible log transport
133
+ #
134
+ # Returns the new logger.
135
+ def logger=(writer)
136
+ @logger = LogAdapter.new(writer, (ENV["JEKYLL_LOG_LEVEL"] || :info).to_sym)
137
+ end
138
+
139
+ # Public: An array of sites
140
+ #
141
+ # Returns the Jekyll sites created.
142
+ def sites
143
+ @sites ||= []
144
+ end
145
+
146
+ # Public: Ensures the questionable path is prefixed with the base directory
147
+ # and prepends the questionable path with the base directory if false.
148
+ #
149
+ # base_directory - the directory with which to prefix the questionable path
150
+ # questionable_path - the path we're unsure about, and want prefixed
151
+ #
152
+ # Returns the sanitized path.
153
+ def sanitized_path(base_directory, questionable_path)
154
+ return base_directory if base_directory.eql?(questionable_path)
155
+
156
+ questionable_path.insert(0, '/') if questionable_path.start_with?('~')
157
+ clean_path = File.expand_path(questionable_path, "/")
158
+ clean_path.sub!(/\A\w\:\//, '/')
159
+
160
+ if clean_path.start_with?(base_directory.sub(/\A\w\:\//, '/'))
161
+ clean_path
162
+ else
163
+ File.join(base_directory, clean_path)
164
+ end
165
+ end
166
+
167
+ # Conditional optimizations
168
+ Jekyll::External.require_if_present('liquid-c')
169
+ end
170
+ end
171
+
172
+ require "jekyll/drops/drop"
173
+ require_all 'jekyll/commands'
174
+ require_all 'jekyll/converters'
175
+ require_all 'jekyll/converters/markdown'
176
+ require_all 'jekyll/drops'
177
+ require_all 'jekyll/generators'
178
+ require_all 'jekyll/tags'
179
+
180
+ 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