0
1<br />Rake as build management tool<br />for developers and project managers<br />Denis Lutz<br />
Rake for Developers<br />	The Hyphothesis  about Ant<br />	“Hello World” from Rake<br />	Ant Hypothesis proove 1<br />Rake...
3<br />Ant <br />We use ant in java projects<br /><ul><li> build management
 deployments
 initial project setup / configurations
 product data load</li></li></ul><li>4<br />Ant <br />Hypothesis<br />1. Ant is not sufficient for what we want to do<br /...
5<br />Rake<br />What is Rake (from JRuby) ?<br /><ul><li> build management language based on ruby
 domain specific language (DSL) for builds based on ruby
 rake for ruby is like ant for java “the build management tool”
 existing rake version in jruby
 rake from jruby is able to call any other ant task or target (!)</li></li></ul><li>6<br />What is rake?<br />Download jru...
7<br />What is rake?<br />Calling a core ant task… <br />rake is a plain mapping to the ant java classes !<br />We can cal...
8<br />What is rake?<br />Create a task that is dependent on the unzip task<br />It should create a folder and move the un...
9<br />Ant is not sufficient for what we want to do<br />Back to Hypothesis…<br />Ant is not sufficient for what we want t...
10<br />Ant is not sufficient for what we want to do<br /><ul><li> build management
 deployments
 initial project setup
 data load (csv, fixtures)
 cron job execution
 moving / copying / deleting files or directories
 writing to files
 processing data sets
 building dependencies on coditions</li></ul><br />
11<br />Ant is not sufficient for what we want to do<br />moving / copying / deleting files and directories<br />Ant: Look...
12<br />Ant is not sufficient for what we want to do<br />processing a data set (Array) in a loop<br />Ant: See, for anyth...
13<br />Ant is not sufficient for what we want to do<br />Ant: Yea, conditions are definded on<br />the tasks themselves, ...
14<br />Ant is not sufficient for what we want to do<br />Rake: that’s all we wanted:<br />
15<br />Ant is not sufficient for what we want to do<br />Rake: How about some methods to don’t repeat yourself in the bui...
16<br />Ant is not sufficient for what we want to do<br />Rake: Watch, that’s what I want..<br />
17<br />Ant is not sufficient for what we want to do<br />Rake: I want to create some objects in my script… <br />Ant: Obj...
18<br />Ant is not sufficient for what we want to do<br />Ant: LOL, it should not be that complicated  <br />Ant: unless y...
19<br />Ant is not sufficient for what we want to do<br /><ul><li> elegant
 powerful
 maintable
 easy understanble
 no external classes to do it</li></li></ul><li>20<br />Ant is not sufficient for what we want to do<br />Why project mana...
21<br />Ant is not sufficient for what we want to do<br />2. We don’t use  Ant often enough to learn it properly<br /><ul>...
 its mostly done by one dedicated person
 everyone else is not familiar with  ant and the build script
Upcoming SlideShare
Loading in...5
×

From Ant to Rake

1,836

Published on

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

