Created
November 11, 2012 19:25
-
-
Save mario/4055971 to your computer and use it in GitHub Desktop.
Gollum support for GitlabHQ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Gemfile b/Gemfile | |
index 3f5a183..48e9f48 100644 | |
--- a/Gemfile | |
+++ b/Gemfile | |
@@ -36,6 +36,8 @@ gem 'bootstrap-sass', "2.0.2" | |
gem "colored" | |
gem 'yaml_db', :git => "https://github.com/gitlabhq/yaml_db.git" | |
gem 'modularity' | |
+gem 'gollum' | |
+gem 'awesome_nested_set' | |
group :assets do | |
gem "sass-rails", "3.2.3" | |
diff --git a/Gemfile.lock b/Gemfile.lock | |
index 81d6236..f16248c 100644 | |
--- a/Gemfile.lock | |
+++ b/Gemfile.lock | |
@@ -72,12 +72,16 @@ GEM | |
rails | |
acts_as_list (0.1.4) | |
addressable (2.2.6) | |
+ albino (1.3.3) | |
+ posix-spawn (>= 0.3.6) | |
ansi (1.4.2) | |
arel (3.0.0) | |
autotest (4.4.6) | |
ZenTest (>= 4.4.1) | |
autotest-rails (4.1.1) | |
ZenTest (= 4.5) | |
+ awesome_nested_set (2.1.3) | |
+ activerecord (>= 3.0.0) | |
awesome_print (1.0.2) | |
bcrypt-ruby (3.0.1) | |
blankslate (2.1.2.4) | |
@@ -125,6 +129,16 @@ GEM | |
term-ansicolor (~> 1.0.7) | |
thor (>= 0.13.6) | |
git (1.2.5) | |
+ github-markup (0.7.2) | |
+ gollum (1.3.1) | |
+ albino (~> 1.3.2) | |
+ github-markup (>= 0.4.0, < 1.0.0) | |
+ grit (~> 2.4.1) | |
+ mustache (>= 0.11.2, < 1.0.0) | |
+ nokogiri (~> 1.4) | |
+ redcarpet | |
+ sanitize (~> 2.0.0) | |
+ sinatra (~> 1.0) | |
haml (3.1.4) | |
haml-rails (0.3.4) | |
actionpack (~> 3.0) | |
@@ -162,6 +176,7 @@ GEM | |
modularity (0.6.1) | |
multi_json (1.0.4) | |
multi_xml (0.4.1) | |
+ mustache (0.99.4) | |
mysql2 (0.3.11) | |
net-ldap (0.2.2) | |
nokogiri (1.5.0) | |
@@ -240,6 +255,8 @@ GEM | |
blankslate (>= 2.1.2.3) | |
ffi (~> 1.0.7) | |
rubyzip (0.9.6.1) | |
+ sanitize (2.0.3) | |
+ nokogiri (>= 1.4.4, < 1.6) | |
sass (3.1.15) | |
sass-rails (3.2.3) | |
railties (~> 3.2.0.beta) | |
@@ -315,6 +332,7 @@ DEPENDENCIES | |
annotate! | |
autotest | |
autotest-rails | |
+ awesome_nested_set | |
awesome_print | |
bootstrap-sass (= 2.0.2) | |
capybara | |
@@ -329,6 +347,7 @@ DEPENDENCIES | |
foreman | |
git | |
gitolite! | |
+ gollum | |
grit! | |
haml (= 3.1.4) | |
haml-rails | |
diff --git a/app/controllers/old_wikis_controller.rb b/app/controllers/old_wikis_controller.rb | |
new file mode 100644 | |
index 0000000..9bcd20c | |
--- /dev/null | |
+++ b/app/controllers/old_wikis_controller.rb | |
@@ -0,0 +1,59 @@ | |
+class WikisController < ApplicationController | |
+ before_filter :project | |
+ before_filter :add_project_abilities | |
+ before_filter :authorize_read_wiki! | |
+ before_filter :authorize_write_wiki!, :only => [:edit, :create, :history] | |
+ before_filter :authorize_admin_wiki!, :only => :destroy | |
+ layout "project" | |
+ | |
+ def show | |
+ if params[:old_page_id] | |
+ @wiki = @project.wikis.find(params[:old_page_id]) | |
+ else | |
+ @wiki = @project.wikis.where(:slug => params[:id]).order("created_at").last | |
+ end | |
+ | |
+ unless @wiki | |
+ return render_404 unless can?(current_user, :write_wiki, @project) | |
+ end | |
+ | |
+ respond_to do |format| | |
+ if @wiki | |
+ format.html | |
+ else | |
+ @wiki = @project.wikis.new(:slug => params[:id]) | |
+ format.html { render "edit" } | |
+ end | |
+ end | |
+ end | |
+ | |
+ def edit | |
+ @wiki = @project.wikis.where(:slug => params[:id]).order("created_at").last | |
+ @wiki = Wiki.regenerate_from @wiki | |
+ end | |
+ | |
+ def create | |
+ @wiki = @project.wikis.new(params[:wiki]) | |
+ @wiki.user = current_user | |
+ | |
+ respond_to do |format| | |
+ if @wiki.save | |
+ format.html { redirect_to [@project, @wiki], notice: 'Wiki was successfully updated.' } | |
+ else | |
+ format.html { render action: "edit" } | |
+ end | |
+ end | |
+ end | |
+ | |
+ def history | |
+ @wikis = @project.wikis.where(:slug => params[:id]).order("created_at") | |
+ end | |
+ | |
+ def destroy | |
+ @wikis = @project.wikis.where(:slug => params[:id]).delete_all | |
+ | |
+ respond_to do |format| | |
+ format.html { redirect_to project_wiki_path(@project, :index), notice: "Page was successfully deleted" } | |
+ end | |
+ end | |
+end | |
diff --git a/app/controllers/wiki_pages_controller.rb b/app/controllers/wiki_pages_controller.rb | |
new file mode 100644 | |
index 0000000..d677146 | |
--- /dev/null | |
+++ b/app/controllers/wiki_pages_controller.rb | |
@@ -0,0 +1,71 @@ | |
+class WikiPagesController < ApplicationController | |
+ before_filter :project | |
+ before_filter :add_project_abilities | |
+ before_filter :wiki | |
+ before_filter :page, :only => [:show, :edit, :update, :destroy] | |
+ | |
+ layout 'project' | |
+ | |
+ def new | |
+ @page = @wiki.pages.new | |
+ end | |
+ | |
+ def create | |
+ @page = @wiki.pages.new(params[:wiki_page]) | |
+ @page.committer = current_user | |
+ if @page.save | |
+ redirect_to [@project, @page], :notice => "Successfully created page." | |
+ else | |
+ render :action => 'new' | |
+ end | |
+ end | |
+ | |
+ def show | |
+ unless @page | |
+ return render_404 unless can?(current_user, :write_wiki, @project) | |
+ end | |
+ | |
+ respond_to do |format| | |
+ if @page | |
+ format.html | |
+ else | |
+ @page = @wiki.pages.new(:name => params[:id].humanize) | |
+ format.html { render "new" } | |
+ end | |
+ end | |
+ end | |
+ | |
+ def edit | |
+ end | |
+ | |
+ def update | |
+ @page.committer = current_user | |
+ if @page.save | |
+ redirect_to [@project, @page], :notice => "Successfully updated page." | |
+ else | |
+ render :action => 'edit' | |
+ end | |
+ end | |
+ | |
+ def pages | |
+ render :text => 'wiki#pages' | |
+ end | |
+ | |
+ def history | |
+ render :text => 'page#history' | |
+ end | |
+ | |
+private | |
+ def wiki | |
+ @wiki = @project.wiki | |
+ unless @wiki | |
+ return render_404 unless can?(current_user, :write_wiki, @project) | |
+ @wiki = @project.create_wiki | |
+ flash.now[:notice] = 'Created wiki for your project.' | |
+ end | |
+ end | |
+ | |
+ def page | |
+ @page = @wiki.pages.where(:url => params[:id]).first | |
+ end | |
+end | |
\ No newline at end of file | |
diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb | |
deleted file mode 100644 | |
index 9bcd20c..0000000 | |
--- a/app/controllers/wikis_controller.rb | |
+++ /dev/null | |
@@ -1,59 +0,0 @@ | |
-class WikisController < ApplicationController | |
- before_filter :project | |
- before_filter :add_project_abilities | |
- before_filter :authorize_read_wiki! | |
- before_filter :authorize_write_wiki!, :only => [:edit, :create, :history] | |
- before_filter :authorize_admin_wiki!, :only => :destroy | |
- layout "project" | |
- | |
- def show | |
- if params[:old_page_id] | |
- @wiki = @project.wikis.find(params[:old_page_id]) | |
- else | |
- @wiki = @project.wikis.where(:slug => params[:id]).order("created_at").last | |
- end | |
- | |
- unless @wiki | |
- return render_404 unless can?(current_user, :write_wiki, @project) | |
- end | |
- | |
- respond_to do |format| | |
- if @wiki | |
- format.html | |
- else | |
- @wiki = @project.wikis.new(:slug => params[:id]) | |
- format.html { render "edit" } | |
- end | |
- end | |
- end | |
- | |
- def edit | |
- @wiki = @project.wikis.where(:slug => params[:id]).order("created_at").last | |
- @wiki = Wiki.regenerate_from @wiki | |
- end | |
- | |
- def create | |
- @wiki = @project.wikis.new(params[:wiki]) | |
- @wiki.user = current_user | |
- | |
- respond_to do |format| | |
- if @wiki.save | |
- format.html { redirect_to [@project, @wiki], notice: 'Wiki was successfully updated.' } | |
- else | |
- format.html { render action: "edit" } | |
- end | |
- end | |
- end | |
- | |
- def history | |
- @wikis = @project.wikis.where(:slug => params[:id]).order("created_at") | |
- end | |
- | |
- def destroy | |
- @wikis = @project.wikis.where(:slug => params[:id]).delete_all | |
- | |
- respond_to do |format| | |
- format.html { redirect_to project_wiki_path(@project, :index), notice: "Page was successfully deleted" } | |
- end | |
- end | |
-end | |
diff --git a/app/models/event.rb b/app/models/event.rb | |
index cf8dc15..d2c0137 100644 | |
--- a/app/models/event.rb | |
+++ b/app/models/event.rb | |
@@ -110,14 +110,15 @@ end | |
# | |
# Table name: events | |
# | |
-# id :integer not null, primary key | |
+# id :integer(4) not null, primary key | |
# target_type :string(255) | |
-# target_id :integer | |
+# target_id :integer(4) | |
# title :string(255) | |
# data :text | |
-# project_id :integer | |
+# project_id :integer(4) | |
# created_at :datetime not null | |
# updated_at :datetime not null | |
-# action :integer | |
+# action :integer(4) | |
+# author_id :integer(4) | |
# | |
diff --git a/app/models/issue.rb b/app/models/issue.rb | |
index 5fe0e0b..12e8f19 100644 | |
--- a/app/models/issue.rb | |
+++ b/app/models/issue.rb | |
@@ -63,17 +63,18 @@ end | |
# | |
# Table name: issues | |
# | |
-# id :integer not null, primary key | |
-# title :string(255) | |
-# description :text | |
-# assignee_id :integer | |
-# author_id :integer | |
-# project_id :integer | |
-# created_at :datetime | |
-# updated_at :datetime | |
-# closed :boolean default(FALSE), not null | |
-# position :integer default(0) | |
-# critical :boolean default(FALSE), not null | |
-# branch_name :string(255) | |
+# id :integer(4) not null, primary key | |
+# title :string(255) | |
+# assignee_id :integer(4) | |
+# author_id :integer(4) | |
+# project_id :integer(4) | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
+# closed :boolean(1) default(FALSE), not null | |
+# position :integer(4) default(0) | |
+# critical :boolean(1) default(FALSE), not null | |
+# branch_name :string(255) | |
+# description :text | |
+# milestone_id :integer(4) | |
# | |
diff --git a/app/models/key.rb b/app/models/key.rb | |
index 1d7aae3..21fd48d 100644 | |
--- a/app/models/key.rb | |
+++ b/app/models/key.rb | |
@@ -71,13 +71,13 @@ end | |
# | |
# Table name: keys | |
# | |
-# id :integer not null, primary key | |
-# user_id :integer | |
-# created_at :datetime | |
-# updated_at :datetime | |
+# id :integer(4) not null, primary key | |
+# user_id :integer(4) | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
# key :text | |
# title :string(255) | |
# identifier :string(255) | |
-# project_id :integer | |
+# project_id :integer(4) | |
# | |
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb | |
index 248bbda..457dbd8 100644 | |
--- a/app/models/merge_request.rb | |
+++ b/app/models/merge_request.rb | |
@@ -197,15 +197,19 @@ end | |
# | |
# Table name: merge_requests | |
# | |
-# id :integer not null, primary key | |
+# id :integer(4) not null, primary key | |
# target_branch :string(255) not null | |
# source_branch :string(255) not null | |
-# project_id :integer not null | |
-# author_id :integer | |
-# assignee_id :integer | |
+# project_id :integer(4) not null | |
+# author_id :integer(4) | |
+# assignee_id :integer(4) | |
# title :string(255) | |
-# closed :boolean default(FALSE), not null | |
-# created_at :datetime | |
-# updated_at :datetime | |
+# closed :boolean(1) default(FALSE), not null | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
+# st_commits :text(2147483647 | |
+# st_diffs :text(2147483647 | |
+# merged :boolean(1) default(FALSE), not null | |
+# state :integer(4) default(1), not null | |
# | |
diff --git a/app/models/milestone.rb b/app/models/milestone.rb | |
index 87e9d1d..71ae7b6 100644 | |
--- a/app/models/milestone.rb | |
+++ b/app/models/milestone.rb | |
@@ -1,3 +1,17 @@ | |
+# == Schema Information | |
+# | |
+# Table name: milestones | |
+# | |
+# id :integer(4) not null, primary key | |
+# title :string(255) not null | |
+# project_id :integer(4) not null | |
+# description :text | |
+# due_date :date | |
+# closed :boolean(1) default(FALSE), not null | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
+# | |
+ | |
class Milestone < ActiveRecord::Base | |
belongs_to :project | |
has_many :issues | |
diff --git a/app/models/note.rb b/app/models/note.rb | |
index cee726e..c070749 100644 | |
--- a/app/models/note.rb | |
+++ b/app/models/note.rb | |
@@ -98,14 +98,14 @@ end | |
# | |
# Table name: notes | |
# | |
-# id :integer not null, primary key | |
+# id :integer(4) not null, primary key | |
# note :text | |
# noteable_id :string(255) | |
# noteable_type :string(255) | |
-# author_id :integer | |
-# created_at :datetime | |
-# updated_at :datetime | |
-# project_id :integer | |
+# author_id :integer(4) | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
+# project_id :integer(4) | |
# attachment :string(255) | |
# line_code :string(255) | |
# | |
diff --git a/app/models/old_wiki.rb b/app/models/old_wiki.rb | |
new file mode 100644 | |
index 0000000..3315488 | |
--- /dev/null | |
+++ b/app/models/old_wiki.rb | |
@@ -0,0 +1,46 @@ | |
+class Wiki < ActiveRecord::Base | |
+ belongs_to :project | |
+ belongs_to :user | |
+ | |
+ validates :content, :title, :user_id, :presence => true | |
+ validates :title, :length => 1..250 | |
+ | |
+ before_update :set_slug | |
+ | |
+ def to_param | |
+ slug | |
+ end | |
+ | |
+ protected | |
+ | |
+ def set_slug | |
+ self.slug = self.title.parameterize | |
+ end | |
+ | |
+ class << self | |
+ def regenerate_from wiki | |
+ regenerated_field = [:slug, :content, :title] | |
+ | |
+ new_wiki = Wiki.new | |
+ regenerated_field.each do |field| | |
+ new_wiki.send("#{field}=", wiki.send(field)) | |
+ end | |
+ new_wiki | |
+ end | |
+ | |
+ end | |
+end | |
+# == Schema Information | |
+# | |
+# Table name: wikis | |
+# | |
+# id :integer not null, primary key | |
+# title :string(255) | |
+# content :text | |
+# project_id :integer | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
+# slug :string(255) | |
+# user_id :integer | |
+# | |
+ | |
diff --git a/app/models/project.rb b/app/models/project.rb | |
index 72cc833..68de381 100644 | |
--- a/app/models/project.rb | |
+++ b/app/models/project.rb | |
@@ -18,7 +18,7 @@ class Project < ActiveRecord::Base | |
has_many :snippets, :dependent => :destroy | |
has_many :deploy_keys, :dependent => :destroy, :foreign_key => "project_id", :class_name => "Key" | |
has_many :web_hooks, :dependent => :destroy | |
- has_many :wikis, :dependent => :destroy | |
+ has_one :wiki, :dependent => :destroy | |
has_many :protected_branches, :dependent => :destroy | |
attr_protected :private_flag, :owner_id | |
@@ -100,19 +100,19 @@ end | |
# | |
# Table name: projects | |
# | |
-# id :integer not null, primary key | |
+# id :integer(4) not null, primary key | |
# name :string(255) | |
# path :string(255) | |
# description :text | |
-# created_at :datetime | |
-# updated_at :datetime | |
-# private_flag :boolean default(TRUE), not null | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
+# private_flag :boolean(1) default(TRUE), not null | |
# code :string(255) | |
-# owner_id :integer | |
+# owner_id :integer(4) | |
# default_branch :string(255) default("master"), not null | |
-# issues_enabled :boolean default(TRUE), not null | |
-# wall_enabled :boolean default(TRUE), not null | |
-# merge_requests_enabled :boolean default(TRUE), not null | |
-# wiki_enabled :boolean default(TRUE), not null | |
+# issues_enabled :boolean(1) default(TRUE), not null | |
+# wall_enabled :boolean(1) default(TRUE), not null | |
+# merge_requests_enabled :boolean(1) default(TRUE), not null | |
+# wiki_enabled :boolean(1) default(TRUE), not null | |
# | |
diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb | |
index 36e6563..d758680 100644 | |
--- a/app/models/protected_branch.rb | |
+++ b/app/models/protected_branch.rb | |
@@ -18,8 +18,8 @@ end | |
# | |
# Table name: protected_branches | |
# | |
-# id :integer not null, primary key | |
-# project_id :integer not null | |
+# id :integer(4) not null, primary key | |
+# project_id :integer(4) not null | |
# name :string(255) not null | |
# created_at :datetime not null | |
# updated_at :datetime not null | |
diff --git a/app/models/snippet.rb b/app/models/snippet.rb | |
index 17d2341..e5f04bb 100644 | |
--- a/app/models/snippet.rb | |
+++ b/app/models/snippet.rb | |
@@ -62,13 +62,13 @@ end | |
# | |
# Table name: snippets | |
# | |
-# id :integer not null, primary key | |
+# id :integer(4) not null, primary key | |
# title :string(255) | |
# content :text | |
-# author_id :integer not null | |
-# project_id :integer not null | |
-# created_at :datetime | |
-# updated_at :datetime | |
+# author_id :integer(4) not null | |
+# project_id :integer(4) not null | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
# file_name :string(255) | |
# expires_at :datetime | |
# | |
diff --git a/app/models/user.rb b/app/models/user.rb | |
index b98ae33..0bd8864 100644 | |
--- a/app/models/user.rb | |
+++ b/app/models/user.rb | |
@@ -136,26 +136,29 @@ end | |
# | |
# Table name: users | |
# | |
-# id :integer not null, primary key | |
+# id :integer(4) not null, primary key | |
# email :string(255) default(""), not null | |
# encrypted_password :string(128) default(""), not null | |
# reset_password_token :string(255) | |
# reset_password_sent_at :datetime | |
# remember_created_at :datetime | |
-# sign_in_count :integer default(0) | |
+# sign_in_count :integer(4) default(0) | |
# current_sign_in_at :datetime | |
# last_sign_in_at :datetime | |
# current_sign_in_ip :string(255) | |
# last_sign_in_ip :string(255) | |
-# created_at :datetime | |
-# updated_at :datetime | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
# name :string(255) | |
-# admin :boolean default(FALSE), not null | |
-# projects_limit :integer default(10) | |
+# admin :boolean(1) default(FALSE), not null | |
+# projects_limit :integer(4) default(10) | |
# skype :string(255) default(""), not null | |
# linkedin :string(255) default(""), not null | |
# twitter :string(255) default(""), not null | |
# authentication_token :string(255) | |
-# dark_scheme :boolean default(FALSE), not null | |
+# dark_scheme :boolean(1) default(FALSE), not null | |
+# theme_id :integer(4) default(1), not null | |
+# bio :string(255) | |
+# blocked :boolean(1) default(FALSE), not null | |
# | |
diff --git a/app/models/users_project.rb b/app/models/users_project.rb | |
index b00ab96..87d77c2 100644 | |
--- a/app/models/users_project.rb | |
+++ b/app/models/users_project.rb | |
@@ -75,11 +75,11 @@ end | |
# | |
# Table name: users_projects | |
# | |
-# id :integer not null, primary key | |
-# user_id :integer not null | |
-# project_id :integer not null | |
-# created_at :datetime | |
-# updated_at :datetime | |
-# project_access :integer default(0), not null | |
+# id :integer(4) not null, primary key | |
+# user_id :integer(4) not null | |
+# project_id :integer(4) not null | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
+# project_access :integer(4) default(0), not null | |
# | |
diff --git a/app/models/web_hook.rb b/app/models/web_hook.rb | |
index b0b1e0b..2628847 100644 | |
--- a/app/models/web_hook.rb | |
+++ b/app/models/web_hook.rb | |
@@ -22,10 +22,10 @@ end | |
# | |
# Table name: web_hooks | |
# | |
-# id :integer not null, primary key | |
+# id :integer(4) not null, primary key | |
# url :string(255) | |
-# project_id :integer | |
-# created_at :datetime | |
-# updated_at :datetime | |
+# project_id :integer(4) | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
# | |
diff --git a/app/models/wiki.rb b/app/models/wiki.rb | |
index 3315488..69505fb 100644 | |
--- a/app/models/wiki.rb | |
+++ b/app/models/wiki.rb | |
@@ -1,46 +1,34 @@ | |
class Wiki < ActiveRecord::Base | |
- belongs_to :project | |
- belongs_to :user | |
+ belongs_to :project | |
+ has_many :pages, :class_name => "WikiPage", :dependent => :destroy | |
- validates :content, :title, :user_id, :presence => true | |
- validates :title, :length => 1..250 | |
+ before_create :initialize_wiki_repo | |
- before_update :set_slug | |
+ def initialize_wiki_repo | |
+ self.path = project.path | |
+ Grit::Repo.init(path_to_repo) | |
+ self.pages << WikiPage.new(:name => 'Home', :body => "Welcome on your wiki page!", :change_comment => 'initialized wiki repository') | |
+ end | |
- def to_param | |
- slug | |
+ def repo | |
+ @@gollum ||= Gollum::Wiki.new(path_to_repo) | |
end | |
- protected | |
- | |
- def set_slug | |
- self.slug = self.title.parameterize | |
+private | |
+ def url_to_repo | |
+ Gitlabhq::GitHost.url_to_repo(path) | |
end | |
- class << self | |
- def regenerate_from wiki | |
- regenerated_field = [:slug, :content, :title] | |
- | |
- new_wiki = Wiki.new | |
- regenerated_field.each do |field| | |
- new_wiki.send("#{field}=", wiki.send(field)) | |
- end | |
- new_wiki | |
- end | |
- | |
+ def path_to_repo | |
+ File.join(GIT_HOST["base_path"], "#{path}.wiki.git") | |
end | |
end | |
+ | |
# == Schema Information | |
# | |
# Table name: wikis | |
# | |
-# id :integer not null, primary key | |
-# title :string(255) | |
-# content :text | |
-# project_id :integer | |
-# created_at :datetime not null | |
-# updated_at :datetime not null | |
-# slug :string(255) | |
-# user_id :integer | |
+# id :integer(4) not null, primary key | |
+# project_id :integer(4) | |
+# path :string(255) | |
# | |
- | |
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb | |
new file mode 100644 | |
index 0000000..0cf42e3 | |
--- /dev/null | |
+++ b/app/models/wiki_page.rb | |
@@ -0,0 +1,87 @@ | |
+class WikiPage < ActiveRecord::Base | |
+ acts_as_nested_set | |
+ | |
+ # Temporarily hard coded | |
+ FORMAT = :markdown | |
+ | |
+ belongs_to :wiki | |
+ belongs_to :user | |
+ | |
+ before_create :create_page, :set_url, :set_user | |
+ before_update :update_page | |
+ before_destroy :delete_page | |
+ | |
+ validates :name, :url, :presence => true, :uniqueness => { :scope => :wiki_id } | |
+ | |
+ attr_accessor :body, :change_comment, :committer | |
+ | |
+ def to_param | |
+ name.parameterize | |
+ end | |
+ | |
+ def content | |
+ page.formatted_data | |
+ end | |
+ | |
+ def raw_content | |
+ page.raw_data | |
+ end | |
+ | |
+ def author | |
+ page.version.author.name.gsub(/<>/, '') | |
+ end | |
+ | |
+ def date | |
+ page.version.authored_date | |
+ end | |
+ | |
+ def preview(data) | |
+ _wiki.preview_page('Preview', data, FORMAT).formatted_data | |
+ end | |
+ | |
+ private | |
+ | |
+ def _wiki | |
+ wiki.repo | |
+ end | |
+ | |
+ def page | |
+ _wiki.page(self.name) | |
+ end | |
+ | |
+ def set_url | |
+ self.url = self.name.parameterize | |
+ end | |
+ | |
+ def set_url | |
+ self.user = self.committer | |
+ end | |
+ | |
+ def create_page | |
+ _wiki.write_page(name, FORMAT, body || '', {:message => self.change_comment, :name => current_user.name, :author => current_user.email}) | |
+ end | |
+ | |
+ def update_page | |
+ _wiki.update_page(page, name, FORMAT, body || self.raw_content, {:message => self.change_comment, :name => current_user.name, :author => current_user.email}) | |
+ end | |
+ | |
+ def delete_page | |
+ _wiki.delete_page(page, {:message => 'deleting page', :name => current_user.name, :author => current_user.email}) | |
+ end | |
+end | |
+ | |
+# == Schema Information | |
+# | |
+# Table name: wiki_pages | |
+# | |
+# id :integer(4) not null, primary key | |
+# name :string(255) | |
+# url :string(255) | |
+# parent_id :integer(4) | |
+# wiki_id :integer(4) | |
+# user_id :integer(4) | |
+# lft :integer(4) | |
+# rgt :integer(4) | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
+# | |
\ No newline at end of file | |
diff --git a/app/views/layouts/_project_menu.html.haml b/app/views/layouts/_project_menu.html.haml | |
index 34987e4..5523bcd 100644 | |
--- a/app/views/layouts/_project_menu.html.haml | |
+++ b/app/views/layouts/_project_menu.html.haml | |
@@ -23,5 +23,5 @@ | |
Wall | |
- if @project.wiki_enabled | |
- = link_to project_wiki_path(@project, :index), :class => (controller.controller_name == "wikis") ? "current" : nil do | |
+ = link_to project_wiki_page_path(@project, "home"), :class => (controller.controller_name == "wiki_pages") ? "current" : nil do | |
Wiki | |
diff --git a/app/views/old_wikis/_form.html.haml b/app/views/old_wikis/_form.html.haml | |
new file mode 100644 | |
index 0000000..5519125 | |
--- /dev/null | |
+++ b/app/views/old_wikis/_form.html.haml | |
@@ -0,0 +1,24 @@ | |
+= form_for [@project, @wiki] do |f| | |
+ -if @wiki.errors.any? | |
+ #error_explanation | |
+ %h2= "#{pluralize(@wiki.errors.count, "error")} prohibited this wiki from being saved:" | |
+ %ul | |
+ - @wiki.errors.full_messages.each do |msg| | |
+ %li= msg | |
+ | |
+ .alert-message.block-message.warning | |
+ %p | |
+ Wiki content is parsed with #{link_to "Markdown", "http://en.wikipedia.org/wiki/Markdown"}. | |
+ %br | |
+ To add link to new page you can just type | |
+ %code [Link Title](page-slug) | |
+ .clearfix | |
+ = f.label :title | |
+ .input= f.text_field :title, :class => :xxlarge | |
+ = f.hidden_field :slug | |
+ .clearfix | |
+ = f.label :content | |
+ .input= f.text_area :content, :class => :xxlarge | |
+ .actions | |
+ = f.submit 'Save', :class => "primary btn" | |
+ = link_to "Cancel", project_wiki_path(@project, :index), :class => "btn" | |
diff --git a/app/views/old_wikis/edit.html.haml b/app/views/old_wikis/edit.html.haml | |
new file mode 100644 | |
index 0000000..26cbd52 | |
--- /dev/null | |
+++ b/app/views/old_wikis/edit.html.haml | |
@@ -0,0 +1,3 @@ | |
+%h3 Editing page | |
+%hr | |
+= render 'form' | |
diff --git a/app/views/old_wikis/history.html.haml b/app/views/old_wikis/history.html.haml | |
new file mode 100644 | |
index 0000000..6a9b56a | |
--- /dev/null | |
+++ b/app/views/old_wikis/history.html.haml | |
@@ -0,0 +1,17 @@ | |
+%h3 Versions | |
+%table | |
+ %thead | |
+ %tr | |
+ %th # | |
+ %th last edit | |
+ %th created by | |
+ %tbody | |
+ - @wikis.each_with_index do |wiki_page, i| | |
+ %tr | |
+ %td= i + 1 | |
+ %td | |
+ = link_to wiki_page.created_at.to_s(:short), project_wiki_path(@project, wiki_page, :old_page_id => wiki_page.id) | |
+ (#{time_ago_in_words(wiki_page.created_at)} | |
+ ago) | |
+ %td= wiki_page.user.name | |
+ | |
diff --git a/app/views/old_wikis/show.html.haml b/app/views/old_wikis/show.html.haml | |
new file mode 100644 | |
index 0000000..e7f879f | |
--- /dev/null | |
+++ b/app/views/old_wikis/show.html.haml | |
@@ -0,0 +1,17 @@ | |
+%h3 | |
+ = @wiki.title | |
+ %span.right | |
+ - if can? current_user, :write_wiki, @project | |
+ = link_to history_project_wiki_path(@project, @wiki), :class => "btn small padded" do | |
+ History | |
+ = link_to edit_project_wiki_path(@project, @wiki), :class => "btn small" do | |
+ Edit | |
+%hr | |
+.wiki_content | |
+ = preserve do | |
+ = markdown @wiki.content | |
+ | |
+%p.time Last edited by #{@wiki.user.name}, in #{time_ago_in_words @wiki.created_at} | |
+- if can? current_user, :admin_wiki, @project | |
+ = link_to project_wiki_path(@project, @wiki), :confirm => "Are you sure you want to delete this page?", :method => :delete do | |
+ Delete this page | |
diff --git a/app/views/wiki_pages/_form.html.haml b/app/views/wiki_pages/_form.html.haml | |
new file mode 100644 | |
index 0000000..1f4c399 | |
--- /dev/null | |
+++ b/app/views/wiki_pages/_form.html.haml | |
@@ -0,0 +1,26 @@ | |
+= form_for [@project, @page] do |f| | |
+ -if @page.errors.any? | |
+ #error_explanation | |
+ %h2= "#{pluralize(@page.errors.count, "error")} prohibited this wiki from being saved:" | |
+ %ul | |
+ - @page.errors.full_messages.each do |msg| | |
+ %li= msg | |
+ | |
+ .alert-message.block-message.warning | |
+ %p | |
+ Wiki content is parsed with #{link_to "Markdown", "http://en.wikipedia.org/wiki/Markdown"}. | |
+ %br | |
+ To add link to new page you can just type | |
+ %code [Link Title](page-url) | |
+ .clearfix | |
+ = f.label :name | |
+ .input= f.text_field :name, :class => :xxlarge | |
+ .clearfix | |
+ = f.label :body | |
+ .input= f.text_area :body, :class => :xxlarge | |
+ .clearfix | |
+ = f.label :change_comment | |
+ .input= f.text_field :change_comment, :class => :xxlarge | |
+ .actions | |
+ = f.submit 'Save', :class => "primary btn" | |
+ = link_to "Cancel", project_wiki_page_path(@project, 'home'), :class => "btn" | |
diff --git a/app/views/wiki_pages/_wiki_head.html.haml b/app/views/wiki_pages/_wiki_head.html.haml | |
new file mode 100644 | |
index 0000000..cdebf59 | |
--- /dev/null | |
+++ b/app/views/wiki_pages/_wiki_head.html.haml | |
@@ -0,0 +1,8 @@ | |
+%ul.nav.nav-tabs | |
+ %li{ :class => "#{'active' if current_page?(project_wiki_pages_path(@project)) }" } | |
+ = link_to project_wiki_pages_path(@project), :class => "wiki-home-tab tab" do | |
+ %i.icon-home | |
+ Home | |
+ %li{ :class => "#{'active' if current_page?(pages_project_wiki_pages_path(@project)) }" } | |
+ = link_to pages_project_wiki_pages_path(@project), :class => "wiki-pages-tab tab " do | |
+ Pages | |
diff --git a/app/views/wiki_pages/edit.html.haml b/app/views/wiki_pages/edit.html.haml | |
new file mode 100644 | |
index 0000000..7ea27a6 | |
--- /dev/null | |
+++ b/app/views/wiki_pages/edit.html.haml | |
@@ -0,0 +1,3 @@ | |
+%h3 Edit #{@page.name} | |
+%hr | |
+= render 'form' | |
\ No newline at end of file | |
diff --git a/app/views/wiki_pages/new.html.haml b/app/views/wiki_pages/new.html.haml | |
new file mode 100644 | |
index 0000000..1dbd30b | |
--- /dev/null | |
+++ b/app/views/wiki_pages/new.html.haml | |
@@ -0,0 +1,3 @@ | |
+%h3 New Page | |
+%hr | |
+= render 'form' | |
\ No newline at end of file | |
diff --git a/app/views/wiki_pages/show.html.haml b/app/views/wiki_pages/show.html.haml | |
new file mode 100644 | |
index 0000000..a49cc54 | |
--- /dev/null | |
+++ b/app/views/wiki_pages/show.html.haml | |
@@ -0,0 +1,21 @@ | |
+= render "wiki_head" | |
+ | |
+%h3 | |
+ = @page.name | |
+ %span.right | |
+ - if can? current_user, :write_wiki, @project | |
+ = link_to new_project_wiki_path(@project), :class => "btn small" do | |
+ New Page | |
+ = link_to edit_project_wiki_path(@project, @page), :class => "btn small" do | |
+ Edit Page | |
+ = link_to history_project_wiki_path(@project, @page), :class => "btn small padded" do | |
+ Page History | |
+%hr | |
+.wiki_content | |
+ = preserve do | |
+ = markdown @page.raw_content | |
+ | |
+%p.time Last edited by #{@page.author}, #{time_ago_in_words @page.updated_at} ago | |
+- if can? current_user, :admin_wiki, @project | |
+ = link_to project_wiki_path(@project, @wiki), :confirm => "Are you sure you want to delete this page?", :method => :delete do | |
+ Delete this page | |
\ No newline at end of file | |
diff --git a/app/views/wikis/_form.html.haml b/app/views/wikis/_form.html.haml | |
deleted file mode 100644 | |
index 5519125..0000000 | |
--- a/app/views/wikis/_form.html.haml | |
+++ /dev/null | |
@@ -1,24 +0,0 @@ | |
-= form_for [@project, @wiki] do |f| | |
- -if @wiki.errors.any? | |
- #error_explanation | |
- %h2= "#{pluralize(@wiki.errors.count, "error")} prohibited this wiki from being saved:" | |
- %ul | |
- - @wiki.errors.full_messages.each do |msg| | |
- %li= msg | |
- | |
- .alert-message.block-message.warning | |
- %p | |
- Wiki content is parsed with #{link_to "Markdown", "http://en.wikipedia.org/wiki/Markdown"}. | |
- %br | |
- To add link to new page you can just type | |
- %code [Link Title](page-slug) | |
- .clearfix | |
- = f.label :title | |
- .input= f.text_field :title, :class => :xxlarge | |
- = f.hidden_field :slug | |
- .clearfix | |
- = f.label :content | |
- .input= f.text_area :content, :class => :xxlarge | |
- .actions | |
- = f.submit 'Save', :class => "primary btn" | |
- = link_to "Cancel", project_wiki_path(@project, :index), :class => "btn" | |
diff --git a/app/views/wikis/edit.html.haml b/app/views/wikis/edit.html.haml | |
deleted file mode 100644 | |
index 26cbd52..0000000 | |
--- a/app/views/wikis/edit.html.haml | |
+++ /dev/null | |
@@ -1,3 +0,0 @@ | |
-%h3 Editing page | |
-%hr | |
-= render 'form' | |
diff --git a/app/views/wikis/history.html.haml b/app/views/wikis/history.html.haml | |
deleted file mode 100644 | |
index 6a9b56a..0000000 | |
--- a/app/views/wikis/history.html.haml | |
+++ /dev/null | |
@@ -1,17 +0,0 @@ | |
-%h3 Versions | |
-%table | |
- %thead | |
- %tr | |
- %th # | |
- %th last edit | |
- %th created by | |
- %tbody | |
- - @wikis.each_with_index do |wiki_page, i| | |
- %tr | |
- %td= i + 1 | |
- %td | |
- = link_to wiki_page.created_at.to_s(:short), project_wiki_path(@project, wiki_page, :old_page_id => wiki_page.id) | |
- (#{time_ago_in_words(wiki_page.created_at)} | |
- ago) | |
- %td= wiki_page.user.name | |
- | |
diff --git a/app/views/wikis/show.html.haml b/app/views/wikis/show.html.haml | |
deleted file mode 100644 | |
index e7f879f..0000000 | |
--- a/app/views/wikis/show.html.haml | |
+++ /dev/null | |
@@ -1,17 +0,0 @@ | |
-%h3 | |
- = @wiki.title | |
- %span.right | |
- - if can? current_user, :write_wiki, @project | |
- = link_to history_project_wiki_path(@project, @wiki), :class => "btn small padded" do | |
- History | |
- = link_to edit_project_wiki_path(@project, @wiki), :class => "btn small" do | |
- Edit | |
-%hr | |
-.wiki_content | |
- = preserve do | |
- = markdown @wiki.content | |
- | |
-%p.time Last edited by #{@wiki.user.name}, in #{time_ago_in_words @wiki.created_at} | |
-- if can? current_user, :admin_wiki, @project | |
- = link_to project_wiki_path(@project, @wiki), :confirm => "Are you sure you want to delete this page?", :method => :delete do | |
- Delete this page | |
diff --git a/config/routes.rb b/config/routes.rb | |
index 681bffc..7d1df20 100644 | |
--- a/config/routes.rb | |
+++ b/config/routes.rb | |
@@ -56,9 +56,12 @@ Gitlab::Application.routes.draw do | |
get "files" | |
end | |
- resources :wikis, :only => [:show, :edit, :destroy, :create] do | |
+ resources :wiki, :controller => :wiki_pages, :as => :wiki_pages, :except => :index do | |
+ collection do | |
+ get 'pages' | |
+ end | |
member do | |
- get "history" | |
+ get 'history' | |
end | |
end | |
diff --git a/db/migrate/20120424140437_change_wikis_table.rb b/db/migrate/20120424140437_change_wikis_table.rb | |
new file mode 100644 | |
index 0000000..6351220 | |
--- /dev/null | |
+++ b/db/migrate/20120424140437_change_wikis_table.rb | |
@@ -0,0 +1,8 @@ | |
+class ChangeWikisTable < ActiveRecord::Migration | |
+ def change | |
+ create_table "wikis", :force => true do |t| | |
+ t.integer "project_id" | |
+ t.string "path" | |
+ end | |
+ end | |
+end | |
diff --git a/db/migrate/20120424144324_create_wiki_pages.rb b/db/migrate/20120424144324_create_wiki_pages.rb | |
new file mode 100644 | |
index 0000000..49c1f9d | |
--- /dev/null | |
+++ b/db/migrate/20120424144324_create_wiki_pages.rb | |
@@ -0,0 +1,17 @@ | |
+class CreateWikiPages < ActiveRecord::Migration | |
+ def change | |
+ create_table :wiki_pages do |t| | |
+ t.string :name | |
+ t.string :url | |
+ t.integer :parent_id | |
+ t.integer :wiki_id | |
+ t.integer :user_id | |
+ t.integer :lft | |
+ t.integer :rgt | |
+ | |
+ t.timestamps | |
+ end | |
+ | |
+ add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id" | |
+ end | |
+end | |
diff --git a/db/schema.rb b/db/schema.rb | |
index b1c2cf1..43cf7cb 100644 | |
--- a/db/schema.rb | |
+++ b/db/schema.rb | |
@@ -11,7 +11,7 @@ | |
# | |
# It's strongly recommended to check this file into your version control system. | |
-ActiveRecord::Schema.define(:version => 20120413135904) do | |
+ActiveRecord::Schema.define(:version => 20120424144324) do | |
create_table "events", :force => true do |t| | |
t.string "target_type" | |
@@ -190,14 +190,23 @@ ActiveRecord::Schema.define(:version => 20120413135904) do | |
t.datetime "updated_at", :null => false | |
end | |
- create_table "wikis", :force => true do |t| | |
- t.string "title" | |
- t.text "content" | |
- t.integer "project_id" | |
+ create_table "wiki_pages", :force => true do |t| | |
+ t.string "name" | |
+ t.string "url" | |
+ t.integer "parent_id" | |
+ t.integer "wiki_id" | |
+ t.integer "user_id" | |
+ t.integer "lft" | |
+ t.integer "rgt" | |
t.datetime "created_at", :null => false | |
t.datetime "updated_at", :null => false | |
- t.string "slug" | |
- t.integer "user_id" | |
+ end | |
+ | |
+ add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id" | |
+ | |
+ create_table "wikis", :force => true do |t| | |
+ t.integer "project_id" | |
+ t.string "path" | |
end | |
end | |
diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb | |
index 04604dd..a295e28 100644 | |
--- a/spec/models/event_spec.rb | |
+++ b/spec/models/event_spec.rb | |
@@ -2,15 +2,16 @@ | |
# | |
# Table name: events | |
# | |
-# id :integer not null, primary key | |
+# id :integer(4) not null, primary key | |
# target_type :string(255) | |
-# target_id :integer | |
+# target_id :integer(4) | |
# title :string(255) | |
# data :text | |
-# project_id :integer | |
+# project_id :integer(4) | |
# created_at :datetime not null | |
# updated_at :datetime not null | |
-# action :integer | |
+# action :integer(4) | |
+# author_id :integer(4) | |
# | |
require 'spec_helper' | |
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb | |
index 791e9cd..b16d94a 100644 | |
--- a/spec/models/issue_spec.rb | |
+++ b/spec/models/issue_spec.rb | |
@@ -61,16 +61,18 @@ end | |
# | |
# Table name: issues | |
# | |
-# id :integer not null, primary key | |
-# title :string(255) | |
-# assignee_id :integer | |
-# author_id :integer | |
-# project_id :integer | |
-# created_at :datetime | |
-# updated_at :datetime | |
-# closed :boolean default(FALSE), not null | |
-# position :integer default(0) | |
-# critical :boolean default(FALSE), not null | |
-# branch_name :string(255) | |
+# id :integer(4) not null, primary key | |
+# title :string(255) | |
+# assignee_id :integer(4) | |
+# author_id :integer(4) | |
+# project_id :integer(4) | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
+# closed :boolean(1) default(FALSE), not null | |
+# position :integer(4) default(0) | |
+# critical :boolean(1) default(FALSE), not null | |
+# branch_name :string(255) | |
+# description :text | |
+# milestone_id :integer(4) | |
# | |
diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb | |
index b24f22c..0f9b317 100644 | |
--- a/spec/models/key_spec.rb | |
+++ b/spec/models/key_spec.rb | |
@@ -53,13 +53,13 @@ end | |
# | |
# Table name: keys | |
# | |
-# id :integer not null, primary key | |
-# user_id :integer | |
-# created_at :datetime | |
-# updated_at :datetime | |
+# id :integer(4) not null, primary key | |
+# user_id :integer(4) | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
# key :text | |
# title :string(255) | |
# identifier :string(255) | |
-# project_id :integer | |
+# project_id :integer(4) | |
# | |
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb | |
index 63996e2..8d750be 100644 | |
--- a/spec/models/merge_request_spec.rb | |
+++ b/spec/models/merge_request_spec.rb | |
@@ -62,15 +62,19 @@ end | |
# | |
# Table name: merge_requests | |
# | |
-# id :integer not null, primary key | |
+# id :integer(4) not null, primary key | |
# target_branch :string(255) not null | |
# source_branch :string(255) not null | |
-# project_id :integer not null | |
-# author_id :integer | |
-# assignee_id :integer | |
+# project_id :integer(4) not null | |
+# author_id :integer(4) | |
+# assignee_id :integer(4) | |
# title :string(255) | |
-# closed :boolean default(FALSE), not null | |
-# created_at :datetime | |
-# updated_at :datetime | |
+# closed :boolean(1) default(FALSE), not null | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
+# st_commits :text(2147483647 | |
+# st_diffs :text(2147483647 | |
+# merged :boolean(1) default(FALSE), not null | |
+# state :integer(4) default(1), not null | |
# | |
diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb | |
index ba11798..bb71ca9 100644 | |
--- a/spec/models/milestone_spec.rb | |
+++ b/spec/models/milestone_spec.rb | |
@@ -1,3 +1,17 @@ | |
+# == Schema Information | |
+# | |
+# Table name: milestones | |
+# | |
+# id :integer(4) not null, primary key | |
+# title :string(255) not null | |
+# project_id :integer(4) not null | |
+# description :text | |
+# due_date :date | |
+# closed :boolean(1) default(FALSE), not null | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
+# | |
+ | |
require 'spec_helper' | |
describe Milestone do | |
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb | |
index c74f727..81a0d7c 100644 | |
--- a/spec/models/note_spec.rb | |
+++ b/spec/models/note_spec.rb | |
@@ -120,14 +120,14 @@ end | |
# | |
# Table name: notes | |
# | |
-# id :integer not null, primary key | |
+# id :integer(4) not null, primary key | |
# note :text | |
# noteable_id :string(255) | |
# noteable_type :string(255) | |
-# author_id :integer | |
-# created_at :datetime | |
-# updated_at :datetime | |
-# project_id :integer | |
+# author_id :integer(4) | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
+# project_id :integer(4) | |
# attachment :string(255) | |
# line_code :string(255) | |
# | |
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb | |
index 6285a85..9b15732 100644 | |
--- a/spec/models/project_spec.rb | |
+++ b/spec/models/project_spec.rb | |
@@ -193,19 +193,19 @@ end | |
# | |
# Table name: projects | |
# | |
-# id :integer not null, primary key | |
+# id :integer(4) not null, primary key | |
# name :string(255) | |
# path :string(255) | |
# description :text | |
-# created_at :datetime | |
-# updated_at :datetime | |
-# private_flag :boolean default(TRUE), not null | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
+# private_flag :boolean(1) default(TRUE), not null | |
# code :string(255) | |
-# owner_id :integer | |
+# owner_id :integer(4) | |
# default_branch :string(255) default("master"), not null | |
-# issues_enabled :boolean default(TRUE), not null | |
-# wall_enabled :boolean default(TRUE), not null | |
-# merge_requests_enabled :boolean default(TRUE), not null | |
-# wiki_enabled :boolean default(TRUE), not null | |
+# issues_enabled :boolean(1) default(TRUE), not null | |
+# wall_enabled :boolean(1) default(TRUE), not null | |
+# merge_requests_enabled :boolean(1) default(TRUE), not null | |
+# wiki_enabled :boolean(1) default(TRUE), not null | |
# | |
diff --git a/spec/models/protected_branch_spec.rb b/spec/models/protected_branch_spec.rb | |
index a0b0032..e9e81f1 100644 | |
--- a/spec/models/protected_branch_spec.rb | |
+++ b/spec/models/protected_branch_spec.rb | |
@@ -2,8 +2,8 @@ | |
# | |
# Table name: protected_branches | |
# | |
-# id :integer not null, primary key | |
-# project_id :integer not null | |
+# id :integer(4) not null, primary key | |
+# project_id :integer(4) not null | |
# name :string(255) not null | |
# created_at :datetime not null | |
# updated_at :datetime not null | |
diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb | |
index 037287a..9b4aaa1 100644 | |
--- a/spec/models/snippet_spec.rb | |
+++ b/spec/models/snippet_spec.rb | |
@@ -18,13 +18,13 @@ end | |
# | |
# Table name: snippets | |
# | |
-# id :integer not null, primary key | |
+# id :integer(4) not null, primary key | |
# title :string(255) | |
# content :text | |
-# author_id :integer not null | |
-# project_id :integer not null | |
-# created_at :datetime | |
-# updated_at :datetime | |
+# author_id :integer(4) not null | |
+# project_id :integer(4) not null | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
# file_name :string(255) | |
# expires_at :datetime | |
# | |
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb | |
index a62e56c..d482ebd 100644 | |
--- a/spec/models/user_spec.rb | |
+++ b/spec/models/user_spec.rb | |
@@ -45,26 +45,29 @@ end | |
# | |
# Table name: users | |
# | |
-# id :integer not null, primary key | |
+# id :integer(4) not null, primary key | |
# email :string(255) default(""), not null | |
# encrypted_password :string(128) default(""), not null | |
# reset_password_token :string(255) | |
# reset_password_sent_at :datetime | |
# remember_created_at :datetime | |
-# sign_in_count :integer default(0) | |
+# sign_in_count :integer(4) default(0) | |
# current_sign_in_at :datetime | |
# last_sign_in_at :datetime | |
# current_sign_in_ip :string(255) | |
# last_sign_in_ip :string(255) | |
-# created_at :datetime | |
-# updated_at :datetime | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
# name :string(255) | |
-# admin :boolean default(FALSE), not null | |
-# projects_limit :integer default(10) | |
+# admin :boolean(1) default(FALSE), not null | |
+# projects_limit :integer(4) default(10) | |
# skype :string(255) default(""), not null | |
# linkedin :string(255) default(""), not null | |
# twitter :string(255) default(""), not null | |
# authentication_token :string(255) | |
-# dark_scheme :boolean default(FALSE), not null | |
+# dark_scheme :boolean(1) default(FALSE), not null | |
+# theme_id :integer(4) default(1), not null | |
+# bio :string(255) | |
+# blocked :boolean(1) default(FALSE), not null | |
# | |
diff --git a/spec/models/users_project_spec.rb b/spec/models/users_project_spec.rb | |
index 85bc4d3..87fbfbf 100644 | |
--- a/spec/models/users_project_spec.rb | |
+++ b/spec/models/users_project_spec.rb | |
@@ -20,11 +20,11 @@ end | |
# | |
# Table name: users_projects | |
# | |
-# id :integer not null, primary key | |
-# user_id :integer not null | |
-# project_id :integer not null | |
-# created_at :datetime | |
-# updated_at :datetime | |
-# project_access :integer default(0), not null | |
+# id :integer(4) not null, primary key | |
+# user_id :integer(4) not null | |
+# project_id :integer(4) not null | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
+# project_access :integer(4) default(0), not null | |
# | |
diff --git a/spec/models/web_hook_spec.rb b/spec/models/web_hook_spec.rb | |
index 309bfc0..9971bd5 100644 | |
--- a/spec/models/web_hook_spec.rb | |
+++ b/spec/models/web_hook_spec.rb | |
@@ -56,10 +56,10 @@ end | |
# | |
# Table name: web_hooks | |
# | |
-# id :integer not null, primary key | |
+# id :integer(4) not null, primary key | |
# url :string(255) | |
-# project_id :integer | |
-# created_at :datetime | |
-# updated_at :datetime | |
+# project_id :integer(4) | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
# | |
diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb | |
new file mode 100644 | |
index 0000000..f6c640d | |
--- /dev/null | |
+++ b/spec/models/wiki_page_spec.rb | |
@@ -0,0 +1,21 @@ | |
+# == Schema Information | |
+# | |
+# Table name: wiki_pages | |
+# | |
+# id :integer(4) not null, primary key | |
+# name :string(255) | |
+# url :string(255) | |
+# parent_id :integer(4) | |
+# wiki_id :integer(4) | |
+# user_id :integer(4) | |
+# lft :integer(4) | |
+# rgt :integer(4) | |
+# created_at :datetime not null | |
+# updated_at :datetime not null | |
+# | |
+ | |
+require 'spec_helper' | |
+ | |
+describe WikiPage do | |
+ pending "add some examples to (or delete) #{__FILE__}" | |
+end | |
diff --git a/spec/models/wiki_spec.rb b/spec/models/wiki_spec.rb | |
index 05dbc97..90481cc 100644 | |
--- a/spec/models/wiki_spec.rb | |
+++ b/spec/models/wiki_spec.rb | |
@@ -16,16 +16,10 @@ describe Wiki do | |
end | |
# == Schema Information | |
# | |
-# Table name: snippets | |
+# Table name: wikis | |
# | |
-# id :integer not null, primary key | |
-# title :string(255) | |
-# content :text | |
-# author_id :integer not null | |
-# project_id :integer not null | |
-# created_at :datetime | |
-# updated_at :datetime | |
-# file_name :string(255) | |
-# expires_at :datetime | |
+# id :integer(4) not null, primary key | |
+# project_id :integer(4) | |
+# path :string(255) | |
# | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment