Merge branch 'master' of /Users/jackie/Sites/tracks_svn into svn-tracking

Up to r881

* 'master' of /Users/jackie/Sites/tracks_svn: (22 commits)
  Added .gitconfig
  Added yaml_db plugin: http://opensource.heroku.com/
  applied patch from Eric from #732
  fixes #730 restores ability to delete user from user management page
  fixes #724 where editing todos truncates the project name of the todo when the project name contains quotes (")
  Applied patch from Eric Pallen whcih automatically converts url's to links. Thanks Eric!
  explain that yaml cannot yet be used for backup as importing is not implemented yet. from mailinglist.
  hopefully fixes #727.Changes the check on running animation to finished animation
  regenerate compressed js and cleanup whitespace
  turns out that getElementsByClassName is removed from prototype and it therfore falls back to the function of the browser which has different semantics. Found here http://www.prototypejs.org/api/utility/getElementsByClassName
  forgot to create a new compressed js from the previous js changes
  in the stats page you can downdrill to see the active todos in a certain week from the running time charts. This patch adds the option to see all active todos from the selected week and older.
  fix #727. Adds a check to prevent expand/collapse while a previous expand/collaps is still animating
  fixed small problem where updating a todo from mobile resulted in an error becase source_view was nil
  fixes #726. Thanks Eric Pallen for the fix. The mobile view showed active todos from completed projects while the home page does not.
  merges changes from tracks1.6 to trunk
  prepares trunk for 1.6 release
  fixes #713. Adds behavior for edit/star/delete/check buttons of todo even if there is no todo to show. This makes sure that the behaviors are present when you add a new todo through AJAX.
  fixes #718. The link included the number of actions which resulted from last commit
  removed some more whitespace to reduce the download of the mobile view.
  ...
This commit is contained in:
bsag 2008-06-15 09:50:05 +01:00
commit 0380d1b15a
49 changed files with 1870 additions and 1338 deletions

4
.gitconfig Normal file
View file

@ -0,0 +1,4 @@
db/data.yml
config/database.yml
config/environment.yml
log

View file

