Commit 95c23b2f974ec15e89cd7e762c80af0fa0ce57a5

Authored by Dmitriy Zaporozhets
1 parent c3b074ac

Annotated. schema updated

app/models/event.rb
  1 +# == Schema Information
  2 +#
  3 +# Table name: events
  4 +#
  5 +# id :integer not null, primary key
  6 +# target_type :string(255)
  7 +# target_id :integer
  8 +# title :string(255)
  9 +# data :text
  10 +# project_id :integer
  11 +# created_at :datetime not null
  12 +# updated_at :datetime not null
  13 +# action :integer
  14 +# author_id :integer
  15 +#
  16 +
1 class Event < ActiveRecord::Base 17 class Event < ActiveRecord::Base
2 include PushEvent 18 include PushEvent
3 19
@@ -144,20 +160,3 @@ class Event &lt; ActiveRecord::Base @@ -144,20 +160,3 @@ class Event &lt; ActiveRecord::Base
144 end 160 end
145 end 161 end
146 end 162 end
147 -  
148 -# == Schema Information  
149 -#  
150 -# Table name: events  
151 -#  
152 -# id :integer not null, primary key  
153 -# target_type :string(255)  
154 -# target_id :integer  
155 -# title :string(255)  
156 -# data :text  
157 -# project_id :integer  
158 -# created_at :datetime not null  
159 -# updated_at :datetime not null  
160 -# action :integer  
161 -# author_id :integer  
162 -#  
163 -  
app/models/group.rb
  1 +# == Schema Information
  2 +#
  3 +# Table name: groups
  4 +#
  5 +# id :integer not null, primary key
  6 +# name :string(255) not null
  7 +# code :string(255) not null
  8 +# owner_id :integer not null
  9 +# created_at :datetime not null
  10 +# updated_at :datetime not null
  11 +#
  12 +
1 class Group < ActiveRecord::Base 13 class Group < ActiveRecord::Base
2 attr_accessible :code, :name, :owner_id 14 attr_accessible :code, :name, :owner_id
3 15
@@ -22,16 +34,3 @@ class Group &lt; ActiveRecord::Base @@ -22,16 +34,3 @@ class Group &lt; ActiveRecord::Base
22 User.joins(:users_projects).where(users_projects: {project_id: project_ids}).uniq 34 User.joins(:users_projects).where(users_projects: {project_id: project_ids}).uniq
23 end 35 end
24 end 36 end
25 -  
26 -# == Schema Information  
27 -#  
28 -# Table name: groups  
29 -#  
30 -# id :integer not null, primary key  
31 -# name :string(255) not null  
32 -# code :string(255) not null  
33 -# owner_id :integer not null  
34 -# created_at :datetime not null  
35 -# updated_at :datetime not null  
36 -#  
37 -  
app/models/issue.rb
  1 +# == Schema Information
  2 +#
  3 +# Table name: issues
  4 +#
  5 +# id :integer not null, primary key
  6 +# title :string(255)
  7 +# assignee_id :integer
  8 +# author_id :integer
  9 +# project_id :integer
  10 +# created_at :datetime not null
  11 +# updated_at :datetime not null
  12 +# closed :boolean default(FALSE), not null
  13 +# position :integer default(0)
  14 +# branch_name :string(255)
  15 +# description :text
  16 +# milestone_id :integer
  17 +#
  18 +
1 class Issue < ActiveRecord::Base 19 class Issue < ActiveRecord::Base
2 include IssueCommonality 20 include IssueCommonality
3 include Votes 21 include Votes
@@ -13,22 +31,3 @@ class Issue &lt; ActiveRecord::Base @@ -13,22 +31,3 @@ class Issue &lt; ActiveRecord::Base
13 opened.assigned(user) 31 opened.assigned(user)
14 end 32 end
15 end 33 end
16 -  
17 -# == Schema Information  
18 -#  
19 -# Table name: issues  
20 -#  
21 -# id :integer not null, primary key  
22 -# title :string(255)  
23 -# assignee_id :integer  
24 -# author_id :integer  
25 -# project_id :integer  
26 -# created_at :datetime not null  
27 -# updated_at :datetime not null  
28 -# closed :boolean default(FALSE), not null  
29 -# position :integer default(0)  
30 -# branch_name :string(255)  
31 -# description :text  
32 -# milestone_id :integer  
33 -#  
34 -  
app/models/key.rb
  1 +# == Schema Information
  2 +#
  3 +# Table name: keys
  4 +#
  5 +# id :integer not null, primary key
  6 +# user_id :integer
  7 +# created_at :datetime not null
  8 +# updated_at :datetime not null
  9 +# key :text
  10 +# title :string(255)
  11 +# identifier :string(255)
  12 +# project_id :integer
  13 +#
  14 +
