Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

"G"はGrapeのG

2,486 views

Published on

JGGUG新春LT大会2010で使った資料

  • Be the first to comment

"G"はGrapeのG

  1. 1. “G” Grape G “G” IS FOR GRAPE JGGUG New Year LT Party / Jan 27th, 2010
  2. 2. “The Groovy Adaptable / Advanced Packaging Engine”
  3. 3. Grape? ✤ Maven/Ivy ✤ jar ✤ ✤ Groovy 1.6 1.7
  4. 4. > groovy .groovy Groovy 1.6 RC1 grape http://d.hatena.ne.jp/masanobuimai/20081224/1230123639
  5. 5. Grape Derby SqlPortable http://d.hatena.ne.jp/kiy0taka/20090308/1236459204 kiy0taka grape groovy & grape http://genzou-postit.blogspot.com/2009/05/groovy-grape.html commons-net jar Groovy FTP by grape http://d.hatena.ne.jp/fumokmm/20090607/1244391071 Grape Twitter4j jar Groovy Twitter (@Grab ) http://d.hatena.ne.jp/nobusue/20090703/p1 nobusue
  6. 6. Java Groovy “G” Gandalf G?
  7. 7. In Groovy 1.6 ✤ ✤ @Grab(group=’gid’, module=’aid’, version=’ver’) ✤ ✤ Grape.grab(group:’gid’, module:’aid’, version=’ver’) ✤ ✤ grape <install|list|resolve>
  8. 8. In Groovy 1.7 ✤ ✤ import package ✤ @Grab ✤ @Grab(‘gid:aid:ver’) ✤ ✤ @GrabResolver(name=’repository’, root=’url’)
  9. 9. ✤ Grape ‣ http://groovy.codehaus.org/Japanese+Grape ✤ Groovy 1.7 ‣ http://groovy.codehaus.org/Japanese+Groovy+1.7+release+notes
  10. 10. Groovy Web
  11. 11. @Grab('org.eclipse.jetty:jetty-server:7.0.1.v20091125') @Grab('org.eclipse.jetty:jetty-servlet:7.0.1.v20091125') import org.eclipse.jetty.server.* import org.eclipse.jetty.server.handler.* import org.eclipse.jetty.servlet.* import groovy.servlet.* server = new Server(8080) servletHandler = new ServletContextHandler(ServletContextHandler.SESSIONS) servletHandler.with { resourceBase = '.' contextPath = '/' addServlet(GroovyServlet, '*.groovy') addServlet(TemplateServlet, '*.gtpl') } resourceHandler = new ResourceHandler( resourceBase:".", welcomeFiles:['index.html'], directoriesListed:true) server.handler = new HandlerList(handlers:[servletHandler, resourceHandler]) server.start()
  12. 12. GitHub
  13. 13. @GrabResolver(name='HiveDB', root='http://www.hivedb.org/maven/') @Grab('org.hivedb:github-api:1.0') import org.hivedb.github.* hub = new GitHub('glaforge', 'gaelyk') println "Recent commits in ${hub.userName}/${hub.repository}:" hub.commits.each { c -> println """ ${c.authorDate} by ${c.author.name} ${c.message} ${c.url}""" }
  14. 14. Smack Google Talk
  15. 15. @Grab('jivesoftware:smack:3.0.4') @Grab('jivesoftware:smackx:3.0.4') import org.jivesoftware.smack.* (username, password) = [' ', ' '] to = ' @gmail.com' con = new XMPPConnection( new ConnectionConfiguration('talk.google.com', 5222, 'gmail.com')) con.connect() con.login(username, password) chat = con.chatManager.createChat(to, { chat, msg -> chat.sendMessage(msg.body) } as MessageListener) chat.sendMessage("Say something to me. I'll echo it.") while(true) { sleep 1000 }
  16. 16. @Grab Grape =
  17. 17. Let’s get Groovy!

×