Sie sind auf Seite 1von 39

Rake as build management tool

for developers and project managers

Denis Lutz

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

Agenda
Rake for Developers The Hyphothesis about Ant Hello World from Rake Ant Hypothesis proove 1 Rake for Project Managers Ant Hypothesis proove 2 Case Study The Perfect Build Riskmanagement 3 Improvements you can make with rake

Ant

We use ant in java projects

build management deployments initial project setup / configurations product data load

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

Ant

Hypothesis
1. Ant is not sufficient for what we want to do

2. We dont use Ant often enough to learn it properly

Solution: RAKE!

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

Rake

What is Rake (from JRuby) ?


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 (!)

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

What is rake?

Download jruby at http://jruby.org/download

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

What is rake? Calling a core ant task rake is a plain mapping to the ant java classes !

We can call any task or target that ant has!


03/09/13 Denis Lutz/ Rake as buildmanagement tool for developers and managers 7

What is rake?
Create a task that is dependent on the unzip task It should create a folder and move the unzipped file into it

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

Ant is not sufficient for what we want to do

Back to Hypothesis

1. Ant is not sufficient for what we want to do.


Not anymore since we have better choices. It was created as no scripting languages were supporting java.

What are we usually doing with Ant?

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

Ant is not sufficient for what we want to do

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

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

10

Ant is not sufficient for what we want to do


moving / copying / deleting files and directories

Ant: Looks pretty simple right? Just couple lines, markup was always easy Rake: I want to do operations as would it be in a unix environment, and rake realizes it:

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

11

Ant is not sufficient for what we want to do processing a data set (Array) in a loop

Ant: See, for anything that a normal language has, ant has a markup version of it Ant: So you will be always fine and be able to write what you want Rake: Well lets just take a scripting language then like ruby Rake: and by the way, can you use unique ant syntax somewhere else ouside the build scripts?

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

12

Ant is not sufficient for what we want to do

Ant: Yea, conditions are definded on the tasks themselves, since its all about tasks.

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

13

Ant is not sufficient for what we want to do

Rake: thats all we wanted:

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

14

Ant is not sufficient for what we want to do

Rake: How about some methods to dont repeat yourself in the build? Ant: Methods??? Your kidding me right? Targets are your methods, or create a macrodef

Ant: If it gets too complicated soo create your java class and call it from ant

Ant: Here is the macrodef syntax

Rake:
Dude, I just want a method ok?
So attribute is clear thats what I need Whats the deal with the <element /> ? What is the <sequential/> suppose to mean? So I predefine what tasks I will call inside my new macro ? Should I always use sequential ?

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

15

Ant is not sufficient for what we want to do

Rake: Watch, thats what I want..

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

16

Ant is not sufficient for what we want to do

Rake: I want to create some objects in my script Ant: Objects??? Lets not exagerrate here ok? Ant: If its that complicated just create a custom ant task with a java class

Rake: Yea, its like object orientation = elegance , so we should use it directly in the script

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

17

Ant is not sufficient for what we want to do

Ant: LOL, it should not be that complicated Ant: unless you really want to fly to the moon Rake: Well lets say I have a deployment script and I deal with servers Rake: This is what I could do with object orientation, all this in one file, within mins

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

18

Ant is not sufficient for what we want to do

elegant powerful maintable easy understanble no external classes to do it

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

19

Ant is not sufficient for what we want to do

Why project managers should love rake?

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

20

Ant is not sufficient for what we want to do

2. We dont use Ant often enough to learn it properly We have proper ant experience only at the project setup its mostly done by one dedicated person everyone else is not familiar with ant and the build script

developers tend to do fast adjustments to the script using the ant api
you are good with ant if you worked with it for a longer time the ant knowledge can not be used somewhere else

developers have no motivation to learn it properly


trivial language construtcs in ant are too complicated to remember

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

21

Ant is not sufficient for what we want to do

Why would it be different with rake?

rake is a subset of ruby => ruby syntax jruby can be declared as the core scripting language in each (java) project anyways because we need ruby for: data import, front end, parsing, any scripting language tasks the knowledge of rake ( = ruby ) is a good investment for developers ruby is a great, simple, elegant and powerfull language

developers can do with ruby knowledge much more then with same amount of ant knowledge

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

22

But java has its scripting languages

But java has its scripting languages.. Why dont we use groovy, beanshell, jsr?

ruby has a bigger community then the java scripting languages (proofes on next slides) ruby knowledge is reused much more in projects with ruby if declared as scripting language

front ends can be written in ruby on rails


ruby knowledge can be reused much more on the US market java scripting languages = languages that are running on jvm well, ruby runs on jvm too, so same integration as e.g. groovy

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

23

Ant is not sufficient for what we want to do

Ruby gained a lot of popularity within the scripting languages

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

24

Ant is not sufficient for what we want to do

Rails competes with JSF in the meanwhile, which indirectly shows the power and acceptance of the ruby language on the us market.

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