No Downloads
Views
Total Views
1,836
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
14
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "From Ant to Rake"

  1. 1. 1<br />Rake as build management tool<br />for developers and project managers<br />Denis Lutz<br />
  2. 2. Rake for Developers<br /> The Hyphothesis about Ant<br /> “Hello World” from Rake<br /> Ant Hypothesis proove 1<br />Rake for Project Managers<br /> Ant Hypothesis proove 2<br /> Case Study “The Perfect Build”<br /> Riskmanagement <br /> 3 Improvements you can make with rake<br />2<br />
  3. 3. 3<br />Ant <br />We use ant in java projects<br /><ul><li> build management
  4. 4. deployments
  5. 5. initial project setup / configurations
  6. 6. product data load</li></li></ul><li>4<br />Ant <br />Hypothesis<br />1. Ant is not sufficient for what we want to do<br />2. We don’t use Ant often enough to learn it properly<br />Solution: RAKE! <br />
  7. 7. 5<br />Rake<br />What is Rake (from JRuby) ?<br /><ul><li> build management language based on ruby
  8. 8. domain specific language (DSL) for builds based on ruby
  9. 9. rake for ruby is like ant for java “the build management tool”
  10. 10. existing rake version in jruby
  11. 11. rake from jruby is able to call any other ant task or target (!)</li></li></ul><li>6<br />What is rake?<br />Download jruby at http://jruby.org/download<br />
  12. 12. 7<br />What is rake?<br />Calling a core ant task… <br />rake is a plain mapping to the ant java classes !<br />We can call any task or target that ant has!<br />
  13. 13. 8<br />What is rake?<br />Create a task that is dependent on the unzip task<br />It should create a folder and move the unzipped file into it<br />
  14. 14. 9<br />Ant is not sufficient for what we want to do<br />Back to Hypothesis…<br />Ant is not sufficient for what we want to do.<br />Not anymore since we have better choices.<br />It was created as no scripting languages were supporting java.<br />What are we usually doing with Ant?<br />
  15. 15. 10<br />Ant is not sufficient for what we want to do<br /><ul><li> build management
  16. 16. deployments
  17. 17. initial project setup
  18. 18. data load (csv, fixtures)
  19. 19. cron job execution
  20. 20. moving / copying / deleting files or directories
  21. 21. writing to files
  22. 22. processing data sets
  23. 23. building dependencies on coditions</li></ul><br />
  24. 24. 11<br />Ant is not sufficient for what we want to do<br />moving / copying / deleting files and directories<br />Ant: Looks pretty simple right? Just couple lines, markup was always easy…<br />Rake: I want to do operations as would it be in a unix environment, and rake realizes it:<br />
  25. 25. 12<br />Ant is not sufficient for what we want to do<br />processing a data set (Array) in a loop<br />Ant: See, for anything that a normal language has, ant has a markup version of it<br />Ant: So you will be always fine and be able to write what you want<br />Rake: Well lets just take a scripting language then… like ruby <br />Rake: and by the way, can you use unique ant syntax somewhere else ouside the build scripts?<br />
  26. 26. 13<br />Ant is not sufficient for what we want to do<br />Ant: Yea, conditions are definded on<br />the tasks themselves, since its all about tasks.<br />
  27. 27. 14<br />Ant is not sufficient for what we want to do<br />Rake: that’s all we wanted:<br />
  28. 28. 15<br />Ant is not sufficient for what we want to do<br />Rake: How about some methods to don’t repeat yourself in the build? <br />Ant: Methods??? Your kidding me right? Targets are your methods, or create a macrodef<br />Ant: If it gets too complicated soo create your java class and call it from ant…<br />Ant: Here is the macrodef syntax<br />Rake:<br />Dude, I just want a method ok?<br />So attribute is clear … that’s what I need<br />Whats the deal with the <element /> ?<br />What is the <sequential/> suppose to mean?<br />So I predefine what tasks I will call inside my new macro ?<br />Should I always use sequential ? <br />
  29. 29. 16<br />Ant is not sufficient for what we want to do<br />Rake: Watch, that’s what I want..<br />
  30. 30. 17<br />Ant is not sufficient for what we want to do<br />Rake: I want to create some objects in my script… <br />Ant: Objects??? Lets not exagerrate here ok? <br />Ant: If its that complicated just create a custom ant task with a java class<br />Rake: Yea, its like object orientation = elegance , so we should use it directly in the script…<br />
  31. 31. 18<br />Ant is not sufficient for what we want to do<br />Ant: LOL, it should not be that complicated <br />Ant: unless you really want to fly to the moon…<br />Rake: Well lets say I have a deployment script and I deal with servers…<br />Rake: This is what I could do with object orientation, all this in one file, within mins<br />
  32. 32. 19<br />Ant is not sufficient for what we want to do<br /><ul><li> elegant
  33. 33. powerful
  34. 34. maintable
  35. 35. easy understanble
  36. 36. no external classes to do it</li></li></ul><li>20<br />Ant is not sufficient for what we want to do<br />Why project managers <br />should love rake?<br />
  37. 37. 21<br />Ant is not sufficient for what we want to do<br />2. We don’t use Ant often enough to learn it properly<br /><ul><li> We have proper ant experience only at the project setup
  38. 38. its mostly done by one dedicated person
  39. 39. everyone else is not familiar with ant and the build script
  40. 40. developers tend to do fast adjustments to the script using the ant api
  41. 41. you are good with ant if you worked with it for a longer time
  42. 42. the ant knowledge can not be used somewhere else
  43. 43. developers have no motivation to learn it properly
  44. 44. trivial language construtcs in ant are too complicated to remember</li></li></ul><li>22<br />Ant is not sufficient for what we want to do<br />Why would it be different with rake?<br /><ul><li> rake is a subset of ruby => ruby syntax
  45. 45. jruby can be declared as the core scripting language in each (java) project anyways
  46. 46. because we need ruby for: data import, front end, parsing, any scripting language tasks
  47. 47. the knowledge of rake ( = ruby ) is a good investment for developers
  48. 48. ruby is a great, simple, elegant and powerfull language
  49. 49. developers can do with ruby knowledge much more then with same amount of ant knowledge</li></li></ul><li>23<br />But java has its scripting languages<br />But java has its scripting languages..<br />Why don’t we use groovy, beanshell, jsr?<br /><ul><li> ruby has a bigger community then the java scripting languages (proofes on next slides)
  50. 50. ruby knowledge is reused much more in projects with ruby if declared as scripting language
  51. 51. front ends can be written in ruby on rails
  52. 52. ruby knowledge can be reused much more on the US market
  53. 53. java scripting languages = languages that are running on jvm
  54. 54. well, ruby runs on jvm too, so same integration as e.g. groovy</li></li></ul><li>24<br />Ant is not sufficient for what we want to do<br />Ruby gained a lot of popularity within the scripting languages<br />
  55. 55. 25<br />Ant is not sufficient for what we want to do<br />Rails competes with JSF in the meanwhile, which indirectly shows the power and acceptance of the ruby language on the us market.<br />
  56. 56. 26<br />Improvements we could reach by using rake<br />Which parts of your java project can be improved by using rake?<br />1. Setting up the project initially and for any new team member<br />2. Working with the project everyday<br />3. Deployment management<br />
  57. 57. 27<br />Improvements we could reach by using rake<br />Setting up the project initially and for any new team member<br /><ul><li> setting up the system always a time consuming task
  58. 58. knowledge is mostly party written on the wiki and outdated
  59. 59. no one really knows what the project setup steps are
  60. 60. the older the project the more out of sync is it
  61. 61. the project setup takes usually the time of the new person and one team member</li></ul>At the end you loose a lot of time, instead of initially investing little bit more!<br />
  62. 62. 28<br />Improvements we could reach by using rake<br />What the a new member feels at the project setup:<br />What database do I need?<br />What are the database properties?<br />Where should I configure them?<br />Who should I ask about it?<br />Where is the wiki page about this project?<br />I have a windows machine,<br /> are there any differences to a macs? <br />What should I write <br />into my “hosts” file?<br />How do I start this special backend / front end / solr server?<br />
  63. 63. 29<br />Improvements we could reach by using rake<br />How can we fix it? = What can be automated? = Run in one workflow?<br /><ul><li> Git/SVN Checkout
  64. 64. Local database setup (setting up mysql/oracle + create database)
  65. 65. Unzipping of vendor files (commercial integrated systems, solr, patches)
  66. 66. Cofiguration files setup: user setting + default + environment
  67. 67. Build (starting automatically)
  68. 68. Database initialization (without entering any client)
  69. 69. different data imports (* n times)
  70. 70. other step by a cronjob (* n times)
  71. 71. server startup (front end, back end, solr, any other server)
  72. 72. commercial integrated system configuration
  73. 73. generating data load files with ruby (just another ruby script execution</li></li></ul><li>30<br />Improvements we could reach by using rake<br />1. The project itself should know about its setup, not the wiki, it will be outdated and lost<br />2. The only one thing that the user should do is the database installation and checkout<br />3. Even in the manual steps, the user should be guided by the rake script <br /><ul><li> using of rake as much a more powerful tool then ant
  74. 74. dedicated person in each project responsible for the build maintenance
  75. 75. project planned time investment for a complete project setup by a build
  76. 76. investment will immidiatelly pay off, with a new team member at the latest
  77. 77. thinking in a perspective of a beginner who has no project knowledge
  78. 78. thinking in a perspective of one big setup workflow without interruptions</li></li></ul><li>31<br />Improvements we could reach by using rake<br />Demo / Case Study<br />The perfect project setup<br />Hi, how are you doing? …. Yea, nice to meet you and welcome….<br />My manager told me to help you to setup your system<br />You are a junior developer? Got you, you just starting, no problem<br />You have a mac? Great…. So here is what I want you to do:<br />Install jruby http://jruby.org.s3.amazonaws.com/downloads/1.5.3/jruby-bin-1.5.3.zip<br />Unzip and add it to your classpath, so it works from console<br />Checkout out the trunk of the project http://yourdomain.com/svn/fromjavatoruby/trunk<br />During the checkout, you can install mysql if you don’t have it yet, create a mysql user<br />Then just call “jruby –S rake full_project_setup” , the script will guide you from there<br />
  79. 79. 32<br />Improvements we could reach by using rake<br />Demo / Case Study<br />The perfect Project Setup, what did we do? :<br /><ul><li> SVN Checkout --> manually
  80. 80. Local database setup (setting up mysql/oracle + create database) (still potentially automatable)
  81. 81. Unzipping of vendor files (solr, patches)  DONE
  82. 82. Cofiguration files setup: user setting + default + environment  DONE
  83. 83. Build (starting automatically)  DONE
  84. 84. Database initialization (without entering the webclient)  DONE
  85. 85. different data imports (* n times)  DONE
  86. 86. other step by a cronjob (* n times)  DONE
  87. 87. server start up / which beanshell script should I call?  DONE started, informed the user how to do it
  88. 88. solr setup and startup / how should I call it, on which port is it running? (same as config step</li></li></ul><li>33<br />Perfect Build: Highlights<br />
  89. 89. 34<br />Improvements we could reach by using rake<br />Demo / Case Study<br />The perfect Project Setup, why was that much more time and money saving?<br /><ul><li> did the user need any project specific knowledge yet? No
  90. 90. did he need to ask someone for something? No
  91. 91. did he need to look up a wiki page and wait till his account on it is created? No
  92. 92. even if there was a manual step we were exactly telling the user what to do at the right time
  93. 93. our assumtion for now was: he works on a mac / unix system
  94. 94. he had to be able to install mysql database by himself
  95. 95. he should have been able to check out the project</li></li></ul><li>35<br />Improvements we could reach by using rake<br />Why the rake integration has no risks for any java environment?<br /><ul><li> jruby rake runs on the java virtual machine and calls the old ant tasks
  96. 96. we have the old ant build.xml still inside the project
  97. 97. we can go back to ant all the time, just by adding old ant targets
  98. 98. jruby is used anyways if this is the official project scripting language
  99. 99. so we are not introducing something new to our standard setup</li></li></ul><li>36<br />Improvements: Working with the project everyday<br />2. Working with the project everyday<br /><ul><li> each developer should get familiar with the build
  100. 100. the build is your source for any automation
  101. 101. server starts (back end/ sorl/ front end/ any server)
  102. 102. cronjob execution (instead of looking it up in a client and executing)
  103. 103. repetitive data load (you work on a data load and need repetitive execution)
  104. 104. any new task that can be added, is easy to add with rake</li></li></ul><li>37<br />Improvements: Deployment management<br />3. Deployment management<br /><ul><li> granular understandable / maintable
  105. 105. same advantages as for the project setup apply
  106. 106. ivy integration</li></li></ul><li>38<br />Conslusion<br />Conclusion/Suggestions<br /><ul><li> ant => has weak points, was ok a long time, but its time to move on…
  107. 107. rake => great new option to use, has a lot of synergies and is fun
  108. 108. separate discussion needed for deployments strategy based on rake
  109. 109. start saving money and time today
  110. 110. start having smooth builds today</li></li></ul><li>39<br />Thanks<br />Thanks<br />Questions?<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×