1 require 'digest/md5' 15 require 'digest/md5'
2 16
3 class Key < ActiveRecord::Base 17 class Key < ActiveRecord::Base
@@ -67,18 +81,3 @@ class Key &lt; ActiveRecord::Base @@ -67,18 +81,3 @@ class Key &lt; ActiveRecord::Base
67 Key.where(identifier: identifier).count == 0 81 Key.where(identifier: identifier).count == 0
68 end 82 end
69 end 83 end
70 -  
71 -# == Schema Information  
72 -#  
73 -# Table name: keys  
74 -#  
75 -# id :integer not null, primary key  
76 -# user_id :integer  
77 -# created_at :datetime not null  
78 -# updated_at :datetime not null  
79 -# key :text  
80 -# title :string(255)  
81 -# identifier :string(255)  
82 -# project_id :integer  
83 -#  
84 -  
app/models/merge_request.rb
  1 +# == Schema Information
  2 +#
  3 +# Table name: merge_requests
  4 +#
  5 +# id :integer not null, primary key
  6 +# target_branch :string(255) not null
  7 +# source_branch :string(255) not null
  8 +# project_id :integer not null
  9 +# author_id :integer
  10 +# assignee_id :integer
  11 +# title :string(255)
  12 +# closed :boolean default(FALSE), not null
  13 +# created_at :datetime not null
  14 +# updated_at :datetime not null
  15 +# st_commits :text(2147483647)
  16 +# st_diffs :text(2147483647)
  17 +# merged :boolean default(FALSE), not null
  18 +# state :integer default(1), not null
  19 +# milestone_id :integer
  20 +#
  21 +
1 require Rails.root.join("app/models/commit") 22 require Rails.root.join("app/models/commit")
2 require Rails.root.join("app/roles/static_model") 23 require Rails.root.join("app/roles/static_model")
3 24
@@ -198,25 +219,3 @@ class MergeRequest &lt; ActiveRecord::Base @@ -198,25 +219,3 @@ class MergeRequest &lt; ActiveRecord::Base
198 Note.where("(noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR (noteable_type = 'Commit' AND noteable_id IN (:commit_ids))", mr_id: id, commit_ids: commit_ids) 219 Note.where("(noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR (noteable_type = 'Commit' AND noteable_id IN (:commit_ids))", mr_id: id, commit_ids: commit_ids)
199 end 220 end
200 end 221 end
201 -  
202 -# == Schema Information  
203 -#  
204 -# Table name: merge_requests  
205 -#  
206 -# id :integer not null, primary key  
207 -# target_branch :string(255) not null  
208 -# source_branch :string(255) not null  
209 -# project_id :integer not null  
210 -# author_id :integer  
211 -# assignee_id :integer  
212 -# title :string(255)  
213 -# closed :boolean default(FALSE), not null  
214 -# created_at :datetime not null  
215 -# updated_at :datetime not null  
216 -# st_commits :text(4294967295  
217 -# st_diffs :text(4294967295  
218 -# merged :boolean default(FALSE), not null  
219 -# state :integer default(1), not null  
220 -# milestone_id :integer  
221 -#  
222 -  
app/models/milestone.rb
  1 +# == Schema Information
  2 +#
  3 +# Table name: milestones
  4 +#
  5 +# id :integer not null, primary key
  6 +# title :string(255) not null
  7 +# project_id :integer not null
  8 +# description :text
  9 +# due_date :date
  10 +# closed :boolean default(FALSE), not null
  11 +# created_at :datetime not null
  12 +# updated_at :datetime not null
  13 +#
  14 +
1 class Milestone < ActiveRecord::Base 15 class Milestone < ActiveRecord::Base
2 attr_accessible :title, :description, :due_date, :closed 16 attr_accessible :title, :description, :due_date, :closed
3 17
@@ -39,18 +53,3 @@ class Milestone &lt; ActiveRecord::Base @@ -39,18 +53,3 @@ class Milestone &lt; ActiveRecord::Base
39 "expires at #{due_date.stamp("Aug 21, 2011")}" if due_date 53 "expires at #{due_date.stamp("Aug 21, 2011")}" if due_date
40 end 54 end
41 end 55 end
42 -  
43 -# == Schema Information  
44 -#  
45 -# Table name: milestones  
46 -#  
47 -# id :integer not null, primary key  
48 -# title :string(255) not null  
49 -# project_id :integer not null  
50 -# description :text  
51 -# due_date :date  
52 -# closed :boolean default(FALSE), not null  
53 -# created_at :datetime not null  
54 -# updated_at :datetime not null  
55 -#  
56 -  
app/models/note.rb
  1 +# == Schema Information
  2 +#
  3 +# Table name: notes
  4 +#
  5 +# id :integer not null, primary key
  6 +# note :text
  7 +# noteable_id :string(255)
  8 +# noteable_type :string(255)
  9 +# author_id :integer
  10 +# created_at :datetime not null
  11 +# updated_at :datetime not null
  12 +# project_id :integer
  13 +# attachment :string(255)
  14 +# line_code :string(255)
  15 +#
  16 +
1 require 'carrierwave/orm/activerecord' 17 require 'carrierwave/orm/activerecord'
2 require 'file_size_validator' 18 require 'file_size_validator'
3 19
@@ -107,20 +123,3 @@ class Note &lt; ActiveRecord::Base @@ -107,20 +123,3 @@ class Note &lt; ActiveRecord::Base
107 note.start_with?('-1') || note.start_with?(':-1:') 123 note.start_with?('-1') || note.start_with?(':-1:')
108 end 124 end
109 end 125 end
110 -  
111 -# == Schema Information  
112 -#  
113 -# Table name: notes  
114 -#  
115 -# id :integer not null, primary key  
116 -# note :text  
117 -# noteable_id :string(255)  
118 -# noteable_type :string(255)  
119 -# author_id :integer  
120 -# created_at :datetime not null  
121 -# updated_at :datetime not null  
122 -# project_id :integer  
123 -# attachment :string(255)  
124 -# line_code :string(255)  
125 -#  
126 -  
app/models/project.rb
  1 +# == Schema Information
  2 +#
  3 +# Table name: projects
  4 +#
  5 +# id :integer not null, primary key
  6 +# name :string(255)
  7 +# path :string(255)
  8 +# description :text
  9 +# created_at :datetime not null
  10 +# updated_at :datetime not null
  11 +# private_flag :boolean default(TRUE), not null
  12 +# code :string(255)
  13 +# owner_id :integer
  14 +# default_branch :string(255)
  15 +# issues_enabled :boolean default(TRUE), not null
  16 +# wall_enabled :boolean default(TRUE), not null
  17 +# merge_requests_enabled :boolean default(TRUE), not null
  18 +# wiki_enabled :boolean default(TRUE), not null
  19 +# group_id :integer
  20 +#
  21 +
