backlog 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -3
- data/bin/backlog +1 -1
- data/config/deploy.rb +5 -5
- data/config/environments/development.rb +7 -8
- data/db/migrate/002_create_backlogs.rb +20 -3
- data/db/migrate/009_add_subtasks.rb +12 -11
- data/db/migrate/018_create_groups.rb +10 -1
- data/db/schema.rb +0 -26
- data/lib/class_table_inheritance.rb +2 -0
- data/lib/user_system.rb +3 -3
- metadata +1 -1
data/Rakefile
CHANGED
@@ -11,9 +11,7 @@ require 'tasks/rails'
|
|
11
11
|
|
12
12
|
require 'hoe'
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
Hoe.new("backlog", GEM_VERSION) do |p|
|
14
|
+
Hoe.new("backlog", '0.1.2') do |p|
|
17
15
|
p.rubyforge_name = "backlog"
|
18
16
|
p.description = p.paragraphs_of('README.txt', 0..-1).join("\n\n")
|
19
17
|
p.remote_rdoc_dir = '' # Release to root
|
data/bin/backlog
CHANGED
@@ -36,8 +36,8 @@ case ARGV[0]
|
|
36
36
|
unless dbs =~ /#{APPLICATION}_production/
|
37
37
|
puts `su - postgres -c "createdb #{APPLICATION}_production"`
|
38
38
|
Dir.chdir INSTALL_DIR
|
39
|
-
puts `rake db:migrate RAILS_ENV=production`
|
40
39
|
end
|
40
|
+
puts `rake db:migrate RAILS_ENV=production`
|
41
41
|
else
|
42
42
|
puts "Usage: #$0 {start|stop|restart|status|setup}"
|
43
43
|
exit 1
|
data/config/deploy.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
set :application, "backlog"
|
2
2
|
set :repository, "svn://rubyforge.org/var/svn/#{application}/trunk"
|
3
|
-
set :rails_env, :production
|
4
3
|
|
5
|
-
role :
|
6
|
-
role :
|
7
|
-
|
4
|
+
role :app, "sandra"
|
5
|
+
role :db, "sandra", :primary => true
|
6
|
+
|
7
|
+
set :deploy_to, "/usr/local/#{application}"
|
8
|
+
set :user, "capistrano"
|
8
9
|
|
9
|
-
set :user, "donv"
|
10
10
|
set :use_sudo, false
|
11
11
|
|
12
12
|
desc "The spinner task is used by :cold_deploy to start the application up"
|
@@ -17,11 +17,10 @@ config.action_view.debug_rjs = true
|
|
17
17
|
# Raise exceptions when mailer fails
|
18
18
|
config.action_mailer.raise_delivery_errors = true
|
19
19
|
|
20
|
-
|
21
|
-
ActionMailer::Base.delivery_method = :smtp
|
22
|
-
|
23
|
-
ActionMailer::Base.smtp_settings = {
|
24
|
-
:address => "mail.datek.no",
|
25
|
-
:port => 25
|
26
|
-
}
|
27
|
-
|
20
|
+
ActionMailer::Base.delivery_method = :sendmail
|
21
|
+
#ActionMailer::Base.delivery_method = :smtp
|
22
|
+
#
|
23
|
+
#ActionMailer::Base.smtp_settings = {
|
24
|
+
# :address => "mail.datek.no",
|
25
|
+
# :port => 25
|
26
|
+
#}
|
@@ -3,12 +3,29 @@ class CreateBacklogs < ActiveRecord::Migration
|
|
3
3
|
create_table :backlogs do |table|
|
4
4
|
table.column :name, :string, :limit => 32, :null => false
|
5
5
|
end
|
6
|
-
|
7
|
-
|
6
|
+
tasks_exist = Task.count > 0
|
7
|
+
if tasks_exist
|
8
|
+
default_backlog = Backlog.create! :name => 'Default Backlog'
|
9
|
+
add_column :tasks, :backlog_id, :integer, :null => false, :default => default_backlog.id
|
10
|
+
|
11
|
+
# TODO(uwe): This line is only needed because Rails 1.2 cannot set default to NULL
|
12
|
+
change_column_default :tasks, :backlog_id, 0
|
13
|
+
|
14
|
+
change_column_default :tasks, :backlog_id, nil
|
15
|
+
else
|
16
|
+
add_column :tasks, :backlog_id, :integer, :null => false
|
17
|
+
end
|
8
18
|
end
|
9
|
-
|
19
|
+
|
10
20
|
def self.down
|
11
21
|
remove_column :tasks, :backlog_id
|
12
22
|
drop_table :backlogs
|
13
23
|
end
|
24
|
+
|
25
|
+
class Task < ActiveRecord::Base
|
26
|
+
end
|
27
|
+
|
28
|
+
class Backlog < ActiveRecord::Base
|
29
|
+
end
|
30
|
+
|
14
31
|
end
|
@@ -3,7 +3,7 @@ class AddSubtasks < ActiveRecord::Migration
|
|
3
3
|
add_column :tasks, :parent_id, :integer, :references => :tasks
|
4
4
|
add_column :backlogs, :enable_subtasks, :boolean, :null => false, :default => false
|
5
5
|
end
|
6
|
-
|
6
|
+
|
7
7
|
def self.down
|
8
8
|
Task.find(:all).each do |task|
|
9
9
|
task.period_id = task.root_task.period_id
|
@@ -12,17 +12,18 @@ class AddSubtasks < ActiveRecord::Migration
|
|
12
12
|
remove_column :tasks, :parent_id
|
13
13
|
remove_column :backlogs, :enable_subtasks
|
14
14
|
end
|
15
|
-
end
|
16
|
-
|
17
|
-
class Task < ActiveRecord::Base
|
18
|
-
acts_as_tree :order => 'position'
|
19
15
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
class Task < ActiveRecord::Base
|
17
|
+
acts_as_tree :order => 'position'
|
18
|
+
|
19
|
+
def root_task
|
20
|
+
if parent
|
21
|
+
parent.root_task
|
22
|
+
else
|
23
|
+
self
|
24
|
+
end
|
25
25
|
end
|
26
|
+
|
26
27
|
end
|
27
|
-
|
28
|
+
|
28
29
|
end
|
@@ -64,7 +64,16 @@ class CreateGroups < ActiveRecord::Migration
|
|
64
64
|
remove_column :tasks, :backlog_id
|
65
65
|
remove_column :periods, :party_id
|
66
66
|
drop_table :groups_users
|
67
|
-
|
67
|
+
|
68
|
+
p User.foreign_keys
|
69
|
+
puts
|
70
|
+
p User.foreign_keys.select {|fk| fk.references_table_name == 'parties'}
|
71
|
+
puts
|
72
|
+
|
73
|
+
User.foreign_keys.select {|fk| fk.references_table_name == 'parties'}.each do |fk|
|
74
|
+
remove_foreign_key :users, fk.name
|
75
|
+
end
|
76
|
+
|
68
77
|
rename_column :users, :party_id, :id
|
69
78
|
drop_table :groups
|
70
79
|
drop_table :parties
|
data/db/schema.rb
CHANGED
@@ -85,68 +85,42 @@ ActiveRecord::Schema.define(:version => 18) do
|
|
85
85
|
|
86
86
|
add_foreign_key_constraint "estimates", "task_id", "tasks", "id", :name => "estimates_task_id_fkey", :on_update => nil, :on_delete => nil
|
87
87
|
add_foreign_key_constraint "estimates", "user_id", "users", "party_id", :name => "estimates_user_id_fkey", :on_update => nil, :on_delete => nil
|
88
|
-
add_foreign_key_constraint "estimates", "task_id", "tasks", "id", :name => "estimates_task_id_fkey1", :on_update => nil, :on_delete => nil
|
89
|
-
add_foreign_key_constraint "estimates", "user_id", "users", "party_id", :name => "estimates_user_id_fkey1", :on_update => nil, :on_delete => nil
|
90
88
|
|
91
89
|
add_foreign_key_constraint "groups", "party_id", "parties", "id", :name => "groups_party_id_fkey", :on_update => nil, :on_delete => nil
|
92
|
-
add_foreign_key_constraint "groups", "party_id", "parties", "id", :name => "groups_party_id_fkey1", :on_update => nil, :on_delete => nil
|
93
90
|
|
94
91
|
add_foreign_key_constraint "groups_users", "group_id", "groups", "party_id", :name => "groups_users_group_id_fkey", :on_update => nil, :on_delete => nil
|
95
92
|
add_foreign_key_constraint "groups_users", "user_id", "users", "party_id", :name => "groups_users_user_id_fkey", :on_update => nil, :on_delete => nil
|
96
|
-
add_foreign_key_constraint "groups_users", "group_id", "groups", "party_id", :name => "groups_users_group_id_fkey1", :on_update => nil, :on_delete => nil
|
97
|
-
add_foreign_key_constraint "groups_users", "user_id", "users", "party_id", :name => "groups_users_user_id_fkey1", :on_update => nil, :on_delete => nil
|
98
93
|
|
99
94
|
add_foreign_key_constraint "periods", "party_id", "parties", "id", :name => "periods_party_id_fkey", :on_update => nil, :on_delete => nil
|
100
|
-
add_foreign_key_constraint "periods", "party_id", "parties", "id", :name => "periods_party_id_fkey1", :on_update => nil, :on_delete => nil
|
101
95
|
|
102
96
|
add_foreign_key_constraint "tasks", "period_id", "periods", "id", :name => "tasks_period_id_fkey", :on_update => nil, :on_delete => nil
|
103
97
|
add_foreign_key_constraint "tasks", "parent_id", "tasks", "id", :name => "tasks_parent_id_fkey", :on_update => nil, :on_delete => nil
|
104
98
|
add_foreign_key_constraint "tasks", "previous_task_id", "tasks", "id", :name => "tasks_previous_task_id_fkey", :on_update => nil, :on_delete => nil
|
105
99
|
add_foreign_key_constraint "tasks", "backlog_id", "backlogs", "id", :name => "tasks_backlog_id_fkey", :on_update => nil, :on_delete => nil
|
106
|
-
add_foreign_key_constraint "tasks", "period_id", "periods", "id", :name => "tasks_period_id_fkey1", :on_update => nil, :on_delete => nil
|
107
|
-
add_foreign_key_constraint "tasks", "parent_id", "tasks", "id", :name => "tasks_parent_id_fkey1", :on_update => nil, :on_delete => nil
|
108
|
-
add_foreign_key_constraint "tasks", "previous_task_id", "tasks", "id", :name => "tasks_previous_task_id_fkey1", :on_update => nil, :on_delete => nil
|
109
|
-
add_foreign_key_constraint "tasks", "backlog_id", "backlogs", "id", :name => "tasks_backlog_id_fkey1", :on_update => nil, :on_delete => nil
|
110
100
|
|
111
101
|
add_foreign_key_constraint "users", "party_id", "parties", "id", :name => "users_party_id_fkey", :on_update => nil, :on_delete => nil
|
112
|
-
add_foreign_key_constraint "users", "party_id", "parties", "id", :name => "users_party_id_fkey1", :on_update => nil, :on_delete => nil
|
113
102
|
|
114
103
|
add_foreign_key_constraint "works", "task_id", "tasks", "id", :name => "works_task_id_fkey", :on_update => nil, :on_delete => nil
|
115
104
|
add_foreign_key_constraint "works", "user_id", "users", "party_id", :name => "works_user_id_fkey", :on_update => nil, :on_delete => nil
|
116
|
-
add_foreign_key_constraint "works", "task_id", "tasks", "id", :name => "works_task_id_fkey1", :on_update => nil, :on_delete => nil
|
117
|
-
add_foreign_key_constraint "works", "user_id", "users", "party_id", :name => "works_user_id_fkey1", :on_update => nil, :on_delete => nil
|
118
105
|
|
119
|
-
add_foreign_key "estimates", ["task_id"], "tasks", ["id"]
|
120
|
-
add_foreign_key "estimates", ["user_id"], "users", ["party_id"]
|
121
106
|
add_foreign_key "estimates", ["task_id"], "tasks", ["id"]
|
122
107
|
add_foreign_key "estimates", ["user_id"], "users", ["party_id"]
|
123
108
|
|
124
|
-
add_foreign_key "groups", ["party_id"], "parties", ["id"]
|
125
109
|
add_foreign_key "groups", ["party_id"], "parties", ["id"]
|
126
110
|
|
127
|
-
add_foreign_key "groups_users", ["group_id"], "groups", ["party_id"]
|
128
|
-
add_foreign_key "groups_users", ["user_id"], "users", ["party_id"]
|
129
111
|
add_foreign_key "groups_users", ["group_id"], "groups", ["party_id"]
|
130
112
|
add_foreign_key "groups_users", ["user_id"], "users", ["party_id"]
|
131
113
|
|
132
|
-
add_foreign_key "periods", ["party_id"], "parties", ["id"]
|
133
114
|
add_foreign_key "periods", ["party_id"], "parties", ["id"]
|
134
115
|
|
135
|
-
add_foreign_key "tasks", ["period_id"], "periods", ["id"]
|
136
|
-
add_foreign_key "tasks", ["parent_id"], "tasks", ["id"]
|
137
|
-
add_foreign_key "tasks", ["previous_task_id"], "tasks", ["id"]
|
138
|
-
add_foreign_key "tasks", ["backlog_id"], "backlogs", ["id"]
|
139
116
|
add_foreign_key "tasks", ["period_id"], "periods", ["id"]
|
140
117
|
add_foreign_key "tasks", ["parent_id"], "tasks", ["id"]
|
141
118
|
add_foreign_key "tasks", ["previous_task_id"], "tasks", ["id"]
|
142
119
|
add_foreign_key "tasks", ["backlog_id"], "backlogs", ["id"]
|
143
120
|
|
144
|
-
add_foreign_key "users", ["party_id"], "parties", ["id"]
|
145
121
|
add_foreign_key "users", ["party_id"], "parties", ["id"]
|
146
122
|
|
147
123
|
add_foreign_key "works", ["task_id"], "tasks", ["id"]
|
148
124
|
add_foreign_key "works", ["user_id"], "users", ["party_id"]
|
149
|
-
add_foreign_key "works", ["task_id"], "tasks", ["id"]
|
150
|
-
add_foreign_key "works", ["user_id"], "users", ["party_id"]
|
151
125
|
|
152
126
|
end
|
data/lib/user_system.rb
CHANGED
@@ -8,7 +8,7 @@ module UserSystem
|
|
8
8
|
#
|
9
9
|
def authenticate_user
|
10
10
|
return true if authenticated_user?
|
11
|
-
|
11
|
+
store_detour_from_params
|
12
12
|
access_denied
|
13
13
|
return false
|
14
14
|
end
|
@@ -34,8 +34,8 @@ module UserSystem
|
|
34
34
|
def authenticated_user?
|
35
35
|
if session[:user_id]
|
36
36
|
@current_user = User.find_by_id(session[:user_id])
|
37
|
-
return
|
38
|
-
|
37
|
+
return true if @current_user
|
38
|
+
session[:user_id]
|
39
39
|
end
|
40
40
|
|
41
41
|
if cookie = cookies[:autologin]
|