我如何更新Octopress?

时间:2014-05-02 23:43:32

标签: octopress

official guide says

git pull octopress master # Get the latest Octopress
bundle install # Keep gems updated
rake update_source # update the template's source
rake update_style # update the template's style

我被困在rake update_source:

Welcome to Git (version 1.8.5.2-preview20131230)

MrD@MRSD /c/Dropbox/Udun/octopress (source) # source, where I write the blog
$ git checkout master
Branch master set up to track remote branch master from octopress.
Switched to a new branch 'master'
MrD@MRSD /c/Dropbox/Udun/octopress (master)
$ git pull octopress master
From git://github.com/imathis/octopress
 * branch            master     -> FETCH_HEAD
Already up-to-date.
MrD@MRSD /c/Dropbox/Udun/octopress (master)
$ bundle install
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (0.9.2.2)
# ...
Using bundler (1.3.5)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
MrD@MRSD /c/Dropbox/Udun/octopress (master)
$ rake update_source
## Set the codepage to 65001 for Windows machines
mkdir source.old
cp -r source/. source.old
## Copied source into source.old/
cp -r --remove-destination .themes/classic/source/. source
cp -r --remove-destination source.old/_includes/custom/. source/_includes/custom
/
rake aborted!
No such file or directory - source.old/_includes/custom/.
c:/Dropbox/Udun/octopress/Rakefile:206:in `block in <top (required)>'
Tasks: TOP => update_source
(See full trace by running task with --trace)

那我该怎么办?

编辑 :我于2014年7月16日发布了一个问题:https://github.com/imathis/octopress/issues/1604

我已经重新掌握了源代码(需要我说我不关心源历史记录,我的错别字是为了分享)和博客功能,但我想对此有一些反馈 - 即:< / p>

  

我是否需要在master上重新设置源代码分支才能正确更新?

2 个答案:

答案 0 :(得分:1)

真正的答案是我永远不应该检查master。当我从源头做到这一过程时,过程进展顺利......

MrD@MRSD /c/Dropbox/Udun/octopress (source)
$ rake update_source
## Removed existing source.old directory
rm -r source.old
mkdir source.old
cp -r source/. source.old
## Copied source into source.old/
cp -r --remove-destination .themes/classic/source/. source
cp -r --remove-destination source.old/_includes/custom/. source/_includes/custom
/
cp source.old/favicon.png source
## Updated source ##

MrD@MRSD /c/Dropbox/Udun/octopress (source)
$ rake update_style
mv sass sass.old
## Moved styles into sass.old/
cp -r .themes/classic/sass/ sass
cp -r sass/custom/. sass.old/custom
## Updated Sass ##

仍然覆盖了:

source/_includes/navigation.html
source/_layouts/post.html

on rake update_source和:

sass/custom/_styles.scss

on rake update_style。

我也想知道 - 我应该重新掌握主人吗?

编辑:我认为应该发出git rebase master并关闭此

答案 1 :(得分:0)

我注意到Octopress的Rakefile存在一些问题,通常是语法错误。

您的错误出现在日志输出中:

No such file or directory - source.old/_includes/custom/.

这给我敲响了...... Octopress的作者最近才在去年年底或者今年年初或之前添加了_includes / custom / set of templates。因此,较旧的安装可能没有它。奇怪的是,这会如何破坏整个剧本 - 它应该忽略它。

您可以查看原始文件/目录,看看您是否有_includes/custom/?我愿意打赌你没有,所以你为什么要更新。

截至4月4日左右看我的Rakefile(我第一次下载Octopress进行转换,最后一次),代码为:

desc "Move source to source.old, install source theme updates, replace source/_includes/navigation.html with source.old's navigation"
task :update_source, :theme do |t, args|
  theme = args.theme || 'classic'
  if File.directory?("#{source_dir}.old")
    puts "## Removed existing #{source_dir}.old directory"
    rm_r "#{source_dir}.old", :secure=>true
  end
  mkdir "#{source_dir}.old"
  cp_r "#{source_dir}/.", "#{source_dir}.old"
  puts "## Copied #{source_dir} into #{source_dir}.old/"
  cp_r "#{themes_dir}/"+theme+"/source/.", source_dir, :remove_destination=>true
  cp_r "#{source_dir}.old/_includes/custom/.", "#{source_dir}/_includes/custom/", :remove_destination=>true
  cp "#{source_dir}.old/favicon.png", source_dir
  mv "#{source_dir}/index.html", "#{blog_index_dir}", :force=>true if blog_index_dir != source_dir
  cp "#{source_dir}.old/index.html", source_dir if blog_index_dir != source_dir && File.exists?("#{source_dir}.old/index.html")
  puts "## Updated #{source_dir} ##"
end

所以,打开你的Rakefile并找到上面的那一行:

cp_r "#{source_dir}.old/_includes/custom/.", "#{source_dir}/_includes/custom/", :remove_destination=>true

并评论出来:

#cp_r "#{source_dir}.old/_includes/custom/.", "#{source_dir}/_includes/custom/", :remove_destination=>true

其余的看起来应该在那里。

另请注意该Rakefile的update_style方法:

desc "Move sass to sass.old, install sass theme updates, replace sass/custom with sass.old/custom"
task :update_style, :theme do |t, args|
  theme = args.theme || 'classic'
  if File.directory?("sass.old")
    puts "removed existing sass.old directory"
    rm_r "sass.old", :secure=>true
  end
  mv "sass", "sass.old"
  puts "## Moved styles into sass.old/"
  cp_r "#{themes_dir}/"+theme+"/sass/", "sass"
  cp_r "sass/custom/.", "sass.old/custom"
  puts "## Updated Sass ##"
end

这可能也会出错,具体取决于您的安装方式。

总而言之,您只需要hack您的Rakefile(和Gemfile,argh)来满足您的安装/要求。这就是为什么你选择运行黑客的博客框架:劈开它。否则你会在Wordpress上,对吗?