如何使用 jruby on Rails 2.3 解压 gem?
我正在尝试解压所有系统 gem,最终得到一个独立的 Rails 目录,其中包括所有 Rails gem 和所有系统 gem。
我从裸轨设置开始;刚刚做了一个 jruby -Srails 和一个“生成 jdbc”。然后,我将 config.gem 'jdbc-mysql' 添加到environment.rb 并执行 jruby -S rake gems:unpack:dependencies。
解压后,如果我进行 rake,我会得到:
no such file to load -- jdbc-mysql
是否还需要做其他事情才能解压 jdbc gem?
我正在使用 jruby 1.4.0(并且迁移到 1.5 在我的待办事项列表中)和 Rails 2.3.8。
I'm trying to unpack all the system gems to end up with a standalone Rails directory including all the rails gems and all the system gems.
I'm starting with a bare rails setup; just did a jruby -S rails and a 'generate jdbc'. I then add a config.gem 'jdbc-mysql' to environment.rb and do the jruby -S rake gems:unpack:dependencies.
After unpacking, if I do a rake I get:
no such file to load -- jdbc-mysql
Is there something else you need to do to get the jdbc gem unpacked?
I'm using jruby 1.4.0 (and moving to 1.5 is on my todo list) and rails 2.3.8.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我所做的:
1)将 gems 安装到本地存储库
2) 将我的加载环境设置为使用本地存储库中的 gemrc.yml 文件
要在本地安装 gem,请从项目文件夹中执行此操作:
gem install {gemname} -i gems
(“-i gems”告诉 rubygems 将 gem 安装在 gems 文件夹中,而 {gemname} 是您要安装的 gem 名称的占位符。)
要设置 gemrc.yml,请在新创建的文件中创建一个文件gems 文件夹名为 gemrc.yml ,其中包含以下内容:
http://gist.github.com/430339
然后你需要告诉你的应用程序使用本地在启动时将以下内容添加到 config/boot.rb 中
http://gist.github.com/430343
祝你好运......并且可以获得额外的积分如果需要的话,设置安装 gem 的能力。我通过一个名为 dependency 的方法来完成此操作,该方法是 require 命令的辅助方法...这个函数接收一个名称和选项...这样我就简单地说: (dependency 'extlib') 如果它满足,它就会执行此操作不能需要宝石。
put gem install --config-file gems/gemrc.yml #{'-v "'+options[:version].gsub(' ','')+'"' if options[:version]} # {选项[:gem] ||名称}
Here is what I do:
1) Install gems to a local repository
2) Set my load environment to use a gemrc.yml file from inside the local repository
To instal gems locally do this from your project folder:
gem install {gemname} -i gems
(the "-i gems" tells rubygems to install the gem in the folder gems and the {gemname} is a placeholder for the name of the gem you want to install.)
To set your gemrc.yml make a file in the newly created gems folder called gemrc.yml with something like the following content:
http://gist.github.com/430339
Then you need to tell your app to use your local gems at startup by adding the following to your config/boot.rb
http://gist.github.com/430343
Good luck... and for extra credit you could setup the ability to install a gem if it is needed. I did this through a method called dependency which is a helper method for the require command... This function receives a name and options... This way I simply say something like: (dependency 'extlib') and it does this if it cannot require the gem.
puts
gem install --config-file gems/gemrc.yml #{'-v "'+options[:version].gsub(' ','')+'"' if options[:version]} #{options[:gem] || name}