1 require "grit" 22 require "grit"
2 23
3 class Project < ActiveRecord::Base 24 class Project < ActiveRecord::Base
@@ -26,6 +47,7 @@ class Project &lt; ActiveRecord::Base @@ -26,6 +47,7 @@ class Project &lt; ActiveRecord::Base
26 has_many :wikis, dependent: :destroy 47 has_many :wikis, dependent: :destroy
27 has_many :protected_branches, dependent: :destroy 48 has_many :protected_branches, dependent: :destroy
28 has_one :last_event, class_name: 'Event', order: 'events.created_at DESC', foreign_key: 'project_id' 49 has_one :last_event, class_name: 'Event', order: 'events.created_at DESC', foreign_key: 'project_id'
  50 + has_many :services, dependent: :destroy
29 51
30 delegate :name, to: :owner, allow_nil: true, prefix: true 52 delegate :name, to: :owner, allow_nil: true, prefix: true
31 53
@@ -163,25 +185,3 @@ class Project &lt; ActiveRecord::Base @@ -163,25 +185,3 @@ class Project &lt; ActiveRecord::Base
163 issues.tag_counts_on(:labels) 185 issues.tag_counts_on(:labels)
164 end 186 end
165 end 187 end
166 -  
167 -# == Schema Information  
168 -#  
169 -# Table name: projects  
170 -#  
171 -# id :integer not null, primary key  
172 -# name :string(255)  
173 -# path :string(255)  
174 -# description :text  
175 -# created_at :datetime not null  
176 -# updated_at :datetime not null  
177 -# private_flag :boolean default(TRUE), not null  
178 -# code :string(255)  
179 -# owner_id :integer  
180 -# default_branch :string(255)  
181 -# issues_enabled :boolean default(TRUE), not null  
182 -# wall_enabled :boolean default(TRUE), not null  
183 -# merge_requests_enabled :boolean default(TRUE), not null  
184 -# wiki_enabled :boolean default(TRUE), not null  
185 -# group_id :integer  
186 -#  
187 -  
app/models/project_hook.rb
1 -class ProjectHook < WebHook  
2 - belongs_to :project  
3 -end  
4 -  
5 # == Schema Information 1 # == Schema Information
6 # 2 #
7 # Table name: web_hooks 3 # Table name: web_hooks
8 # 4 #
9 -# id :integer not null, primary key 5 +# id :integer not null, primary key
10 # url :string(255) 6 # url :string(255)
11 # project_id :integer 7 # project_id :integer
12 -# created_at :datetime not null  
13 -# updated_at :datetime not null  
14 -# type :string(255) default("ProjectHook") 8 +# created_at :datetime not null
  9 +# updated_at :datetime not null
  10 +# type :string(255) default("ProjectHook")
15 # 11 #
16 12
  13 +class ProjectHook < WebHook
  14 + belongs_to :project
  15 +end
app/models/protected_branch.rb
  1 +# == Schema Information
  2 +#
  3 +# Table name: protected_branches
  4 +#
  5 +# id :integer not null, primary key
  6 +# project_id :integer not null
  7 +# name :string(255) not null
  8 +# created_at :datetime not null
  9 +# updated_at :datetime not null
  10 +#
  11 +
1 class ProtectedBranch < ActiveRecord::Base 12 class ProtectedBranch < ActiveRecord::Base
2 include GitHost 13 include GitHost
3 14
@@ -18,15 +29,3 @@ class ProtectedBranch &lt; ActiveRecord::Base @@ -18,15 +29,3 @@ class ProtectedBranch &lt; ActiveRecord::Base
18 project.commit(self.name) 29 project.commit(self.name)
19 end 30 end
20 end 31 end
21 -  
22 -# == Schema Information  
23 -#  
24 -# Table name: protected_branches  
25 -#  
26 -# id :integer not null, primary key  
27 -# project_id :integer not null  
28 -# name :string(255) not null  
29 -# created_at :datetime not null  
30 -# updated_at :datetime not null  
31 -#  
32 -  
app/models/snippet.rb
  1 +# == Schema Information
  2 +#
  3 +# Table name: snippets
  4 +#
  5 +# id :integer not null, primary key
  6 +# title :string(255)
  7 +# content :text
  8 +# author_id :integer not null
  9 +# project_id :integer not null
  10 +# created_at :datetime not null
  11 +# updated_at :datetime not null
  12 +# file_name :string(255)
  13 +# expires_at :datetime
  14 +#
  15 +
