JS Tooling in Rails 3.1

699 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
699
On SlideShare
0
From Embeds
0
Number of Embeds
14
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

JS Tooling in Rails 3.1

  1. 1. JavaScript Tooling In Rails 3.1 And how you should be doing it...Saturday, November 12, 2011
  2. 2. @dudadornellesSaturday, November 12, 2011
  3. 3. Saturday, November 12, 2011
  4. 4. Saturday, November 12, 2011
  5. 5. 9f09aeb8273177fc2d09ebdafcc76ee8eb56fe33Saturday, November 12, 2011
  6. 6. Saturday, November 12, 2011
  7. 7. http://gastronomous.files.wordpress.com/2010/03/img_6226.jpg http://jashkenas.github.com/coffee-script/Saturday, November 12, 2011
  8. 8. math = root: Math.sqrt square: square cube: (x) -> x * square x math = { root: Math.sqrt, square: square, cube: function(x) { return x * square(x); } };Saturday, November 12, 2011
  9. 9. Saturday, November 12, 2011
  10. 10. Saturday, November 12, 2011
  11. 11. Saturday, November 12, 2011
  12. 12. + .JS =Saturday, November 12, 2011
  13. 13. Saturday, November 12, 2011
  14. 14. Insert broken build picture hereSaturday, November 12, 2011
  15. 15. class Ninja constructor: (@numOfShurikens) -> throwShuriken: -> @numOfShurikens-- class Ronin extends Ninja constructor: (numOfShurikens) -> super numOfShurikens+1 #ronins know to carry a spareSaturday, November 12, 2011
  16. 16. Debugging... :(Saturday, November 12, 2011
  17. 17. http://getsprockets.orgSaturday, November 12, 2011
  18. 18. .JS Your entire application .JS .JS .JS .JS .JS .JSSaturday, November 12, 2011
  19. 19. .task.js.coffee window.MyApp = window.MyApp || {} class Task constructor: (@description) -> @save: (task) -> ... window.MyApp.Task = Task .task_controller.js.coffee #= require task window.MyApp = window.MyApp || {} Task = window.MyApp.Task class TaskController create: (description) -> Task.save(new Task(description))Saturday, November 12, 2011
  20. 20. +Saturday, November 12, 2011
  21. 21. .coffee .coffee .coffee .coffee .coffee .coffee .coffeeSaturday, November 12, 2011
  22. 22. .coffee .coffee .coffee .coffee .coffee .coffee .coffee Single ClassSaturday, November 12, 2011
  23. 23. Saturday, November 12, 2011
  24. 24. DOM Interactions .coffee .coffee .coffee .coffee .coffee .coffee .coffee Domain/Business LogicSaturday, November 12, 2011
  25. 25. Saturday, November 12, 2011
  26. 26. COWBOY?Saturday, November 12, 2011
  27. 27. http://pivotal.github.com/jasmine/Saturday, November 12, 2011
  28. 28. describe Math, ->   describe fib, ->     it should calculate the numbers correctly up to fib(16), ->       fib = [0, 1, 1, 2, 3, 5, 8, 13]       expect(Math.fib(i)).toEqual fib[i] for i in [0..7] describe Math do   describe fib do     it should calculate the numbers correctly up to fib(16)       fib = [0, 1, 1, 2, 3, 5, 8, 13]       (0..7).map { |n| Math.fib(n) }.should == fib end end endSaturday, November 12, 2011
  29. 29. DOM Interactions .coffee .coffee .coffee .coffee .coffee .coffee .coffee Domain/Business LogicSaturday, November 12, 2011
  30. 30. DOM Interactions .coffee .coffee .coffee spec spec spec .coffee .coffee .coffee spec spec .coffee Domain/Business Logic specSaturday, November 12, 2011
  31. 31. DOM Interactions ? .coffee .coffee .coffee spec spec spec .coffee .coffee .coffee spec spec .coffee Domain/Business Logic specSaturday, November 12, 2011
  32. 32. TDDSaturday, November 12, 2011
  33. 33. Standard?Saturday, November 12, 2011
  34. 34. + + =Saturday, November 12, 2011 ?
  35. 35. https://github.com/bradphelan/jasminerice https://github.com/pivotal/jasmine/tree/1.2.rc1 https://gist.github.com/673967 - GuardSaturday, November 12, 2011
  36. 36. Saturday, November 12, 2011
  37. 37. Saturday, November 12, 2011
  38. 38. +Saturday, November 12, 2011
  39. 39. Saturday, November 12, 2011
  40. 40. Thanks! :)Saturday, November 12, 2011

×