ruby on rails 打包

1.打包Gems

有用的命令

#rakegems#Listthegemsthatthisrailsapplicationdependson

#rakegems:install#Installsallrequiredgemsforthisapplication.

#rakegems:unpack#Unpacksallgemsintovendor/gems.

#rakegems:unpack:dependencies#Unpackalldependencies

#rakegems:unpack:dependenciesGEM=foo#Unpackalldependenciesforgemfoo

#rakegems:build#forbuildnativeextensions.

最主要还是用下面的命令,

#cdvendor/gems

#gemunpackgem-name(likesinatra)

错误1:

config.gem:Unpackedgemyajl-ruby-0.7.6invendor/gemshasnospecificationfile.Run'rakegems:refresh_specs'tofixthis.

解决1:

#sudorakegems:refresh_specs

错误2:

把sqlite3-ruby-1.2.5卸载掉(sudogemuninstallsqlite3-ruby),

看打包到vendorgems下的包能好争取运行?没有出现“nosqlite3的错误”

那是切出现了

NameError-uninitializedconstantSQLite3::Driver::Native::Driver::API:

重新sudogeminstallsqlite3-ruby,也没用。最后把,“vendor/gems/sqlite3-ruby.1.2.5“

删掉好了。

2.打包rails

我本地装rails是2.3.5。运行#rakerails:freeze:edge后,会下载rails.edge.zip,然后安装到

vendor/rails/。运行后有错误:

"nosuchfiletoload-../config/../vendor/rails/railties/lib/initializer"

看代码后,发现可能是版本不对的问题。最后从,"http://dev.rubyonrails.org/archives/"

下载rails.2.3.5.zip解压到vendor/rails.成功。

3.打包rake,rubygems

4.用tar2rubyscript生成,****.rb

5.打包ruby进去

====

达到的要求是,在考虑用户没有网络连接的情况下,没有实现装任何东西包括ruby,

点击安装后就可以运行RubyOnRails运用。

简化gem安装

[装自]http://www.javaeye.com/topic/184400

RubyonRails项目往往用到大量第三方的gems,在项目有新成员加入,或配置新的开发系统时,一个个的安装是件很繁琐的事情。我用的办法就是写一个自己的gem,让它依赖于项目里用到的其他gems。这样的话,安装这个gem的时候,就会顺带把其他gems安装了。

代码非常简单:

>catinstall-gems.gemspec

#

#Usage:

#gembuildinstall-gems.gemspec

#geminstallinstall-gems.0.0.1.gem

#gemuninstallinstall-gems(optional,removethisuselessgem)

#

spec=Gem::Specification.newdo|s|

s.name="install-gems"

s.version="0.0.1"

s.author="yawl"

s.email="[email protected]"

s.homepage="http://xruby.javaeye.com"

s.platform=Gem::Platform::RUBY

s.summary="Thisgemhasnocontentinitself,ithelpstoinstallallthegemswedependon"

s.add_dependency('actionmailer','>=2.0.2')

s.add_dependency('actionpack','>=2.0.2')

s.add_dependency('activerecord','>=2.0.2')

s.add_dependency('activeresource','>=2.0.2')

s.add_dependency('activesupport','>=2.0.2')

s.add_dependency('acts_as_ferret','>=0.4.3')

s.add_dependency('capistrano','>=2.1.0')

s.add_dependency('mysql','>=2.7')

s.add_dependency('rails','>=2.0.2')

s.add_dependency('rake','>=0.8.1')

#addmorehere

end阅读全文

相关推荐