1 class Snippet < ActiveRecord::Base 16 class Snippet < ActiveRecord::Base
2 include Linguist::BlobHelper 17 include Linguist::BlobHelper
3 18
@@ -48,19 +63,3 @@ class Snippet &lt; ActiveRecord::Base @@ -48,19 +63,3 @@ class Snippet &lt; ActiveRecord::Base
48 expires_at && expires_at < Time.current 63 expires_at && expires_at < Time.current
49 end 64 end
50 end 65 end
51 -  
52 -# == Schema Information  
53 -#  
54 -# Table name: snippets  
55 -#  
56 -# id :integer not null, primary key  
57 -# title :string(255)  
58 -# content :text  
59 -# author_id :integer not null  
60 -# project_id :integer not null  
61 -# created_at :datetime not null  
62 -# updated_at :datetime not null  
63 -# file_name :string(255)  
64 -# expires_at :datetime  
65 -#  
66 -  
app/models/system_hook.rb
  1 +# == Schema Information
  2 +#
  3 +# Table name: web_hooks
  4 +#
  5 +# id :integer not null, primary key
  6 +# url :string(255)
  7 +# project_id :integer
  8 +# created_at :datetime not null
  9 +# updated_at :datetime not null
  10 +# type :string(255) default("ProjectHook")
  11 +#
  12 +
1 class SystemHook < WebHook 13 class SystemHook < WebHook
2 def self.all_hooks_fire(data) 14 def self.all_hooks_fire(data)
3 SystemHook.all.each do |sh| 15 SystemHook.all.each do |sh|
@@ -9,16 +21,3 @@ class SystemHook &lt; WebHook @@ -9,16 +21,3 @@ class SystemHook &lt; WebHook
9 Resque.enqueue(SystemHookWorker, id, data) 21 Resque.enqueue(SystemHookWorker, id, data)
10 end 22 end
11 end 23 end
12 -  
13 -# == Schema Information  
14 -#  
15 -# Table name: web_hooks  
16 -#  
17 -# id :integer not null, primary key  
18 -# url :string(255)  
19 -# project_id :integer  
20 -# created_at :datetime not null  
21 -# updated_at :datetime not null  
22 -# type :string(255) default("ProjectHook")  
23 -#  
24 -  
app/models/user.rb
  1 +# == Schema Information
  2 +#
  3 +# Table name: users
  4 +#
  5 +# id :integer not null, primary key
  6 +# email :string(255) default(""), not null
  7 +# encrypted_password :string(255) default(""), not null
  8 +# reset_password_token :string(255)
  9 +# reset_password_sent_at :datetime
  10 +# remember_created_at :datetime
  11 +# sign_in_count :integer default(0)
  12 +# current_sign_in_at :datetime
  13 +# last_sign_in_at :datetime
  14 +# current_sign_in_ip :string(255)
  15 +# last_sign_in_ip :string(255)
  16 +# created_at :datetime not null
  17 +# updated_at :datetime not null
  18 +# name :string(255)
  19 +# admin :boolean default(FALSE), not null
  20 +# projects_limit :integer default(10)
  21 +# skype :string(255) default(""), not null
  22 +# linkedin :string(255) default(""), not null
  23 +# twitter :string(255) default(""), not null
  24 +# authentication_token :string(255)
  25 +# dark_scheme :boolean default(FALSE), not null
  26 +# theme_id :integer default(1), not null
  27 +# bio :string(255)
  28 +# blocked :boolean default(FALSE), not null
  29 +# failed_attempts :integer default(0)
  30 +# locked_at :datetime
  31 +# extern_uid :string(255)
  32 +# provider :string(255)
  33 +#
  34 +
1 class User < ActiveRecord::Base 35 class User < ActiveRecord::Base
2 include Account 36 include Account
3 37
@@ -79,38 +113,3 @@ class User &lt; ActiveRecord::Base @@ -79,38 +113,3 @@ class User &lt; ActiveRecord::Base
79 end 113 end
80 end 114 end
81 end 115 end
82 -  
83 -# == Schema Information  
84 -#  
85 -# Table name: users  
86 -#  
87 -# id :integer not null, primary key  
88 -# email :string(255) default(""), not null  
89 -# encrypted_password :string(128) default(""), not null  
90 -# reset_password_token :string(255)  
91 -# reset_password_sent_at :datetime  
92 -# remember_created_at :datetime  
93 -# sign_in_count :integer default(0)  
94 -# current_sign_in_at :datetime  
95 -# last_sign_in_at :datetime  
96 -# current_sign_in_ip :string(255)  
97 -# last_sign_in_ip :string(255)  
98 -# created_at :datetime not null  
99 -# updated_at :datetime not null  
100 -# name :string(255)  
101 -# admin :boolean default(FALSE), not null  
102 -# projects_limit :integer default(10)  
103 -# skype :string(255) default(""), not null  
104 -# linkedin :string(255) default(""), not null  
105 -# twitter :string(255) default(""), not null  
106 -# authentication_token :string(255)  
107 -# dark_scheme :boolean default(FALSE), not null  
108 -# theme_id :integer default(1), not null  
109 -# bio :string(255)  
110 -# blocked :boolean default(FALSE), not null  
111 -# failed_attempts :integer default(0)  
112 -# locked_at :datetime  
113 -# extern_uid :string(255)  
114 -# provider :string(255)  
115 -#  
116 -  
app/models/users_project.rb
  1 +# == Schema Information
  2 +#
  3 +# Table name: users_projects
  4 +#
  5 +# id :integer not null, primary key
  6 +# user_id :integer not null
  7 +# project_id :integer not null
  8 +# created_at :datetime not null
  9 +# updated_at :datetime not null
  10 +# project_access :integer default(0), not null
  11 +#
  12 +