@ -7,10 +7,12 @@
* Mailing list: http://lists.rousette.org.uk/mailman/listinfo/tracks-discuss
* Original developer: bsag (http://www.rousette.org.uk/)
* Contributors: http://dev.rousette.org.uk/wiki/Tracks/Contributing/Contributors
* Version: 1.5
* Copyright: (cc) 2004-2006 rousette.org.uk.
* Version: 1.6
* Copyright: (cc) 2004-2008 rousette.org.uk.
* License: GNU GPL
**An important note for version 1.6: OpenID support is broken in this release. The fix isn't trivial because of changes to the `ruby-openid` gem, so we wanted to get this version out now and fix OpenID for the next release. If you depend on OpenID integration, we recommend waiting until the next release.**
All the documentation for Tracks can be found within the /doc directory. It contains a manual in HTML (manual.html) or PDF format (manual.pdf), and this includes full instructions for both new installations and upgrades from older installations of Tracks. The instructions might appear long and intimidatingly complex, but that is mostly because of the number of different platforms supported, and the different configurations which can be used (e.g. running Tracks on your local computer or on a remote server). If you choose the appropriate section for your situation (installation vs. upgrade), and use the easiest (recommended) method, you should find the instructions easy to follow. If you encounter problems, try searching the wiki, forum or mailing list (URLs above), and ask a question if you cannot find a solution to your problem.
For those upgrading, change notes are available in /doc/CHANGELOG. If you are thinking about contributing towards the development of Tracks, please read /doc/README_DEVELOPERS for general information, or /doc/tracks_api_wrapper.rb for information on Tracks' API.

View file

@ -481,8 +481,10 @@ class StatsController < ApplicationController
@chart_name = "actions_visible_running_time_data"
@page_title = "Actions selected from week "
@further = false
if params['id'] == 'avrt_end'
@page_title += week_from.to_s + " and further"
@further = true
else
@page_title += week_from.to_s + " - " + week_to.to_s + ""
end
@ -512,8 +514,10 @@ class StatsController < ApplicationController
@chart_name = "actions_running_time_data"
@page_title = "Actions selected from week "
@further = false
if params['id'] == 'art_end'
@page_title += week_from.to_s + " and further"
@further = true
else
@page_title += week_from.to_s + " - " + week_to.to_s + ""
end

View file

@ -154,6 +154,7 @@ class TodosController < ApplicationController
end
def update
@source_view = params['_source_view'] || 'todo'
init_data_for_sidebar unless mobile?
@todo.tag_with(params[:tag_list], current_user) if params[:tag_list]
@original_item_context_id = @todo.context_id
@ -461,7 +462,11 @@ class TodosController < ApplicationController
@todos = Todo.find(:all, :conditions => ['todos.user_id = ?', current_user.id], :include => [ :project, :context, :tags ])
# Exclude hidden projects from the home page
@not_done_todos = Todo.find(:all, :conditions => ['todos.user_id = ? AND contexts.hide = ? AND (projects.state = ? OR todos.project_id IS NULL)', current_user.id, false, 'active'], :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC", :include => [ :project, :context, :tags ])
@not_done_todos = Todo.find(:all,
:conditions => ['todos.user_id = ? AND contexts.hide = ? AND (projects.state = ? OR todos.project_id IS NULL)',
current_user.id, false, 'active'],
:order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC",
:include => [ :project, :context, :tags ])
end
end
@ -475,8 +480,8 @@ class TodosController < ApplicationController
# Exclude hidden projects from the home page
@not_done_todos = Todo.find(:all,
:conditions => ['todos.user_id = ? AND todos.state = ? AND contexts.hide = ?',
current_user.id, 'active', false],
:conditions => ['todos.user_id = ? AND todos.state = ? AND contexts.hide = ? AND (projects.state = ? OR todos.project_id IS NULL)',
current_user.id, 'active', false, 'active'],
:order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC",
:include => [ :project, :context ])
end

View file

@ -116,7 +116,7 @@ class UsersController < ApplicationController
# DELETE /users/somelogin
# DELETE /users/somelogin.xml
def destroy
@deleted_user = User.find_by_id(params[:id])
@deleted_user = User.find_by_login(params[:id])
@saved = @deleted_user.destroy
@total_users = User.find(:all).size

View file

@ -22,55 +22,71 @@ module TodosHelper
:prevent_default => true
end
def remote_delete_icon
def set_behavior_for_delete_icon
parameters = "_source_view=#{@source_view}"
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
str = link_to( image_tag_for_delete,
todo_path(@todo), :id => "delete_icon_"+@todo.id.to_s,
:class => "icon delete_icon", :title => "delete the action '#{@todo.description}'")
apply_behavior '.item-container a.delete_icon:click', :prevent_default => true do |page|
page.confirming "'Are you sure that you want to ' + this.title + '?'" do
page << "itemContainer = this.up('.item-container'); itemContainer.startWaiting();"
page << remote_to_href(:method => 'delete', :with => "'#{parameters}'", :complete => "itemContainer.stopWaiting();")
end
end
end
def remote_delete_icon
str = link_to( image_tag_for_delete,
todo_path(@todo), :id => "delete_icon_"+@todo.id.to_s,
:class => "icon delete_icon", :title => "delete the action '#{@todo.description}'")
set_behavior_for_delete_icon
str
end
def set_behavior_for_star_icon
apply_behavior '.item-container a.star_item:click',
remote_to_href(:method => 'put', :with => "{ _source_view : '#{@source_view}' }"),
:prevent_default => true
end
def remote_star_icon
str = link_to( image_tag_for_star(@todo),
toggle_star_todo_path(@todo),
:class => "icon star_item", :title => "star the action '#{@todo.description}'")
apply_behavior '.item-container a.star_item:click',
remote_to_href(:method => 'put', :with => "{ _source_view : '#{@source_view}' }"),
:prevent_default => true
set_behavior_for_star_icon
str
end
def remote_edit_icon
def set_behavior_for_edit_icon
parameters = "_source_view=#{@source_view}"
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
if !@todo.completed?
str = link_to( image_tag_for_edit,
edit_todo_path(@todo),
:class => "icon edit_icon")
apply_behavior '.item-container a.edit_icon:click', :prevent_default => true do |page|
page << "Effect.Pulsate(this);"
page << remote_to_href(:method => 'get', :with => "'#{parameters}'")
end
end
def remote_edit_icon
if !@todo.completed?
str = link_to( image_tag_for_edit,
edit_todo_path(@todo),
:class => "icon edit_icon")
set_behavior_for_edit_icon
else
str = '<a class="icon">' + image_tag("blank.png") + "</a> "
end
str
end
def remote_toggle_checkbox
str = check_box_tag('item_id', toggle_check_todo_path(@todo), @todo.completed?, :class => 'item-checkbox')
def set_behavior_for_toggle_checkbox
parameters = "_source_view=#{@source_view}"
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
apply_behavior '.item-container input.item-checkbox:click',
remote_function(:url => javascript_variable('this.value'), :method => 'put',
:with => "'#{parameters}'")
end
def remote_toggle_checkbox
str = check_box_tag('item_id', toggle_check_todo_path(@todo), @todo.completed?, :class => 'item-checkbox')
set_behavior_for_toggle_checkbox
str
end

View file

@ -4,7 +4,9 @@
<% if collapsible -%>
<a href="#" class="container_toggle" id="toggle_c<%= context.id %>"><%= image_tag("collapse.png") %></a>
<% apply_behavior '.container_toggle:click', :prevent_default => true do |page|
page << "containerElem = this.up('.container')
page << " /* only handle the click if a previous click had finished its animation */
if (todoItems.lastEffect == null || todoItems.lastEffect.state=='finished') {
containerElem = this.up('.container')
toggleTarget = containerElem.down('.toggle_target')
if (Element.visible(toggleTarget))
{
@ -16,6 +18,7 @@
todoItems.expandNextActionListing(this, toggleTarget);
todoItems.contextCollapseCookieManager.clearCookie(todoItems.buildCookieName(containerElem))
}
}
"
end
%>
@ -32,5 +35,13 @@
<div class="message"><p>Currently there are no incomplete actions in this context</p></div>
</div>
<%= render :partial => "todos/todo", :collection => @not_done, :locals => { :parent_container_type => "context" } %>
<% if @not_done.empty?
# fix (hack) for #713
set_behavior_for_delete_icon
set_behavior_for_star_icon
set_behavior_for_edit_icon
set_behavior_for_toggle_checkbox
end
-%>
</div><!-- [end:items] -->
</div><!-- [end:c<%= context.id %>] -->

View file

@ -4,11 +4,11 @@
if not @not_done.empty?
# only show a context when there are actions in it
%>
-%>
<h2><%=mobile_context.name%></h2>
<table cellpadding="0" cellspacing="0" border="0">
<%= render :partial => "todos/mobile_todo",
:collection => @not_done,
:locals => { :parent_container_type => "context" }%>
:locals => { :parent_container_type => "context" }-%>
</table>
<% end -%>

View file

@ -1,2 +1,2 @@
<% context = mobile_context_listing %>
<% context = mobile_context_listing -%>
<div id="ctx"><%= link_to context.name, formatted_context_path(context, :m) %><%= " (" + count_undone_todos_phrase(context,"actions") + ")" %></div>

View file

@ -1,6 +1,2 @@
<h2>Visible Contexts</h2>
<%= render :partial => 'mobile_context_listing', :collection => @active_contexts%>
<h2>Hidden Contexts</h2>
<%= render :partial => 'mobile_context_listing', :collection => @hidden_contexts %>
<h2>Visible Contexts</h2><%= render :partial => 'mobile_context_listing', :collection => @active_contexts %>
<h2>Hidden Contexts</h2><%= render :partial => 'mobile_context_listing', :collection => @hidden_contexts %>

View file

@ -3,10 +3,10 @@
<h3>Exporting data</h3>
<p>You can choose between the following formats:</p>
<ul>
<li><strong>YAML: </strong>Best for porting data between Tracks installations</li>
<li><strong>YAML: </strong>Best for exporting data. <br/><i>Please note that Tracks currently does not support importing YAML files. Do not use this (yet) to backup your Tracks database.</i></li>
<li><strong>CSV: </strong>Best for importing into spreadsheet or data analysis software</li>
<li><strong>XML: </strong>Best for importing or repurposing the data</li>
</ul
</ul>
</div>
<p>

View file

@ -1,50 +1,32 @@
<ul>
<li>
<%= rss_formatted_link({ :controller => 'todos', :action => 'index', :limit => 15 }) %>
<%= text_formatted_link({ :controller => 'todos', :action => 'index', :limit => 15 }) %>
<%= ical_formatted_link({ :controller => 'todos', :action => 'index', :limit => 15 }) %>
Last 15 actions
</li>
<li>
<%= rss_formatted_link( { :controller => 'todos', :action => 'index' } ) %>
<%= text_formatted_link( { :controller => 'todos', :action => 'index' } ) %>
<%= ical_formatted_link( { :controller => 'todos', :action => 'index' } ) %>
All actions
</li>
<li>
<%= rss_formatted_link({ :controller => 'todos', :action => 'index', :due => 0 }) %>
<%= text_formatted_link({ :controller => 'todos', :action => 'index', :due => 0 }) %>
<%= ical_formatted_link({ :controller => 'todos', :action => 'index', :due => 0 }) %>
Actions due today or earlier
</li>
<li>
<%= rss_formatted_link({ :controller => 'todos', :action => 'index', :due => 6 }) %>
<%= text_formatted_link({ :controller => 'todos', :action => 'index', :due => 6 }) %>
<%= ical_formatted_link({ :controller => 'todos', :action => 'index', :due => 6 }) %>
Actions due in 7 days or earlier
</li>
<li>
<%= rss_formatted_link({ :controller => 'todos', :action => 'index', :done => 7 }) %>
<%= text_formatted_link({ :controller => 'todos', :action => 'index', :done => 7 }) %>
Actions completed in the last 7 days
</li>
<li>
<%= rss_formatted_link({:controller => 'contexts', :action => 'index'}) %>
<%= text_formatted_link({:controller => 'contexts', :action => 'index'}) %>
All Contexts
</li>
<li>
<%= rss_formatted_link({:controller => 'projects', :action => 'index'}) %>
<%= text_formatted_link({:controller => 'projects', :action => 'index'}) %>
All Projects
</li>
<li>
<%= rss_formatted_link({:controller => 'projects', :action => 'index', :only_active_with_no_next_actions => true}) %>
<li><%= rss_formatted_link({ :controller => 'todos', :action => 'index', :limit => 15 }) -%>
<%= text_formatted_link({ :controller => 'todos', :action => 'index', :limit => 15 }) -%>
<%= ical_formatted_link({ :controller => 'todos', :action => 'index', :limit => 15 }) -%>
Last 15 actions</li>
<li><%= rss_formatted_link( { :controller => 'todos', :action => 'index' } ) -%>
<%= text_formatted_link( { :controller => 'todos', :action => 'index' } ) -%>
<%= ical_formatted_link( { :controller => 'todos', :action => 'index' } ) -%>
All actions</li>
<li><%= rss_formatted_link({ :controller => 'todos', :action => 'index', :due => 0 }) -%>
<%= text_formatted_link({ :controller => 'todos', :action => 'index', :due => 0 }) -%>
<%= ical_formatted_link({ :controller => 'todos', :action => 'index', :due => 0 }) -%>
Actions due today or earlier</li>
<li><%= rss_formatted_link({ :controller => 'todos', :action => 'index', :due => 6 }) -%>
<%= text_formatted_link({ :controller => 'todos', :action => 'index', :due => 6 }) -%>
<%= ical_formatted_link({ :controller => 'todos', :action => 'index', :due => 6 }) -%>
Actions due in 7 days or earlier</li>
<li><%= rss_formatted_link({ :controller => 'todos', :action => 'index', :done => 7 }) -%>
<%= text_formatted_link({ :controller => 'todos', :action => 'index', :done => 7 }) -%>
Actions completed in the last 7 days</li>
<li><%= rss_formatted_link({:controller => 'contexts', :action => 'index'}) -%>
<%= text_formatted_link({:controller => 'contexts', :action => 'index'}) -%>
All Contexts</li>
<li><%= rss_formatted_link({:controller => 'projects', :action => 'index'}) -%>
<%= text_formatted_link({:controller => 'projects', :action => 'index'}) -%>
All Projects</li>
<li><%= rss_formatted_link({:controller => 'projects', :action => 'index', :only_active_with_no_next_actions => true}) %>
<%= text_formatted_link({:controller => 'projects', :action => 'index', :only_active_with_no_next_actions => true}) %>
Active projects with no next actions
</li>
<li>
<%= text_formatted_link({:controller => 'projects', :action => 'index', :projects_and_actions => true}) %>
Active projects with no next actions</li>
<li><%= text_formatted_link({:controller => 'projects', :action => 'index', :projects_and_actions => true}) %>
Active projects with their actions
</li>
</ul>
</li></ul>

View file

@ -5,33 +5,28 @@
<meta name="viewport" content="initial-scale = 1.0" />
<%= stylesheet_link_tag "mobile"%>
<title><%= @page_title %></title>
</head>
<body>
</head><body>
<% if !(@new_mobile || @edit_mobile)
if !@prefs.nil? %>
if !@prefs.nil? -%>
<h1><span class="count"><%= @down_count %></span> <%=
user_time.strftime(@prefs.title_date_format) %></h1>
user_time.strftime(@prefs.title_date_format) -%></h1>
<%= (link_to("Add new action", formatted_new_todo_path(:m))+" | ") unless @new_mobile -%>
<%= (link_to("Home", formatted_todos_path(:m))+" | ") unless @home -%>
<%= (link_to("Contexts", formatted_contexts_path(:m))+" | ") %>
<%= (link_to("Projects", formatted_projects_path(:m))+" | ") %>
<%= (link_to("Contexts", formatted_contexts_path(:m))+" | ") -%>
<%= (link_to("Projects", formatted_projects_path(:m))+" | ") -%>
<%= (link_to("Starred", {:action => "tag", :controller => "todos", :id => "starred.m"})) -%>
<% end
end %>
<%= render_flash -%>
<hr/>
<%= yield %>
<hr/>
<% if !@prefs.nil? %>
<%= link_to "Logout", formatted_logout_path(:format => 'm') %> |
end -%><%= render_flash -%>
<hr/><%= yield -%>
<hr/><% if !@prefs.nil? -%>
<%= (link_to("Logout", formatted_logout_path(:format => 'm')) +" | ") -%>
<%= (link_to("Add new action", formatted_new_todo_path(:m))+" | ") unless @new_mobile -%>
<%= (link_to("Home", formatted_todos_path(:m))+" | ") unless @home -%>
<%= (link_to("Contexts", formatted_contexts_path(:m))+" | ") %>
<%= (link_to("Projects", formatted_projects_path(:m))+" | ") %>
<%= (link_to("Contexts", formatted_contexts_path(:m))+" | ") -%>
<%= (link_to("Projects", formatted_projects_path(:m))+" | ") -%>
<%= (link_to("Starred", {:action => "tag", :controller => "todos", :id => "starred.m"})+" | ") -%>
<%= (link_to("Tickler", {:action => "index", :controller => "tickler.m"})+" | ") -%>
<%= (link_to("Feeds", {:action => "index", :controller => "feeds.m"})) %>
<% end %>
<%= render :partial => "shared/mobile_footer" %>
</body>
</html>
<%= (link_to("Feeds", {:action => "index", :controller => "feeds.m"})) -%>
<% end -%>
<%= render :partial => "shared/mobile_footer" -%>
</body></html>

View file

@ -41,7 +41,6 @@ window.onload=function(){
end
-%>&nbsp;|&nbsp;
<%= link_to "Logout (#{current_user.display_name}) »", logout_path %>
<% end %>
</div>
<div id="navcontainer">

View file

@ -2,7 +2,7 @@
<div id="<%= dom_id(note, 'container') %>">
<h2><%= link_to("Note #{note.id}", note_path(note), :title => "Show note #{note.id}" ) %></h2>
<div id="<%= dom_id(note) %>">
<%= sanitize(textilize(note.body)) %>
<%= sanitize(textilize(note.body.gsub(/((https?:\/\/[^ \n\t]*))/, '"\1":\2'))) %>
<div class="note_footer">
<%= link_to_remote(

View file

@ -1,2 +1,4 @@
<% project = mobile_project_listing %>
<div id="pjr"><%= link_to project.name, formatted_project_path(project) %><%= " (" + count_undone_todos_and_notes_phrase(project,"actions") + ")" %></div>
<% project = mobile_project_listing -%>
<div id="pjr"><%=
link_to(project.name, formatted_project_path(project)) +
" (" + count_undone_todos_and_notes_phrase(project,"actions") + ")" %></div>

View file

@ -22,5 +22,13 @@
<div class="message"><p>Currently there are no incomplete actions in this project</p></div>
</div>
<%= render :partial => "todos/todo", :collection => @not_done, :locals => { :parent_container_type => "project" } %>
<% if @not_done.empty?
# fix (hack) for #713
set_behavior_for_delete_icon
set_behavior_for_star_icon
set_behavior_for_edit_icon
set_behavior_for_toggle_checkbox
end
-%>
</div><!-- [end:items] -->
</div><!-- [end:p<%= project.id %>] -->

View file

@ -1,8 +1,6 @@
<h2>Active projects</h2>
<%= render :partial => 'mobile_project_listing', :collection => @active_projects%>
<h2>Hidden projects</h2>
<%= render :partial => 'mobile_project_listing', :collection => @hidden_projects %>
<h2>Completed projects</h2>
<%= render :partial => 'mobile_project_listing', :collection => @completed_projects %>
<h2>Active projects</h2><%=
render :partial => 'mobile_project_listing', :collection => @active_projects%>
<h2>Hidden projects</h2><%=
render :partial => 'mobile_project_listing', :collection => @hidden_projects %>
<h2>Completed projects</h2><%=
render :partial => 'mobile_project_listing', :collection => @completed_projects %>

View file

@ -1,11 +1,9 @@
<div id="message_holder">
<% if flash.empty? %>
<% if flash.empty? -%>
<h4 id="flash" class="alert" style="display:none"></h4>
<% else %>
<% else -%>
<% flash.each do |key,value| -%>
<h4 id="flash" class='alert <%= key %>'>
<%= value %>
</h4>
<h4 id="flash" class='alert <%= key %>'><%= value %></h4>
<% end -%>
<% end -%>
<% end %>
</div>

View file

@ -1,3 +1 @@
<div class="footer">
<p>Mobile Tracks <%= TRACKS_VERSION %>: <a href="mailto:butshesagirl@rousette.org.uk?subject=Tracks feedback">Email</a> | <a href="http://www.rousette.org.uk/projects/">Website</a> | <a href="http://www.rousette.org.uk/projects/tracks/contribute">Contribute</a></p>
</div>
<div class="footer"><p>Mobile Tracks <%= TRACKS_VERSION %>: <a href="mailto:butshesagirl@rousette.org.uk?subject=Tracks feedback">Email</a> | <a href="http://www.rousette.org.uk/projects/">Website</a> | <a href="http://www.rousette.org.uk/projects/tracks/contribute">Contribute</a></p></div>

View file

@ -1,18 +1,18 @@
<%= render :partial => 'chart', :locals => {:width => @chart_width, :height => @chart_height, :data => url_for(:action => @chart_name)} -%>
<br/>
<p>Click on a bar in the chart to update the actions below. Click <%=link_to "here", {:controller => "stats", :action => "index"} %> to return to the statistics page</p>
<p>Click on a bar in the chart to update the actions below. Click <%=link_to "here", {:controller => "stats", :action => "index"} %> to return to the statistics page. <%
unless @further -%> <%=
"Click " +
link_to("here", {:controller => "stats", :action => "show_selected_actions_from_chart", :id=>"#{params[:id]}_end", :index => params[:index]})+
" to show the actions from week " + params[:index] + " and further." -%>
<% end %></p>
<br/>
<div class="container tickler" id="tickler_container">
<h2>
<%= @page_title -%>
</h2>
<h2><%= @page_title -%></h2>
<div id="tickler" class="items toggle_target">
<div id="tickler-empty-nd" style="display:<%= @selected_actions.empty? ? 'block' : 'none'%>;">
<div class="message"><p>There are no actions selected</p></div>
</div>
<%= render :partial => "todos/todo", :collection => @selected_actions, :locals => { :parent_container_type => 'stats' } %>
</div>
</div>

View file

@ -11,7 +11,7 @@
<div class="project_input">
<label for="<%= dom_id(@todo, 'project_name') %>">Project</label>
<input id="<%= dom_id(@todo, 'project_name') %>" name="project_name" autocomplete="off" tabindex="10" size="30" type="text" value="<%= @todo.project.nil? ? 'None' : @todo.project.name %>" />
<input id="<%= dom_id(@todo, 'project_name') %>" name="project_name" autocomplete="off" tabindex="10" size="30" type="text" value="<%= @todo.project.nil? ? 'None' : @todo.project.name.gsub(/"/,"&quot;") %>" />
<div class="page_name_auto_complete" id="<%= dom_id(@todo, 'project_list') %>" style="display:none"></div>
<script type="text/javascript">

View file

@ -1,5 +1,5 @@
<% if @not_done_todos.empty? -%>
<p>There are no incomplete actions</p>
<% else -%>
<%= render :partial => "contexts/mobile_context", :collection => @contexts_to_show %>
<%= render :partial => "contexts/mobile_context", :collection => @contexts_to_show -%>
<% end -%>

View file

@ -5,24 +5,22 @@ else
bullet = "<span class=r>&raquo;&nbsp;</span>"
end -%>
<div class="t" id="<%= dom_id(mobile_todo) %>">
<tr valign="top"><td><%= bullet %></td><td>
<% if mobile_todo.completed? -%>
<span class="m_t_d">
<% else -%>
<span class="m_t">
<tr valign="top"><td><%= bullet %></td><td><%
if mobile_todo.completed?
-%><span class="m_t_d">
<% else
-%><span class="m_t">
<% end -%>
<%= date_span -%>
<%= link_to mobile_todo.description, formatted_todo_path(mobile_todo, :m) %>
<%= date_span -%> <%= link_to mobile_todo.description, formatted_todo_path(mobile_todo, :m) -%>
<% if parent_container_type == 'context' or parent_container_type == 'tag' -%>
<%= "<span class=prj> (" +
link_to(mobile_todo.project.name, formatted_project_path(mobile_todo.project, :m)) +
")</span>" unless mobile_todo.project.nil? %>
")</span>" unless mobile_todo.project.nil? -%>
<% end
if parent_container_type == 'project' or parent_container_type == 'tag' -%>
<%= "<span class=ctx> (" +
link_to(mobile_todo.context.name, formatted_context_path(mobile_todo.context, :m)) +
")</span>" %>
")</span>" -%>
<% end -%>
<%= tag_list_mobile %>
</span>
</td></tr></div>
<%= tag_list_mobile -%>
</span></td></tr></div>

View file

@ -1,8 +1,7 @@
<%= link_to(image_tag( 'blank.png', :width=>'16', :height=>'16', :border=>'0' ), "#", {:class => 'show_notes', :title => 'Show notes'}) %>
<% apply_behavior 'a.show_notes:click', :prevent_default => true do |page, element|
element.next('.todo_notes').toggle
end
-%>
end -%>
<div class="todo_notes" id="<%= dom_id(item, 'notes') %>" style="display:none">
<%= markdown( item.notes ) %>
<%= markdown( item.notes.gsub(/((https?:\/\/[^ \n\t]*))/, '"\1":\2') ) %>
</div>

View file

@ -1 +1 @@
<%= render :partial => 'mobile_actions' %>
<%= render :partial => 'mobile_actions' -%>

View file

@ -1,6 +1,5 @@
<% if @count == 0 -%>
<div class="message"><p>Currently there are no deferred actions.</p></div>
<% end -%>
<%= render :partial => "contexts/mobile_context", :collection => @contexts,
:locals => { :collapsible => true } %>
:locals => { :collapsible => true } -%>

View file

@ -1,28 +1,25 @@
<div id="display_box">
<div class="container context" <%= "style=\"display:none\"" unless @not_done_todos.empty? %>>
<h2>
No actions found
</h2>
<div class="message"><p>Currently there are no incomplete actions with the tag '<%= @tag_name %>'</p></div>
<% if @not_done_todos.empty? -%>
<div class="container context">
<h2>No actions found</h2>
<div class="message">Currently there are no incomplete actions with the tag '<%= @tag_name %>'</div>
</div>
<%= render :partial => "contexts/mobile_context", :collection => @contexts_to_show %>
<% end -%>
<%= render :partial => "contexts/mobile_context", :collection => @contexts_to_show -%>
<h2>Deferred actions with the tag <%= @tag_name %></h2>
<% unless (@deferred.nil? or @deferred.size == 0) -%>
<table cellpadding="0" cellspacing="0" border="0">
<%= render :partial => "todos/mobile_todo", :collection => @deferred, :locals => { :parent_container_type => "tag" } %>
<%= render :partial => "todos/mobile_todo", :collection => @deferred, :locals => { :parent_container_type => "tag" } -%>
</table>
<% else %>
<% else -%>
No deferred actions with the tag <%= @tag_name %>
<% end -%>
<h2>Completed actions with the tag <%= @tag_name %></h2>
<% unless (@done.nil? or @done.size == 0) -%>
<table cellpadding="0" cellspacing="0" border="0">
<%= render :partial => "todos/mobile_todo", :collection => @done, :locals => { :parent_container_type => "tag" } %>
</table>
<% else %>
<% else -%>
No completed actions with the tag <%= @tag_name %>
<% end -%>
</div><!-- End of display_box -->
</div>

View file

@ -98,10 +98,4 @@ end
MOBILE_CONTENT_TYPE = 'tracks/mobile'
Mime::Type.register(MOBILE_CONTENT_TYPE, :m)
tracks_version = '1.6-trunk'
info = `svn info #{RAILS_ROOT} --config-dir /etc/subversion`[/Last Changed Rev: (.*?)\n/]
if info
tracks_version += '-rev'+info[/(\d+)/]
end
TRACKS_VERSION=tracks_version
TRACKS_VERSION='1.6'

View file

@ -12,16 +12,16 @@
ActiveRecord::Schema.define(:version => 38) do
create_table "contexts", :force => true do |t|
t.string "name", :default => "", :null => false
t.integer "position"
t.string "name", :null => false
t.integer "position", :limit => 255, :default => 0
t.boolean "hide", :default => false
t.integer "user_id", :default => 1
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "contexts", ["user_id"], :name => "index_contexts_on_user_id"
add_index "contexts", ["user_id", "name"], :name => "index_contexts_on_user_id_and_name"
add_index "contexts", ["user_id"], :name => "index_contexts_on_user_id"
create_table "notes", :force => true do |t|
t.integer "user_id", :null => false
@ -31,8 +31,8 @@ ActiveRecord::Schema.define(:version => 38) do
t.datetime "updated_at"
end
add_index "notes", ["project_id"], :name => "index_notes_on_project_id"
add_index "notes", ["user_id"], :name => "index_notes_on_user_id"
add_index "notes", ["project_id"], :name => "index_notes_on_project_id"
create_table "open_id_associations", :force => true do |t|
t.binary "server_url"
@ -75,8 +75,8 @@ ActiveRecord::Schema.define(:version => 38) do
add_index "preferences", ["user_id"], :name => "index_preferences_on_user_id"
create_table "projects", :force => true do |t|
t.string "name", :default => "", :null => false
t.integer "position"
t.string "name", :null => false
t.integer "position", :limit => 255, :default => 0
t.integer "user_id", :default => 1
t.text "description"
t.string "state", :limit => 20, :default => "active", :null => false
@ -86,8 +86,8 @@ ActiveRecord::Schema.define(:version => 38) do
t.datetime "completed_at"
end
add_index "projects", ["user_id"], :name => "index_projects_on_user_id"
add_index "projects", ["user_id", "name"], :name => "index_projects_on_user_id_and_name"
add_index "projects", ["user_id"], :name => "index_projects_on_user_id"
create_table "sessions", :force => true do |t|
t.string "session_id"
@ -95,7 +95,7 @@ ActiveRecord::Schema.define(:version => 38) do
t.datetime "updated_at"
end
add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
add_index "sessions", ["session_id"], :name => "sessions_session_id_index"
create_table "taggings", :force => true do |t|
t.integer "taggable_id"
@ -117,7 +117,7 @@ ActiveRecord::Schema.define(:version => 38) do
create_table "todos", :force => true do |t|
t.integer "context_id", :null => false
t.integer "project_id"
t.string "description", :default => "", :null => false
t.string "description", :null => false
t.text "notes"
t.datetime "created_at"
t.date "due"
@ -127,15 +127,15 @@ ActiveRecord::Schema.define(:version => 38) do
t.string "state", :limit => 20, :default => "immediate", :null => false
end
add_index "todos", ["user_id", "state"], :name => "index_todos_on_user_id_and_state"
add_index "todos", ["user_id", "project_id"], :name => "index_todos_on_user_id_and_project_id"
add_index "todos", ["project_id"], :name => "index_todos_on_project_id"
add_index "todos", ["context_id"], :name => "index_todos_on_context_id"
add_index "todos", ["user_id", "context_id"], :name => "index_todos_on_user_id_and_context_id"
add_index "todos", ["context_id"], :name => "index_todos_on_context_id"
add_index "todos", ["project_id"], :name => "index_todos_on_project_id"
add_index "todos", ["user_id", "project_id"], :name => "index_todos_on_user_id_and_project_id"
add_index "todos", ["user_id", "state"], :name => "index_todos_on_user_id_and_state"
create_table "users", :force => true do |t|
t.string "login", :limit => 80, :default => "", :null => false
t.string "crypted_password", :limit => 40
t.string "login", :limit => 80, :null => false
t.string "crypted_password", :limit => 40, :null => false
t.string "token"
t.boolean "is_admin", :default => false, :null => false
t.string "first_name"

View file

@ -2,8 +2,8 @@
* Homepage: http://www.rousette.org.uk/projects/
* Author: bsag (http://www.rousette.org.uk/)
* Contributors: Nicholas Lee, Lolindrath, Jim Ray, Arnaud Limbourg, Timothy Martens, Luke Melia, John Leonard, Jim Strupp, Eric Lesh, Damien Cirotteau, Janet Riley, Reinier Balt, Jacqui Maher, James Kebinger
* Version: 1.5rc1
* Contributors: Nicholas Lee, Lolindrath, Jim Ray, Arnaud Limbourg, Timothy Martens, Luke Melia, John Leonard, Jim Strupp, Eric Lesh, Damien Cirotteau, Janet Riley, Reinier Balt, Jacqui Maher, James Kebinger, Jeffrey Gipson
* Version: 1.6
* Copyright: (cc) 2004-2008 rousette.org.uk
* License: GNU GPL
@ -13,7 +13,13 @@ Trac (for bug reports and feature requests): http://dev.rousette.org.uk/report/6
Wiki (deprecated - please use Trac): http://www.rousette.org.uk/projects/wiki/
== Version 1.5rc1
== Version 1.6
1. upgrade to rails 2.0.2
2. new mobile interface (with some iPhone compatibility fixes)
3. new search functionality to search on todos, projects, contexts and notes
4. Bugfixes
== Version 1.5
1. Show from date allows you to postpone the appearance of actions in the list until you can do something about them (like a 'tickler')
2. Tagging of actions
3. Simple management of users (deleting users through the web interface)

View file

@ -1,4 +1,8 @@
1. SQLITE3 FOR TESTING
1. Wiki
There are some pointers for setting up your Tracks copy for testing at http://dev.rousette.org.uk/wiki/Tracks/Testing
2. SQLITE3 FOR TESTING
By default, tests are configured to run using sqlite3 in memory mode to increase speed. You will need the sqlite3-ruby gem for this.
@ -8,7 +12,7 @@ To avoid showing the migrations as tests are run, add the following to your data
If you want to run tests using another database, that's fine, too. Just change your database.yml accordingly.
2. SELENIUM TESTS
3. SELENIUM TESTS
To run selenium tests, start Tracks in test mode using

View file

@ -14,22 +14,24 @@ http://creativecommons.org/licenses/by-nc-sa/3.0/" />
<meta name="Date" content="2008-04-07" />
<meta name="Format" content="complete" />
<meta name="LaTeXXSLT" content="memoir-twosided-manual.xslt" />
<meta name="Revision" content="$Id: manual.markdown 811 2008-04-07 20:21:00Z bsag $" />
<title>Tracks 1.5 Manual</title>
<meta name="Version" content="1.5" />
<meta name="Revision" content="$Id: manual.markdown 864 2008-06-03 17:01:00Z bsag $" />
<title>Tracks 1.6 Manual</title>
<meta name="Version" content="1.6" />
<meta name="XMP" content="CCAttributionShareAlike" />
</head>
<body>
<!-- The HTML file manual.html is generated from manual.markdown, so make edits to the *.markdown file -->
<h2 id="installingtracks1.5">Installing Tracks 1.5</h2>
<h2 id="installingtracks1.6">Installing Tracks 1.6</h2>
<h3 id="introduction">Introduction</h3>
<p>Tracks 1.5 has been thoroughly beta tested by a large number of people, and should be fully stable for everyday use. However, once set up, Tracks will contain the majority of your plans for your work and personal life, so it&#8217;s only sensible to make sure that you have frequent, reliable backups of your data. Full changenotes on the release can be found in <code>doc/CHANGELOG</code>. Full API documentation can be found at <code>doc/app/index.html</code>, once you have run <code>rake appdoc</code></p>
<p><strong>An important note for version 1.6: OpenID support is broken in this release. The fix isn&#8217;t trivial because of changes to the <code>ruby-openid</code> gem, so we wanted to get this version out now and fix OpenID for the next release. If you depend on OpenID integration, we recommend waiting until the next release.</strong></p>
<p>There are two methods of downloading Tracks 1.5 <strong>(N.B. These links will not work until Tracks 1.5 final is released)</strong>):</p>
<p>Tracks 1.6 has been thoroughly beta tested by a large number of people, and should be fully stable for everyday use. However, once set up, Tracks will contain the majority of your plans for your work and personal life, so it&#8217;s only sensible to make sure that you have frequent, reliable backups of your data. Full changenotes on the release can be found in <code>doc/CHANGELOG</code>. Full API documentation can be found at <code>doc/app/index.html</code>, once you have run <code>rake appdoc</code></p>
<p>There are two methods of downloading Tracks 1.6:</p>
<ol>
<li>(Recommended for most people) Download the <a href="http://www.rousette.org.uk/projects/files/tracks-current.zip">zipped package</a>, and unzip in your preferred location (e.g. <code>~/Sites</code> for Mac OS X users).</li>
@ -59,7 +61,7 @@ http://creativecommons.org/licenses/by-nc-sa/3.0/" />
<ol>
<li>Tracks itself</li>
<li>Rails 1.2.5 (installed in the <code>/vendor/rails</code> directory, so you do not need to install Rails yourself)</li>
<li>Rails 2.0.2 (installed in the <code>/vendor/rails</code> directory, so you do not need to install Rails yourself)</li>
<li>An empty SQLite3 database, set up with the correct database schema</li>
</ol>
@ -73,11 +75,11 @@ http://creativecommons.org/licenses/by-nc-sa/3.0/" />
<li><strong>Database</strong>. The easiest option is to use SQLite3, as the database is included in the package. All you need then is the <code>sqlite3-ruby</code> gem, as described in step 2, and the SQLite3 libraries and binary (see <a href="http://sqlite.org/download.html">sqlite.org</a> for downloads and installation instructions). If you want to use MySQL, download and install a package for your platform from <a href="http://dev.mysql.com/downloads/mysql/5.0.html">MySQL.com</a>. The basic steps for Postgresql should be similar to those for MySQL, but they will not be discussed further here.</li>
</ol>
<p>If you are using Unix, you might find <a href="http://www.cooldown.com.ar/2006/12/16/install-tracks-on-ubuntu-or-debian/">this guide</a> by c00i90wn helpful. It was written for Tracks 1.043, but it should work for Tracks 1.5.</p>
<p>If you are using Unix, you might find <a href="http://www.cooldown.com.ar/2006/12/16/install-tracks-on-ubuntu-or-debian/">this guide</a> by c00i90wn helpful. It was written for Tracks 1.043, but it should work for Tracks 1.6.</p>
<h3 id="installation">Installation</h3>
<p>This description is intended for people installing Tracks from scratch. If you would like to upgrade an existing installation, please see <a href="#upgrading" title="Upgrading to Tracks 1.5">Upgrading to Tracks 1.5</a>.</p>
<p>This description is intended for people installing Tracks from scratch. If you would like to upgrade an existing installation, please see <a href="#upgrading" title="Upgrading to Tracks 1.6">Upgrading to Tracks 1.6</a>.</p>
<ol>
<li><a href="#unzip_install" title="Unzip Tracks and install">Unzip tracks</a> and install in a directory</li>
@ -85,7 +87,7 @@ http://creativecommons.org/licenses/by-nc-sa/3.0/" />
<ol><li>SQLite3 - change database.yml to point to SQLite3 database</li>
<li>MySQL - create new MySQL db and grant all privileges </li></ol></li>
<li><a href="#config_install" title="Configure variables">Configure some variables</a></li>
<li>Populate the database with the <a href="#rake_install" title="Populate your database with the Tracks 1.5 schema">Tracks 1.5 schema</a></li>
<li>Populate the database with the <a href="#rake_install" title="Populate your database with the Tracks 1.6 schema">Tracks 1.6 schema</a></li>
<li><a href="#startserver_install" title="Start the server">Start the server</a></li>
<li><a href="#signup_install" title="Visit Tracks in a browser">Visit Tracks in a browser</a></li>
<li><a href="#customise_install" title="Customise Tracks">Customise Tracks</a></li>
@ -101,7 +103,7 @@ http://creativecommons.org/licenses/by-nc-sa/3.0/" />
<ol>
<li><strong>SQLite3</strong>. All you need to do is make sure that you point Tracks to the included SQLite3 database in <code>/db</code> in the next step, <a href="#config_install" title="Configure variables">Configure variables</a>.</li>
<li><strong>MySQL</strong>. Once you have MySQL installed, you need to create a database to use with Tracks 1.5. Go into a terminal and issue the following commands:</li>
<li><strong>MySQL</strong>. Once you have MySQL installed, you need to create a database to use with Tracks 1.6. Go into a terminal and issue the following commands:</li>
</ol>
<pre>
@ -116,23 +118,23 @@ http://creativecommons.org/licenses/by-nc-sa/3.0/" />
<h4 id="config_install">Configure variables</h4>
<ol>
<li>If you downloaded Tracks 1.5 via Subversion, you need to duplicate the files <code>database.yml.tmpl</code> and <code>environment.yml.tmpl</code> and remove the <code>*.tmpl</code> extension from the duplicates. Similarly, duplicate <code>/log.tmpl</code> and remove the <code>*.tmpl</code> extension, then edit the files as described in steps 2 and 3.</li>
<li>If you downloaded Tracks 1.6 via Subversion, you need to duplicate the files <code>database.yml.tmpl</code> and <code>environment.yml.tmpl</code> and remove the <code>*.tmpl</code> extension from the duplicates. Similarly, duplicate <code>/log.tmpl</code> and remove the <code>*.tmpl</code> extension, then edit the files as described in steps 2 and 3.</li>
<li>Open the file <code>/config/database.yml</code> and edit the <code>production:</code> section with the details of your database. If you are using MySQL the <code>adapter:</code> line should read <code>adapter: mysql</code>, <code>host: localhost</code> (in the majority of cases), and your username and password should match those you assigned when you created the database. If you are using SQLite3, you should have only two lines under the production section: <code>adapter: sqlite3</code> and <code>database: db/tracks-15-blank.db</code>. If you downloaded the zipped file, the database.yml file is already configured to use the provided SQLite3 file.</li>
<li>Open the file <code>/config/environment.rb</code>, and read through the settings to make sure that they suit your setup. In most cases, all you need to change is the <code>SALT = "change-me"</code> line (change the string &#8220;change-me&#8221; to some other string of your choice), and the time zone setting.</li>
<li>If you are using Windows, you may need to check the &#8216;shebang&#8217; lines (<code>#!/usr/bin/env ruby</code>) of the <code>/public/dispatch.*</code> files and all the files in the <code>/script</code> directory. They are set to <code>#!/usr/bin/env ruby</code> by default. This should work for all *nix based setups (Linux or Mac OS X), but Windows users will probably have to change it to something like <code>#c:/ruby/bin/ruby</code> to point to the Ruby binary on your system.</li>
</ol>
<h4 id="rake_install">Populate your database with the Tracks 1.5 schema</h4>
<h4 id="rake_install">Populate your database with the Tracks 1.6 schema</h4>
<p>Open a terminal and change into the root of your Tracks 1.5 directory. Enter the following command:</p>
<p>Open a terminal and change into the root of your Tracks 1.6 directory. Enter the following command:</p>
<p><code>rake db:migrate RAILS_ENV=production</code></p>
<p>This will update your database with the required schema for Tracks 1.5. If you are using SQLite3, it is not strictly necessary, because the SQLite3 database included with Tracks already has the schema included in it, but it should not do any harm to run the command (nothing will happen if it is up to date).</p>
<p>This will update your database with the required schema for Tracks 1.6. If you are using SQLite3, it is not strictly necessary, because the SQLite3 database included with Tracks already has the schema included in it, but it should not do any harm to run the command (nothing will happen if it is up to date).</p>
<h4 id="startserver_install">Start the server</h4>
<p>While still in the Terminal inside the Tracks 1.5 root directory, issue the following command:</p>
<p>While still in the Terminal inside the Tracks 1.6 root directory, issue the following command:</p>
<p><code>script/server -e production</code></p>
@ -146,7 +148,19 @@ http://creativecommons.org/licenses/by-nc-sa/3.0/" />
<p>Once logged in, add some Contexts and Projects, and then go ahead and add your actions. You might also want to visit the Preferences page to edit various settings to your liking. Have fun!</p>
<h2 id="upgrading">Upgrading to Tracks 1.5</h2>
<h2 id="upgrading">Upgrading to Tracks 1.6</h2>
<h3 id="upgrading_1.5">Upgrading from Tracks 1.5</h3>
<p>There are no changes to the database between 1.5 and 1.6, but you will need to upgrade your <code>config/environment.rb</code> with the new content from <code>config/environment.rb.tmpl</code> included in 1.6, as the format of this file has changed a great deal between 1.5 and 1.6.</p>
<ol>
<li><a href="#backup_upgrade" title="Backing up">Back up</a> your existing database and installation of Tracks</li>
<li><a href="#install_upgrade" title="Install Tracks 1.6">Install Tracks 1.6</a> in a new directory</li>
<li><a href="#config_upgrade" title="Copy over old configuration files">Copy over</a> a few configuration files from your Tracks 1.043 directory. If using SQLite3, copy the old database into the new Tracks 1.6 directory</li>
<li>Run <code>script/server</code> inside your Tracks 1.6 directory to <a href="#startserver_upgrade" title="Start the server">start up Tracks 1.6</a>.</li>
<li>Once you are happy that everything is working well, <a href="#cleanup_upgrade" title="Clean up your old installation">delete your old Tracks directory</a>.</li>
</ol>
<h3 id="upgrading_1043">Upgrading from Tracks 1.043</h3>
@ -154,10 +168,10 @@ http://creativecommons.org/licenses/by-nc-sa/3.0/" />
<ol>
<li><a href="#backup_upgrade" title="Backing up">Back up</a> your existing database and installation of Tracks</li>
<li><a href="#install_upgrade" title="Install Tracks 1.5">Install Tracks 1.5</a> in a new directory</li>
<li><a href="#config_upgrade" title="Copy over old configuration files">Copy over</a> a few configuration files from your Tracks 1.043 directory. If using SQLite3, copy the old database into the new Tracks 1.5 directory</li>
<li><a href="#install_upgrade" title="Install Tracks 1.6">Install Tracks 1.6</a> in a new directory</li>
<li><a href="#config_upgrade" title="Copy over old configuration files">Copy over</a> a few configuration files from your Tracks 1.043 directory. If using SQLite3, copy the old database into the new Tracks 1.6 directory</li>
<li>Run <code>rake db:migrate RAILS_ENV=production</code> to <a href="#rake_upgrade" title="Update your old database to the new format">update your old database</a> to the new schema &#8211; you did back up your database didn&#8217;t you?</li>
<li>Run <code>script/server</code> inside your Tracks 1.5 directory to <a href="#startserver_upgrade" title="Start the server">start up Tracks 1.5</a>.</li>
<li>Run <code>script/server</code> inside your Tracks 1.6 directory to <a href="#startserver_upgrade" title="Start the server">start up Tracks 1.6</a>.</li>
<li>Once you are happy that everything is working well, <a href="#cleanup_upgrade" title="Clean up your old installation">delete your old Tracks directory</a>.</li>
</ol>
@ -167,11 +181,11 @@ http://creativecommons.org/licenses/by-nc-sa/3.0/" />
<p><code>mysqldump -user [user name] -password=[password] [database name] &gt; [dump file]</code></p>
<p>Rename your old Tracks installation (e.g. to &#8216;tracks-old&#8217;) so that you can install Tracks 1.5 along side it.</p>
<p>Rename your old Tracks installation (e.g. to &#8216;tracks-old&#8217;) so that you can install Tracks 1.6 along side it.</p>
<h4 id="install_upgrade">Install Tracks 1.5</h4>
<h4 id="install_upgrade">Install Tracks 1.6</h4>
<p>There are two methods of downloading Tracks 1.5:</p>
<p>There are two methods of downloading Tracks 1.6:</p>
<ol>
<li>(Recommended for most people) Download the <a href="http://www.rousette.org.uk/projects/files/tracks-current.zip">zipped package</a>, and unzip in your preferred location (e.g. <code>~/Sites</code> for Mac OS X users).</li>
@ -191,7 +205,7 @@ http://creativecommons.org/licenses/by-nc-sa/3.0/" />
<ol>
<li>Copy <code>/config/database.yml</code> from your old Tracks directory to the same location in the new one. Double check that the information there is still correct.</li>
<li>Duplicate <code>/config/environment.rb.tmpl</code> in the Tracks 1.5 directory, and rename the file to <code>environment.rb</code>. Open the file and alter the line <code>SALT = "change-me"</code> so that it matches what you had in this file in your old installation. You may also want to change the time zone setting as appropriate for your location (<code>ENV['TZ'] = 'US/Eastern'</code>). If you have made any other customisations to <code>environment.rb</code> in the past, copy those over, but the contents of the file have changed quite a lot since 1.043, so check it carefully.</li>
<li>Duplicate <code>/config/environment.rb.tmpl</code> in the Tracks 1.6 directory, and rename the file to <code>environment.rb</code>. Open the file and alter the line <code>SALT = "change-me"</code> so that it matches what you had in this file in your old installation. You may also want to change the time zone setting as appropriate for your location (<code>ENV['TZ'] = 'US/Eastern'</code>). If you have made any other customisations to <code>environment.rb</code> in the past, copy those over, but the contents of the file have changed quite a lot since 1.043, so check it carefully.</li>
<li>Copy your <code>/log</code> directory over from your old installation to the root of the new one, or just rename <code>/log.tmpl</code> to <code>log</code> to start afresh.</li>
<li>If you are using SQLite3, copy your database from <code>/db</code> in your old Tracks directory to the same location in the new one.</li>
<li>If you are using Windows, you may need to check the &#8216;shebang&#8217; lines (<code>#!/usr/bin/env ruby</code>)<a href="#fn:env" id="fnref:env" class="footnote">1</a> of the <code>/public/dispatch.*</code> files and all the files in the <code>/script</code> directory. They are set to <code>#!/usr/bin/env ruby</code> by default. Check the format of those lines in your old installation, and change the new ones as necessary.</li>
@ -199,7 +213,7 @@ http://creativecommons.org/licenses/by-nc-sa/3.0/" />
<h4 id="rake_upgrade">Update your old database to the new format</h4>
<p>In a terminal, change directories so that you are inside the Tracks 1.5 directory. Then issue the command to update your Tracks 1.043 database to the format required for Tracks 1.5:</p>
<p>In a terminal, change directories so that you are inside the Tracks 1.6 directory. Then issue the command to update your Tracks 1.043 database to the format required for Tracks 1.6:</p>
<p><code>rake db:migrate RAILS_ENV=production</code></p>
@ -207,7 +221,7 @@ http://creativecommons.org/licenses/by-nc-sa/3.0/" />
<h4 id="startserver_upgrade">Start the server</h4>
<p>If you&#8217;re still in the Tracks 1.5 root directory in a terminal, enter the following command to start up Tracks in production mode:</p>
<p>If you&#8217;re still in the Tracks 1.6 root directory in a terminal, enter the following command to start up Tracks in production mode:</p>
<p><code>script/server -e production</code></p>
@ -216,7 +230,7 @@ http://creativecommons.org/licenses/by-nc-sa/3.0/" />
<h4 id="cleanup_upgrade">Clean up your old installation</h4>
<p>Once you&#8217;re certain that your new Tracks 1.5 installation is working perfectly, you can delete your old Tracks directory.</p>
<p>Once you&#8217;re certain that your new Tracks 1.6 installation is working perfectly, you can delete your old Tracks directory.</p>
<h3 id="upgradingfromversionspriorto1.043">Upgrading from versions prior to 1.043</h3>
@ -234,7 +248,7 @@ http://creativecommons.org/licenses/by-nc-sa/3.0/" />
<li>Run the command <code>rake db_schema_import</code> inside the Tracks directory. This should import the upgraded schema for 1.043 into your new database.</li>
<li>Run the command <code>rake load_exported_fixtures</code> which will import the contents of your old database from the fixtures files in <code>db/exported_fixtures</code>.</li>
<li>If you are using Windows, you may need to check the &#8216;shebang&#8217; lines (<code>#!/usr/bin/env ruby</code>)<a href="#fn:env" id="fnref:env" class="footnote">2</a> of the <code>/public/dispatch.*</code> files and all the files in the <code>/script</code> directory. They are set to <code>#!/usr/bin/env ruby</code> by default. Check the format of those lines in your old installation, and change the new ones as necessary.</li>
<li>Try starting up the server with <code>script/server</code> to make sure that all your data has migrated successfully. If all is well, follow the instructions above to <a href="#upgrading_1043" title="Upgrading from Tracks 1.043">upgrade from version 1.043</a> to Tracks 1.5. If you need to access Tracks from a mobile/cellular phone browser, visit <code>http://yourdomain.com/mobile/</code>. This mobile version is a special, lightweight version of Tracks, designed to use on a mobile browser.</li>
<li>Try starting up the server with <code>script/server</code> to make sure that all your data has migrated successfully. If all is well, follow the instructions above to <a href="#upgrading_1043" title="Upgrading from Tracks 1.043">upgrade from version 1.043</a> to Tracks 1.6. If you need to access Tracks from a mobile/cellular phone browser, visit <code>http://yourdomain.com/mobile/</code>. This mobile version is a special, lightweight version of Tracks, designed to use on a mobile browser.</li>
</ol>
<div class="footnotes">

View file

@ -1,8 +1,8 @@
Title: Tracks 1.5 Manual
Title: Tracks 1.6 Manual
Author: Tracks Development Team
Date: 2008-04-07
Revision: $Id: manual.markdown 811 2008-04-07 20:21:00Z bsag $
Version: 1.5
Revision: $Id: manual.markdown 864 2008-06-03 17:01:00Z bsag $
Version: 1.6
Copyright: 2008 rousette.org.uk
This work is licensed under a Creative Commons License.
http://creativecommons.org/licenses/by-nc-sa/3.0/
@ -14,13 +14,15 @@ CSS: manual.css
<!-- The HTML file manual.html is generated from manual.markdown, so make edits to the *.markdown file -->
# Installing Tracks 1.5 #
# Installing Tracks 1.6 #
## Introduction ##
Tracks 1.5 has been thoroughly beta tested by a large number of people, and should be fully stable for everyday use. However, once set up, Tracks will contain the majority of your plans for your work and personal life, so it's only sensible to make sure that you have frequent, reliable backups of your data. Full changenotes on the release can be found in `doc/CHANGELOG`. Full API documentation can be found at `doc/app/index.html`, once you have run `rake appdoc`
**An important note for version 1.6: OpenID support is broken in this release. The fix isn't trivial because of changes to the `ruby-openid` gem, so we wanted to get this version out now and fix OpenID for the next release. If you depend on OpenID integration, we recommend waiting until the next release.**
There are two methods of downloading Tracks 1.5 **(N.B. These links will not work until Tracks 1.5 final is released)**):
Tracks 1.6 has been thoroughly beta tested by a large number of people, and should be fully stable for everyday use. However, once set up, Tracks will contain the majority of your plans for your work and personal life, so it's only sensible to make sure that you have frequent, reliable backups of your data. Full changenotes on the release can be found in `doc/CHANGELOG`. Full API documentation can be found at `doc/app/index.html`, once you have run `rake appdoc`
There are two methods of downloading Tracks 1.6:
1. (Recommended for most people) Download the [zipped package](http://www.rousette.org.uk/projects/files/tracks-current.zip), and unzip in your preferred location (e.g. `~/Sites` for Mac OS X users).
2. Download using Subversion:
@ -46,7 +48,7 @@ If you'd like an easy way to access Tracks from any internet-connected computer,
### What is included with the Tracks package ###
1. Tracks itself
2. Rails 1.2.5 (installed in the `/vendor/rails` directory, so you do not need to install Rails yourself)
2. Rails 2.0.2 (installed in the `/vendor/rails` directory, so you do not need to install Rails yourself)
3. An empty SQLite3 database, set up with the correct database schema
### What you need to install [whatyouneed] ###
@ -57,18 +59,18 @@ If you don't want to (or can't) use one of the all in one installations, you'll
2. **RubyGems**. The gems needed by Rails to interact with the database have to be compiled on the platform on which they will be run, so we cannot include them with the Tracks package, unlike some other gems. So you will need to [download](http://rubyforge.org/frs/?group_id=126) and install RubyGems (run `ruby setup.rb` after extracting the package). Note that once again, Mac OS X Leopard users get an easy life, because RubyGems and the SQLite3 gem is already installed. Once installed you can use RubyGems to install the gems you need for your database. If you are using SQLite3, run `sudo gem install sqlite3-ruby`, then select the appropriate package for your platform (version 1.2.1 recommended). You can use MySQL without installing a gem, but installing the gem can speed things up a bit: `sudo install gem mysql`. If you're using Leopard, there are a few work-arounds necessary, which are explained on [Mac OS Forge](http://trac.macosforge.org/projects/ruby/wiki/Troubleshooting#IcannotbuildrubymysqlonLeopardwithmysql.combinaries). The ruby-mysql bindings can sometimes be a bit troublesome to install, so to be honest, it's probably not worth the bother unless you are trying to wring maximum speed out of your system. If you are using PostgreSQL, then you can install a postgres gem: `gem install postgres`.
3. **Database**. The easiest option is to use SQLite3, as the database is included in the package. All you need then is the `sqlite3-ruby` gem, as described in step 2, and the SQLite3 libraries and binary (see [sqlite.org](http://sqlite.org/download.html) for downloads and installation instructions). If you want to use MySQL, download and install a package for your platform from [MySQL.com](http://dev.mysql.com/downloads/mysql/5.0.html). The basic steps for Postgresql should be similar to those for MySQL, but they will not be discussed further here.
If you are using Unix, you might find [this guide](http://www.cooldown.com.ar/2006/12/16/install-tracks-on-ubuntu-or-debian/) by c00i90wn helpful. It was written for Tracks 1.043, but it should work for Tracks 1.5.
If you are using Unix, you might find [this guide](http://www.cooldown.com.ar/2006/12/16/install-tracks-on-ubuntu-or-debian/) by c00i90wn helpful. It was written for Tracks 1.043, but it should work for Tracks 1.6.
## Installation ##
This description is intended for people installing Tracks from scratch. If you would like to upgrade an existing installation, please see [Upgrading to Tracks 1.5][upgrading].
This description is intended for people installing Tracks from scratch. If you would like to upgrade an existing installation, please see [Upgrading to Tracks 1.6][upgrading].
1. [Unzip tracks][unzip_install] and install in a directory
2. Decide on a [database][database_install] to use
1. SQLite3 - change database.yml to point to SQLite3 database
2. MySQL - create new MySQL db and grant all privileges
3. [Configure some variables][config_install]
4. Populate the database with the [Tracks 1.5 schema][rake_install]
4. Populate the database with the [Tracks 1.6 schema][rake_install]
5. [Start the server][startserver_install]
6. [Visit Tracks in a browser][signup_install]
7. [Customise Tracks][customise_install]
@ -82,7 +84,7 @@ Unzip the package and move Tracks into the directory you want to run it from. Fo
Before you go any further, you need to decide which database you will use. See the [What you need to install][whatyouneed] section for details on installing the required components for you choice of database.
1. **SQLite3**. All you need to do is make sure that you point Tracks to the included SQLite3 database in `/db` in the next step, [Configure variables][config_install].
2. **MySQL**. Once you have MySQL installed, you need to create a database to use with Tracks 1.5. Go into a terminal and issue the following commands:
2. **MySQL**. Once you have MySQL installed, you need to create a database to use with Tracks 1.6. Go into a terminal and issue the following commands:
<pre>
<code>
mysql -uroot -p
@ -94,22 +96,22 @@ Before you go any further, you need to decide which database you will use. See t
### Configure variables [config_install] ###
1. If you downloaded Tracks 1.5 via Subversion, you need to duplicate the files `database.yml.tmpl` and `environment.yml.tmpl` and remove the `*.tmpl` extension from the duplicates. Similarly, duplicate `/log.tmpl` and remove the `*.tmpl` extension, then edit the files as described in steps 2 and 3.
1. If you downloaded Tracks 1.6 via Subversion, you need to duplicate the files `database.yml.tmpl` and `environment.yml.tmpl` and remove the `*.tmpl` extension from the duplicates. Similarly, duplicate `/log.tmpl` and remove the `*.tmpl` extension, then edit the files as described in steps 2 and 3.
2. Open the file `/config/database.yml` and edit the `production:` section with the details of your database. If you are using MySQL the `adapter:` line should read `adapter: mysql`, `host: localhost` (in the majority of cases), and your username and password should match those you assigned when you created the database. If you are using SQLite3, you should have only two lines under the production section: `adapter: sqlite3` and `database: db/tracks-15-blank.db`. If you downloaded the zipped file, the database.yml file is already configured to use the provided SQLite3 file.
3. Open the file `/config/environment.rb`, and read through the settings to make sure that they suit your setup. In most cases, all you need to change is the `SALT = "change-me"` line (change the string "change-me" to some other string of your choice), and the time zone setting.
4. If you are using Windows, you may need to check the 'shebang' lines (`#!/usr/bin/env ruby`) of the `/public/dispatch.*` files and all the files in the `/script` directory. They are set to `#!/usr/bin/env ruby` by default. This should work for all *nix based setups (Linux or Mac OS X), but Windows users will probably have to change it to something like `#c:/ruby/bin/ruby` to point to the Ruby binary on your system.
### Populate your database with the Tracks 1.5 schema [rake_install] ###
### Populate your database with the Tracks 1.6 schema [rake_install] ###
Open a terminal and change into the root of your Tracks 1.5 directory. Enter the following command:
Open a terminal and change into the root of your Tracks 1.6 directory. Enter the following command:
`rake db:migrate RAILS_ENV=production`
This will update your database with the required schema for Tracks 1.5. If you are using SQLite3, it is not strictly necessary, because the SQLite3 database included with Tracks already has the schema included in it, but it should not do any harm to run the command (nothing will happen if it is up to date).
This will update your database with the required schema for Tracks 1.6. If you are using SQLite3, it is not strictly necessary, because the SQLite3 database included with Tracks already has the schema included in it, but it should not do any harm to run the command (nothing will happen if it is up to date).
### Start the server [startserver_install] ###
While still in the Terminal inside the Tracks 1.5 root directory, issue the following command:
While still in the Terminal inside the Tracks 1.6 root directory, issue the following command:
`script/server -e production`
@ -123,17 +125,28 @@ Visit `http://0.0.0.0:3000/signup` in a browser (or whatever URL and port was re
Once logged in, add some Contexts and Projects, and then go ahead and add your actions. You might also want to visit the Preferences page to edit various settings to your liking. Have fun!
# Upgrading to Tracks 1.5 [upgrading] #
# Upgrading to Tracks 1.6 [upgrading] #
## Upgrading from Tracks 1.5 [upgrading_1.5] ##
There are no changes to the database between 1.5 and 1.6, but you will need to upgrade your `config/environment.rb` with the new content from `config/environment.rb.tmpl` included in 1.6, as the format of this file has changed a great deal between 1.5 and 1.6.
1. [Back up][backup_upgrade] your existing database and installation of Tracks
2. [Install Tracks 1.6][install_upgrade] in a new directory
3. [Copy over][config_upgrade] a few configuration files from your Tracks 1.043 directory. If using SQLite3, copy the old database into the new Tracks 1.6 directory
4. Run `script/server` inside your Tracks 1.6 directory to [start up Tracks 1.6][startserver_upgrade].
5. Once you are happy that everything is working well, [delete your old Tracks directory][cleanup_upgrade].
## Upgrading from Tracks 1.043 [upgrading_1043] ##
This should be a relatively straightforward, and involves the following main steps:
1. [Back up][backup_upgrade] your existing database and installation of Tracks
2. [Install Tracks 1.5][install_upgrade] in a new directory
3. [Copy over][config_upgrade] a few configuration files from your Tracks 1.043 directory. If using SQLite3, copy the old database into the new Tracks 1.5 directory
2. [Install Tracks 1.6][install_upgrade] in a new directory
3. [Copy over][config_upgrade] a few configuration files from your Tracks 1.043 directory. If using SQLite3, copy the old database into the new Tracks 1.6 directory
5. Run `rake db:migrate RAILS_ENV=production` to [update your old database][rake_upgrade] to the new schema -- you did back up your database didn't you?
6. Run `script/server` inside your Tracks 1.5 directory to [start up Tracks 1.5][startserver_upgrade].
6. Run `script/server` inside your Tracks 1.6 directory to [start up Tracks 1.6][startserver_upgrade].
7. Once you are happy that everything is working well, [delete your old Tracks directory][cleanup_upgrade].
### Backing up [backup_upgrade] ###
@ -142,11 +155,11 @@ It's very important that you **back up your database** before you start the upgr
`mysqldump -user [user name] -password=[password] [database name] > [dump file]`
Rename your old Tracks installation (e.g. to 'tracks-old') so that you can install Tracks 1.5 along side it.
Rename your old Tracks installation (e.g. to 'tracks-old') so that you can install Tracks 1.6 along side it.
### Install Tracks 1.5 [install_upgrade] ###
### Install Tracks 1.6 [install_upgrade] ###
There are two methods of downloading Tracks 1.5:
There are two methods of downloading Tracks 1.6:
1. (Recommended for most people) Download the [zipped package](http://www.rousette.org.uk/projects/files/tracks-current.zip), and unzip in your preferred location (e.g. `~/Sites` for Mac OS X users).
2. Download using Subversion:
@ -162,14 +175,14 @@ There are two methods of downloading Tracks 1.5:
There are a few files you need to copy over from your old installation. If you copy them over rather than moving them, you can still run your old version of Tracks if anything goes awry with the installation process.
1. Copy `/config/database.yml` from your old Tracks directory to the same location in the new one. Double check that the information there is still correct.
2. Duplicate `/config/environment.rb.tmpl` in the Tracks 1.5 directory, and rename the file to `environment.rb`. Open the file and alter the line `SALT = "change-me"` so that it matches what you had in this file in your old installation. You may also want to change the time zone setting as appropriate for your location (`ENV['TZ'] = 'US/Eastern'`). If you have made any other customisations to `environment.rb` in the past, copy those over, but the contents of the file have changed quite a lot since 1.043, so check it carefully.
2. Duplicate `/config/environment.rb.tmpl` in the Tracks 1.6 directory, and rename the file to `environment.rb`. Open the file and alter the line `SALT = "change-me"` so that it matches what you had in this file in your old installation. You may also want to change the time zone setting as appropriate for your location (`ENV['TZ'] = 'US/Eastern'`). If you have made any other customisations to `environment.rb` in the past, copy those over, but the contents of the file have changed quite a lot since 1.043, so check it carefully.
3. Copy your `/log` directory over from your old installation to the root of the new one, or just rename `/log.tmpl` to `log` to start afresh.
4. If you are using SQLite3, copy your database from `/db` in your old Tracks directory to the same location in the new one.
5. If you are using Windows, you may need to check the 'shebang' lines (`#!/usr/bin/env ruby`)[^env] of the `/public/dispatch.*` files and all the files in the `/script` directory. They are set to `#!/usr/bin/env ruby` by default. Check the format of those lines in your old installation, and change the new ones as necessary.
### Update your old database to the new format [rake_upgrade] ###
In a terminal, change directories so that you are inside the Tracks 1.5 directory. Then issue the command to update your Tracks 1.043 database to the format required for Tracks 1.5:
In a terminal, change directories so that you are inside the Tracks 1.6 directory. Then issue the command to update your Tracks 1.043 database to the format required for Tracks 1.6:
`rake db:migrate RAILS_ENV=production`
@ -177,7 +190,7 @@ Watch the output carefully for errors, but it should report at the end of the pr
### Start the server [startserver_upgrade] ###
If you're still in the Tracks 1.5 root directory in a terminal, enter the following command to start up Tracks in production mode:
If you're still in the Tracks 1.6 root directory in a terminal, enter the following command to start up Tracks in production mode:
`script/server -e production`
@ -186,7 +199,7 @@ Visit the URL indicated by the output (e.g. `** Mongrel available at 0.0.0.0:300
### Clean up your old installation [cleanup_upgrade] ###
Once you're certain that your new Tracks 1.5 installation is working perfectly, you can delete your old Tracks directory.
Once you're certain that your new Tracks 1.6 installation is working perfectly, you can delete your old Tracks directory.
[^env]: The `env` binary helps to locate other binaries, regardless of their location. If you don't have `env` installed, you'll need to change this line to point to the location of your Ruby binary.
@ -205,4 +218,4 @@ The best option for versions prior to 1.043 is to follow the instructions below
9. Run the command `rake db_schema_import` inside the Tracks directory. This should import the upgraded schema for 1.043 into your new database.
10. Run the command `rake load_exported_fixtures` which will import the contents of your old database from the fixtures files in `db/exported_fixtures`.
11. If you are using Windows, you may need to check the 'shebang' lines (`#!/usr/bin/env ruby`)[^env] of the `/public/dispatch.*` files and all the files in the `/script` directory. They are set to `#!/usr/bin/env ruby` by default. Check the format of those lines in your old installation, and change the new ones as necessary.
12. Try starting up the server with `script/server` to make sure that all your data has migrated successfully. If all is well, follow the instructions above to [upgrade from version 1.043][upgrading_1043] to Tracks 1.5. If you need to access Tracks from a mobile/cellular phone browser, visit `http://yourdomain.com/mobile/`. This mobile version is a special, lightweight version of Tracks, designed to use on a mobile browser.
12. Try starting up the server with `script/server` to make sure that all your data has migrated successfully. If all is well, follow the instructions above to [upgrade from version 1.043][upgrading_1043] to Tracks 1.6. If you need to access Tracks from a mobile/cellular phone browser, visit `http://yourdomain.com/mobile/`. This mobile version is a special, lightweight version of Tracks, designed to use on a mobile browser.

Binary file not shown.

View file

@ -133,11 +133,11 @@
\date{2008-04-07}
\def\format{complete}
\def\latexxslt{memoir-twosided-manual.xslt}
\def\revision{Revision: \$Id: manual.markdown 811 2008-04-07 20:21:00Z bsag \$}
\def\mytitle{Tracks 1.5 Manual}
\def\version{1.5}
\usepackage{xmpincl}
\includexmp{CCAttributionShareAlike}
\def\revision{Revision: \$Id: manual.markdown 864 2008-06-03 17:01:00Z bsag \$}
\def\mytitle{Tracks 1.6 Manual}
\def\version{1.6}
%%\usepackage{xmpincl}
%%\includexmp{CCAttributionShareAlike}
%
@ -254,16 +254,19 @@
\setlength{\parskip}{\baselineskip/2}
\mainmatter
\chapter{Installing Tracks 1.5}
\label{installingtracks1.5}
\chapter{Installing Tracks 1.6}
\label{installingtracks1.6}
\section{Introduction}
\label{introduction}
Tracks 1.5 has been thoroughly beta tested by a large number of people, and should be fully stable for everyday use. However, once set up, Tracks will contain the majority of your plans for your work and personal life, so it's only sensible to make sure that you have frequent, reliable backups of your data. Full changenotes on the release can be found in \texttt{doc/CHANGELOG}. Full API documentation can be found at \texttt{doc/app/index.html}, once you have run \texttt{rake appdoc}
\textbf{An important note for version 1.6: OpenID support is broken in this release. The fix isn't trivial because of changes to the \texttt{ruby-openid} gem, so we wanted to get this version out now and fix OpenID for the next release. If you depend on OpenID integration, we recommend waiting until the next release.}
There are two methods of downloading Tracks 1.5 \textbf{(N.B. These links will not work until Tracks 1.5 final is released)}):
Tracks 1.6 has been thoroughly beta tested by a large number of people, and should be fully stable for everyday use. However, once set up, Tracks will contain the majority of your plans for your work and personal life, so it's only sensible to make sure that you have frequent, reliable backups of your data. Full changenotes on the release can be found in \texttt{doc/CHANGELOG}. Full API documentation can be found at \texttt{doc/app/index.html}, once you have run \texttt{rake appdoc}
There are two methods of downloading Tracks 1.6:
\begin{enumerate}
@ -311,7 +314,7 @@ If you'd like an easy way to access Tracks from any internet-connected computer,
\item Tracks itself
\item Rails 1.2.5 (installed in the \texttt{/vendor/rails} directory, so you do not need to install Rails yourself)
\item Rails 2.0.2 (installed in the \texttt{/vendor/rails} directory, so you do not need to install Rails yourself)
\item An empty SQLite3 database, set up with the correct database schema
\end{enumerate}
@ -332,13 +335,13 @@ If you don't want to (or can't) use one of the all in one installations, you'll
\item \textbf{Database}. The easiest option is to use SQLite3, as the database is included in the package. All you need then is the \texttt{sqlite3-ruby} gem, as described in step 2, and the SQLite3 libraries and binary (see \href{http://sqlite.org/download.html}{sqlite.org} for downloads and installation instructions). If you want to use MySQL, download and install a package for your platform from \href{http://dev.mysql.com/downloads/mysql/5.0.html}{MySQL.com}. The basic steps for Postgresql should be similar to those for MySQL, but they will not be discussed further here.
\end{enumerate}
If you are using Unix, you might find \href{http://www.cooldown.com.ar/2006/12/16/install-tracks-on-ubuntu-or-debian/}{this guide} by c00i90wn helpful. It was written for Tracks 1.043, but it should work for Tracks 1.5.
If you are using Unix, you might find \href{http://www.cooldown.com.ar/2006/12/16/install-tracks-on-ubuntu-or-debian/}{this guide} by c00i90wn helpful. It was written for Tracks 1.043, but it should work for Tracks 1.6.
\section{Installation}
\label{installation}
This description is intended for people installing Tracks from scratch. If you would like to upgrade an existing installation, please see Upgrading to Tracks 1.5 (\autoref{upgrading}).
This description is intended for people installing Tracks from scratch. If you would like to upgrade an existing installation, please see Upgrading to Tracks 1.6 (\autoref{upgrading}).
\begin{enumerate}
@ -359,7 +362,7 @@ This description is intended for people installing Tracks from scratch. If you w
\item Configure some variables (\autoref{config_install})
\item Populate the database with the Tracks 1.5 schema (\autoref{rake_install})
\item Populate the database with the Tracks 1.6 schema (\autoref{rake_install})
\item Start the server (\autoref{startserver_install})
@ -385,7 +388,7 @@ Before you go any further, you need to decide which database you will use. See t
\item \textbf{SQLite3}. All you need to do is make sure that you point Tracks to the included SQLite3 database in \texttt{/db} in the next step, Configure variables (\autoref{config_install}).
\item \textbf{MySQL}. Once you have MySQL installed, you need to create a database to use with Tracks 1.5. Go into a terminal and issue the following commands:
\item \textbf{MySQL}. Once you have MySQL installed, you need to create a database to use with Tracks 1.6. Go into a terminal and issue the following commands:
\end{enumerate}
\begin{adjustwidth}{2.5em}{2.5em}
@ -407,7 +410,7 @@ Before you go any further, you need to decide which database you will use. See t
\begin{enumerate}
\item If you downloaded Tracks 1.5 via Subversion, you need to duplicate the files \texttt{database.yml.tmpl} and \texttt{environment.yml.tmpl} and remove the \texttt{*.tmpl} extension from the duplicates. Similarly, duplicate \texttt{/log.tmpl} and remove the \texttt{*.tmpl} extension, then edit the files as described in steps 2 and 3.
\item If you downloaded Tracks 1.6 via Subversion, you need to duplicate the files \texttt{database.yml.tmpl} and \texttt{environment.yml.tmpl} and remove the \texttt{*.tmpl} extension from the duplicates. Similarly, duplicate \texttt{/log.tmpl} and remove the \texttt{*.tmpl} extension, then edit the files as described in steps 2 and 3.
\item Open the file \texttt{/config/database.yml} and edit the \texttt{production:} section with the details of your database. If you are using MySQL the \texttt{adapter:} line should read \texttt{adapter: mysql}, \texttt{host: localhost} (in the majority of cases), and your username and password should match those you assigned when you created the database. If you are using SQLite3, you should have only two lines under the production section: \texttt{adapter: sqlite3} and \texttt{database: db/tracks-15-blank.db}. If you downloaded the zipped file, the database.yml file is already configured to use the provided SQLite3 file.
@ -416,22 +419,22 @@ Before you go any further, you need to decide which database you will use. See t
\item If you are using Windows, you may need to check the `shebang' lines (\texttt{\#!/usr/bin/env ruby}) of the \texttt{/public/dispatch.*} files and all the files in the \texttt{/script} directory. They are set to \texttt{\#!/usr/bin/env ruby} by default. This should work for all *nix based setups (Linux or Mac OS X), but Windows users will probably have to change it to something like \texttt{\#c:/ruby/bin/ruby} to point to the Ruby binary on your system.
\end{enumerate}
\subsection{Populate your database with the Tracks 1.5 schema}
\subsection{Populate your database with the Tracks 1.6 schema}
\label{rake_install}
Open a terminal and change into the root of your Tracks 1.5 directory. Enter the following command:
Open a terminal and change into the root of your Tracks 1.6 directory. Enter the following command:
\texttt{rake db:migrate RAILS\_ENV=production}
This will update your database with the required schema for Tracks 1.5. If you are using SQLite3, it is not strictly necessary, because the SQLite3 database included with Tracks already has the schema included in it, but it should not do any harm to run the command (nothing will happen if it is up to date).
This will update your database with the required schema for Tracks 1.6. If you are using SQLite3, it is not strictly necessary, because the SQLite3 database included with Tracks already has the schema included in it, but it should not do any harm to run the command (nothing will happen if it is up to date).
\subsection{Start the server}
\label{startserver_install}
While still in the Terminal inside the Tracks 1.5 root directory, issue the following command:
While still in the Terminal inside the Tracks 1.6 root directory, issue the following command:
\texttt{script/server -e production}
@ -452,9 +455,29 @@ Visit \texttt{http://0.0.0.0:3000/signup} in a browser (or whatever URL and port
Once logged in, add some Contexts and Projects, and then go ahead and add your actions. You might also want to visit the Preferences page to edit various settings to your liking. Have fun!
\chapter{Upgrading to Tracks 1.5}
\chapter{Upgrading to Tracks 1.6}
\label{upgrading}
\section{Upgrading from Tracks 1.5}
\label{upgrading_1.5}
There are no changes to the database between 1.5 and 1.6, but you will need to upgrade your \texttt{config/environment.rb} with the new content from \texttt{config/environment.rb.tmpl} included in 1.6, as the format of this file has changed a great deal between 1.5 and 1.6.
\begin{enumerate}
\item Back up (\autoref{backup_upgrade}) your existing database and installation of Tracks
\item Install Tracks 1.6 (\autoref{install_upgrade}) in a new directory
\item Copy over (\autoref{config_upgrade}) a few configuration files from your Tracks 1.043 directory. If using SQLite3, copy the old database into the new Tracks 1.6 directory
\item Run \texttt{script/server} inside your Tracks 1.6 directory to start up Tracks 1.6 (\autoref{startserver_upgrade}).
\item Once you are happy that everything is working well, delete your old Tracks directory (\autoref{cleanup_upgrade}).
\end{enumerate}
\section{Upgrading from Tracks 1.043}
\label{upgrading_1043}
@ -466,13 +489,13 @@ This should be a relatively straightforward, and involves the following main ste
\item Back up (\autoref{backup_upgrade}) your existing database and installation of Tracks
\item Install Tracks 1.5 (\autoref{install_upgrade}) in a new directory
\item Install Tracks 1.6 (\autoref{install_upgrade}) in a new directory
\item Copy over (\autoref{config_upgrade}) a few configuration files from your Tracks 1.043 directory. If using SQLite3, copy the old database into the new Tracks 1.5 directory
\item Copy over (\autoref{config_upgrade}) a few configuration files from your Tracks 1.043 directory. If using SQLite3, copy the old database into the new Tracks 1.6 directory
\item Run \texttt{rake db:migrate RAILS\_ENV=production} to update your old database (\autoref{rake_upgrade}) to the new schema -- you did back up your database didn't you?
\item Run \texttt{script/server} inside your Tracks 1.5 directory to start up Tracks 1.5 (\autoref{startserver_upgrade}).
\item Run \texttt{script/server} inside your Tracks 1.6 directory to start up Tracks 1.6 (\autoref{startserver_upgrade}).
\item Once you are happy that everything is working well, delete your old Tracks directory (\autoref{cleanup_upgrade}).
\end{enumerate}
@ -486,13 +509,13 @@ It's very important that you \textbf{back up your database} before you start the
\texttt{mysqldump ---user [user name] ---password=[password] [database name] $>$ [dump file]}
Rename your old Tracks installation (e.g.\ to `tracks-old') so that you can install Tracks 1.5 along side it.
Rename your old Tracks installation (e.g.\ to `tracks-old') so that you can install Tracks 1.6 along side it.
\subsection{Install Tracks 1.5}
\subsection{Install Tracks 1.6}
\label{install_upgrade}
There are two methods of downloading Tracks 1.5:
There are two methods of downloading Tracks 1.6:
\begin{enumerate}
@ -525,7 +548,7 @@ There are a few files you need to copy over from your old installation. If you c
\item Copy \texttt{/config/database.yml} from your old Tracks directory to the same location in the new one. Double check that the information there is still correct.
\item Duplicate \texttt{/config/environment.rb.tmpl} in the Tracks 1.5 directory, and rename the file to \texttt{environment.rb}. Open the file and alter the line \texttt{SALT = "change-me"} so that it matches what you had in this file in your old installation. You may also want to change the time zone setting as appropriate for your location (\texttt{ENV['TZ'] = 'US/Eastern'}). If you have made any other customisations to \texttt{environment.rb} in the past, copy those over, but the contents of the file have changed quite a lot since 1.043, so check it carefully.
\item Duplicate \texttt{/config/environment.rb.tmpl} in the Tracks 1.6 directory, and rename the file to \texttt{environment.rb}. Open the file and alter the line \texttt{SALT = "change-me"} so that it matches what you had in this file in your old installation. You may also want to change the time zone setting as appropriate for your location (\texttt{ENV['TZ'] = 'US/Eastern'}). If you have made any other customisations to \texttt{environment.rb} in the past, copy those over, but the contents of the file have changed quite a lot since 1.043, so check it carefully.
\item Copy your \texttt{/log} directory over from your old installation to the root of the new one, or just rename \texttt{/log.tmpl} to \texttt{log} to start afresh.
@ -537,7 +560,7 @@ There are a few files you need to copy over from your old installation. If you c
\subsection{Update your old database to the new format}
\label{rake_upgrade}
In a terminal, change directories so that you are inside the Tracks 1.5 directory. Then issue the command to update your Tracks 1.043 database to the format required for Tracks 1.5:
In a terminal, change directories so that you are inside the Tracks 1.6 directory. Then issue the command to update your Tracks 1.043 database to the format required for Tracks 1.6:
\texttt{rake db:migrate RAILS\_ENV=production}
@ -549,7 +572,7 @@ Watch the output carefully for errors, but it should report at the end of the pr
\subsection{Start the server}
\label{startserver_upgrade}
If you're still in the Tracks 1.5 root directory in a terminal, enter the following command to start up Tracks in production mode:
If you're still in the Tracks 1.6 root directory in a terminal, enter the following command to start up Tracks in production mode:
\texttt{script/server -e production}
@ -562,7 +585,7 @@ Visit the URL indicated by the output (e.g.\ \texttt{** Mongrel available at 0.0
\subsection{Clean up your old installation}
\label{cleanup_upgrade}
Once you're certain that your new Tracks 1.5 installation is working perfectly, you can delete your old Tracks directory.
Once you're certain that your new Tracks 1.6 installation is working perfectly, you can delete your old Tracks directory.
\section{Upgrading from versions prior to 1.043}
@ -596,7 +619,7 @@ The best option for versions prior to 1.043 is to follow the instructions below
\item If you are using Windows, you may need to check the `shebang' lines (\texttt{\#!/usr/bin/env ruby})\footnote{The \texttt{env} binary helps to locate other binaries, regardless of their location. If you don't have \texttt{env} installed, you'll need to change this line to point to the location of your Ruby binary.The \texttt{env} binary helps to locate other binaries, regardless of their location. If you don't have \texttt{env} installed, you'll need to change this line to point to the location of your Ruby binary.} of the \texttt{/public/dispatch.*} files and all the files in the \texttt{/script} directory. They are set to \texttt{\#!/usr/bin/env ruby} by default. Check the format of those lines in your old installation, and change the new ones as necessary.
\item Try starting up the server with \texttt{script/server} to make sure that all your data has migrated successfully. If all is well, follow the instructions above to upgrade from version 1.043 (\autoref{upgrading_1043}) to Tracks 1.5. If you need to access Tracks from a mobile/cellular phone browser, visit \texttt{http://yourdomain.com/mobile/}. This mobile version is a special, lightweight version of Tracks, designed to use on a mobile browser.
\item Try starting up the server with \texttt{script/server} to make sure that all your data has migrated successfully. If all is well, follow the instructions above to upgrade from version 1.043 (\autoref{upgrading_1043}) to Tracks 1.6. If you need to access Tracks from a mobile/cellular phone browser, visit \texttt{http://yourdomain.com/mobile/}. This mobile version is a special, lightweight version of Tracks, designed to use on a mobile browser.
\end{enumerate}
%

View file

@ -12,6 +12,8 @@ ToDoItems = Class.create();
ToDoItems.prototype = {
initialize: function()
{
/* keep track of last effect so you can check if the animation has finised */
this.lastEffect= null;
this.initialized = true;
this.contextCollapseCookieManager = new CookieManager();
this.toggleItemsMap = {};
@ -26,7 +28,7 @@ ToDoItems.prototype = {
{
toggleElem = this.containerToggles[i];
containerElem = toggleElem.parentNode.parentNode
itemsElem = document.getElementsByClassName('toggle_target',containerElem)[0];
itemsElem = $(containerElem.id).select("div#"+containerElem.id+"items")[0];
this.toggleContainerMap[toggleElem.id] = containerElem;
this.toggleItemsMap[toggleElem.id] = itemsElem;
this.containerItemsMap[containerElem.id] = itemsElem;
@ -112,7 +114,7 @@ ToDoItems.prototype = {
}
else
{
Effect.BlindDown(itemsElem, { duration: 0.4 });
this.lastEffect = Effect.BlindDown(itemsElem, { duration: 0.4 });
}
toggleElem.setAttribute('title', 'Collapse');
imgElem = this.findToggleImgElem(toggleElem);
@ -133,7 +135,7 @@ ToDoItems.prototype = {
},
collapseNextActionListing: function(toggleElem, itemsElem)
{
Effect.BlindUp(itemsElem, { duration: 0.4});
this.lastEffect = Effect.BlindUp(itemsElem, { duration: 0.4});
toggleElem.setAttribute('title', 'Expand');
imgElem = this.findToggleImgElem(toggleElem);
imgElem.src = imgElem.src.replace('collapse','expand');

View file

@ -723,10 +723,10 @@ else
return'Alt';else
return'Ctrl';}}
Event.observe(window,"load",accessKeyHintsAdder.run.bindAsEventListener(accessKeyHintsAdder));ToDoItems=Class.create();ToDoItems.prototype={initialize:function()
{this.initialized=true;this.contextCollapseCookieManager=new CookieManager();this.toggleItemsMap={};this.toggleContainerMap={};this.containerItemsMap={};},addNextActionListingToggles:function()
{this.lastEffect=null;this.initialized=true;this.contextCollapseCookieManager=new CookieManager();this.toggleItemsMap={};this.toggleContainerMap={};this.containerItemsMap={};},addNextActionListingToggles:function()
{this.containerToggles=$$('.container_toggle');containerTogglesClick=this.toggleNextActionListing.bindAsEventListener(this);for(i=0;i<this.containerToggles.length;i++)
{toggleElem=this.containerToggles[i];containerElem=toggleElem.parentNode.parentNode
itemsElem=document.getElementsByClassName('toggle_target',containerElem)[0];this.toggleContainerMap[toggleElem.id]=containerElem;this.toggleItemsMap[toggleElem.id]=itemsElem;this.containerItemsMap[containerElem.id]=itemsElem;}
itemsElem=$(containerElem.id).select("div#"+containerElem.id+"items")[0];this.toggleContainerMap[toggleElem.id]=containerElem;this.toggleItemsMap[toggleElem.id]=itemsElem;this.containerItemsMap[containerElem.id]=itemsElem;}
this.setNextActionListingTogglesToCookiedState();},setNextActionListingTogglesToCookiedState:function()
{for(i=0;i<this.containerToggles.length;i++)
{toggleElem=this.containerToggles[i];containerElem=this.toggleContainerMap[toggleElem.id];collapsedCookie=this.contextCollapseCookieManager.getCookie(this.buildCookieName(containerElem));itemsElem=this.toggleItemsMap[toggleElem.id];isExpanded=Element.visible(itemsElem);if(collapsedCookie&&isExpanded)
@ -748,11 +748,11 @@ else
{itemsElem=$(itemsElem)
if(skipAnimation==true){itemsElem.style.display='block';}
else
{Effect.BlindDown(itemsElem,{duration:0.4});}
{this.lastEffect=Effect.BlindDown(itemsElem,{duration:0.4});}
toggleElem.setAttribute('title','Collapse');imgElem=this.findToggleImgElem(toggleElem);imgElem.src=imgElem.src.replace('expand','collapse');imgElem.setAttribute('title','Collapse');},ensureContainerHeight:function(itemsElem)
{itemsElem=$(itemsElem);Element.setStyle(itemsElem,{height:''});Element.setStyle(itemsElem,{overflow:''});},expandNextActionListingByContext:function(itemsElem,skipAnimation)
{contextElem=this.findNearestParentByClassName($(itemsElem),"context");toggleElem=this.findToggleElemForContext(contextElem);this.expandNextActionListing(toggleElem,itemsElem,skipAnimation);},collapseNextActionListing:function(toggleElem,itemsElem)
{Effect.BlindUp(itemsElem,{duration:0.4});toggleElem.setAttribute('title','Expand');imgElem=this.findToggleImgElem(toggleElem);imgElem.src=imgElem.src.replace('collapse','expand');imgElem.setAttribute('title','Expand');},findToggleImgElem:function(toggleElem)
{this.lastEffect=Effect.BlindUp(itemsElem,{duration:0.4});toggleElem.setAttribute('title','Expand');imgElem=this.findToggleImgElem(toggleElem);imgElem.src=imgElem.src.replace('collapse','expand');imgElem.setAttribute('title','Expand');},findToggleImgElem:function(toggleElem)
{childImgElems=$A(toggleElem.getElementsByTagName('img'));return childImgElems[0];},buildCookieName:function(containerElem)
{tracks_login=this.contextCollapseCookieManager.getCookie('tracks_login');return'tracks_'+tracks_login+'_context_'+containerElem.id+'_collapsed';},findNearestParentByClassName:function(elem,parentClassName)
{var parentElem=elem.parentNode;while(parentElem)

0
script/plugin Normal file → Executable file
View file

33
vendor/plugins/yaml_db/README vendored Normal file
View file

@ -0,0 +1,33 @@
= YamlDb
YamlDb is a database-independent format for dumping and restoring data. It complements the the database-independent schema format found in db/schema.rb. The data is saved into db/data.yml.
This can be used as a replacement for mysqldump or pg_dump, but only for the databases typically used by Rails apps. Users, permissions, schemas, triggers, and other advanced database features are not supported - by design.
Any database that has an ActiveRecord adapter should work.
== Usage
rake db:data:dump -> Dump contents of Rails database to db/data.yml
rake db:data:load -> Load contents of db/data.yml into the database
Further, there are tasks db:dump and db:load which do the entire database (the equivalent of running db:schema:dump followed by db:data:load).
== Examples
One common use would be to switch your data from one database backend to another. For example, let's say you wanted to switch from SQLite to MySQL. You might execute the following steps:
1. rake db:dump
2. Edit config/database.yml and change your adapter to mysql, set up database params
3. mysqladmin create [database name]
4. rake db:load
== Credits
Created by Orion Henry and Adam Wiggins. Major updates by Ricardo Chimal, Jr. Patches contributed by Michael Irwin.
Send questions, feedback, or patches to the Heroku mailing list: http://groups.google.com/group/heroku

10
vendor/plugins/yaml_db/Rakefile vendored Normal file
View file

@ -0,0 +1,10 @@
require 'rake'
require 'spec/rake/spectask'
desc "Run all specs"
Spec::Rake::SpecTask.new('spec') do |t|
t.spec_files = FileList['spec/*_spec.rb']
end
task :default => :spec

5
vendor/plugins/yaml_db/about.yml vendored Normal file
View file

@ -0,0 +1,5 @@
author: Orion Henry and Adam Wiggins of Heroku
summary: Dumps and loads a database-independent data dump format in db/data.yml.
homepage: http://opensource.heroku.com/
license: MIT
rails_version: 1.2+

1
vendor/plugins/yaml_db/init.rb vendored Normal file
View file

@ -0,0 +1 @@
require 'yaml_db'

170
vendor/plugins/yaml_db/lib/yaml_db.rb vendored Normal file
View file

@ -0,0 +1,170 @@
require 'rubygems'
require 'yaml'
require 'active_record'
module YamlDb
def self.dump(filename)
disable_logger
YamlDb::Dump.dump(File.new(filename, "w"))
reenable_logger
end
def self.load(filename)
disable_logger
YamlDb::Load.load(File.new(filename, "r"))
reenable_logger
end
def self.disable_logger
@@old_logger = ActiveRecord::Base.logger
ActiveRecord::Base.logger = nil
end
def self.reenable_logger
ActiveRecord::Base.logger = @@old_logger
end
end
module YamlDb::Utils
def self.chunk_records(records)
yaml = [ records ].to_yaml
yaml.sub!("--- \n", "")
yaml.sub!('- - -', ' - -')
yaml
end
def self.unhash(hash, keys)
keys.map { |key| hash[key] }
end
def self.unhash_records(records, keys)
records.each_with_index do |record, index|
records[index] = unhash(record, keys)
end
records
end
def self.convert_booleans(records, columns)
records.each do |record|
columns.each do |column|
next if is_boolean(record[column])
record[column] = (record[column] == 't' or record[column] == '1')
end
end
records
end
def self.boolean_columns(table)
columns = ActiveRecord::Base.connection.columns(table).reject { |c| c.type != :boolean }
columns.map { |c| c.name }
end
def self.is_boolean(value)
value.kind_of?(TrueClass) or value.kind_of?(FalseClass)
end
end
module YamlDb::Dump
def self.dump(io)
ActiveRecord::Base.connection.tables.each do |table|
dump_table(io, table)
end
end
def self.dump_table(io, table)
return if table_record_count(table).zero?
dump_table_columns(io, table)
dump_table_records(io, table)
end
def self.dump_table_columns(io, table)
io.write("\n")
io.write({ table => { 'columns' => table_column_names(table) } }.to_yaml)
end
def self.dump_table_records(io, table)
table_record_header(io)
column_names = table_column_names(table)
each_table_page(table) do |records|
rows = YamlDb::Utils.unhash_records(records, column_names)
io.write(YamlDb::Utils.chunk_records(records))
end
end
def self.table_record_header(io)
io.write(" records: \n")
end
def self.table_column_names(table)
ActiveRecord::Base.connection.columns(table).map { |c| c.name }
end
def self.each_table_page(table, records_per_page=1000)
total_count = table_record_count(table)
pages = (total_count.to_f / records_per_page).ceil - 1
id = table_column_names(table).first
boolean_columns = YamlDb::Utils.boolean_columns(table)
(0..pages).to_a.each do |page|
sql_limit = "LIMIT #{records_per_page} OFFSET #{records_per_page*page}"
records = ActiveRecord::Base.connection.select_all("SELECT * FROM #{table} ORDER BY #{id} #{sql_limit}")
records = YamlDb::Utils.convert_booleans(records, boolean_columns)
yield records
end
end
def self.table_record_count(table)
ActiveRecord::Base.connection.select_one("SELECT COUNT(*) FROM #{table}").values.first.to_i
end
end
module YamlDb::Load
def self.load(io)
ActiveRecord::Base.connection.transaction do
YAML.load_documents(io) do |ydoc|
ydoc.keys.each do |table_name|
next if ydoc[table_name].nil?
load_table(table_name, ydoc[table_name])
end
end
end
end
def self.truncate_table(table)
begin
ActiveRecord::Base.connection.execute("TRUNCATE #{table}")
rescue Exception
ActiveRecord::Base.connection.execute("DELETE FROM #{table}")
end
end
def self.load_table(table, data)
column_names = data['columns']
truncate_table(table)
load_records(table, column_names, data['records'])
# Uncomment if using PostgreSQL
# reset_pk_sequence!(table)
end
def self.load_records(table, column_names, records)
quoted_column_names = column_names.map { |column| ActiveRecord::Base.connection.quote_column_name(column) }.join(',')
records.each do |record|
ActiveRecord::Base.connection.execute("INSERT INTO #{table} (#{quoted_column_names}) VALUES (#{record.map { |r| ActiveRecord::Base.connection.quote(r) }.join(',')})")
end
end
# Uncomment if using PostgreSQL
# def self.reset_pk_sequence!(table_name)
# if ActiveRecord::Base.connection.kind_of?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
# ActiveRecord::Base.connection.reset_pk_sequence!(table_name)
# end
# end
end

7
vendor/plugins/yaml_db/spec/base.rb vendored Normal file
View file

@ -0,0 +1,7 @@
require 'rubygems'
require 'spec'
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
require 'yaml_db'

View file

@ -0,0 +1,89 @@
require File.dirname(__FILE__) + '/base'
describe YamlDb::Dump do
before do
File.stub!(:new).with('dump.yml', 'w').and_return(StringIO.new)
ActiveRecord::Base = mock('ActiveRecord::Base', :null_object => true)
ActiveRecord::Base.connection = mock('connection')
ActiveRecord::Base.connection.stub!(:tables).and_return([ 'mytable' ])
ActiveRecord::Base.connection.stub!(:columns).with('mytable').and_return([ mock('a',:name => 'a'), mock('b', :name => 'b') ])
ActiveRecord::Base.connection.stub!(:select_one).and_return({"count"=>"2"})
ActiveRecord::Base.connection.stub!(:select_all).and_return([ { 'a' => 1, 'b' => 2 }, { 'a' => 3, 'b' => 4 } ])
end
before(:each) do
@io = StringIO.new
end
it "should return a formatted string" do
YamlDb::Dump.table_record_header(@io)
@io.rewind
@io.read.should == " records: \n"
end
it "should return a list of column names" do
YamlDb::Dump.table_column_names('mytable').should == [ 'a', 'b' ]
end
it "should return the total number of records in a table" do
YamlDb::Dump.table_record_count('mytable').should == 2
end
it "should return a yaml string that contains a table header and column names" do
YamlDb::Dump.stub!(:table_column_names).with('mytable').and_return([ 'a', 'b' ])
YamlDb::Dump.dump_table_columns(@io, 'mytable')
@io.rewind
@io.read.should == <<EOYAML
---
mytable:
columns:
- a
- b
EOYAML
end
it "should return all records from the database and return them when there is only 1 page" do
YamlDb::Dump.each_table_page('mytable') do |records|
records.should == [ { 'a' => 1, 'b' => 2 }, { 'a' => 3, 'b' => 4 } ]
end
end
it "should paginate records from the database and return them" do
ActiveRecord::Base.connection.stub!(:select_all).and_return([ { 'a' => 1, 'b' => 2 } ], [ { 'a' => 3, 'b' => 4 } ])
records = [ ]
YamlDb::Dump.each_table_page('mytable', 1) do |page|
page.size.should == 1
records.concat(page)
end
records.should == [ { 'a' => 1, 'b' => 2 }, { 'a' => 3, 'b' => 4 } ]
end
it "should return dump the records for a table in yaml to a given io stream" do
YamlDb::Dump.dump_table_records(@io, 'mytable')
@io.rewind
@io.read.should == <<EOYAML
records:
- - 1
- 2
- - 3
- 4
EOYAML
end
it "should dump a table's contents to yaml" do
YamlDb::Dump.should_receive(:dump_table_columns)
YamlDb::Dump.should_receive(:dump_table_records)
YamlDb::Dump.dump_table(@io, 'mytable')
end
it "should not dump a table's contents when the record count is zero" do
YamlDb::Dump.stub!(:table_record_count).with('mytable').and_return(0)
YamlDb::Dump.should_not_receive(:dump_table_columns)
YamlDb::Dump.should_not_receive(:dump_table_records)
YamlDb::Dump.dump_table(@io, 'mytable')
end
end

View file

@ -0,0 +1,88 @@
require File.dirname(__FILE__) + '/base'
describe YamlDb::Load do
before do
ActiveRecord::Base = mock('ActiveRecord::Base', :null_object => true)
ActiveRecord::Base.connection = mock('connection')
ActiveRecord::Base.connection.stub!(:transaction).and_yield
end
before(:each) do
@io = StringIO.new
end
it "should truncate the table" do
ActiveRecord::Base.connection.stub!(:execute).with("TRUNCATE mytable").and_return(true)
ActiveRecord::Base.connection.should_not_receive(:execute).with("DELETE FROM mytable")
YamlDb::Load.truncate_table('mytable')
end
it "should delete the table if truncate throws an exception" do
ActiveRecord::Base.connection.should_receive(:execute).with("TRUNCATE mytable").and_raise()
ActiveRecord::Base.connection.should_receive(:execute).with("DELETE FROM mytable").and_return(true)
YamlDb::Load.truncate_table('mytable')
end
it "should insert records into a table" do
ActiveRecord::Base.connection.stub!(:quote_column_name).with('a').and_return('a')
ActiveRecord::Base.connection.stub!(:quote_column_name).with('b').and_return('b')
ActiveRecord::Base.connection.stub!(:quote).with(1).and_return("'1'")
ActiveRecord::Base.connection.stub!(:quote).with(2).and_return("'2'")
ActiveRecord::Base.connection.stub!(:quote).with(3).and_return("'3'")
ActiveRecord::Base.connection.stub!(:quote).with(4).and_return("'4'")
ActiveRecord::Base.connection.should_receive(:execute).with("INSERT INTO mytable (a,b) VALUES ('1','2')")
ActiveRecord::Base.connection.should_receive(:execute).with("INSERT INTO mytable (a,b) VALUES ('3','4')")
YamlDb::Load.load_records('mytable', ['a', 'b'], [[1, 2], [3, 4]])
end
it "should quote column names that correspond to sql keywords" do
ActiveRecord::Base.connection.stub!(:quote_column_name).with('a').and_return('a')
ActiveRecord::Base.connection.stub!(:quote_column_name).with('count').and_return('"count"')
ActiveRecord::Base.connection.stub!(:quote).with(1).and_return("'1'")
ActiveRecord::Base.connection.stub!(:quote).with(2).and_return("'2'")
ActiveRecord::Base.connection.stub!(:quote).with(3).and_return("'3'")
ActiveRecord::Base.connection.stub!(:quote).with(4).and_return("'4'")
ActiveRecord::Base.connection.should_receive(:execute).with("INSERT INTO mytable (a,\"count\") VALUES ('1','2')")
ActiveRecord::Base.connection.should_receive(:execute).with("INSERT INTO mytable (a,\"count\") VALUES ('3','4')")
YamlDb::Load.load_records('mytable', ['a', 'count'], [[1, 2], [3, 4]])
end
it "should truncate the table and then load the records into the table" do
YamlDb::Load.should_receive(:truncate_table).with('mytable')
YamlDb::Load.should_receive(:load_records).with('mytable', ['a', 'b'], [[1, 2], [3, 4]])
YamlDb::Load.should_receive(:reset_pk_sequence!).with('mytable')
YamlDb::Load.load_table('mytable', { 'columns' => [ 'a', 'b' ], 'records' => [[1, 2], [3, 4]] })
end
it "should call load structure for each document in the file" do
YAML.should_receive(:load_documents).with(@io).and_yield({ 'mytable' => {
'columns' => [ 'a', 'b' ],
'records' => [[1, 2], [3, 4]]
} })
YamlDb::Load.should_receive(:load_table).with('mytable', { 'columns' => [ 'a', 'b' ], 'records' => [[1, 2], [3, 4]] })
YamlDb::Load.load(@io)
end
it "should not call load structure when the document in the file contains no records" do
YAML.should_receive(:load_documents).with(@io).and_yield({ 'mytable' => nil })
YamlDb::Load.should_not_receive(:load_table)
YamlDb::Load.load(@io)
end
it "should call reset pk sequence if the connection adapter is postgres" do
module ActiveRecord; module ConnectionAdapters; class PostgreSQLAdapter; end; end; end;
ActiveRecord::Base.connection.stub!(:kind_of?).with(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter).and_return(true)
ActiveRecord::Base.connection.should_receive(:reset_pk_sequence!).with('mytable')
YamlDb::Load.reset_pk_sequence!('mytable')
end
it "should not call reset_pk_sequence if the connection adapter is not postgres" do
module ActiveRecord; module ConnectionAdapters; class PostgreSQLAdapter; end; end; end;
ActiveRecord::Base.connection.stub!(:kind_of?).with(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter).and_return(false)
ActiveRecord::Base.connection.should_not_receive(:reset_pk_sequence!)
YamlDb::Load.reset_pk_sequence!('mytable')
end
end

View file

@ -0,0 +1,39 @@
require File.dirname(__FILE__) + '/base'
describe YamlDb::Utils, " convert records utility method" do
it "turns an array with one record into a yaml chunk" do
YamlDb::Utils.chunk_records([ %w(a b) ]).should == <<EOYAML
- - a
- b
EOYAML
end
it "turns an array with two records into a yaml chunk" do
YamlDb::Utils.chunk_records([ %w(a b), %w(x y) ]).should == <<EOYAML
- - a
- b
- - x
- y
EOYAML
end
it "returns an array of hash values using an array of ordered keys" do
YamlDb::Utils.unhash({ 'a' => 1, 'b' => 2 }, [ 'b', 'a' ]).should == [ 2, 1 ]
end
it "should unhash each hash an array using an array of ordered keys" do
YamlDb::Utils.unhash_records([ { 'a' => 1, 'b' => 2 }, { 'a' => 3, 'b' => 4 } ], [ 'b', 'a' ]).should == [ [ 2, 1 ], [ 4, 3 ] ]
end
it "should return true if it is a boolean type" do
YamlDb::Utils.is_boolean(true).should == true
YamlDb::Utils.is_boolean('true').should_not == true
end
it "should return an array of boolean columns" do
ActiveRecord::Base = mock('ActiveRecord::Base', :null_object => true)
ActiveRecord::Base.connection = mock('connection')
ActiveRecord::Base.connection.stub!(:columns).with('mytable').and_return([ mock('a',:name => 'a',:type => :string), mock('b', :name => 'b',:type => :boolean) ])
YamlDb::Utils.boolean_columns('mytable').should == ['b']
end
end

View file

@ -0,0 +1,23 @@
namespace :db do
desc "Dump schema and data to db/schema.rb and db/data.yml"
task(:dump => [ "db:schema:dump", "db:data:dump" ])
desc "Load schema and data from db/schema.rb and db/data.yml"
task(:load => [ "db:schema:load", "db:data:load" ])
namespace :data do
def db_dump_data_file
"#{RAILS_ROOT}/db/data.yml"
end
desc "Dump contents of database to db/data.yml"
task(:dump => :environment) do
YamlDb.dump db_dump_data_file
end
desc "Load contents of db/data.yml into database"
task(:load => :environment) do
YamlDb.load db_dump_data_file
end
end
end