Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*schema.rb
4 changes: 4 additions & 0 deletions test/.s2i/bin/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This folder can contain scripts that can be used during various points in the
S2I process. For more information on the types of scripts that can be placed
here, and their required details, please see:
https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md#s2i-scripts
2 changes: 2 additions & 0 deletions test/.s2i/environment
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# The default environment for this Ruby application is production
RACK_ENV=production
6 changes: 3 additions & 3 deletions test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM openshift/ruby-20-centos7
FROM centos/ruby-22-centos7
USER default
EXPOSE 8080
ENV RACK_ENV production
ENV RAILS_ENV production
COPY . /opt/app-root/src/
RUN scl enable ror40 "bundle install"
CMD ["scl", "enable", "ror40", "./run.sh"]
RUN scl enable rh-ruby22 "bundle install"
CMD ["scl", "enable", "rh-ruby22", "./run.sh"]

USER root
RUN chmod og+rw /opt/app-root/src/db
Expand Down
2 changes: 1 addition & 1 deletion test/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ GEM
arel (5.0.1.20140414130214)
builder (3.2.2)
i18n (0.6.11)
json (1.8.3)
json (1.8.6)
minitest (5.4.2)
mysql2 (0.3.16)
rack (1.5.2)
Expand Down
7 changes: 6 additions & 1 deletion test/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ def configure_database
end

get '/' do
puts "Servicing index request..."
erb :main
end

get '/keys' do
puts "Retrieving all keys"
a={}
KeyPair.all.each do |v|
a[v.key]=v.value
Expand All @@ -43,6 +45,7 @@ def configure_database
end

get '/keys/:id' do
puts "Retrieving key #{params[:id]}"
if KeyPair.exists?(params[:id])
KeyPair.find(params[:id]).value
else
Expand All @@ -51,8 +54,9 @@ def configure_database
end

post '/keys/:id' do
puts "Updating key #{params[:id]} to #{params['value']}"
if KeyPair.exists?(params[:id])
KeyPair.update(params['id'], value: params['value'])
KeyPair.update(params[:id], value: params['value'])
"Key updated"
else
KeyPair.create(key:params[:id],value:params['value']).save
Expand All @@ -61,6 +65,7 @@ def configure_database
end

delete '/keys/:id' do
puts "Deleting key #{params[:id]}"
if KeyPair.exists?(params[:id])
v=KeyPair.find(params[:id])
v.destroy
Expand Down
2 changes: 2 additions & 0 deletions test/config.ru
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#\ -p 8080
require './app'
$stdout.sync = true
$stderr.sync = true
run Sinatra::Application