1 class UsersProject < ActiveRecord::Base 13 class UsersProject < ActiveRecord::Base
2 include GitHost 14 include GitHost
3 15
@@ -119,16 +131,3 @@ class UsersProject &lt; ActiveRecord::Base @@ -119,16 +131,3 @@ class UsersProject &lt; ActiveRecord::Base
119 self.class.access_roles.invert[self.project_access] 131 self.class.access_roles.invert[self.project_access]
120 end 132 end
121 end 133 end
122 -  
123 -# == Schema Information  
124 -#  
125 -# Table name: users_projects  
126 -#  
127 -# id :integer not null, primary key  
128 -# user_id :integer not null  
129 -# project_id :integer not null  
130 -# created_at :datetime not null  
131 -# updated_at :datetime not null  
132 -# project_access :integer default(0), not null  
133 -#  
134 -  
app/models/web_hook.rb
  1 +# == Schema Information
  2 +#
  3 +# Table name: web_hooks
  4 +#
  5 +# id :integer not null, primary key
  6 +# url :string(255)
  7 +# project_id :integer
  8 +# created_at :datetime not null
  9 +# updated_at :datetime not null
  10 +# type :string(255) default("ProjectHook")
  11 +#
  12 +
1 class WebHook < ActiveRecord::Base 13 class WebHook < ActiveRecord::Base
2 include HTTParty 14 include HTTParty
3 15
@@ -22,16 +34,3 @@ class WebHook &lt; ActiveRecord::Base @@ -22,16 +34,3 @@ class WebHook &lt; ActiveRecord::Base
22 end 34 end
23 end 35 end
24 end 36 end
25 -  
26 -# == Schema Information  
27 -#  
28 -# Table name: web_hooks  
29 -#  
30 -# id :integer not null, primary key  
31 -# url :string(255)  
32 -# project_id :integer  
33 -# created_at :datetime not null  
34 -# updated_at :datetime not null  
35 -# type :string(255) default("ProjectHook")  
36 -#  
37 -  
app/models/wiki.rb
  1 +# == Schema Information
  2 +#
  3 +# Table name: wikis
  4 +#
  5 +# id :integer not null, primary key
  6 +# title :string(255)
  7 +# content :text
  8 +# project_id :integer
  9 +# created_at :datetime not null
  10 +# updated_at :datetime not null
  11 +# slug :string(255)
  12 +# user_id :integer
  13 +#
  14 +
1 class Wiki < ActiveRecord::Base 15 class Wiki < ActiveRecord::Base
2 attr_accessible :title, :content, :slug 16 attr_accessible :title, :content, :slug
3 17
@@ -38,18 +52,3 @@ class Wiki &lt; ActiveRecord::Base @@ -38,18 +52,3 @@ class Wiki &lt; ActiveRecord::Base
38 end 52 end
39 53
40 end 54 end
41 -  
42 -# == Schema Information  
43 -#  
44 -# Table name: wikis  
45 -#  
46 -# id :integer not null, primary key  
47 -# title :string(255)  
48 -# content :text  
49 -# project_id :integer  
50 -# created_at :datetime not null  
51 -# updated_at :datetime not null  
52 -# slug :string(255)  
53 -# user_id :integer  
54 -#  
55 -  
app/views/projects/_form.html.haml
@@ -10,9 +10,8 @@ @@ -10,9 +10,8 @@
10 .input 10 .input
11 = f.text_field :name, placeholder: "Example Project", class: "xxlarge" 11 = f.text_field :name, placeholder: "Example Project", class: "xxlarge"
12 12
13 - %hr  
14 - .adv_settings  
15 - %h6 Advanced settings: 13 + %fieldset
  14 + %legend Advanced settings:
16 .clearfix 15 .clearfix
17 = f.label :path do 16 = f.label :path do
18 Path 17 Path
@@ -34,9 +33,8 @@ @@ -34,9 +33,8 @@
34 .input= f.select(:default_branch, @project.heads.map(&:name), {}, style: "width:210px;") 33 .input= f.select(:default_branch, @project.heads.map(&:name), {}, style: "width:210px;")
35 34
36 - unless @project.new_record? 35 - unless @project.new_record?
37 - %hr  
38 - .adv_settings  
39 - %h6 Features: 36 + %fieldset
  37 + %legend Features:
40 38
41 .clearfix 39 .clearfix
42 = f.label :issues_enabled, "Issues" 40 = f.label :issues_enabled, "Issues"
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 # 11 #
12 # It's strongly recommended to check this file into your version control system. 12 # It's strongly recommended to check this file into your version control system.
13 13
14 -ActiveRecord::Schema.define(:version => 20121026114600) do 14 +ActiveRecord::Schema.define(:version => 20121120051432) do
15 15
16 create_table "events", :force => true do |t| 16 create_table "events", :force => true do |t|
17 t.string "target_type" 17 t.string "target_type"
@@ -127,6 +127,15 @@ ActiveRecord::Schema.define(:version =&gt; 20121026114600) do @@ -127,6 +127,15 @@ ActiveRecord::Schema.define(:version =&gt; 20121026114600) do
127 t.datetime "updated_at", :null => false 127 t.datetime "updated_at", :null => false
128 end 128 end
129 129
  130 + create_table "services", :force => true do |t|
  131 + t.string "type"
  132 + t.string "title"
  133 + t.string "token"
  134 + t.integer "project_id", :null => false
  135 + t.datetime "created_at", :null => false
  136 + t.datetime "updated_at", :null => false
  137 + end
  138 +
