Merge master branch of base
This commit is contained in:
commit
b5acd9b116
10 changed files with 1925 additions and 75 deletions
|
@ -38,6 +38,19 @@ $.fn.sorter = (function(){
|
|||
|
||||
})();
|
||||
|
||||
// allow touch devices to work on click events
|
||||
// http://stackoverflow.com/a/16221066
|
||||
$.fn.extend({ _on: (function(){ return $.fn.on; })() });
|
||||
$.fn.extend({
|
||||
on: (function(){
|
||||
var isTouchSupported = 'ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch;
|
||||
return function( types, selector, data, fn, one ) {
|
||||
if (typeof types == 'string' && isTouchSupported && !(types.match(/touch/gi))) types = types.replace(/click/gi, 'touchstart');
|
||||
return this._on( types, selector, data, fn);
|
||||
};
|
||||
}()),
|
||||
});
|
||||
|
||||
// Load following statements, when DOM is ready
|
||||
$(function() {
|
||||
|
||||
|
|
|
@ -108,17 +108,7 @@ class Ordergroup < Group
|
|||
|
||||
# Make sure, the name is uniq, add usefull message if uniq group is already deleted
|
||||
def uniqueness_of_name
|
||||
id = new_record? ? '' : self.id
|
||||
group = Ordergroup.with_deleted.where('groups.id != ? AND groups.name = ?', id, name).first
|
||||
if group.present?
|
||||
message = group.deleted? ? :taken_with_deleted : :taken
|
||||
errors.add :name, message
|
||||
end
|
||||
end
|
||||
|
||||
# Make sure, the name is uniq, add usefull message if uniq group is already deleted
|
||||
def uniqueness_of_name
|
||||
id = new_record? ? '' : self.id
|
||||
id = new_record? ? nil : self.id
|
||||
group = Ordergroup.where('groups.id != ? AND groups.name = ?', id, name).first
|
||||
if group.present?
|
||||
message = group.deleted? ? :taken_with_deleted : :taken
|
||||
|
|
|
@ -82,7 +82,7 @@ class Supplier < ActiveRecord::Base
|
|||
|
||||
# Make sure, the name is uniq, add usefull message if uniq group is already deleted
|
||||
def uniqueness_of_name
|
||||
id = new_record? ? '' : self.id
|
||||
id = new_record? ? nil : self.id
|
||||
supplier = Supplier.where('suppliers.id != ? AND suppliers.name = ?', id, name).first
|
||||
if supplier.present?
|
||||
message = supplier.deleted? ? :taken_with_deleted : :taken
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
%tr{:class => cycle("even","odd", :name => "order")}
|
||||
%td= link_to truncate(order.name), new_finance_order_path(order_id: order.id)
|
||||
%td=h format_time(order.ends) unless order.ends.nil?
|
||||
%td= order.closed? ? t('.cleared', amount: number_to_currency(order.foodcoop_result)) : "beendet"
|
||||
%td= order.closed? ? t('.cleared', amount: number_to_currency(order.foodcoop_result)) : t('.ended')
|
||||
%td= order.updated_by.nil? ? '??' : order.updated_by.nick
|
||||
%td
|
||||
- unless order.closed?
|
||||
|
@ -23,4 +23,4 @@
|
|||
= link_to t('.close'), close_direct_finance_order_path(order),
|
||||
:confirm => t('.confirm'), :method => :put, class: 'btn btn-mini'
|
||||
- else
|
||||
%i= t('.no_closed_orders')
|
||||
%i= t('.no_closed_orders')
|
||||
|
|
|
@ -1 +1 @@
|
|||
= t '.text', user: @user.nick, link: @link, expires: I18n.l(@user.reset_password_expires)
|
||||
= raw t '.text', user: @user.nick, link: @link, expires: I18n.l(@user.reset_password_expires)
|
||||
|
|
|
@ -22,17 +22,17 @@ default: &defaults
|
|||
zip_code: "10997"
|
||||
city: Berlin
|
||||
country: Deutschland
|
||||
email: foodsoft@myfoodcoop.org
|
||||
email: foodsoft@foodcoop.test
|
||||
phone: "030 323 23249"
|
||||
|
||||
# Homepage
|
||||
homepage: http://www.fctest.de
|
||||
homepage: http://www.foodcoop.test
|
||||
|
||||
# foodsoft documentation URL
|
||||
help_url: https://github.com/bennibu/foodsoft/wiki/Doku
|
||||
help_url: https://github.com/foodcoops/foodsoft/wiki/Doku
|
||||
|
||||
# documentation URL for the apples&pears work system
|
||||
applepear_url: https://github.com/bennibu/foodsoft/wiki/%C3%84pfel-u.-Birnen
|
||||
applepear_url: https://github.com/foodcoops/foodsoft/wiki/%C3%84pfel-u.-Birnen
|
||||
|
||||
# price markup in percent
|
||||
price_markup: 2.0
|
||||
|
@ -46,17 +46,17 @@ default: &defaults
|
|||
# stop_ordering_under: 75
|
||||
|
||||
# email address to be used as sender
|
||||
email_sender: foodsoft@myfoodcoop.org
|
||||
email_sender: foodsoft@foodcoop.test
|
||||
|
||||
# If your foodcoop uses a mailing list instead of internal messaging system
|
||||
#mailing_list: list@myfoodcoop.org
|
||||
#mailing_list_subscribe: list-subscribe@myfoodcoop.org
|
||||
#mailing_list: list@example.org
|
||||
#mailing_list_subscribe: list-subscribe@example.org
|
||||
|
||||
# Config for the exception_notification plugin
|
||||
notification:
|
||||
error_recipients:
|
||||
- admin@myfoodcoop.org
|
||||
sender_address: "\"FoodSoft Error\" <foodsoft@myfoodcoop.org>"
|
||||
- admin@foodcoop.test
|
||||
sender_address: "\"FoodSoft Error\" <foodsoft@foodcoop.test>"
|
||||
email_prefix: "[FoodSoft]"
|
||||
|
||||
# Access to sharedLists, the external article-database
|
||||
|
|
|
@ -190,11 +190,11 @@ de:
|
|||
first_paragraph: Neue Mitglieder kannst du %{url} einladen.
|
||||
here: hier
|
||||
index:
|
||||
first_paragraph: Hier kannst du %{url} anlegen, Gruppen bearbeiten und löschen.
|
||||
first_paragraph: Hier kannst du %{url} anlegen, bearbeiten und löschen.
|
||||
new_workgroup: Neue Arbeitsgruppe anlegen
|
||||
new_workgroups: neue Arbeitsgruppen
|
||||
ordergroup: Bestellgruppe
|
||||
second_paragraph: ! 'Beachte dabei den <em>Unterschied zwischen Gruppe und Bestellgruppe</em>: Eine %{url} hat ein Konto und kann Essen bestellen. In einer Arbeitsgruppe (z.b. ''Soritiergruppe'') koordinieren sich die Mitglieder mittels Aufgaben und Nachrichten. Nutzer_innen können immer nur einer Bestellgruppe, aber beliebig vielen anderen Gruppen angehören.'
|
||||
second_paragraph: ! 'Beachte dabei den Unterschied zwischen <em>Gruppe</em> und <em>Bestellgruppe</em>: eine <em>%{url}</em> hat ein Konto und kann Essen bestellen. In einer Arbeitsgruppe (z.b. ''Soritiergruppe'') koordinieren sich die Mitglieder mittels Aufgaben und Nachrichten. Nutzer_innen können immer nur einer Bestellgruppe, aber beliebig vielen anderen Gruppen angehören.'
|
||||
title: Arbeitsgruppen
|
||||
new:
|
||||
title: Arbeitsgruppe anlegen
|
||||
|
@ -302,7 +302,7 @@ de:
|
|||
body: ! 'Folgende Artikel wurden ausgelistet und werden <b>gelöscht</b>:'
|
||||
body_skip: Es müssen keine Artikel gelöscht werden.
|
||||
title: Auslisten ...
|
||||
price_short: Price
|
||||
price_short: Preis
|
||||
submit: Alle löschen/aktualisieren
|
||||
title: Artikel mit externer Datenbank synchronisieren
|
||||
unit_quantity_short: GebGr
|
||||
|
@ -614,8 +614,9 @@ de:
|
|||
close: direkt schließen
|
||||
confirm: Wirklich die Bestellung schließen setzen?
|
||||
end: Ende
|
||||
last_edited_by: zuletzt bearbeitet von
|
||||
name: Name
|
||||
ended: beendet
|
||||
last_edited_by: Zuletzt bearbeitet von
|
||||
name: Lieferantin
|
||||
no_closed_orders: derzeit gibt es keine beendeten Bestellungen
|
||||
state: Status
|
||||
summary:
|
||||
|
|
|
@ -7,7 +7,7 @@ en:
|
|||
general_msg: ! 'A problem has occured: %{msg}'
|
||||
messages:
|
||||
accepted: has to be accepted
|
||||
blank: has to be filled
|
||||
blank: has to be entered
|
||||
confirmation: does not match the confirmation
|
||||
empty: has to be entered
|
||||
equal_to: has to be exactly %{count}
|
||||
|
@ -135,11 +135,11 @@ en:
|
|||
first_paragraph: You can invite new members %{url}.
|
||||
here: here
|
||||
index:
|
||||
first_paragraph: Here you can add a %{url}, administer a group or delete it.
|
||||
first_paragraph: Here you can add %{url}, and edit or delete groups.
|
||||
new_ordergroup: Add new ordergroup
|
||||
new_ordergroups: new ordergroups
|
||||
second_paragraph: ! 'Consider the <em>difference between group and ordergroup</em>: An ordergroup has an account and can order food. In a <em>%{url}</em> (for example ''sorting group'') the members coordinate with each other via tasks and messages. Users can only be in one ordergroup, but can be in multiple other groups.'
|
||||
title: Ordergroup
|
||||
second_paragraph: ! 'Consider the difference between <em>group</em> and <em>ordergroup</em>: An ordergroup has an account and can order food. In a <em>%{url}</em> (for example ''sorting group''), members coordinate with each other via tasks and messages. Users can only be in one ordergroup, but can be in multiple workgroups.'
|
||||
title: Ordergroups
|
||||
workgroup: workgroup
|
||||
new:
|
||||
title: Create ordergroup
|
||||
|
@ -150,7 +150,7 @@ en:
|
|||
name: Name
|
||||
show:
|
||||
confirm: Are you sure?
|
||||
edit: Edit group/member
|
||||
edit: Edit group/members
|
||||
send_message: Send message
|
||||
title: Ordergroup %{name}
|
||||
search_placeholder: name ..
|
||||
|
@ -158,10 +158,10 @@ en:
|
|||
edit:
|
||||
title: Edit user
|
||||
index:
|
||||
first_paragraph: Here you can edit users %{url}, bearbeiten and also delete them.
|
||||
first_paragraph: Here you can %{url}, edit and delete users.
|
||||
new_user: Create new user
|
||||
new_users: Create new user
|
||||
title: Admin/users
|
||||
new_users: create new
|
||||
title: User admin
|
||||
new:
|
||||
title: Create new user
|
||||
show:
|
||||
|
@ -194,7 +194,7 @@ en:
|
|||
new_workgroup: Create new workgroup
|
||||
new_workgroups: new workgroups
|
||||
ordergroup: ordergroup
|
||||
second_paragraph: ! 'Be aware of the <em>difference between a group and ordergroup</em>: A %{url} has an account and can order food. In a workgroup (for example ''sorting group'') the members coordinate with each other via tasks and messages. Users can only be in one ordergroup, but can be in multiple other groups.'
|
||||
second_paragraph: ! 'Consider the difference between a <em>workgroup</em> and an <em>ordergroup</em>: an <em>%{url}</em> has an account and can order food. In a workgroup (for example ''sorting group''), members coordinate with each other via tasks and messages. Users can only be in one ordergroup, but can be in multiple workgroups.'
|
||||
title: Workgroups
|
||||
new:
|
||||
title: Create workgroup
|
||||
|
@ -223,43 +223,43 @@ en:
|
|||
articles:
|
||||
article:
|
||||
confirm_delete: Are you sure?
|
||||
last_update: ! 'last updated: %{last_update} | Gross: %{gross_price}'
|
||||
last_update: ! 'last updated: %{last_update} | gross: %{gross_price}'
|
||||
articles:
|
||||
confirm_delete: Do you really want to delete all selected articles?
|
||||
option_available: Articles are available
|
||||
option_available: Make articles available
|
||||
option_delete: Delete article
|
||||
option_not_available: Articles are not available anymore
|
||||
option_not_available: Make articles unavailable
|
||||
option_select: Choose special offer ...
|
||||
price_netto: Price
|
||||
unit_quantity_desc: Unit quantity
|
||||
unit_quantity_short: Quantity
|
||||
controller:
|
||||
create_from_upload:
|
||||
notice: ! '%{count} new articles were saved'
|
||||
error_invalid: Articles are incorrect.
|
||||
error_nosel: You have selected no articles
|
||||
notice: ! '%{count} new articles were saved.'
|
||||
error_invalid: There are errors in articles
|
||||
error_nosel: No articles selected
|
||||
error_parse: ! '%{msg} ... in line %{line}'
|
||||
error_update: ! 'There was an error when updating the article ''%{article}'' on: %{msg}'
|
||||
error_update: ! 'An error occured when updating article ''%{article}'': %{msg}'
|
||||
parse_upload:
|
||||
notice: ! '%{count} articles analysed succesfully.'
|
||||
notice: ! '%{count} articles were succesfully analysed.'
|
||||
sync:
|
||||
notice: The catalog is up to date
|
||||
notice: Catalog is up to date
|
||||
shared_alert: ! '%{supplier} is not linked to an external database'
|
||||
update_all:
|
||||
notice: All articles and prices are updated
|
||||
notice: All articles and prices were updated.
|
||||
update_sel:
|
||||
notice_avail: ! 'All selected articles have been made available '
|
||||
notice_destroy: All selected articles have been deleted
|
||||
notice_noaction: No action selected!
|
||||
notice_unavail: All selected articles have been made unavailable
|
||||
notice_avail: All selected articles were set to be available.
|
||||
notice_destroy: All selected articles were deleted.
|
||||
notice_noaction: No action specified!
|
||||
notice_unavail: All selected articles were set to be unavailable.
|
||||
update_sync:
|
||||
notice: All articles and prices have been updated
|
||||
notice: All articles and prices were updated.
|
||||
destroy_active_article:
|
||||
drop: delete
|
||||
note: ! '%{article} is used in current orders and can not be deleted Please first ... the article from orders %{drop_link}.'
|
||||
edit_all:
|
||||
note: ! 'Mandatory fields are: name, unit, (net) price and order number.'
|
||||
submit: Updating all articles
|
||||
submit: Update all articles
|
||||
title: Edit all articles from %{supplier}
|
||||
warning: ! 'Warning: all articles will be updated!'
|
||||
edit_all_table:
|
||||
|
@ -291,7 +291,7 @@ en:
|
|||
new: New article
|
||||
new_order: Create new order
|
||||
search_placeholder: Name ...
|
||||
title: Article from %{supplier} (%{count})
|
||||
title: Articles from %{supplier} (%{count})
|
||||
upload: Upload articles
|
||||
model:
|
||||
error_in_use: ! '%{article} can not be deleted because the article is part of a current order!'
|
||||
|
@ -300,14 +300,16 @@ en:
|
|||
body: <p><i>Please verify the articles.</i></p> <p><i>Warning, at the moment there is no check for duplicate articles.</i></p>
|
||||
outlist:
|
||||
body: ! 'The following articles were outlisted and <b>deleted</b>:'
|
||||
body_skip: No articles were deleted.
|
||||
body_skip: No articles to delete.
|
||||
title: Outlist ...
|
||||
price_short: Price
|
||||
submit: Delete/update all
|
||||
title: Synchronize articles with external database
|
||||
unit_quantity_short: unit quantity
|
||||
update:
|
||||
body: <p><i>All articles are shown twice. Old articles are shown in grey and the text fields show their current values.</i></p> <p><i>Changes from old articles are marked in yellow.</i></p>
|
||||
body: ! '<p><i>Every article is shown twice. The old values are gray and contain the current values.</i></p>
|
||||
|
||||
<p><i>Differences with the old articles are marked yellow.</i></p>'
|
||||
title: Update ...
|
||||
update_msg: ! 'Articles must be updated:'
|
||||
upload:
|
||||
|
@ -566,7 +568,7 @@ en:
|
|||
edit_results_by_articles:
|
||||
add_article: Add article
|
||||
amount: Amount
|
||||
amount_per_unit: Unit quantity
|
||||
amount_per_unit: Unit quantity * Unit
|
||||
article: Article
|
||||
gross: Gross
|
||||
net: Net
|
||||
|
@ -590,11 +592,11 @@ en:
|
|||
new: Create new invoice
|
||||
new_body: ! 'Create an invoice for this order:'
|
||||
plus_refund_credited: ! '+ refund credited:'
|
||||
refund_adjusted_amount: ! 'refund adjusted amount:'
|
||||
refund_adjusted_amount: ! 'amount adjusted for refund:'
|
||||
new:
|
||||
alert: Attention, order was already accounted
|
||||
articles_overview: Overview of articles
|
||||
comment_on_transaction: Here you can add a comment with your accounting
|
||||
comment_on_transaction: Here you can add a comment to your accounting.
|
||||
comments: Comments
|
||||
confirm_order: Close order
|
||||
create_invoice: Create invoice
|
||||
|
@ -609,14 +611,15 @@ en:
|
|||
order_article:
|
||||
confirm: Are you sure?
|
||||
orders:
|
||||
clear: Accounting
|
||||
cleared: Accounted (%{amount})
|
||||
close: Close directly
|
||||
confirm: Really want to put the order on closed?
|
||||
clear: accounting
|
||||
cleared: accounted (%{amount})
|
||||
close: close directly
|
||||
confirm: Do you really want to fully close the order?
|
||||
end: End
|
||||
ended: ended
|
||||
last_edited_by: Last edited by
|
||||
name: Name
|
||||
no_closed_orders: At the moment there are not closed orders
|
||||
name: Supplier
|
||||
no_closed_orders: At the moment there are no ended orders.
|
||||
state: State
|
||||
summary:
|
||||
changed: Data was changed!
|
||||
|
@ -627,8 +630,8 @@ en:
|
|||
groups_amount: ! 'Group amounts:'
|
||||
net_amount: ! 'Net amount:'
|
||||
reload: Reload summary
|
||||
with_extra_charge: ! 'With extra charge:'
|
||||
without_extra_charge: ! 'Without extra charge:'
|
||||
with_extra_charge: ! 'with extra charge:'
|
||||
without_extra_charge: ! 'without extra charge:'
|
||||
create:
|
||||
notice: Invoice was created
|
||||
financial_transactions:
|
||||
|
@ -639,12 +642,12 @@ en:
|
|||
notice: All Transactions were saved.
|
||||
index:
|
||||
balance: ! 'Balance of account: %{balance}'
|
||||
last_updated_at: (last updated at %{when})
|
||||
last_updated_at: (last updated %{when} ago)
|
||||
new_transaction: Create new transaction
|
||||
search_placeholder: Search ..
|
||||
title: Account statement for %{name}
|
||||
new:
|
||||
paragraph: Here you can credit/deduct the order group <b>%{name}</b> money.
|
||||
paragraph: Here you can credit and debit money for the order group <b>%{name}</b>.
|
||||
title: New transaction
|
||||
new_collection:
|
||||
amount: Amount
|
||||
|
@ -773,7 +776,7 @@ en:
|
|||
last_update: Last ordered
|
||||
manufacturer: Manufacturer
|
||||
min_quantity: Minimum quantity
|
||||
name: Mame
|
||||
name: Name
|
||||
new_funds: New account balance
|
||||
note: Note
|
||||
price: Price
|
||||
|
@ -791,7 +794,7 @@ en:
|
|||
units_full: Filled units
|
||||
index:
|
||||
closed_orders:
|
||||
more: more..
|
||||
more: more...
|
||||
title: Closed orders
|
||||
finished_orders:
|
||||
title: Unaccounted orders
|
||||
|
@ -834,7 +837,7 @@ en:
|
|||
comments:
|
||||
title: Comments
|
||||
ending: End
|
||||
not_ordered: You didn’t order
|
||||
not_ordered: You didn’t order.
|
||||
note: Note
|
||||
order_sum: Order sum
|
||||
sum: Sum
|
||||
|
@ -1298,7 +1301,7 @@ en:
|
|||
number: Number
|
||||
to_address: Shipping address
|
||||
finish:
|
||||
notice: The order has finished.
|
||||
notice: The order has been ended.
|
||||
form:
|
||||
name: Name
|
||||
note: Note
|
||||
|
@ -1324,7 +1327,7 @@ en:
|
|||
model:
|
||||
error_closed: Order was already accounted for
|
||||
error_nosel: At least one article must be selected
|
||||
error_starts_before_ends: must be before the starting date (or remain empty)
|
||||
error_starts_before_ends: must be after the start date (or remain empty)
|
||||
notice_close: ! 'Order: %{name}, until %{ends}'
|
||||
new:
|
||||
title: Create new order
|
||||
|
|
1723
config/locales/nl.yml
Normal file
1723
config/locales/nl.yml
Normal file
File diff suppressed because it is too large
Load diff
120
script/heroku_deploy
Executable file
120
script/heroku_deploy
Executable file
|
@ -0,0 +1,120 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# deploy foodsoft to heroku
|
||||
#
|
||||
# To be run from foodsoft's root. A new temporary git branch will be created
|
||||
# from the current working directory - it's safest to run this with a clean
|
||||
# working directory.
|
||||
#
|
||||
# Use environment variables to customize variables below.
|
||||
# You need to have a working heroku client.
|
||||
#
|
||||
|
||||
# rails environment to deploy
|
||||
[ "$RAILS_ENV" ] || RAILS_ENV=production
|
||||
# heroku application name
|
||||
[ "$APP" ] || APP=foodsoft-translation
|
||||
# heroku region to create application in
|
||||
[ "$REGION" ] || REGION=eu
|
||||
|
||||
|
||||
# make sure required software is available
|
||||
if ! heroku >/dev/null 2>&1; then
|
||||
echo "Please install heroku." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
if ! git version >/dev/null 2>&1; then
|
||||
echo "Please install git." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
# required settings
|
||||
if [ "$RAILS_ENV" = "translation" -a ! "$LOCALEAPP_KEY" ]; then
|
||||
echo "Need to specify LOCALEAPP_KEY key for translation environment" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# create app if it doesn't exist
|
||||
if ! heroku apps | grep -q "^$APP\s"; then
|
||||
heroku create "$APP" --region "$REGION"
|
||||
heroku addons:add heroku-postgresql:dev --app "$APP"
|
||||
heroku pg:promote `heroku config | grep 'HEROKU_POSTGRESQL_.*_URL' | cut -d: -f1`
|
||||
fi
|
||||
heroku config:set RACK_ENV="${RAILS_ENV}" RAILS_ENV="${RAILS_ENV}" --app "$APP"
|
||||
|
||||
# create temporary branch with heroku-specific changes
|
||||
touch ._tmp_havestash
|
||||
OLDSTASH=`git stash list | wc -l`
|
||||
git stash save -q -a "stored changes before creating heroku-$APP"
|
||||
ORIG_BRANCH=`git status --b --porcelain | head -n 1 | sed 's|^#*\s*||;s|\.\.\..*$||'`
|
||||
BRANCH="_tmp-heroku-$APP"
|
||||
if ! git checkout -b "$BRANCH"; then
|
||||
echo "Could not create to temporary branch '$BRANCH', aborting." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
# remove sqlite3 dependency as it doesn't install on heroku
|
||||
sed -i "s|^\\(\\s*gem\\s\\+'sqlite3'\\)|#\1|" Gemfile
|
||||
sed -i "s|^\\(\\s*sqlite3\\b\)|#\1|" Gemfile.lock
|
||||
# make sure postgresql db is present, as it is the default heroku db
|
||||
echo "\ngem 'pg'" >>Gemfile
|
||||
echo "\ngem 'localeapp'" >>Gemfile
|
||||
# always use unicorn
|
||||
echo "\ngem 'unicorn'" >>Gemfile
|
||||
echo 'web: bundle exec unicorn -p $PORT -E $RACK_ENV' >Procfile
|
||||
bundle install --quiet # to update Gemfile.lock
|
||||
# do not ignore deployment files
|
||||
sed -i 's|^\(config/\*.yml\)|#\1|' .gitignore
|
||||
sed -i 's|^\(config/initializers/secret_token.rb\)|#\1|' .gitignore
|
||||
sed -i 's|^\(config/environments/development.rb\)|#\1|' .gitignore
|
||||
# make sure we have a full configuration
|
||||
# TODO pull this from heroku when exists?
|
||||
if [ ! -e config/app_config.yml ]; then
|
||||
echo "config/app_config.yml not present, copying config/app_config.yml.SAMPLE"
|
||||
cp config/app_config.yml.SAMPLE config/app_config.yml
|
||||
fi
|
||||
# keep secret token from currently deployed app, else generate new one
|
||||
heroku git:remote --app="$APP" >/dev/null 2>&1
|
||||
if git show heroku/master:config/initializers/secret_token.rb >/dev/null 2>&1; then
|
||||
git show heroku/master:config/initializers/secret_token.rb >config/initializers/secret_token.rb
|
||||
else
|
||||
cat >config/initializers/secret_token.rb <<-EOF
|
||||
# auto-generated secret key
|
||||
Foodsoft::Application.config.secret_token = '`openssl rand -hex 128`'
|
||||
EOF
|
||||
fi
|
||||
# configure localeapp, manually to include environment
|
||||
if [ "$LOCALEAPP_KEY" ]; then
|
||||
cat >config/initializers/localeapp.rb <<EOF
|
||||
require 'localeapp/rails'
|
||||
|
||||
Localeapp.configure do |config|
|
||||
config.api_key = '$LOCALEAPP_KEY'
|
||||
config.sending_environments = ['$RAILS_ENV']
|
||||
config.polling_environments = ['$RAILS_ENV']
|
||||
end
|
||||
EOF
|
||||
# also do not cache so we get locale updates
|
||||
sed -i 's|config\.cache_classes\s*=.*|config.cache_classes = false|' config/environments/${RAILS_ENV}.rb
|
||||
fi
|
||||
# TODO add more extensive database seed
|
||||
|
||||
# and push = deploy
|
||||
git add -A
|
||||
git commit -q -m "heroku changes for environment ${RAILS_ENV}" -a
|
||||
git push -f heroku $BRANCH:master
|
||||
# create/update database
|
||||
if !heroku run rake db:version >/dev/null 2>&1; then
|
||||
heroku run rake db:setup
|
||||
else
|
||||
heroku run rake db:migrate
|
||||
fi
|
||||
# get full translations so update works
|
||||
[ "$LOCALEAPP_KEY" ] && heroku run localeapp pull
|
||||
|
||||
# restart just to be sure
|
||||
heroku ps:restart
|
||||
|
||||
# return to original branch
|
||||
git checkout -q "$ORIG_BRANCH" && git stash pop -q
|
||||
git branch -q -D "$BRANCH"
|
||||
rm -f ._tmp_havestash
|
||||
|
Loading…
Reference in a new issue