Updated docker config

This commit is contained in:
Dan Elbert 2016-01-19 17:26:23 -06:00
parent ae76d41903
commit aed9ac9fd5
4 changed files with 20 additions and 1 deletions

View File

@ -11,6 +11,11 @@ RUN rm /etc/nginx/sites-enabled/default
ADD docker/nginx_server.conf /etc/nginx/sites-enabled/parsley.conf
ADD docker/nginx_env.conf /etc/nginx/main.d/env.conf
# Add DB Migration Script
RUN mkdir -p /etc/my_init.d
ADD docker/db_migrate.sh /etc/my_init.d/db_migrate.sh
RUN chmod +x /etc/my_init.d/db_migrate.sh
# Set Default RAILS_ENV
ENV PASSENGER_APP_ENV docker

View File

@ -14,6 +14,16 @@ class Recipe < ActiveRecord::Base
validates :total_time, numericality: true, allow_blank: true
validates :active_time, numericality: true, allow_blank: true
NAME_CUTOFF = 35
def display_name
if self.name.length >= NAME_CUTOFF
self.name[0...NAME_CUTOFF] + '...'
else
self.name
end
end
def scale(factor)
recipe_ingredients.each do |ri|
ri.scale(factor)

View File

@ -25,7 +25,7 @@
<tbody>
<% @recipes.each do |recipe| %>
<tr>
<td><%= link_to recipe.name, recipe %></td>
<td><%= link_to recipe.display_name, recipe %></td>
<td>
<%= link_to edit_recipe_path(recipe), class: 'btn btn-sm btn-primary' do %>
<span class="glyphicon glyphicon-pencil"></span>

4
docker/db_migrate.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
cd /home/app/parsley/
RAILS_ENV=$PASSENGER_APP_ENV bundle exec rake db:migrate