130 create_table "snippets", :force => true do |t| 139 create_table "snippets", :force => true do |t|
131 t.string "title" 140 t.string "title"
132 t.text "content" 141 t.text "content"
@@ -203,6 +212,7 @@ ActiveRecord::Schema.define(:version =&gt; 20121026114600) do @@ -203,6 +212,7 @@ ActiveRecord::Schema.define(:version =&gt; 20121026114600) do
203 t.datetime "created_at", :null => false 212 t.datetime "created_at", :null => false
204 t.datetime "updated_at", :null => false 213 t.datetime "updated_at", :null => false
205 t.string "type", :default => "ProjectHook" 214 t.string "type", :default => "ProjectHook"
  215 + t.integer "service_id"
206 end 216 end
207 217
208 create_table "wikis", :force => true do |t| 218 create_table "wikis", :force => true do |t|
spec/factories.rb
@@ -132,4 +132,16 @@ FactoryGirl.define do @@ -132,4 +132,16 @@ FactoryGirl.define do
132 name 132 name
133 project 133 project
134 end 134 end
  135 +
  136 + factory :service do
  137 + type ""
  138 + title "GitLab CI"
  139 + token "x56olispAND34ng"
  140 + project
  141 + end
  142 +
  143 + factory :service_hook do
  144 + url
  145 + service
  146 + end
135 end 147 end
spec/models/event_spec.rb
@@ -2,14 +2,14 @@ @@ -2,14 +2,14 @@
2 # 2 #
3 # Table name: events 3 # Table name: events
4 # 4 #
5 -# id :integer not null, primary key 5 +# id :integer not null, primary key
6 # target_type :string(255) 6 # target_type :string(255)
7 # target_id :integer 7 # target_id :integer
8 # title :string(255) 8 # title :string(255)
9 # data :text 9 # data :text
10 # project_id :integer 10 # project_id :integer
11 -# created_at :datetime not null  
12 -# updated_at :datetime not null 11 +# created_at :datetime not null
  12 +# updated_at :datetime not null
13 # action :integer 13 # action :integer
14 # author_id :integer 14 # author_id :integer
15 # 15 #
spec/models/group_spec.rb
@@ -2,12 +2,12 @@ @@ -2,12 +2,12 @@
2 # 2 #
3 # Table name: groups 3 # Table name: groups
4 # 4 #
5 -# id :integer not null, primary key  
6 -# name :string(255) not null  
7 -# code :string(255) not null  
8 -# owner_id :integer not null  
9 -# created_at :datetime not null  
10 -# updated_at :datetime not null 5 +# id :integer not null, primary key
  6 +# name :string(255) not null
  7 +# code :string(255) not null
  8 +# owner_id :integer not null
  9 +# created_at :datetime not null
  10 +# updated_at :datetime not null
11 # 11 #
12 12
13 require 'spec_helper' 13 require 'spec_helper'
spec/models/issue_spec.rb
@@ -2,15 +2,15 @@ @@ -2,15 +2,15 @@
2 # 2 #
3 # Table name: issues 3 # Table name: issues
4 # 4 #
5 -# id :integer not null, primary key 5 +# id :integer not null, primary key
6 # title :string(255) 6 # title :string(255)
7 # assignee_id :integer 7 # assignee_id :integer
8 # author_id :integer 8 # author_id :integer
9 # project_id :integer 9 # project_id :integer
10 -# created_at :datetime not null  
11 -# updated_at :datetime not null  
12 -# closed :boolean default(FALSE), not null  
13 -# position :integer default(0) 10 +# created_at :datetime not null
  11 +# updated_at :datetime not null
  12 +# closed :boolean default(FALSE), not null
  13 +# position :integer default(0)
14 # branch_name :string(255) 14 # branch_name :string(255)
15 # description :text 15 # description :text
16 # milestone_id :integer 16 # milestone_id :integer
spec/models/key_spec.rb
@@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
2 # 2 #
3 # Table name: keys 3 # Table name: keys
4 # 4 #
5 -# id :integer not null, primary key 5 +# id :integer not null, primary key
6 # user_id :integer 6 # user_id :integer
7 -# created_at :datetime not null  
8 -# updated_at :datetime not null 7 +# created_at :datetime not null
  8 +# updated_at :datetime not null
9 # key :text 9 # key :text
10 # title :string(255) 10 # title :string(255)
11 # identifier :string(255) 11 # identifier :string(255)
spec/models/merge_request_spec.rb
@@ -2,20 +2,20 @@ @@ -2,20 +2,20 @@
2 # 2 #
3 # Table name: merge_requests 3 # Table name: merge_requests
4 # 4 #
5 -# id :integer not null, primary key  
6 -# target_branch :string(255) not null  
7 -# source_branch :string(255) not null  
8 -# project_id :integer not null 5 +# id :integer not null, primary key
  6 +# target_branch :string(255) not null
  7 +# source_branch :string(255) not null
  8 +# project_id :integer not null
9 # author_id :integer 9 # author_id :integer
10 # assignee_id :integer 10 # assignee_id :integer
11 # title :string(255) 11 # title :string(255)
12 -# closed :boolean default(FALSE), not null  
13 -# created_at :datetime not null  
14 -# updated_at :datetime not null  
15 -# st_commits :text(4294967295  
16 -# st_diffs :text(4294967295  
17 -# merged :boolean default(FALSE), not null  
18 -# state :integer default(1), not null 12 +# closed :boolean default(FALSE), not null
  13 +# created_at :datetime not null
  14 +# updated_at :datetime not null
  15 +# st_commits :text(2147483647)
  16 +# st_diffs :text(2147483647)
  17 +# merged :boolean default(FALSE), not null
  18 +# state :integer default(1), not null
