如何使用jruby-complete.jar安装gem

时间:2015-07-08 16:38:54

标签: rubygems jruby

我是java的新手,请帮助!

我已将已下载的mymat <- structure(c("—", "16", "3", " 2", "11", " 1"), .Dim = c(3L, 2L), .Dimnames = list(c("John Smith", "Jane Doe", "Mary Johnson" ), c("treatmenta", "treatmentb"))) mydf <- structure(list(name = structure(c(2L, 1L, 3L), .Label = c("Jane Doe", "John Smith", "Mary Johnson"), class = "factor"), treatmenta = c("—", "16", "3"), treatmentb = c(2L, 11L, 1L)), .Names = c("name", "treatmenta", "treatmentb"), row.names = c(NA, 3L), class = "data.frame") 置于 self.searchController.searchBar.setTranslatesAutoresizingMaskIntoConstraints(false) self.view.addSubview(self.searchController.searchBar) let heightConstraint = NSLayoutConstraint(item: self.searchController.searchBar, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 1, constant: 44) self.searchController.searchBar.addConstraint(heightConstraint) let statusBarHeight = UIApplication.sharedApplication().statusBarFrame.size.height let navigationBarHeight = self.navigationController?.navigationBar.frame.size.height let searchBarTopConstraint = NSLayoutConstraint(item: self.searchController.searchBar, attribute: NSLayoutAttribute.Top, relatedBy: NSLayoutRelation.Equal, toItem: self.view, attribute: NSLayoutAttribute.Top, multiplier: 1, constant: (statusBarHeight + navigationBarHeight!)) let searchBarLeftConstraint = NSLayoutConstraint(item: self.searchController.searchBar, attribute: NSLayoutAttribute.Left, relatedBy: NSLayoutRelation.Equal, toItem: self.view, attribute: NSLayoutAttribute.Left, multiplier: 1, constant: 0) let searchBarRightConstraint = NSLayoutConstraint(item: self.searchController.searchBar, attribute: NSLayoutAttribute.Right, relatedBy: NSLayoutRelation.Equal, toItem: self.view, attribute: NSLayoutAttribute.Right, multiplier: 1, constant: 0) self.view.addConstraints([searchBarTopConstraint, searchBarLeftConstraint, searchBarRightConstraint]) ,并将其作为该目录中的每个文件的 select line_item_id, Sum( CASE WHEN DATEDIFF(curdate(), event_date) <= 5 then 1 ELSE 0 END ) 'last5days', Sum( CASE WHEN DATEDIFF(curdate(), event_date) <= 10 then 1 ELSE 0 END ) 'last10days', Sum( CASE WHEN DATEDIFF(curdate(), event_date) <= 30 then 1 ELSE 0 END ) 'last30days', Sum( CASE WHEN DATEDIFF(curdate(), event_date) <= 60 then 1 ELSE 0 END ) 'last60days', Sum( CASE WHEN DATEDIFF(curdate(), event_date) <= 90 then 1 ELSE 0 END ) 'last90days' from rpt_domain_by_campaign Group by line_item_id

执行jruby-complete-1.7.21.jar

/var/lib/tomcat6/webapps/activiti-explorer/WEB-INF/lib

我看到奇怪的路径tomcat6:tomcat6

它应该保存宝石的位置?

当我执行gem environment时,它会抱怨权限

/var/lib/tomcat6/webapps/activiti-explorer/WEB-INF/lib# java -jar jruby-complete-1.7.21.jar -S gem environmentRubyGems Environment:
  - RUBYGEMS VERSION: 2.4.8
  - RUBY VERSION: 1.9.3 (2015-07-07 patchlevel 551) [java]
  - INSTALLATION DIRECTORY: file:/var/lib/tomcat6/webapps/activiti-explorer/WEB-INF/lib/jruby-complete-1.7.21.jar!/META-INF/jruby.home/lib/ruby/gems/shared
  - RUBY EXECUTABLE: "java -cp :/var/lib/tomcat6/webapps/activiti-explorer/WEB-INF/lib/jruby-complete-1.7.21.jar org.jruby.Main"
  - EXECUTABLE DIRECTORY: file:/var/lib/tomcat6/webapps/activiti-explorer/WEB-INF/lib/jruby-complete-1.7.21.jar!/META-INF/jruby.home/bin
  - SPEC CACHE DIRECTORY: /root/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: file:/var/lib/tomcat6/webapps/activiti-explorer/WEB-INF/lib/jruby-complete-1.7.21.jar!/META-INF/jruby.home/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-java-1.6
  - GEM PATHS:
     - file:/var/lib/tomcat6/webapps/activiti-explorer/WEB-INF/lib/jruby-complete-1.7.21.jar!/META-INF/jruby.home/lib/ruby/gems/shared
     - /root/.gem/jruby/1.9
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "install" => "--no-rdoc --no-ri --env-shebang"
     - "update" => "--no-rdoc --no-ri --env-shebang"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin

UPDATE1:

如果我尝试以用户tomcat6的身份安装gem,我会收到另一个错误:

file:/var/lib/tomcat6/webapps/activiti-explorer/WEB-INF/lib/jruby-complete-1.7.21.jar!/META-INF/jruby.home/lib/ruby/gems/shared

1 个答案:

答案 0 :(得分:3)

作为tomcat用户,您可以在文件系统上查看默认gem路径的设置:

java -jar jruby-complete-1.7.21.jar -S gem env

您可以指定在系统上安装gem的位置: java -jar jruby-complete-1.7.21.jar -S gem install -i / path / to / location faraday

您可以将GEM_PATH环境变量设置为指向该位置。

您还可以使用rvm来管理ruby和jruby版本以及使用gemdir的gem目录。

相关问题