diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 0000000..f825659 --- /dev/null +++ b/test/.gitignore @@ -0,0 +1 @@ +*schema.rb diff --git a/test/.s2i/bin/README b/test/.s2i/bin/README new file mode 100644 index 0000000..03ea8db --- /dev/null +++ b/test/.s2i/bin/README @@ -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 diff --git a/test/.s2i/environment b/test/.s2i/environment new file mode 100644 index 0000000..cdb36b5 --- /dev/null +++ b/test/.s2i/environment @@ -0,0 +1,2 @@ +# The default environment for this Ruby application is production +RACK_ENV=production diff --git a/test/Dockerfile b/test/Dockerfile index 1db380d..570bd16 100644 --- a/test/Dockerfile +++ b/test/Dockerfile @@ -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 diff --git a/test/Gemfile.lock b/test/Gemfile.lock index 42dc4fe..42f8df3 100644 --- a/test/Gemfile.lock +++ b/test/Gemfile.lock @@ -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) diff --git a/test/app.rb b/test/app.rb index 0156f78..db84f88 100644 --- a/test/app.rb +++ b/test/app.rb @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/test/config.ru b/test/config.ru index ace45d6..9d920bc 100644 --- a/test/config.ru +++ b/test/config.ru @@ -1,3 +1,5 @@ #\ -p 8080 require './app' +$stdout.sync = true +$stderr.sync = true run Sinatra::Application