19 # milestone_id :integer 19 # milestone_id :integer
20 # 20 #
21 21
spec/models/milestone_spec.rb
@@ -2,14 +2,14 @@ @@ -2,14 +2,14 @@
2 # 2 #
3 # Table name: milestones 3 # Table name: milestones
4 # 4 #
5 -# id :integer not null, primary key  
6 -# title :string(255) not null  
7 -# project_id :integer not null 5 +# id :integer not null, primary key
  6 +# title :string(255) not null
  7 +# project_id :integer not null
8 # description :text 8 # description :text
9 # due_date :date 9 # due_date :date
10 -# closed :boolean default(FALSE), not null  
11 -# created_at :datetime not null  
12 -# updated_at :datetime not null 10 +# closed :boolean default(FALSE), not null
  11 +# created_at :datetime not null
  12 +# updated_at :datetime not null
13 # 13 #
14 14
15 require 'spec_helper' 15 require 'spec_helper'
spec/models/note_spec.rb
@@ -2,13 +2,13 @@ @@ -2,13 +2,13 @@
2 # 2 #
3 # Table name: notes 3 # Table name: notes
4 # 4 #
5 -# id :integer not null, primary key 5 +# id :integer not null, primary key
6 # note :text 6 # note :text
7 # noteable_id :string(255) 7 # noteable_id :string(255)
8 # noteable_type :string(255) 8 # noteable_type :string(255)
9 # author_id :integer 9 # author_id :integer
10 -# created_at :datetime not null  
11 -# updated_at :datetime not null 10 +# created_at :datetime not null
  11 +# updated_at :datetime not null
12 # project_id :integer 12 # project_id :integer
13 # attachment :string(255) 13 # attachment :string(255)
14 # line_code :string(255) 14 # line_code :string(255)
spec/models/project_spec.rb
@@ -2,20 +2,20 @@ @@ -2,20 +2,20 @@
2 # 2 #
3 # Table name: projects 3 # Table name: projects
4 # 4 #
5 -# id :integer not null, primary key 5 +# id :integer not null, primary key
6 # name :string(255) 6 # name :string(255)
7 # path :string(255) 7 # path :string(255)
8 # description :text 8 # description :text
9 -# created_at :datetime not null  
10 -# updated_at :datetime not null  
11 -# private_flag :boolean default(TRUE), not null 9 +# created_at :datetime not null
  10 +# updated_at :datetime not null
  11 +# private_flag :boolean default(TRUE), not null
12 # code :string(255) 12 # code :string(255)
13 # owner_id :integer 13 # owner_id :integer
14 # default_branch :string(255) 14 # default_branch :string(255)
15 -# issues_enabled :boolean default(TRUE), not null  
16 -# wall_enabled :boolean default(TRUE), not null  
17 -# merge_requests_enabled :boolean default(TRUE), not null  
18 -# wiki_enabled :boolean default(TRUE), not null 15 +# issues_enabled :boolean default(TRUE), not null
  16 +# wall_enabled :boolean default(TRUE), not null
  17 +# merge_requests_enabled :boolean default(TRUE), not null
  18 +# wiki_enabled :boolean default(TRUE), not null
19 # group_id :integer 19 # group_id :integer
20 # 20 #
21 21
@@ -37,6 +37,7 @@ describe Project do @@ -37,6 +37,7 @@ describe Project do
37 it { should have_many(:hooks).dependent(:destroy) } 37 it { should have_many(:hooks).dependent(:destroy) }
38 it { should have_many(:wikis).dependent(:destroy) } 38 it { should have_many(:wikis).dependent(:destroy) }
39 it { should have_many(:protected_branches).dependent(:destroy) } 39 it { should have_many(:protected_branches).dependent(:destroy) }
  40 + it { should have_many(:services).dependent(:destroy) }
40 end 41 end
41 42
42 describe "Mass assignment" do 43 describe "Mass assignment" do
spec/models/protected_branch_spec.rb
@@ -2,11 +2,11 @@ @@ -2,11 +2,11 @@
2 # 2 #
3 # Table name: protected_branches 3 # Table name: protected_branches
4 # 4 #
5 -# id :integer not null, primary key  
6 -# project_id :integer not null  
7 -# name :string(255) not null  
8 -# created_at :datetime not null  
9 -# updated_at :datetime not null 5 +# id :integer not null, primary key
  6 +# project_id :integer not null
  7 +# name :string(255) not null
  8 +# created_at :datetime not null
  9 +# updated_at :datetime not null
10 # 10 #
11 11
12 require 'spec_helper' 12 require 'spec_helper'
spec/models/snippet_spec.rb
@@ -2,13 +2,13 @@ @@ -2,13 +2,13 @@
2 # 2 #
3 # Table name: snippets 3 # Table name: snippets
4 # 4 #
5 -# id :integer not null, primary key 5 +# id :integer not null, primary key
6 # title :string(255) 6 # title :string(255)
7 # content :text 7 # content :text
8 -# author_id :integer not null  
9 -# project_id :integer not null  
10 -# created_at :datetime not null  
11 -# updated_at :datetime not null 8 +# author_id :integer not null
  9 +# project_id :integer not null
  10 +# created_at :datetime not null
  11 +# updated_at :datetime not null
