Fixed broken links in tasks-module. Translated some views into german.

This commit is contained in:
Benjamin Meichsner 2009-02-06 20:51:14 +01:00
parent 85eb27079f
commit 96442477d1
24 changed files with 141 additions and 274 deletions

2
.gitignore vendored
View file

@ -4,4 +4,4 @@ config/*.yml
db/*.sqlite3 db/*.sqlite3
nbproject/ nbproject/
config/environments/development.rb config/environments/development.rb
capfile

View file

@ -14,7 +14,7 @@ class HomeController < ApplicationController
tasks = Task.find(:all, :conditions => ["assigned = ? and done = ?", false, false]) tasks = Task.find(:all, :conditions => ["assigned = ? and done = ?", false, false])
@unassigned_tasks_number = 0 @unassigned_tasks_number = 0
for task in tasks for task in tasks
(@unassigned_tasks_number += 1) unless task.workgroup && !current_user.is_member_of(task.workgroup) (@unassigned_tasks_number += 1) unless task.workgroup && !current_user.member_of?(task.workgroup)
end end
end end

View file

@ -3,7 +3,7 @@ class TasksController < ApplicationController
def index def index
@non_group_tasks = Task.non_group @non_group_tasks = Task.non_group
@groups = Group.find :all, :conditions => "type != 'Ordergroup'" @groups = Workgroup.all
end end
def myTasks def myTasks
@ -86,7 +86,7 @@ class TasksController < ApplicationController
task.assignments.create(:user => current_user, :accepted => true) task.assignments.create(:user => current_user, :accepted => true)
end end
flash[:notice] = "Du hast die Aufgabe übernommen" flash[:notice] = "Du hast die Aufgabe übernommen"
redirect_to :action => "myTasks" redirect_to my_tasks_path
end end
# deletes assignment between current_user and given task # deletes assignment between current_user and given task
@ -103,7 +103,7 @@ class TasksController < ApplicationController
# Shows all tasks, which are already done # Shows all tasks, which are already done
def archive def archive
@tasks = Task.find :all, :conditions => "done = 1", :order => "due_date DESC" @tasks = Task.done
end end
# shows workgroup (normal group) to edit weekly_tasks_template # shows workgroup (normal group) to edit weekly_tasks_template

View file

@ -20,7 +20,8 @@ class Task < ActiveRecord::Base
has_many :users, :through => :assignments has_many :users, :through => :assignments
belongs_to :workgroup belongs_to :workgroup
named_scope :non_group, :conditions => { :workgroup_id => nil, :done => false }, :order => "due_date ASC" named_scope :non_group, :conditions => { :workgroup_id => nil, :done => false }
named_scope :done, :conditions => {:done => true}, :order => "due_date ASC"
# form will send user in string. responsibilities will added later # form will send user in string. responsibilities will added later
attr_protected :users attr_protected :users

View file

@ -181,8 +181,8 @@ class User < ActiveRecord::Base
end end
# returns true if user is a member of a given group # returns true if user is a member of a given group
def is_member_of(group) def member_of?(group)
return true if group.users.detect {|user| user == self} group.users.exists?(self.id)
end end
#Returns an array with the users groups (but without the Ordergroups -> because tpye=>"") #Returns an array with the users groups (but without the Ordergroups -> because tpye=>"")

View file

@ -8,14 +8,12 @@
<p><b>Kontostand:</b> <%= number_to_currency(@ordergroup.account_balance) %></p> <p><b>Kontostand:</b> <%= number_to_currency(@ordergroup.account_balance) %></p>
<h2>Personen</h2> <h2>Personen</h2>
<ul style="list-style-type:decimal;"> <ul style="list-style-type:decimal;">
<% for membership in @ordergroup.memberships %> <% for membership in @ordergroup.memberships -%>
<li> <li><%= membership.user.nick -%></li>
<%= link_to membership.user.nick, :controller => 'index', :action => 'showUser', :id => membership.user %> <% end -%>
</li>
<% end %>
</ul> </ul>
<%= link_to('Hinzufügen/entfernen', :action => 'members', :id => @ordergroup) %> | <%= link_to('Hinzufügen/entfernen', :controller => 'foodcoop', :action => 'memberships', :id => @ordergroup) %> |
<%= link_to('Person einladen', :action => 'invite', :id => @ordergroup) %> <%= link_to('Person einladen', :controller => 'foodcoop', :action => 'invite', :id => @ordergroup) %>
</div> </div>
</div> </div>

View file

@ -3,27 +3,28 @@
tabs = [ tabs = [
{ :name => "Start", :url => root_path, :active => ["index", "messages", "home"], { :name => "Start", :url => root_path, :active => ["index", "messages", "home"],
:subnav => [ :subnav => [
{ :name => "Messages", :url => "/messages"}, { :name => "Nachrichten", :url => "/messages"},
{ :name => "My tasks", :url => "/home/tasks" }, { :name => "Meine Aufgaben", :url => "/home/tasks" },
{ :name => "My ordergroup", :url => "/home/ordergroup"}, { :name => "Meine Bestellgruppe", :url => "/home/ordergroup"},
{ :name => "My profile", :url => "/home/profile"} { :name => "Mein Profil", :url => "/home/profile"}
] ]
}, },
{ :name => "Foodcoop", :url => "/foodcoop/members", :active => ["foodcoop", "tasks"], { :name => "Foodcoop", :url => "/foodcoop/members", :active => ["foodcoop", "tasks"],
:subnav => [ :subnav => [
{ :name => "Members", :url => "/foodcoop/members"}, { :name => "Mitglieder", :url => "/foodcoop/members"},
{ :name => "Workgroups", :url => "/foodcoop/workgroups"}, { :name => "Abeitsgruppen", :url => "/foodcoop/workgroups"},
{ :name => "Tasks", :url => "/tasks"} { :name => "Aufgaben", :url => "/tasks"}
] ]
}, },
{ :name => "Orders", :url => "/ordering", :active => ["orders", "ordering"], { :name => "Bestellungen", :url => u.ordergroup ? "/ordering/" : "/orders",
:active => ["orders", "ordering"],
:subnav => [ :subnav => [
{ :name => "Order", :url => "/ordering" }, { :name => "Bestellen!", :url => "/ordering" },
{ :name => "My orders", :url => "/ordering/myOrders" }, { :name => "Meine Bestellungen", :url => "/ordering/myOrders" },
{ :name => "Manage orders", :url => "/orders", :access_denied? => (!u.role_orders?) } { :name => "Bestellverwaltung", :url => "/orders", :access_denied? => (!u.role_orders?) }
] ]
}, },
{ :name => "Articles", :url => "/suppliers", { :name => "Artikel", :url => "/suppliers",
:active => ["articles", "suppliers", "deliveries", "article_categories", "stockit"], :active => ["articles", "suppliers", "deliveries", "article_categories", "stockit"],
:access_denied? => (!u.role_article_meta? && !u.role_suppliers?), :access_denied? => (!u.role_article_meta? && !u.role_suppliers?),
:subnav => [ :subnav => [
@ -33,22 +34,22 @@
{ :name => "Kategorien", :url => "/article_categories"} { :name => "Kategorien", :url => "/article_categories"}
] ]
}, },
{ :name => "Finance", :url => "/finance", { :name => "Finanzen", :url => "/finance",
:active => ["finance/invoices", "finance/transactions", "finance/balancing"], :active => ["finance/invoices", "finance/transactions", "finance/balancing"],
:access_denied? => (!u.role_finance?), :access_denied? => (!u.role_finance?),
:subnav => [ :subnav => [
{ :name => "Manage accounts", :url => "/finance/transactions" }, { :name => "Konten verwalten", :url => "/finance/transactions" },
{ :name => "Balance orders", :url => "/finance/balancing/list" }, { :name => "Bestellungen abrechnen", :url => "/finance/balancing/list" },
{ :name => "Invoices", :url => finance_invoices_path } { :name => "Rechnungen", :url => finance_invoices_path }
] ]
}, },
{ :name => "Administration", :url => "/admin", { :name => "Administration", :url => "/admin",
:active => ["admin", "admin/users", "admin/ordergroups", "admin/workgroups"], :active => ["admin", "admin/users", "admin/ordergroups", "admin/workgroups"],
:access_denied? => (!u.role_admin?), :access_denied? => (!u.role_admin?),
:subnav => [ :subnav => [
{ :name => "Users", :url => admin_users_path }, { :name => "Benutzerinnen", :url => admin_users_path },
{ :name => "Ordergroups", :url => admin_ordergroups_path }, { :name => "Bestellgruppen", :url => admin_ordergroups_path },
{ :name => "Workgroups", :url => admin_workgroups_path } { :name => "Arbeitsgruppen", :url => admin_workgroups_path }
] ]
} }
] ]

View file

@ -0,0 +1,18 @@
- title "Passwort vergessen?"
- if flash[:error]
%p{:style => "color: red"}= flash[:error]
%p
Kein Problem, Du kannst dir einfach ein neues Passwort zulegen.
%p
Dazu musst hier die E-Mail-Adresse eingeben, mit der Du in der FoodSoft angemeldet bist.
Du erhälst dann eine E-Mail mit weiteren Instruktionen.
.edit_form{:style => "width:25em"}
- form_tag(:action => 'reset_passwort') do
%p
E-Mail:
%br/
= text_field 'login', 'email'
= submit_tag 'Neues Passwort anfordern'
|
= link_to 'Abbrechen', :action => 'login'

View file

@ -1,12 +0,0 @@
<% title _('Forgot password?') %>
<% if flash[:error] %>
<p style="color: red"><%= flash[:error] %></p><% end %>
<p><%= _('No problem: You can enter a new password here.') -%></p>
<p><%= _("Just enter your email address. Then you'll receive an email with the detailed instructions.") %></p>
<div class="edit_form" style="width:25em">
<% form_tag(:action => 'reset_password') do %>
<p><label for="user">Email</label><br/>
<%= text_field 'login', 'email' %></p>
<%= submit_tag _("Reset your password") %> | <%= link_to _("Back"), :action => 'login' %>
<% end %>
</div>

View file

@ -1,4 +1,5 @@
%h1=_ 'Login' - title "Login"
.edit_form{:style => "width:25em"} .edit_form{:style => "width:25em"}
- form_tag :action => 'login' do - form_tag :action => 'login' do
- if flash[:notice] - if flash[:notice]
@ -6,17 +7,17 @@
- if flash[:error] - if flash[:error]
%div.error= flash[:error] %div.error= flash[:error]
%p %p
%label{:for => 'user'}=_ 'Username' %label{:for => 'user'} Benutzerin
%br/ %br/
= text_field 'login', 'user' = text_field 'login', 'user'
%p %p
%label{:for => 'password'}=_ 'Password' %label{:for => 'password'} Passwort
%br/ %br/
= password_field 'login', 'password' = password_field 'login', 'password'
= submit_tag _('Login!') = submit_tag "Anmelden"
| |
= link_to _('Forgot Password?'), :action => 'forgot_password' = link_to "Passwort vergessen?", :action => 'forgot_password'
%br/ %br/
%br/ %br/
%i{:style => 'font-size:0.8em;'}=_ 'Cookies must be accepted!' %i{:style => 'font-size:0.8em;'} Kekse und Javascript müssen erlaubt sein!
= javascript_tag("$('login_user').focus()") = javascript_tag("$('login_user').focus()")

View file

@ -0,0 +1,17 @@
- title "Neues Passwort"
%p=h "Bitte neues Passwort für #{@user.nick} eingeben."
- if flash[:error]
%p{:style => "color: red"}= flash[:error]
.edit_form{:style => "width:25em"}
- form_tag(:action => 'new', :id => @user.id, :token => @user.reset_password_token) do
%p
Neues Passwort
%br/
= password_field_tag "user[password]"
%p
Passwort wiederholen
%br/
= password_field_tag "user[password_confirmation]"
= submit_tag 'Speichern'
|
= link_to 'abbrechen', :action => 'login'

View file

@ -1,11 +0,0 @@
<h1>Neues Passwort</h1>
<p>Bitte neues Passwort für <%=h @user.nick %> eingeben.</p>
<% if flash[:error] %><p style="color: red"><%= flash[:error] %></p><% end %>
<div class="edit_form" style="width:25em">
<% form_tag(:action => 'new', :id => @user.id, :token => @user.reset_password_token) do %>
<p><label for="user">Neues Passwort</label><br/>
<%= password_field_tag "user[password]" %></p>
<p><label for="user">Passwort wiederholen</label><br/>
<%= password_field_tag "user[password_confirmation]" %></p>
<%= submit_tag 'Speichern' %> | <%= link_to 'abbrechen', :action => 'login' %>
<% end %>

View file

@ -1,4 +1,4 @@
- @task.assignments.each do |ass| - @task.assignments.each do |ass|
= ass.user.nick = ass.user.nick
%small= link_to _('Remove'), {:action => "drop_assignment", :id => ass}, :confirm => 'Bist du sicher?', :method => "post" %small= link_to icon(:delete), {:action => "drop_assignment", :id => ass}, :confirm => 'Bist du sicher?', :method => "post"
%br/ %br/

View file

@ -1,37 +1,30 @@
= error_messages_for "task" = form.error_messages
%p %p
%label{:for => "task_name"} %b= form.label :name
%b=_ 'Subject'
%br/ %br/
= text_field :task, :name = form.text_field :name
%p %p
%label{:for => "task_description"} %b= form.label :description
%b=_ 'Description'
%br/ %br/
= text_area :task, :description, :cols => 50, :rows => 10 = form.text_area :description, :cols => 50, :rows => 10
%p %p
%label{:for => "task_user"} %b= form.label :user
%b=_ 'Responsible people'
%small=_ 'tasks can have multiple assignments' %small=_ 'tasks can have multiple assignments'
/%br/ /%br/
/= render :partial => "assignments" /= render :partial => "assignments"
%p %p
%small=_ 'use commas to seperate the names' %small=_ 'use commas to seperate the names'
%br/ %br/
/= text_field_with_auto_complete :user, :nick, {}, {:tokens => ","}
= text_field_with_auto_complete :task, :user_list, {}, {:tokens => ","} = text_field_with_auto_complete :task, :user_list, {}, {:tokens => ","}
%p %p
%label{:for => "task_required_users"} %b= form.label :required_users, "How many users are altogether required?"
%b= _("How many users are altogether required?")
%br/ %br/
= text_field :task, :required_users, :size => 3 = form.text_field :required_users, :size => 3
%p %p
%label{:for => "task_group"} %b= form.label :workgroup
%b=_ 'Group'
%br/ %br/
= select(:task, :group_id, Group.find(:all, :conditions => "type != 'Ordergroup'", :order => 'name').collect {|g| [ g.name, g.id ] }, { :include_blank => true }) = form.select :workgroup_id, Workgroup.all(:order => 'name').collect {|g| [ g.name, g.id ] }, { :include_blank => true }
%p %p
%label{:for => "task_due_date"} %b= form.label :due_date
%b=_ 'Due date'
%br/ %br/
= date_select :task, :due_date, :start_year => 2007, :include_blank => true = form.date_select :due_date, :start_year => 2007, :include_blank => true

View file

@ -1,12 +1,13 @@
%table %table
%tr %tr
%th= _('Due date') %th Fälligkeit
%th= _('Subject') %th Betreff
%th{:colspan => '2'} %th{:colspan => '2'}
= _('Who will make it?') Wer machts?
%small= "(" + _("How many are still required?") + ")" %small (Wie viele werden noch benötigt?)
- for task in @tasks - for task in @tasks
%tr{:class => cycle('even','odd', :name => "tasks") + (task.done ? " done" : "") } - done = task.done ? " done" : ""
%tr{:class => cycle('even','odd', :name => "tasks") + done }
%td= format_date(task.due_date) unless task.due_date.nil? %td= format_date(task.due_date) unless task.due_date.nil?
%td= link_to task.name, :controller => "tasks", :action => "show", :id => task %td= link_to task.name, :controller => "tasks", :action => "show", :id => task
%td %td
@ -22,11 +23,11 @@
= highlighted_required_users task = highlighted_required_users task
%td %td
- unless task.is_accepted?(@current_user) - unless task.is_accepted?(@current_user)
%span{:style => "float:left"}= button_to _('Accept task'), :controller => "tasks", :action => "accept", :id => task %span{:style => "float:left"}= button_to "Aufgabe übernehmen", :controller => "tasks", :action => "accept", :id => task
= button_to _("Reject task"), :controller => "tasks", :action => "reject", :id => task if task.is_assigned?(@current_user) = button_to "Aufgabe ablehnen", :controller => "tasks", :action => "reject", :id => task if task.is_assigned?(@current_user)
- else - else
- form_for :task, :url => {:action => "update_status", :id => task} do |f| - form_for :task, :url => {:action => "update_status", :id => task} do |f|
= _("Done") + "?" Erledigt?
= f.check_box :done, {:onchange => "submit()"} = f.check_box :done, {:onchange => "submit()", :title => "Die Aufgabe wandert in das Archiv"}
= _("Done") if task.done = "Erledigt" if task.done
- reset_cycle("tasks") - reset_cycle("tasks")

View file

@ -1,19 +1,19 @@
#start_nav{:style => "float:right"} #start_nav{:style => "float:right"}
%h2=_ 'TaskMenu' %h2 Aufgabenmenü
%ul %ul
%li %li
=_ 'Actions' Aktionen
%ul %ul
%li= link_to _('New task'), :action => "new" %li= link_to "Neue Aufgabe erstellen", :action => "new"
%li %li
=_ 'Pages' Seiten
%ul %ul
%li= link_to _('My tasks'), :action => "myTasks" %li= link_to "Meine Aufgaben", my_tasks_path
%li= link_to _('All tasks'), :action => "index" %li= link_to "Alle Aufgaben", :action => "index"
%li= link_to _('Tasks done'), :action => "archive" %li= link_to "Erledigt Aufgaben (Archiv)", :action => "archive"
%li %li
=_ 'Group tasks' Gruppenaufgaben
%ul %ul
- for group in Group.find :all, :conditions => "type != 'Ordergroup'" - for group in Workgroup.all
%li= link_to group.name, :action => "workgroup", :id => group %li= link_to group.name, :action => "workgroup", :id => group

View file

@ -1,11 +1,11 @@
- title _('Task archive') - title "Aufgabenarchiv"
= render :partial => "nav" = render :partial => "nav"
%table{:style => "width: 76%"} %table{:style => "width: 76%"}
%tr %tr
%th=_ 'Due date' %th Fälligkeitsdatum
%th=_ 'Subject' %th Betreff
%th=_ 'Responsible people' %th Verantwortliche Menschen
%th %th
- for task in @tasks - for task in @tasks
%tr{:class => cycle('even','odd')} %tr{:class => cycle('even','odd')}

View file

@ -1,12 +1,12 @@
- title _('Edit task') - title "Aufgabe bearbeiten"
#form{:style => "float:left; width:39em"} #form{:style => "float:left; width:39em"}
- form_tag :action => 'update', :id => @task do - form_for :task, @task, :url => {:action => 'update', :id => @task} do |form|
= render :partial => 'form' = render :partial => 'form', :locals => {:form => form}
= submit_tag _('Save changes') = submit_tag "Speichern"
| |
= link_to _('Cancel'), :action => "show", :id => @task = link_to "Abbrechen", :action => "show", :id => @task
#workgroup_members{:style => "padding-left:41em"} #workgroup_members{:style => "padding-left:41em"}
%h3=_ 'Members of the workgroups' %h3 Mitglieder der Gruppe
#list #list
= render :partial => "shared/workgroup_members" = render :partial => "shared/workgroup_members"

View file

@ -1,11 +1,11 @@
- title _('Arrange tasks') - title "Aufgabenübersicht"
= render :partial => "nav" = render :partial => "nav"
- unless @non_group_tasks.empty? - unless @non_group_tasks.empty?
.left_column{:style => "width:75%"} .left_column{:style => "width:75%"}
- @tasks = @non_group_tasks - @tasks = @non_group_tasks
.box_title .box_title
%h2=_ 'Tasks for all' %h2 Aufgaben für alle!
.column_content .column_content
= render :partial => "list" = render :partial => "list"

View file

@ -1,4 +1,4 @@
- title _("My tasks") - title "Meine Aufgaben"
= render :partial => "nav" = render :partial => "nav"
- @tasks = @unaccepted_tasks - @tasks = @unaccepted_tasks

View file

@ -1,11 +1,11 @@
- title _('Create new task') - title "Neue Aufgabe erstellen"
#form{:style => "float:left; width:39em"} #form{:style => "float:left; width:39em"}
- form_tag :action => 'create' do - form_for :task, @task, :url => {:action => 'create'} do |form|
= render :partial => 'form' = render :partial => 'form', :locals => {:form => form}
= submit_tag _('Create task') = submit_tag "Aufgabe erstellen"
#workgroup_members{:style => "padding-left:41em"} #workgroup_members{:style => "padding-left:41em"}
%h3=_ 'Members of the workgroups' %h3 Mitglieder der Gruppe
#list #list
= render :partial => "shared/workgroup_members" = render :partial => "shared/workgroup_members"

View file

@ -1,35 +1,35 @@
- title _('Task in detail') - title "Aufgabe im Detail"
= render :partial => "nav" = render :partial => "nav"
#task{:style => 'width:70%'} #task{:style => 'width:70%'}
%table %table
%tr %tr
%td{:style => "width: 10em"}= _'Name' %td{:style => "width: 10em"} Name
%td %td
%b= @task.name %b= @task.name
%tr %tr
%td{:style => "vertical-align:top;"}=_ 'Description' %td{:style => "vertical-align:top;"} Beschreibung
%td= simple_format(@task.description) %td= simple_format(@task.description)
%tr %tr
%td=_ 'Due date' %td Fälligkeitsdatum
%td= format_date(@task.due_date) %td= format_date(@task.due_date)
%tr %tr
%td=_ 'Responsible people' %td Verantwortliche Menschen
%td= render :partial => "assignments" %td= render :partial => "assignments"
%tr %tr
%td=_ 'Group' %td Arbeitsgruppe
%td %td
- if @task.workgroup - if @task.workgroup
= link_to @task.workgroup.name, :action => "workgroup", :id => @task.workgroup = link_to @task.workgroup.name, :action => "workgroup", :id => @task.workgroup
%tr %tr
%td{:colspan => "2"} %td{:colspan => "2"}
%div{:style => "float:left"}=_ 'Done' %div{:style => "float:left"} Als erledigt markieren
- form_for :task, :url => {:action => "update_status", :id => @task} do |f| - form_for :task, :url => {:action => "update_status", :id => @task} do |f|
= f.check_box :done, {:onchange => "submit()"} = f.check_box :done, {:onchange => "submit()", :title => "Die Aufgabe wandert in das Archiv"}
%p %p
= link_to _('Edit'), :action => "edit", :id => @task = link_to "Bearbeiten", :action => "edit", :id => @task
| |
= link_to _('Delete'), {:action => "destroy", :id => @task}, :method => "post", :confirm => _('Delete the task?') = link_to "Löschen", {:action => "destroy", :id => @task}, :method => "post", :confirm => "Die Aufgabe wirklich löschen?"

View file

@ -1,12 +1,12 @@
%h1 %h1
= _('Arrange tasks for') Aufgaben verwalten für
= @group.name = @group.name
= render :partial => "nav" = render :partial => "nav"
.left_column{:style => "width:45em"} .left_column{:style => "width:45em"}
.box_title .box_title
%h2 %h2
= _('Weekly tasks') + ':' Wöchentliche Aufgaben
= @group.task_name = @group.task_name
.column_content .column_content
- if @group.weekly_task - if @group.weekly_task
@ -45,7 +45,8 @@
%br/ %br/
- else - else
= _('No weekly tasks defined yet') = _('No weekly tasks defined yet')
= link_to _('Edit weekly tasks'), :controller => "index", :action => "editGroup", :id => @group - if @current_user.member_of?(@group) or @current_user.role_admin?
= link_to _('Edit weekly tasks'), :controller => "foodcoop", :action => "edit_group", :id => @group
.left_column{:style => "width:75%"} .left_column{:style => "width:75%"}
.box_title .box_title

141
capfile
View file

@ -1,141 +0,0 @@
role :libs, "root@webserver"
set :root_path, "/var/www/vhosts/foodcoops.net/railsapps/"
set :backup_path, "/var/www/vhosts/foodcoops.net/railsapps/backup/"
set :foodsoft_path, "/var/www/vhosts/foodcoops.net/railsapps/foodsoft/"
set :sandbox, {:subdomain => "sandbox"}
set :sharedLists,
{
:subdomain => "/var/www/vhosts/foodcoops.net/railsapps/sharedLists/",
:db_user => "fcnet_shared",
:db_name => "fcnet_shared",
:db_pwd => "dhj450lw"
}
set :foodcoops, [
{
:subdomain => "sandbox",
:db_user => "fs2_sandbox",
:db_name => "fs2_sandbox",
:db_pwd => "gruenbarsch"},
{
:subdomain => "fcschinke09",
:db_user => "fs2_fcschinke09",
:db_name => "fs2_fcschinke09",
:db_pwd => "gruenbarsch"},
{
:subdomain => "fc-fruchtzwerge",
:db_user => "fs2_fruchtzwerge",
:db_name => "fs2_fruchtzwerge",
:db_pwd => "fruchtblub234"},
{
:subdomain => "fcnova",
:db_user => "fs2_fcnova",
:db_name => "fs2_fcnova",
:db_pwd => "suppenkueche2"},
{
:subdomain => "mosa",
:db_user => "fs2_mosa",
:db_name => "fs2_mosa",
:db_pwd => "skh489ndp"},
{
:subdomain => "mainz",
:db_user => "fs2_mainz",
:db_name => "fs2_mainz",
:db_pwd => "sdfh2987s2m"},
{
:subdomain => "bioparadeis",
:db_user => "fs2_bioparadeis",
:db_name => "fs2_bioparadeis",
:db_pwd => "sdfh4872bs00"},
{
:subdomain => "fcduncker",
:db_user => "fs2_fcduncker",
:db_name => "fs2_fcduncker",
:db_pwd => "sdf89gh3"},
{
:subdomain => "leipzig",
:db_user => "fs2_leipzig",
:db_name => "fs2_leipzig",
:db_pwd => "dfh2098q1hja"},
{
:subdomain => "fcfutterneid",
:db_user => "fs2_fcfutterneid",
:db_name => "fs2_fcfutterneid",
:db_pwd => "lreiugh277ah2l"}
]
desc "backup code and databases"
task :backup do
run "tar cfz #{backup_path}foodsoft.tar.gz #{foodsoft_path}" #code-backup
for fc in foodcoops
# backup db and compress
run "mysqldump -u #{fc[:db_user]} --password=#{fc[:db_pwd]} #{fc[:db_name]} | gzip > #{backup_path + fc[:subdomain]}/#{fc[:subdomain]}_#{Time.now.strftime('%Y-%m-%d_%H:%M')}.sql.gz"
end
end
desc "backup code and databases, updates foodsoft-code, runs migrations for every foodcoop-db, restart passenger"
task :update_and_migrate do
run "tar cfz #{backup_path}foodsoft.tar.gz #{foodsoft_path}" #code-backup
run "svn up #{foodsoft_path}" # code-update
for fc in foodcoops
# backup db and compress
run "mysqldump -u #{fc[:db_user]} --password=#{fc[:db_pwd]} #{fc[:db_name]} | gzip > #{backup_path + fc[:subdomain]}/#{fc[:subdomain]}_#{Time.now.strftime('%Y-%m-%d_%H:%M')}.sql.gz"
# migrations
run "cd #{foodsoft_path} && rake db:migrate RAILS_ENV=#{fc[:subdomain]}"
end
run "touch #{foodsoft_path}tmp/restart.txt"
run "chown -R www-data:www-data #{foodsoft_path}app"
end
desc "backup and update code, restart passenger"
task :update do
#run "tar cfz #{backup_path}foodsoft.tar.gz #{foodsoft_path}" #code-backup
run "svn up #{foodsoft_path}" # code-update
for fc in foodcoops
# backup db and compress
run "mysqldump -u #{fc[:db_user]} --password=#{fc[:db_pwd]} #{fc[:db_name]} | gzip > #{backup_path + fc[:subdomain]}/#{fc[:subdomain]}_#{Time.now.strftime('%Y-%m-%d_%H:%M')}.sql.gz"
end
run "touch #{foodsoft_path}tmp/restart.txt"
run "chown -R www-data:www-data #{foodsoft_path}app"
end
desc "only update, no backups -> use for small! fixes"
task :only_update do
run "svn up #{foodsoft_path}" # code-update
run "touch #{foodsoft_path}tmp/restart.txt"
run "chown -R www-data:www-data #{foodsoft_path}app"
end
desc "sharedLists: backup, update, migration, restart server"
task :update_sharedLists do
end
desc "create fcschinke09 database dump, download and fills up the development db"
task :dump do
run "mysqldump -u #{foodcoops[1][:db_user]} --password=#{foodcoops[1][:db_pwd]} #{foodcoops[1][:db_name]} | gzip > #{backup_path + foodcoops[1][:subdomain]}/fcschinke09_tmp.sql.gz"
puts "download mysqldump"
puts `scp server:"#{backup_path + foodcoops[1][:subdomain]}"/fcschinke09_tmp.sql.gz ../`
puts "load dump into database"
puts `gunzip ../fcschinke09_tmp.sql.gz`
puts `mysql -u root foodsoft_development < ../fcschinke09_tmp.sql`
end
desc "dump databases to backup-dir"
task :dump_to_backup do
for fc in foodcoops
run "mysqldump -u #{fc[:db_user]} --password=#{fc[:db_pwd]} #{fc[:db_name]} | gzip > #{backup_path}/#{fc[:subdomain]}.sql.gz"
end
end
desc "load last mysql-dumps in backup-path"
task :load_dumps do
for fc in foodcoops
run "gunzip -c #{backup_path}/#{fc[:subdomain]}.sql.gz | mysql -u #{fc[:db_user]} --password=#{fc[:db_pwd]} #{fc[:db_name]}"
end
end