Rails專案中jRuby與Scala的互動
The JVM is awesome.
But back to the topic of this post: We’ll see how you can leverage both Scala andJRuby in one project. Each will doing what it does best:
1. Ruby will handle the FAST frontend development as one of Ruby’s strong points is obviously Rails which made it so popular. Though there are people implementing APIs in ruby, if you need pure performance, you may need some other lang (vide airbreak, twitter…).
2. Scala will be doing all the heavy lifting including some of our existing code which interacts with zookeeper or uses Akka actors to crunch some numbers.
Another great point here is the reuse of our existing scala codebase which has some nice libraries we’ve implemented during our day-to-day. Anyway, let’s see some code!
Start out with a plain Rails 3.2 project
You know the drill. rvm, ruby, rails new. The only difference here is that we’ll use JRuby right from the start here, so:
CODE:
# get JRuby and start a new rails apprvm install jruby && rvm use jruby
gem install rails
rails new scala-on-railsJRubify it!
Next we’ll add some more dependencies to our Gemfile:
CODE:
# jruby dependencies in Gemfilegem 'jruby-openssl' # simply required
gem 'jruby-scala' # a jruby scala bridge
gem 'warbler' # to create a war file that we'll deploy layer
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/301743/viewspace-733665/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Ruby on rails專案中 引入BootstrapAIboot
- Ruby on Rails 生成指定版本的 Rails 專案AI
- JRuby1.5.1下執行Rails2.2.2應用AI
- 讓你的Rails專案保持清潔AI
- scala 專案生成工具
- ajax與XML檔案互動XML
- Scala的安裝以及建立Scala專案的詳細步驟
- 8.3 JSON資料互動 -《SSM深入解析與專案實戰》JSONSSM
- 使用SBT構建Scala專案
- OC與C++ 混編的檔案互動C++
- 閃購網站Gilt從Rails遷移到Scala網站AI
- JN專案-String與Timestamp互轉
- 敘事:遊戲中角色與劇情的互動遊戲
- python與mysql互動中的各種坑PythonMySql
- 重構 Rails 專案之最佳實踐AI
- Windows IDEA 專案(Scala+Sbt、Scala+Maven)建立與遠端部署到Linux(遠端部署其它專案也適用)WindowsIdeaMavenLinux
- 【Scala篇】--Scala中的函式函式
- 微互動(五)——微互動的迴圈與模式模式
- Java與Excel的互動!-JavaExcel
- Lua 與 ObjC 的互動OBJ
- webview與JS的互動WebViewJS
- (譯)通過WebChannel/WebSockets與QML中的HTML互動WebHTML
- Rails中的Helper方法AI
- kafka:spark-project專案的kafka和scala配置KafkaSparkProject
- Android中程式與Service互動的方式——互動方式Android
- Scala學習(五)---Scala中的類
- Scala 中的集合(一):集合型別與操作型別
- sbt建立play framework(play!)scala web專案FrameworkWeb
- Flutter 與 Android 的互動FlutterAndroid
- ReactNative與iOS的互動ReactiOS
- oc 與js 的原生互動JS
- Intellij IDEA 安裝Scala外掛 + 建立Scala專案(Hello World!)IntelliJIdea
- [混編] iOS原生專案- iOS/flutter 程式碼互動iOSFlutter
- Android 與WebView中的js程式碼的互動記錄AndroidWebViewJS
- linux sed如何與檔案進行互動Linux
- 通過互動式命令從github拉取專案模板並建立新專案Github
- js 與WKWebView 互動JSWebView
- 互動與關係