下一代静态网站生成框架Awestruct在Fedora18安装全过程

Awestruct是非常棒的静态网站生成框架,他基于Jekyll,使用Ruby语言开发。Awestruct可以根据模板生成非常漂亮的网站,例如可以用BootStrap或者BluePrint,这两个大名鼎鼎的东东不用多说了吧,地球人都知道。废话不多说,进入主题。

安装Ruby环境

首先安装一些依赖库,否则安装Awestruct会报如下的错误:

Building native extensions.  This could take a while... 
.........
ERROR: Error installing 下一代静态网站生成工具:
        ERROR: Failed to build gem native extension. .
        /usr/bin/ruby extconf.rb
checking for stdio.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
.
Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/bin/ruby
/usr/share/ruby/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from /usr/share/ruby/mkmf.rb:506:in `try_cpp'
        from /usr/share/ruby/mkmf.rb:931:in `block in have_header'
        from /usr/share/ruby/mkmf.rb:790:in `block in checking_for'
        from /usr/share/ruby/mkmf.rb:284:in `block (2 levels) in postpone'
        from /usr/share/ruby/mkmf.rb:254:in `open'
        from /usr/share/ruby/mkmf.rb:284:in `block in postpone'
        from /usr/share/ruby/mkmf.rb:254:in `open'
        from /usr/share/ruby/mkmf.rb:280:in `postpone'
        from /usr/share/ruby/mkmf.rb:789:in `checking_for'
        from /usr/share/ruby/mkmf.rb:930:in `have_header'
        from extconf.rb:2:in `<main>'

开始安装依赖库,用 root 用户或者 su 执行如下命令:

yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel
我是Fedora的粉丝,对不住用其它发行版的童鞋了,请自行根据我列出的安装包找到对应的系统安装方法。

安装Ruby和RubyGems,用 root 用户或者 su 执行如下命令:

yum install ruby ruby-devel ruby-irb rubygems

Fedora18 Yum源的Ruby非常新,都是目前(2012-12-14)的最新版本,看看安装的Ruby版本:

正在安装    : libyaml-0.1.4-3.fc18.x86_64                                           1/10    
正在安装 : ruby-libs-1.9.3.327-22.fc18.x86_64 2/10
正在安装 : ruby-irb-1.9.3.327-22.fc18.noarch 3/10
正在安装 : rubygem-json-1.6.5-2.fc18.x86_64 4/10
正在安装 : rubygem-io-console-0.3-22.fc18.x86_64 5/10
正在安装 : rubygem-bigdecimal-1.1.0-22.fc18.x86_64 6/10
正在安装 : rubygem-rdoc-3.12-5.fc18.noarch 7/10
正在安装 : rubygems-1.8.24-3.fc18.noarch 8/10
正在安装 : ruby-1.9.3.327-22.fc18.x86_64 9/10
正在安装 : ruby-devel-1.9.3.327-22.fc18.x86_64

安装Awestruct

Awestruct使用RubyGems管理安装,用 root 用户或者 su 执行如下命令:

gem install 下一代静态网站生成工具 --no-ri --no-rdoc

结果报如下错误:

Fetching: nokogiri-1.5.5.gem (100%) 
ERROR: Error installing 下一代静态网站生成工具:
        invalid gem format for /usr/local/share/gems/cache/nokogiri-1.5.5.gem

这个问题让我郁闷了N久时间,Google了大半天,还特意搞了FANQIANG,结果死活装不上nokogiri。最后通过Yum来解决,我只能说RubyGems安装很无耻!还是YUM好!,命令如下:

yum install -y rubygem-nokogiri

再次安装Awestruct:

yum install -y rubygem-nokogiri

盼望已久的时刻来临,如果哪位童鞋看到如下的输出,Congratulations!

Successfully installed 下一代静态网站生成工具-0.4.7 17 gems installed

不过别高兴太早,先适用下是否OK!用BootStrap模板生产一个新的静态网站,命令如下:

下一代静态网站生成工具 -i -f bootstrap //或者用awestruct --init --framework bootstrap

傻眼了,还是报错:

[root@localhost kuuyee]# 下一代静态网站生成工具 -i -f bootstrap 
/usr/local/share/gems/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
        from /usr/local/share/gems/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>'
        from /usr/local/share/gems/gems/execjs-1.4.0/lib/execjs.rb:4:in `<top (required)>'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/local/share/gems/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'      
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/local/share/gems/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'     
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/handlers/coffeescript_handler.rb:8:in `<top (required)>'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/handler_chains.rb:14:in `<top (required)>'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/pipeline.rb:2:in `<top (required)>'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/engine.rb:6:in `<top (required)>'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/cli/generate.rb:1:in `<top (required)>'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/cli/invoker.rb:4:in `<top (required)>'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/local/share/gems/gems/awestruct-0.4.7/bin/awestruct:6:in `<top (required)>'
        from /usr/local/bin/awestruct:23:in `load'
        from /usr/local/bin/awestruct:23:in `<main>'

顾名思义,提示没有JavaScript Runtime。继续Google,最后一位高人指点说装个JavaScript引擎就OK,我选择NodeJS。只可惜NodeJSF没有YUM源,只能源码编译安装,无所谓,继续:

wget -c 'http://nodejs.org/dist/v0.8.16/node-v0.8.16.tar.gz' 
tar zxvf node-v0.8.16.tar.gz
cd node-v0.8.16
./configure
make && make install

又是一阵漫长的等待,搞不明白一个JS框架怎么要编译这么久,无语!最后编译完成测试一下:

[root@localhost node-v0.8.16]# node -v v0.8.16

OK,继续Awestruct测试:

[root@localhost kuuyee]# 下一代静态网站生成工具 -i -f bootstrap 
/usr/local/share/gems/gems/git-1.2.5/lib/git/lib.rb:700:in `command': git version 2>&1:sh: git: 未找到命令 (Git::GitExecuteError)
        from /usr/local/share/gems/gems/git-1.2.5/lib/git/lib.rb:649:in `current_command_version'
        from /usr/local/share/gems/gems/git-1.2.5/lib/git/lib.rb:659:in `meets_required_version?'
        from /usr/local/share/gems/gems/git-1.2.5/lib/git.rb:30:in `<top (required)>'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/deploy/base_deploy.rb:2:in `<top (required)>'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/deploy/s3_deploy.rb:1:in `<top (required)>'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/cli/deploy.rb:1:in `<top (required)>'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/cli/invoker.rb:7:in `<top (required)>'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
        from /usr/local/share/gems/gems/awestruct-0.4.7/bin/awestruct:6:in `<top (required)>'
        from /usr/local/bin/awestruct:23:in `load'
        from /usr/local/bin/awestruct:23:in `<main>'

竟然还TMD报错,不过这回不用急,只是提示没装Git,好办!那就装呗:

yum install git

再继续Awestruct:

[root@localhost kuuyee.org]# 下一代静态网站生成工具 -i -f bootstrap Create directory: /root/git_project/kuuyee.org/_config Create directory: /root/git_project/kuuyee.org/_layouts Create directory: /root/git_project/kuuyee.org/_ext Create file: /root/git_project/kuuyee.org/_ext/pipeline.rb Create directory: /root/git_project/kuuyee.org/stylesheets directory _site/stylesheets/ directory images/ directory javascripts/ create stylesheets/styles.scss create images/glyphicons-halflings.png create images/glyphicons-halflings-white.png create javascripts/bootstrap-alert.js create javascripts/bootstrap-button.js create javascripts/bootstrap-carousel.js create javascripts/bootstrap-collapse.js create javascripts/bootstrap-dropdown.js create javascripts/bootstrap-modal.js create javascripts/bootstrap-popover.js create javascripts/bootstrap-scrollspy.js create javascripts/bootstrap-tab.js create javascripts/bootstrap-tooltip.js create javascripts/bootstrap-transition.js create javascripts/bootstrap-typeahead.js create _site/stylesheets/styles.css Now you're 下一代静态网站生成工具! To generate your site continuous during development, simply run: 下一代静态网站生成工具 -d and visit your site at http://localhost:4242/ Create file: /root/git_project/kuuyee.org/_layouts/base.html.haml Create file: /root/git_project/kuuyee.org/index.html.haml

Congratulations! 这回真的恭喜你了!赶紧部署一下:

[root@localhost kuuyee]# 下一代静态网站生成工具 -d Unable to locate profile: development Using profile: NONE Generating site: http://localhost:4242 Generating: /1003/awestruct-sample/_site/images/glyphicons-halflings-white.png Generating: /1003/awestruct-sample/_site/images/glyphicons-halflings.png Generating: /1003/awestruct-sample/_site/index.html Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-alert.js /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/handlers/interpolation_handler.rb:35: Use RbConfig instead of obsolete and deprecated Config. Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-button.js Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-carousel.js Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-collapse.js Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-dropdown.js Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-modal.js Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-popover.js Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-scrollspy.js Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-tab.js Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-tooltip.js Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-transition.js Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-typeahead.js Analyzing: /1003/awestruct-sample/_site/stylesheets/styles.css [Listen warning]: Missing dependency 'rb-inotify' (version '~> 0.8.8')! Please run the following to satisfy the dependency: gem install --version '~> 0.8.8' rb-inotify . For a better performance, it's recommended that you satisfy the missing dependency. Listen will be polling changes. Learn more at https://github.com/guard/listen#polling-fallback. . >> Thin web server (v1.4.1 codename Chromeo) >> Maximum connections set to 1024 >> Listening on 0.0.0.0:4242, CTRL+C to stop

打开 http://localhost:4242/ 看看吧!

BootStrap网站模板

细心的童鞋一定会注意到部署输出有警告,我是属于不想看到任何警告的人,所以还得继续,清楚警告:

gem install --version '~> 0.8.8' rb-inotify

再次部署访问就不会有警告了!

大功告成!祝愿各位童鞋安装成功!

posted on 2013-01-24 13:39 kuuyee 阅读(2238) 评论(2)  编辑  收藏 所属分类: LinuxGit/Maven系统管理Ruby/Python/Ceylon

评论

# re: 下一代静态网站生成框架Awestruct在Fedora18安装全过程 2013-01-24 20:06 免费网络记事本

用过 Jekyll ,可以制作一些简单的网站,数据量如果不太大的话是一个很好的选择。配合 github,连空间都省了,很好~  回复  更多评论   

# re: 下一代静态网站生成框架Awestruct在Fedora18安装全过程 2013-01-24 21:10 将夜

框架很重要  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航:
 

导航

<2013年1月>
303112345
6789101112
13141516171819
20212223242526
272829303112
3456789

统计

随笔分类(139)

Linux内核

搜索

积分与排名

最新评论

阅读排行榜