ruby、gem、haml安装

ruby、gem、haml安装

  • ruby 安装

windows用户,使用RubyInstaller安装,下载地址: http://rubyinstaller.org/downloads/

目前Ruby最新版为Ruby 2.2.2(64位系统的安装Ruby 2.2.2(x64))。

安装完成后,打开控制台,输入:

C:\Users\dul>ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x64-mingw32]

查看Ruby是否安装成功及安装的版本号。

  • gem安装

gem是个用ruby写的应用程序,用来安装软件包的程序。

Ruby 1.9.2以后的版本默认已安装Ruby Gem

控制台输入:

C:\Users\dul>gem -v
2.4.5

查看gem版本号

  • haml安装

国内网络环境被墙,会出现连接错误,如下:

C:\Users\dul>gem install haml
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ECONNABORTED: An established connection was aborted by the software in your host machine. - SSL_connect (https://api.rubygems.org
/quick/Marshal.4.8/haml-4.0.6.gemspec.rz)

淘宝提供了淘宝提供了RubyGems的国内镜像站点,解决办法是:

C:\Users\dul>gem sources --remove https://rubygems.org/
https://rubygems.org/ removed from sources
C:\Users\dul>gem sources -a http://ruby.taobao.org/
source http://ruby.taobao.org/ already present in the cache
C:\Users\dul>gem sources -l
*** CURRENT SOURCES ***

http://ruby.taobao.org/

请确保只有 ruby.taobao.org

C:\Users\dul>gem install haml
Fetching: tilt-2.0.1.gem (100%)
Successfully installed tilt-2.0.1
Fetching: haml-4.0.6.gem (100%)

HEADS UP! Haml 4.0 has many improvements, but also has changes that may break
your application:

* Support for Ruby 1.8.6 dropped
* Support for Rails 2 dropped
* Sass filter now always outputs <style> tags
* Data attributes are now hyphenated, not underscored
* html2haml utility moved to the html2haml gem
* Textile and Maruku filters moved to the haml-contrib gem

For more info see:

http://rubydoc.info/github/haml/haml/file/CHANGELOG.md

Successfully installed haml-4.0.6
Parsing documentation for tilt-2.0.1
Installing ri documentation for tilt-2.0.1
Parsing documentation for haml-4.0.6
Installing ri documentation for haml-4.0.6
Done installing documentation for tilt, haml after 3 seconds
2 gems installed

haml安装成功后,输入:

C:\Users\dul>haml --help

查看haml命令行工具用法

  • 使用haml命令行工具将haml文件编译为html文件
E:\workspace\jquery-plugins\examples>haml test.html.haml test.html

haml学习地址:

http://haml.info/docs/yardoc/file.REFERENCE.html

时间: 2024-10-07 04:17:35

ruby、gem、haml安装的相关文章

windows下,ruby环境的安装,与sass,compass的使用方法

cmd下:ruby -v  成功 安装使用sass 1:移除http://rubygems.org源 gem sources  --remove  https://rubygems.org/ 2: 添加taobao源 gem sources  -a  https://ruby.taobao.org/ 3: 查看前两步是否操作成功 gem sources  -l 4: 安装sass gem install  sass sass -v 5: gem升级 gem  update 6: 安装制定版本的s

Ruby Gem命令详解

转自:http://www.jianshu.com/p/728184da1699 Gem介绍: Gem是一个管理Ruby库和程序的标准包,它通过Ruby Gem(如 http://rubygems.org/ )源来查找.安装.升级和卸载软件包,非常的便捷. Ruby 1.9.2版本默认已安装Ruby Gem,如果你使用其它发行版本,请参考“如何安装Ruby Gem”. Ruby gem包的安装方式: 所有的gem包,会被安装到 /[Ruby root]/lib/ruby/gems/[ver]/

windows安装ruby,DevKit安装rails,svn安装

Ruby on Rails的安装,是从被称为RubyGems的包管理系统开始的.Ruby on Rails是由Ruby处理系统的类库的.被称为“gem”的格式来进行配置的.“gem”形式的类库,通过使用RubyGems,很容易的来进行安装/卸装.在本文档中,介绍了基于“面向Windows7的安装次序”完成Ruby处理系统(1.9.3)的安装后,进行Ruby on Rails安装的次序.1. RubyInstaller Development Kit (DevKit)的安装在使用RubyGems安

如何创建自己的ruby gem包

编写一个最简单的例子 1. 建好如下文件夹 注意:lib目录下必须有个和你gem名字一样的rb文件. [ruby] view plaincopy $ cd hola $ tree . ├── hola.gemspec └── lib └── hola.rb 2. 编写代码 . hola.rb [ruby] view plaincopy % cat lib/hola.rb class Hola def self.hi puts "Hello world!" end end .hola.g

ruby gem 代理设置

可能是国家防火墙的原因包,安装railsinstaller后执行总是出错, bundle install DL is deprecated, please use Fiddle Fetching gem metadata from https://rubygems.org/---. Resolving dependencies- Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read serv

ruby gem tips(转)

升级ruby gem Ruby代码   gem update --system 查看gem版本 Ruby代码   gem -v 查看gem版本,gems安装目录,remote sources等 Ruby代码   gem env 查看已经添加的remote sources Ruby代码   gem sources 添加一个source Ruby代码   gem sources -a 'htt://rubygems.org' 安装一个gem包 Ruby代码   gem install will_pa

ruby源码安装遇到的问题

用gem install 时报Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources错误, 解决方法: 进入源码包下的ext/zlib ruby ./extconf.rb make make install ruby源码安装遇到的问题

how to build a ruby gem

1. first you will creata a user in rubygem.org (https://rubygems.org/) 2. create the directory structure like this: Java代码   $ tree . ├── cc_hola.gemspec └── lib └── cc_hola.rb you can use any name but you must keep consistency 3. in your .gemspec fi

ruby on rails安装和hello world

一.环境安装 centos 操作系统 1.安装rvm curl -sSL https://get.rvm.io | bash -s stable rvm -v查看是否安装成功 2.安装ruby rvm install 1.9.3 ruby -v 查看ruby版本号 Rvm命令简单使用介绍: rvm install ruby    默认安装最新版本 rvm reinstall ruby  重新安装 rvm remove ruby  删除ruby的安装 若需安装.重装.删除ruby都可指定版本,即在