buildout.cfg 2.72 KB
Newer Older
1 2 3 4
# helloweb - programs to say hello to the Web in various languages
[buildout]
extends =
  ../git/buildout.cfg
5
  ../ruby/buildout.cfg
6
  ../golang/buildout.cfg
7 8

parts =
9
  helloweb-python
10
  helloweb-ruby
11
  helloweb-go
12 13 14 15 16 17 18


# repository with examples
[helloweb-repository]
recipe  = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git
repository = https://lab.nexedi.com/nexedi/helloweb.git
Kirill Smelkov's avatar
Kirill Smelkov committed
19
revision = 39fd89a35718c3b4828296efcd9a45b6c9bbd13b
20 21 22
location = ${buildout:parts-directory}/helloweb


23
# -*- python -*-
24 25 26 27 28
[helloweb-egg]
recipe  = zc.recipe.egg:develop
egg     = helloweb
setup   = ${helloweb-repository:location}/python/

29
[helloweb-python]
30 31
recipe  = zc.recipe.egg:scripts
eggs    = ${helloweb-egg:egg}
32
scripts = helloweb=helloweb-python
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49


# -*- ruby -*-

# if ruby program is represented as already-released gem, we can install it
# with `gem install ...` (via rubygemsrecipe).
#
# Alternatively if we need to
# install the program from source-checkout, the Ruby way is to use bundler,
# install program dependencies via it, and run the program itself via it.
#
# Since for helloweb.rb we have source checkout - we go the second - bundler way.

# bundler, that we'll use to install gems and run binaries (via `bundle exec ...`)
[bundler]
# rubygemsrecipe with fixed url and this way pinned rubygems version
recipe  = rubygemsrecipe
Kirill Smelkov's avatar
Kirill Smelkov committed
50
url     = https://rubygems.org/rubygems/rubygems-2.5.2.zip
51 52
ruby-location = ${ruby2.1:location}
ruby-executable = ${:ruby-location}/bin/ruby
Kirill Smelkov's avatar
Kirill Smelkov committed
53
gems    = bundler==1.11.2
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76

# bin installed here
bundle  = ${buildout:bin-directory}/bundle

# install together with path to ruby enabled
# ( reason: rubygemsrecipe hardcodes PATH inside generated bin/* and it is
#   impossible to adjust it later )
#
# bundle exec <smth>                ; <smth> starts with `#!/usr/bin/env ruby` as rubygems
environment =
  PATH    = ${:ruby-location}/bin:%(PATH)s


[helloweb-ruby-bundle]
recipe  = slapos.recipe.cmmi
path    = ${helloweb-repository:location}/ruby/

configure-command = :
make-binary =
make-targets= cd ${:path} && ${bundler:bundle} install


[helloweb-ruby]
77 78 79 80 81 82 83 84
# NOTE slapos.cookbook:wrapper also works, but currently _only_ in instance
recipe  = collective.recipe.template
output  = ${buildout:bin-directory}/${:_buildout_section_name_}
mode    = 0755
input   = inline:
    #!/bin/sh
    export BUNDLE_GEMFILE=${helloweb-ruby-bundle:path}/Gemfile
    exec ${bundler:bundle} exec sh -c 'helloweb.rb "$@"' ${:_buildout_section_name_} "$@"
85 86 87 88 89 90 91


# -*- go -*-
[helloweb-go]
recipe  = slapos.recipe.cmmi
path    = ${helloweb-repository:location}/go/

92
go      = ${golang19:location}/bin/go
93 94 95 96 97 98
configure-command = :
make-binary =
make-targets= cd ${:path} &&
     ${:go} build
        -o ${buildout:bin-directory}/${:_buildout_section_name_}
        helloweb.go