Skip to content

Commit

Permalink
Merge pull request #2 from wzheng1/master
Browse files Browse the repository at this point in the history
dependency changes
  • Loading branch information
akostadinov authored Oct 30, 2019
2 parents 4e7c264 + b71436f commit 8610ce9
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 45 deletions.
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
12 changes: 7 additions & 5 deletions test/Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
source 'https://rubygems.org'

gem 'sinatra'
gem 'sinatra-activerecord'
gem 'mysql2'
gem 'rake'
gem 'minitest'
gem 'sinatra', '2.0.5'
gem 'sinatra-activerecord', '2.0.13'
gem 'mysql2', '0.4.10'
gem 'rake', '12.3.0'
gem 'minitest', '5.11.3'
gem 'i18n', '0.9.3'

69 changes: 35 additions & 34 deletions test/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@
GEM
remote: https://rubygems.org/
specs:
activemodel (4.1.7)
activesupport (= 4.1.7)
builder (~> 3.1)
activerecord (4.1.7)
activemodel (= 4.1.7)
activesupport (= 4.1.7)
arel (~> 5.0.0)
activesupport (4.1.7)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
activemodel (5.1.4)
activesupport (= 5.1.4)
activerecord (5.1.4)
activemodel (= 5.1.4)
activesupport (= 5.1.4)
arel (~> 8.0)
activesupport (5.1.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
arel (5.0.1.20140414130214)
builder (3.2.2)
i18n (0.6.11)
json (1.8.3)
minitest (5.4.2)
mysql2 (0.3.16)
rack (1.5.2)
rack-protection (1.5.3)
arel (8.0.0)
concurrent-ruby (1.0.5)
i18n (0.9.3)
concurrent-ruby (~> 1.0)
minitest (5.11.3)
mustermann (1.0.3)
mysql2 (0.4.10)
rack (2.0.6)
rack-protection (2.0.5)
rack
rake (10.3.2)
sinatra (1.4.5)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
sinatra-activerecord (2.0.3)
rake (12.3.0)
sinatra (2.0.5)
mustermann (~> 1.0)
rack (~> 2.0)
rack-protection (= 2.0.5)
tilt (~> 2.0)
sinatra-activerecord (2.0.13)
activerecord (>= 3.2)
sinatra (~> 1.0)
thread_safe (0.3.4)
tilt (1.4.1)
tzinfo (1.2.2)
sinatra (>= 1.0)
thread_safe (0.3.6)
tilt (2.0.9)
tzinfo (1.2.5)
thread_safe (~> 0.1)

PLATFORMS
ruby

DEPENDENCIES
minitest
mysql2
rake
sinatra
sinatra-activerecord
i18n (= 0.9.3)
minitest (= 5.11.3)
mysql2 (= 0.4.10)
rake (= 12.3.0)
sinatra (= 2.0.5)
sinatra-activerecord (= 2.0.13)
1 change: 1 addition & 0 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
This is a sample openshift v3 application repository.

For instructions on how to use it, please see: https://github.com/openshift/origin/blob/master/examples/sample-app/README.md

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
2 changes: 1 addition & 1 deletion test/config/database.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% # Handle old behaviour of official mysql image %>
<%# Handle old behaviour of official mysql image %>
<% user = ENV.key?("MYSQL_ROOT_PASSWORD") ? "root" : ENV["MYSQL_USER"] %>
<% password = ENV.key?("MYSQL_ROOT_PASSWORD") ? ENV["MYSQL_ROOT_PASSWORD"] : ENV["MYSQL_PASSWORD"] %>
development:
Expand Down
2 changes: 1 addition & 1 deletion test/db/migrate/20141102191902_create_key_pair.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreateKeyPair < ActiveRecord::Migration
class CreateKeyPair < ActiveRecord::Migration[5.1]
def up
create_table :key_pairs, :primary_key => :key do |t|
t.string :value
Expand Down

0 comments on commit 8610ce9

Please sign in to comment.