12 # file_name :string(255) 12 # file_name :string(255)
13 # expires_at :datetime 13 # expires_at :datetime
14 # 14 #
spec/models/system_hook_spec.rb
@@ -2,12 +2,12 @@ @@ -2,12 +2,12 @@
2 # 2 #
3 # Table name: web_hooks 3 # Table name: web_hooks
4 # 4 #
5 -# id :integer not null, primary key 5 +# id :integer not null, primary key
6 # url :string(255) 6 # url :string(255)
7 # project_id :integer 7 # project_id :integer
8 -# created_at :datetime not null  
9 -# updated_at :datetime not null  
10 -# type :string(255) default("ProjectHook") 8 +# created_at :datetime not null
  9 +# updated_at :datetime not null
  10 +# type :string(255) default("ProjectHook")
11 # 11 #
12 12
13 require "spec_helper" 13 require "spec_helper"
spec/models/user_spec.rb
@@ -2,31 +2,31 @@ @@ -2,31 +2,31 @@
2 # 2 #
3 # Table name: users 3 # Table name: users
4 # 4 #
5 -# id :integer not null, primary key  
6 -# email :string(255) default(""), not null  
7 -# encrypted_password :string(128) default(""), not null 5 +# id :integer not null, primary key
  6 +# email :string(255) default(""), not null
  7 +# encrypted_password :string(255) default(""), not null
8 # reset_password_token :string(255) 8 # reset_password_token :string(255)
9 # reset_password_sent_at :datetime 9 # reset_password_sent_at :datetime
10 # remember_created_at :datetime 10 # remember_created_at :datetime
11 -# sign_in_count :integer default(0) 11 +# sign_in_count :integer default(0)
12 # current_sign_in_at :datetime 12 # current_sign_in_at :datetime
13 # last_sign_in_at :datetime 13 # last_sign_in_at :datetime
14 # current_sign_in_ip :string(255) 14 # current_sign_in_ip :string(255)
15 # last_sign_in_ip :string(255) 15 # last_sign_in_ip :string(255)
16 -# created_at :datetime not null  
17 -# updated_at :datetime not null 16 +# created_at :datetime not null
  17 +# updated_at :datetime not null
18 # name :string(255) 18 # name :string(255)
19 -# admin :boolean default(FALSE), not null  
20 -# projects_limit :integer default(10)  
21 -# skype :string(255) default(""), not null  
22 -# linkedin :string(255) default(""), not null  
23 -# twitter :string(255) default(""), not null 19 +# admin :boolean default(FALSE), not null
  20 +# projects_limit :integer default(10)
  21 +# skype :string(255) default(""), not null
  22 +# linkedin :string(255) default(""), not null
  23 +# twitter :string(255) default(""), not null
24 # authentication_token :string(255) 24 # authentication_token :string(255)
25 -# dark_scheme :boolean default(FALSE), not null  
26 -# theme_id :integer default(1), not null 25 +# dark_scheme :boolean default(FALSE), not null
  26 +# theme_id :integer default(1), not null
27 # bio :string(255) 27 # bio :string(255)
28 -# blocked :boolean default(FALSE), not null  
29 -# failed_attempts :integer default(0) 28 +# blocked :boolean default(FALSE), not null
  29 +# failed_attempts :integer default(0)
30 # locked_at :datetime 30 # locked_at :datetime
31 # extern_uid :string(255) 31 # extern_uid :string(255)
32 # provider :string(255) 32 # provider :string(255)
spec/models/users_project_spec.rb
@@ -2,12 +2,12 @@ @@ -2,12 +2,12 @@
2 # 2 #
3 # Table name: users_projects 3 # Table name: users_projects
4 # 4 #
5 -# id :integer not null, primary key  
6 -# user_id :integer not null  
7 -# project_id :integer not null  
8 -# created_at :datetime not null  
9 -# updated_at :datetime not null  
10 -# project_access :integer default(0), not null 5 +# id :integer not null, primary key
  6 +# user_id :integer not null
  7 +# project_id :integer not null
  8 +# created_at :datetime not null
  9 +# updated_at :datetime not null
  10 +# project_access :integer default(0), not null
11 # 11 #
12 12
13 require 'spec_helper' 13 require 'spec_helper'
spec/models/web_hook_spec.rb
@@ -2,12 +2,12 @@ @@ -2,12 +2,12 @@
2 # 2 #
3 # Table name: web_hooks 3 # Table name: web_hooks
4 # 4 #
5 -# id :integer not null, primary key 5 +# id :integer not null, primary key
6 # url :string(255) 6 # url :string(255)
7 # project_id :integer 7 # project_id :integer
8 -# created_at :datetime not null  
9 -# updated_at :datetime not null  
10 -# type :string(255) default("ProjectHook") 8 +# created_at :datetime not null
  9 +# updated_at :datetime not null
  10 +# type :string(255) default("ProjectHook")
11 # 11 #
12 12
13 require 'spec_helper' 13 require 'spec_helper'
spec/models/wiki_spec.rb
@@ -2,12 +2,12 @@ @@ -2,12 +2,12 @@
2 # 2 #
3 # Table name: wikis 3 # Table name: wikis
4 # 4 #
5 -# id :integer not null, primary key 5 +# id :integer not null, primary key
6 # title :string(255) 6 # title :string(255)
7 # content :text 7 # content :text
8 # project_id :integer 8 # project_id :integer
9 -# created_at :datetime not null  
10 -# updated_at :datetime not null 9 +# created_at :datetime not null
  10 +# updated_at :datetime not null
11 # slug :string(255) 11 # slug :string(255)
12 # user_id :integer 12 # user_id :integer
13 # 13 #