25

Improvements we could reach by using rake

Which parts of your java project can be improved by using rake?

1. Setting up the project initially and for any new team member

2. Working with the project everyday


3. Deployment management

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

26

Improvements we could reach by using rake

1. Setting up the project initially and for any new team member

setting up the system always a time consuming task knowledge is mostly party written on the wiki and outdated no one really knows what the project setup steps are the older the project the more out of sync is it the project setup takes usually the time of the new person and one team member

At the end you loose a lot of time, instead of initially investing little bit more!

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

27

Improvements we could reach by using rake

What the a new member feels at the project setup:


What database do I need?

What are the database properties? Where should I configure them?

Who should I ask about it?

Where is the wiki page about this project?

What should I write into my hosts file?

I have a windows machine, are there any differences to a macs?

How do I start this special backend / front end / solr server?

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

28

Improvements we could reach by using rake

How can we fix it? = What can be automated? = Run in one workflow? Git/SVN Checkout Local database setup (setting up mysql/oracle + create database) Unzipping of vendor files (commercial integrated systems, solr, patches)

Cofiguration files setup: user setting + default + environment


Build (starting automatically) Database initialization (without entering any client) different data imports (* n times)

other step by a cronjob (* n times)


server startup (front end, back end, solr, any other server) commercial integrated system configuration generating data load files with ruby (just another ruby script execution

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

29

Improvements we could reach by using rake

1. The project itself should know about its setup, not the wiki, it will be outdated and lost 2. The only one thing that the user should do is the database installation and checkout 3. Even in the manual steps, the user should be guided by the rake script

using of rake as much a more powerful tool then ant

dedicated person in each project responsible for the build maintenance


project planned time investment for a complete project setup by a build investment will immidiatelly pay off, with a new team member at the latest thinking in a perspective of a beginner who has no project knowledge thinking in a perspective of one big setup workflow without interruptions

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

30

Improvements we could reach by using rake

Demo / Case Study The perfect project setup


Hi, how are you doing? . Yea, nice to meet you and welcome. My manager told me to help you to setup your system You are a junior developer? Got you, you just starting, no problem You have a mac? Great. So here is what I want you to do: 1. Install jruby http://jruby.org.s3.amazonaws.com/downloads/1.5.3/jruby-bin-1.5.3.zip 2. Unzip and add it to your classpath, so it works from console 3. Checkout out the trunk of the project http://yourdomain.com/svn/fromjavatoruby/trunk 4. During the checkout, you can install mysql if you dont have it yet, create a mysql user 5. Then just call jruby S rake full_project_setup , the script will guide you from there

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

31

Improvements we could reach by using rake

Demo / Case Study The perfect Project Setup, what did we do? :

SVN Checkout --> manually Local database setup (setting up mysql/oracle + create database) (still potentially automatable) Unzipping of vendor files (solr, patches) DONE Cofiguration files setup: user setting + default + environment DONE Build (starting automatically) DONE Database initialization (without entering the webclient) DONE different data imports (* n times) DONE

other step by a cronjob (* n times) DONE


server start up / which beanshell script should I call? DONE started, informed the user how to do it solr setup and startup / how should I call it, on which port is it running? (same as config step

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

32

Perfect Build: Highlights

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

33

Improvements we could reach by using rake

Demo / Case Study The perfect Project Setup, why was that much more time and money saving? did the user need any project specific knowledge yet? No did he need to ask someone for something? No did he need to look up a wiki page and wait till his account on it is created? No even if there was a manual step we were exactly telling the user what to do at the right time

our assumtion for now was: he works on a mac / unix system he had to be able to install mysql database by himself he should have been able to check out the project

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

34

Improvements we could reach by using rake

Why the rake integration has no risks for any java environment?

jruby rake runs on the java virtual machine and calls the old ant tasks we have the old ant build.xml still inside the project we can go back to ant all the time, just by adding old ant targets jruby is used anyways if this is the official project scripting language so we are not introducing something new to our standard setup

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

35

Improvements: Working with the project everyday

2. Working with the project everyday

each developer should get familiar with the build the build is your source for any automation server starts (back end/ sorl/ front end/ any server) cronjob execution (instead of looking it up in a client and executing) repetitive data load (you work on a data load and need repetitive execution) any new task that can be added, is easy to add with rake

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

36

Improvements: Deployment management

3. Deployment management
granular understandable / maintable same advantages as for the project setup apply ivy integration

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

37

Conslusion

Conclusion/Suggestions
ant => has weak points, was ok a long time, but its time to move on
rake => great new option to use, has a lot of synergies and is fun separate discussion needed for deployments strategy based on rake start saving money and time today start having smooth builds today

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

38

Thanks

Thanks

Questions?

03/09/13

Denis Lutz/ Rake as buildmanagement tool for developers and managers

39

Das könnte Ihnen auch gefallen