Skip to content

Commit

Permalink
Merge pull request openshift#18 from bparees/enable_sti
Browse files Browse the repository at this point in the history
enable hello world app for STI building
  • Loading branch information
bparees committed Nov 2, 2014
2 parents 84fc19f + f2221f4 commit 19b0cff
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM openshift/ruby-20-centos

RUN gem install sinatra sinatra-activerecord mysql2 --no-ri --no-rdoc

ADD sinatra_app /tmp/
ADD . /tmp/

USER root

Expand All @@ -13,4 +13,4 @@ USER ruby
WORKDIR /tmp/

EXPOSE 8080
CMD ["ruby", "start.rb"]
CMD ["ruby", "app.rb"]
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

gem 'sinatra'
gem 'sinatra-activerecord'
gem 'mysql2'
gem 'rake'
46 changes: 46 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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)
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.1)
minitest (5.4.2)
mysql2 (0.3.16)
rack (1.5.2)
rack-protection (1.5.3)
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)
activerecord (>= 3.2)
sinatra (~> 1.0)
thread_safe (0.3.4)
tilt (1.4.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)

PLATFORMS
ruby

DEPENDENCIES
mysql2
rake
sinatra
sinatra-activerecord
4 changes: 4 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require_relative 'config/environments'
require_relative 'models'
require 'sinatra/activerecord/rake'

15 changes: 15 additions & 0 deletions sinatra_app/app.rb → app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@
set :bind, '0.0.0.0'
set :port, 8080

configure do
puts "Running app file"
puts "Create database..."
%x"rake db:create"
puts "Run migrations..."
%x"rake db:migrate"
puts "Run app..."

while !self.connect_to_database
puts "Connecting to database...\n"
sleep 0.1
end
puts "Connected to database"
end

get '/' do
Timestamp.create(date: Time.now, text: "This is a message from a database query. The last insertion in the database was at")
"Hello World!\n"+
Expand Down
2 changes: 2 additions & 0 deletions config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require './app'
run Sinatra::Application
File renamed without changes.
9 changes: 0 additions & 9 deletions sinatra_app/config/environments.rb → config/environments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,3 @@ def self.connect_to_database
return false
end
end

configure :development do

while !self.connect_to_database
puts "Connecting to database...\n"
sleep 0.1
end
puts "Connected to database"
end
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions sinatra_app/Rakefile

This file was deleted.

6 changes: 0 additions & 6 deletions sinatra_app/start.rb

This file was deleted.

0 comments on commit 19b0cff

Please sign in to comment.