With a Ruby environment installed and bundler gem (gem install bundler
), you can run the application locally with:
bundle install # install Sinatra library
rackup & # start server via Rack
# manually test
curl -i localhost:3000/
curl -i localhost:3000/hello/Simon
docker-compose up -d # start up container
# set server IP address
[ -z ${DOCKER_MACHINE_NAME} ] || WEBSERVER=$(docker-machine ip ${DOCKER_MACHINE_NAME})
WEBSERVER=${WEBSERVER:-localhost}
# manually test
curl -i ${WEBSERVER}:3000/
curl -i ${WEBSERVER}:3000/hello/Simon
vagrant up # start up virtualbox w/ docker container
# manually test
curl -i localhost:3000/
curl -i localhost:3000/hello/Simon
There are basic unit tests provided, to run them simply run:
rake
In a CI system, for a test stage, you can run:
rake ci:all
A Jenkinsfile
using DSL pipeline is provided to demonstrate this solution.
- Web Microframework:
- Test Frameworks
- Jenkins Declarative Pipeline for Ruby