Gaelyk

2,827 views
2,765 views

Published on

2011/02/24 JGGUGの第15回G*ワークショップの連続LTで使った資料

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,827
On SlideShare
0
From Embeds
0
Number of Embeds
613
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Gaelyk

  1. 1. GAELYK
  2. 2.              
  3. 3.        
  4. 4. http://gaelyk.appspot.com
  5. 5.   / +-- build.groovy +-- src +-- war | +-- index.gtpl +-- css +-- images +-- js +-- WEB-INF | +-- appengine-web.xml +-- web.xml +-- plugins.groovy +-- routes.groovy +-- classes | +-- groovy | | | +-- controller.groovy | +-- includes | | | +-- header.gtpl | +-- lib | +-- appengine-api-1.0-sdk-x.y.z.jar +-- appengine-api-labs-x.y.z.jar +-- gaelyk-x.y.z.jar +-- groovy-all-x.y.z.jar
  6. 6. // hello.groovyout.println “Hello, JGGUG!”
  7. 7. ⼒力力⼒力力
  8. 8. <html> <body> <p><% def message = "Hello, JGGUG!" print message %> </p> <p><%= message %></p> <p>${message}</p> <ul> <% 3.times { %> <li>${message}</li> <% } %> </ul> </body></html>
  9. 9. ⽤用mail.send to: to@gmail.com, from: other@gmail.com, subject: Hello World, htmlBody: <bold>Hello</bold>
  10. 10. get "/about", redirect: "/blog/2008/10/20/welcome-to-my-blog"post "/tweet", forward: "/tweet.groovy"// wildcardsget "/author/*", forward: "/authorsInformation.groovy"// path variablesget "/article/@year/@month/@day", forward: "/article.groovy?year=@year&month=@month&day=@day"// caching outputsget "/news", forward: "/new.groovy", cache: 10.minutesget "/download", forward: "/download.gtpl", cache: 2.hours// incoming emailemail to: "/receiveEmail.groovy"
  11. 11. ⽤用✓ ✓✓ ✓✓   ✓✓ ✓
  12. 12. // Hatebu Groovy Bot -- @hatebu_groovy// inspired by @nobusues @hatena_groovyimport com.google.appengine.api.datastore.*tag = groovyrss = "http://b.hatena.ne.jp/t/${tag}?sort=eid&mode=rss"def root = new XmlSlurper().parse(rss)root.item.each { item ->! def title = item.title.text().trim()! def url = item.link.text()! def query = new Query(entry)! query.addFilter(url, Query.FilterOperator.EQUAL, url)! def found = datastore.prepare(query).asSingleEntity()!! if (!found) {! ! try {! ! ! twitter.updateStatus "$title $url"! ! ! log.info "tweeted: $title $url"! ! ! def entry = new Entity(entry)! ! ! entry.title = title! ! ! entry.url = url! ! ! entry.save()! ! ! log.info "recorded: $title $url"! ! } catch (TwitterException ex) {! ! ! log.warning(ex.toString())! ! }! }}
  13. 13.    
  14. 14. ⾝身
  15. 15. ⾃自 ▶ http://gaelyk.appspot.com/ ▶ https://github.com/glaforge/gaelyk ▶ http://dl.dropbox.com/u/132573/Gaelyk-Tutorial.html ▶   http://dl.dropbox.com/u/132573/plugins.html
  16. 16. GAELYK

×