Last active
December 21, 2015 16:59
-
-
Save koron/6337694 to your computer and use it in GitHub Desktop.
patches for Jekyll to work on Windows (2013/08/26 version)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -u jekyll-1.1.2/lib/jekyll/command.rb.orig jekyll-1.1.2/lib/jekyll/command.rb | |
--- jekyll-1.1.2/lib/jekyll/command.rb.orig 2013-08-26 11:31:03 +0900 | |
+++ jekyll-1.1.2/lib/jekyll/command.rb 2013-08-26 11:31:06 +0900 | |
@@ -15,7 +15,9 @@ | |
# | |
# Returns nothing | |
def self.process_site(site) | |
- site.process | |
+ t = Time.now | |
+ num = site.process | |
+ puts "Built #{num} pages in #{Time.now - t} secs" | |
rescue Jekyll::FatalException => e | |
puts | |
Jekyll.logger.error "ERROR:", "YOUR SITE COULD NOT BE BUILT:" | |
diff -u jekyll-1.1.2/lib/jekyll/commands/serve.rb.orig jekyll-1.1.2/lib/jekyll/commands/serve.rb | |
--- jekyll-1.1.2/lib/jekyll/commands/serve.rb.orig 2013-08-26 11:31:03 +0900 | |
+++ jekyll-1.1.2/lib/jekyll/commands/serve.rb 2013-08-26 11:31:06 +0900 | |
@@ -20,7 +20,8 @@ | |
s = HTTPServer.new( | |
:Port => options['port'], | |
:BindAddress => options['host'], | |
- :MimeTypes => mime_types | |
+ :MimeTypes => mime_types, | |
+ :DoNotReverseLookup => true | |
) | |
s.mount(options['baseurl'], HTTPServlet::FileHandler, destination, fh_option) | |
diff -u jekyll-1.1.2/lib/jekyll/convertible.rb.orig jekyll-1.1.2/lib/jekyll/convertible.rb | |
--- jekyll-1.1.2/lib/jekyll/convertible.rb.orig 2013-08-26 11:31:03 +0900 | |
+++ jekyll-1.1.2/lib/jekyll/convertible.rb 2013-08-26 11:31:06 +0900 | |
@@ -28,7 +28,7 @@ | |
# Returns nothing. | |
def read_yaml(base, name) | |
begin | |
- self.content = File.read(File.join(base, name)) | |
+ self.content = File.read(File.join(base, name), self.site.file_read_opts) | |
if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m | |
self.content = $POSTMATCH | |
@@ -145,7 +145,7 @@ | |
def write(dest) | |
path = destination(dest) | |
FileUtils.mkdir_p(File.dirname(path)) | |
- File.open(path, 'w') do |f| | |
+ File.open(path, 'wb') do |f| | |
f.write(self.output) | |
end | |
end | |
diff -u jekyll-1.1.2/lib/jekyll/site.rb.orig jekyll-1.1.2/lib/jekyll/site.rb | |
--- jekyll-1.1.2/lib/jekyll/site.rb.orig 2013-08-26 11:31:03 +0900 | |
+++ jekyll-1.1.2/lib/jekyll/site.rb 2013-08-26 11:31:06 +0900 | |
@@ -5,7 +5,7 @@ | |
attr_accessor :config, :layouts, :posts, :pages, :static_files, | |
:categories, :exclude, :include, :source, :dest, :lsi, :pygments, | |
:permalink_style, :tags, :time, :future, :safe, :plugins, :limit_posts, | |
- :show_drafts, :keep_files, :baseurl | |
+ :show_drafts, :keep_files, :baseurl, :file_read_opts | |
attr_accessor :converters, :generators | |
@@ -30,6 +30,11 @@ | |
self.limit_posts = config['limit_posts'] | |
self.keep_files = config['keep_files'] | |
+ self.file_read_opts = {} | |
+ if config['encoding'] | |
+ self.file_read_opts[:encoding] = Encoding.find(config['encoding']) | |
+ end | |
+ | |
self.reset | |
self.setup | |
end | |
@@ -44,6 +49,7 @@ | |
self.render | |
self.cleanup | |
self.write | |
+ return self.posts.length + self.pages.length | |
end | |
# Reset Site details. | |
diff -u jekyll-1.1.2/lib/jekyll/tags/include.rb.orig jekyll-1.1.2/lib/jekyll/tags/include.rb | |
--- jekyll-1.1.2/lib/jekyll/tags/include.rb.orig 2013-08-26 11:31:03 +0900 | |
+++ jekyll-1.1.2/lib/jekyll/tags/include.rb 2013-08-26 11:31:06 +0900 | |
@@ -62,7 +62,7 @@ | |
Dir.chdir(includes_dir) do | |
choices = Dir['**/*'].reject { |x| File.symlink?(x) } | |
if choices.include?(@file) | |
- source = File.read(@file) | |
+ source = File.read(@file, context.registers[:site].file_read_opts) | |
partial = Liquid::Template.parse(source) | |
context.stack do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -u posix-spawn-0.3.6/lib/posix/spawn.rb.orig posix-spawn-0.3.6/lib/posix/spawn.rb | |
--- posix-spawn-0.3.6/lib/posix/spawn.rb.orig 2013-08-26 11:20:38 +0900 | |
+++ posix-spawn-0.3.6/lib/posix/spawn.rb 2013-08-26 11:20:40 +0900 | |
@@ -267,7 +267,12 @@ | |
# Returns the String output of the command. | |
def `(cmd) | |
r, w = IO.pipe | |
- pid = spawn(['/bin/sh', '/bin/sh'], '-c', cmd, :out => w, r => :close) | |
+ if RUBY_PLATFORM =~ /(mswin|mingw|cygwin|bccwin)/ | |
+ sh = ENV['COMSPEC'] || 'cmd.exe' | |
+ pid = spawn([sh, sh], '/c', cmd, :out => w, r => :close) | |
+ else | |
+ pid = spawn(['/bin/sh', '/bin/sh'], '-c', cmd, :out => w, r => :close) | |
+ end | |
if pid > 0 | |
w.close |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -u pygments.rb-0.5.2/lib/pygments/popen.rb.orig pygments.rb-0.5.2/lib/pygments/popen.rb | |
--- pygments.rb-0.5.2/lib/pygments/popen.rb.orig 2013-08-26 11:20:46 +0900 | |
+++ pygments.rb-0.5.2/lib/pygments/popen.rb 2013-08-26 11:20:56 +0900 | |
@@ -45,6 +45,9 @@ | |
# because apparently some old versions of Debian only have `python` or | |
# something like that. | |
def python_binary | |
+ if RUBY_PLATFORM =~ /(mswin|mingw|cygwin|bccwin)/ | |
+ return 'python' | |
+ end | |
@python_binary ||= begin | |
`which python2` | |
$?.success? ? "python2" : "python" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment