If you have not followed the Play framework mailing list, it is likely you have never heard of Calimoucho as software. Basically, Calimoucho itself is a Play application, which checks out other applications from a VCS, runs their tests, and reports this in a simple GUI. If you think Setting up a Jenkins instance and configuring it appropriately usually takes quite some time and might not be needed for a small play project. In such a case using Calimoucho makes sense.
In case you are wondering where the name is from: It is a drink, which consists of cola and red wine. The tool is way better than the drink.
You can find the source code of this example in the examples/chapter7/test-calimoucho
directory.
First you should check out Calimoucho from github
:
git clone https://github.com/guillaumebort/calimoucho.git
Now you can check the calimoucho/conf/projects.yaml
file, where the current projects are placed.
When following the examples of this recipe, you should create an application for each version control system, as each system stores its version data differently. This might lead to clashes.
We will try to add support for some version control systems. The starting point is bazaar:
play new test-bazaar cd test-bazaar bzr init bzr whoami "Your name <[email protected]>" bzr add bzr commit -m "Initial commit"
Now edit the conf/projects.yml
file if the Calimoucho application in order to set up configuration paths:
models.Project(bazaar): name: Bazaar test project path: checkout/test-bazaar framework: /path/to/your/play/installation/ updateCommand: bzr update versionCommand: bzr revno %path versionPattern: 1.0r%version revisionDetailPattern: http://bzr/test/browse/%version notifications: - [email protected]
Now put a copy of the repository into the checkout/test-bazaar
(make sure the checkout directory actually exists) directory via:
bzr branch ../../test-bazaar
It is time to start Calimoucho now and see it working. After five minutes you should check the main page of the application, which runs on port 8084—also do not forget to visit the main page after starting the application in order to make sure it is running. The above mentioned 5 minute waiting time is the default time to wait before checking a repository for changes. You can configure this time via the cron.checkInterval
parameter in your application conf
.
To show you that Calimoucho actually works and updates, add a commit to the main repository (not the one in the checkout directory):
echo Foo > README bzr add README bzr commit -m "Added Readme"
Now you should see the second successful test run.
As you can see, Calimoucho automatically updates the repository with the command provided in the projects YAML file. However, what it does not do is check out the repository initially. That would be a nice feature indeed. Basically, you need to configure five different aspects per build job:
app/views/Notifier/sendResult.txt
template file with some content in order to have this feature working.After configuring it, all you have to do is make an initial checkout and from then on updating works automatically.
As there are more versioning systems available, you might want to check how you can use Git, mercurial, and SVN repositories as well.
As there are plenty of version control systems available, the following paragraphs provide help to configure Calimoucho to also support Git, mercurial, and subversion.
As Git is one of the most used versioning systems, so it should be listed here as well. Just change your project configuration to this one.
play new test-git cd test-git git init git add . git commit -m "initial import"
Go to the calimoucho/checkout
directory and check out the freshly created repo:
git clone /path/to/absolute-repo
Add this to your conf/projects.yml
:
models.Project(git): name: Git test project path: checkout/test-git framework: /path/to/play-1.1/ updateCommand: git --git-dir=%path/.git pull versionCommand: git --git-dir=%path/.git log --format=%h -1 versionPattern: g%version revisionDetailPattern: http://git/test/browse/%version
Mercurial is another distributed versioning control system just like Git, and is also used in many cases:
play new test-mercurial cd test-mercurial hg init hg add hg commit -m "initial commit"
Now go to the calimoucho/checkout
directory and check out the project:
hg clone file:///path/to/repo
Add this to your conf/projects.yml
:
models.Project(mercurial): name: Mercurial test project path: checkout/test-mercurial framework: /path/to/play-1.1/ updateCommand: hg pull -u -R %path versionCommand: hg log -l 1 --template {rev} %path versionPattern: r%version revisionDetailPattern: http://hg/test/browse/%version notifications: - [email protected]
Though subversion has already been around for a while, it is still used a lot. You can configure Calimoucho to check out any subversion based repository as well:
svnadmin create svn-repo play new test-svn svn import test-svn/ file:///absolute/path/to/svn-repo/test-svn/trunk -m "initial import" rm -fr test-svn
Now go to the calimoucho/checkout
directory and check out the project:
svn co file:///path/to/svn-repo/test-svn/trunk test-svn
Add this to your conf/projects.yml
:
models.Project(svn): name: SVN test project path: checkout/test-svn framework: /path/to/play-1.1/ updateCommand: svn update %path versionCommand: svnversion %path versionPattern: r%version revisionDetailPattern: http://svn/test/browse/%version notifications: - your@email
18.116.118.229