Ruby打包发布
http://www.erikveen.dds.nl/distributingrubyapplications/rails.html:
In this tutorial, we'll go through the following steps: Setup the environment Create the SQLite database Develop the Rails application Create the RBA (= Ruby archive) from the application with Tar2RubyScript Create the standalone executable with RubyScript2Exe module Rails
class Configuration
def database_configuration
#conf = YAML::load(ERB.new(IO.read(database_configuration_file)).result) 会出错
conf = YAML::load(File.read(database_configuration_file))
if defined?(TAR2RUBYSCRIPT)
conf.each do |k, v|
if v["adapter"] =~ /^sqlite/
v["database"] = oldlocation(v["database"]) if v.include?("database")
v["dbfile"] = oldlocation(v["dbfile"]) if v.include?("dbfile")
end
end
end
conf
end
end
end "database"=>"E:/worksapce/temp/db/demo_development.sqlite3", oldlocation(v["database"]) 其实是在DB子目录中,而不是在当前运行的目录下
tar2rubyscript可以了
rubyscript2exe 不行,有可能是RAILS版本问题, 现在证明不是RAILS版本问题,估计是RUBY 版本问题 2.Exerb不能通过gem安装,不过安装方式也十分方便。
首先到exerb的官方网站下载exerb.链接在页面中间那个位置。
相关文档:
Bignum
+ 加
- 减
* 乘
/ 除
** 指数操作2**2 意思是2的平方
<=> 大于, ......
转自 http://zhujg.javaeye.com/blog/355040
首先 安装 cygwin
cygwin 要安装的插件是
默认的+ make + gcc + libiconv
+ openssl
cygwin下需要编译原文件
到ruby-lang(http://ruby-lang.org/)
下载ruby-1.9.1-p0.tar.gz
tar xvf ruby-1.9.1-p0.tar.gz
cd
ruby-1.9.1-p0
./configure
make && make in ......
Update: This post is outdated. All in one installer for 1.9
is ready now, you should use it if you need 1.9 on windows. Get it here
http://rubyforge.org/frs/?group_id=167
Ruby has “all-in-one” installer for Windows, but it is outdated. As
of May 2009, Ruby 1.9.1 is released, ......
Ruby 异常处理
文章分类:Ruby编程 关键字: ruby 异常 异常处理
异常处理是开发过程中经常要面对的问题,基本所有高级语言都有自己的异常处理系统,ruby也不例外,而且使用起来也非常简单。
ruby中异常的抛出是使用的raise方法,记住 ......
1. 进制的快捷转换
"100".to_i(2) , 将100作为二进制输出十进制数,
结果 : 4
"100".to_i(9), 九进制,
结果: 81
"100".to_i(16), 十六机制,
结果: 256
比较帅,字符串转换在vc编程里面比较头疼。 ......