李順利
          隨筆-50  評(píng)論-170  文章-0  trackbacks-0

          程序員的第一篇博客,一般都是Hello World,我也習(xí)俗下。

          以下用幾種方式(Octopress)來(lái)貼HelloWorld的代碼

          • Backtick Code Blocks
          HelloWorld.java
          1
          2
          3
          4
          5
          6
          7
          8
          9
          
          /**
           *
           * @author ShunLi
           */
            public class HelloWorld {
            public static void main(String[] args) {
                System.out.println("Hello World!");
            }
          }
          
          • Include Code Snippets
          (HelloWorld.java)download
          1
          2
          3
          4
          5
          6
          7
          8
          9
          
          /**
           *
           * @author ShunLi
           */
          public class HelloWorld {
              public static void main(String[] args) {
                  System.out.println("Hello World!");
              }
          }
          
          • Gist Embedding
          • Inline Code Blocks
          1
          2
          3
          4
          5
          6
          7
          8
          9
          
          /**
           *
           * @author ShunLi
           */
            public class HelloWorld {
            public static void main(String[] args) {
                System.out.println("Hello World!");
            }
          }
          

          B.T.W. 我以后應(yīng)該比較常用Backtick code blocks 和 Include code sinipets.

          P.S. 悲催地體驗(yàn)——在Windows下安裝Octopress

          在Windows下體驗(yàn)Ruby,真的是一件很痛苦的事情,有打算遷移到Ubuntu環(huán)境了。 這里記錄下載Windows下安裝Octopress的步驟,有些真是很痛苦。

          • 安裝 ruby 
            如果你不怕麻煩的話,可以選擇裝ruby+Devkit(Devkit也要安裝不然在bundle install這步附近應(yīng)該會(huì)有問(wèn)題),Windows下安裝ruby可以通過(guò)RubyInstaller(不過(guò)好像經(jīng)常需要翻Wall過(guò)去才能打開(kāi)),更方便地方法是直接通過(guò)
            railsinstaller 來(lái)安裝,里面包括很多需要的工具。

          • 安裝 python 這個(gè)真的需要,ruby核心部分有用到。如果沒(méi)有安裝Python的話,在Octopress的代碼高亮(include_code 等)部分可能會(huì)出現(xiàn)問(wèn)題: 
            比如:

          1
          2
          3
          
          Liquid error: No such file or directory - python -c import sys; print sys.executable
          # or
          Liquid error: undefined method `Py_IsInitialized’ for RubyPython::Python:Module
          

          請(qǐng)先安裝 python-xxx.msi,然后把python home(e.g. C:\Python27)加到windows環(huán)境變量下 
          請(qǐng)注意,一定要把python home加到windows環(huán)境變量下。

          如果還不行的話,請(qǐng)參考這個(gè)issue,應(yīng)該能夠解決。

          • 安裝octopress 
            這個(gè)官網(wǎng)已經(jīng)有介紹了,應(yīng)該比較簡(jiǎn)單。

          • 中文問(wèn)題
            Windows下如果有中文的話,在generate步驟就會(huì)失敗,網(wǎng)上給出的解決方法也很簡(jiǎn)單,就是設(shè)置自己本機(jī)的環(huán)境變量 
             
            具體的就是這樣設(shè)置的

          1
          2
          
          set LC_ALL=zh_CN.UTF-8
          set LANG=zh_CN.UTF-8
          
          • 還有一個(gè)問(wèn)題 
            對(duì)有序序列支持不好,我已經(jīng)提了一個(gè)
            bug了。

          • 就請(qǐng)歡樂(lè)地?fù)肀ctopress/Jekyll吧。

          后記

          Octopress 重裝記

          1. 參考本文 ,安裝ROR,Python并配置好環(huán)境配置(中文編碼、python)
          2. git clone git@github.com:lishunli/lishunli.github.com.git (change it by yourself)
          3. git checkout source
          4. bundle install or bundle update
          5. rake setup_github_pages
          6. rake generate, rake preview, rake deploy
          7. rake new_post[“title”] 新建的文章默認(rèn)是ANSI編碼的,這會(huì)導(dǎo)致generate步驟失敗,請(qǐng)轉(zhuǎn)換為UTF-8格式的文件后重新來(lái)過(guò),如果還有問(wèn)題,嘗試其它的解決辦法。

          順利更新于2012年12月17日



          博客中的一些下載已經(jīng)放到了百度云了,請(qǐng)根據(jù)需要下載。【點(diǎn)我去百度云下載】

          最后弱弱地說(shuō)一下,如果可以的話,轉(zhuǎn)載請(qǐng)?zhí)峁┏鎏? ),謝謝。
          posted on 2012-03-18 00:04 李順利 閱讀(7984) 評(píng)論(3)  編輯  收藏

          評(píng)論:
          # re: 試用Octopress 2012-03-18 11:43 | 李順利
          @tb
          我知道,我只是寫(xiě)一些我自己使用過(guò)程中的一些問(wèn)題,在Windows下,有太多問(wèn)題了。  回復(fù)  更多評(píng)論
            
          # re: 試用Octopress 2012-03-18 13:57 | liang
          不錯(cuò)  回復(fù)  更多評(píng)論
            
          # rake deploy 錯(cuò)誤 2013-07-30 11:44 | abdong
          d:\GitHub>git clone git://github.com/imathis/octopress.git abdong.github.com
          Cloning into 'abdong.github.com'...
          remote: Counting objects: 10661, done.
          remote: Compressing objects: 100% (5052/5052), done.
          remote: Total 10661 (delta 5434), reused 9941 (delta 4748)
          Receiving objects: 100% (10661/10661), 2.58 MiB | 39.00 KiB/s, done.
          Resolving deltas: 100% (5434/5434), done.

          d:\GitHub>cd abdong.github.com


          d:\GitHub\abdong.github.com>gem install bundler
          Successfully installed bundler-1.3.5
          1 gem installed
          Installing ri documentation for bundler-1.3.5...
          Installing RDoc documentation for bundler-1.3.5...

          d:\GitHub\abdong.github.com>bundle install
          Fetching source index from http://ruby.taobao.org/


          d:\GitHub\abdong.github.com>rake setup_github_pages
          Enter the read/write url for your repository
          (For example, 'git@github.com:your_username/your_username.github.io)
          or 'https://github.com/your_username/your_username.github.io')
          Repository url: git@github.com:abdong/abdong.github.com.git
          Added remote git@github.com:abdong/abdong.github.com.git as origin

          d:\GitHub\abdong.github.com>rake install

          d:\GitHub\abdong.github.com>rake new_post["第一篇博客"]

          d:\GitHub\abdong.github.com>rake generate


          d:\GitHub\abdong.github.com>rake preview


          d:\GitHub\abdong.github.com>rake deploy
          ## Deploying branch to Github Pages
          ## Pulling any updates from Github Pages
          cd _deploy
          ERROR: Repository not found.
          fatal: Could not read from remote repository.

          Please make sure you have the correct access rights
          and the repository exists.
          cd -
          rm -rf _deploy/index.html

          ## Copying public to _deploy
          cp -r public/. _deploy
          cd _deploy

          ## Commiting: Site updated at 2013-07-30 02:49:26 UTC
          [master 37e047c] Site updated at 2013-07-30 02:49:26 UTC
          61 files changed, 1118 insertions(+)
          .................................................
          create mode 100644 stylesheets/screen.css

          ## Pushing generated _deploy website
          ERROR: Repository not found.
          fatal: Could not read from remote repository.

          Please make sure you have the correct access rights
          and the repository exists.

          ## Github Pages deploy complete
          cd -


          請(qǐng)問(wèn)是什么原因,多謝!~  回復(fù)  更多評(píng)論
            

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 黄平县| 新巴尔虎右旗| 泰安市| 瑞昌市| 石楼县| 建瓯市| 镇雄县| 平陆县| 海门市| 石门县| 綦江县| 曲周县| 白山市| 霍邱县| 虎林市| 淮滨县| 广丰县| 夏津县| 方山县| 宁城县| 英吉沙县| 于田县| 湛江市| 平泉县| 和政县| 潍坊市| 夏河县| 黄冈市| 怀来县| 大冶市| 台东县| 浮梁县| 沙雅县| 土默特左旗| 辛集市| 高密市| 兴文县| 麟游县| 靖远县| 彰武县| 昌图县|