v 1.1.0 v 1.1.0
- project dashboard
- wall redesigned
- feature: code snippets - feature: code snippets
- fixed horizontal scroll on file preview - fixed horizontal scroll on file preview
- fixed app crash if commit message has invalid chars - fixed app crash if commit message has invalid chars
... ...
......
...@@ -15,7 +15,7 @@ gem 'therubyracer' ...@@ -15,7 +15,7 @@ gem 'therubyracer'
gem 'faker' gem 'faker'
gem 'seed-fu', :git => 'git://github.com/mbleigh/seed-fu.git' gem 'seed-fu', :git => 'git://github.com/mbleigh/seed-fu.git'
gem "inifile" gem "inifile"
gem "albino", :git => "git://github.com/gitlabhq/albino.git" gem "pygments.rb", "0.2.3"
gem "kaminari" gem "kaminari"
gem "thin" gem "thin"
gem "git" gem "git"
... ...
......
...@@ -4,13 +4,6 @@ GIT ...@@ -4,13 +4,6 @@ GIT
specs: specs:
annotate (2.4.1.beta1) annotate (2.4.1.beta1)
GIT
remote: git://github.com/gitlabhq/albino.git
revision: 118380924969f3a856659f86ea1f40c1ba7bfcb1
specs:
albino (1.3.3)
posix-spawn (>= 0.3.6)
GIT GIT
remote: git://github.com/gitlabhq/grit.git remote: git://github.com/gitlabhq/grit.git
revision: ff015074ef35bd94cba943f9c0f98e161ab5851c revision: ff015074ef35bd94cba943f9c0f98e161ab5851c
...@@ -72,6 +65,7 @@ GEM ...@@ -72,6 +65,7 @@ GEM
ZenTest (= 4.5) ZenTest (= 4.5)
awesome_print (0.4.0) awesome_print (0.4.0)
bcrypt-ruby (3.0.1) bcrypt-ruby (3.0.1)
blankslate (2.1.2.4)
builder (3.0.0) builder (3.0.0)
capybara (1.0.1) capybara (1.0.1)
mime-types (>= 1.16) mime-types (>= 1.16)
...@@ -138,6 +132,8 @@ GEM ...@@ -138,6 +132,8 @@ GEM
orm_adapter (0.0.5) orm_adapter (0.0.5)
polyglot (0.3.2) polyglot (0.3.2)
posix-spawn (0.3.6) posix-spawn (0.3.6)
pygments.rb (0.2.3)
rubypython (>= 0.5.1)
rack (1.3.2) rack (1.3.2)
rack-cache (1.0.3) rack-cache (1.0.3)
rack (>= 0.4) rack (>= 0.4)
...@@ -189,6 +185,9 @@ GEM ...@@ -189,6 +185,9 @@ GEM
ruby-debug-base19 (>= 0.11.19) ruby-debug-base19 (>= 0.11.19)
ruby_core_source (0.1.5) ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2) archive-tar-minitar (>= 0.5.2)
rubypython (0.5.1)
blankslate (>= 2.1.2.3)
ffi (~> 1.0.7)
rubyzip (0.9.4) rubyzip (0.9.4)
sass (3.1.7) sass (3.1.7)
sass-rails (3.1.1) sass-rails (3.1.1)
...@@ -242,7 +241,6 @@ PLATFORMS ...@@ -242,7 +241,6 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
acts_as_list acts_as_list
albino!
annotate! annotate!
autotest autotest
autotest-rails autotest-rails
...@@ -260,6 +258,7 @@ DEPENDENCIES ...@@ -260,6 +258,7 @@ DEPENDENCIES
jquery-rails jquery-rails
kaminari kaminari
launchy launchy
pygments.rb (= 0.2.3)
rails (= 3.1.0) rails (= 3.1.0)
rails-footnotes (>= 3.7.5.rc4) rails-footnotes (>= 3.7.5.rc4)
rspec-rails rspec-rails
... ...
......
...@@ -34,18 +34,19 @@ sqlite as default db ...@@ -34,18 +34,19 @@ sqlite as default db
sudo easy_install pygments sudo easy_install pygments
sudo gem install bundler sudo gem install bundler
bundle bundle
RAILS_ENV=production rake db:setup bundle exec rake db:setup RAILS_ENV=production
# create admin user # create admin user
# login....admin@local.host # login....admin@local.host
# pass.....5iveL!fe # pass.....5iveL!fe
RAILS_ENV=production rake db:seed_fu bundle exec rake db:seed_fu RAILS_ENV=production
Install gitosis, edit conf/gitosis.yml & start server Install gitosis, edit conf/gitosis.yml & start server
rails s rails s -e production
== Install Gitosis == Install Gitosis
sudo aptitude install gitosis sudo aptitude install gitosis
...@@ -63,6 +64,7 @@ Install gitosis, edit conf/gitosis.yml & start server ...@@ -63,6 +64,7 @@ Install gitosis, edit conf/gitosis.yml & start server
ssh-keygen -t rsa ssh-keygen -t rsa
sudo -H -u git gitosis-init < ~/.ssh/id_rsa.pub sudo -H -u git gitosis-init < ~/.ssh/id_rsa.pub
sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update
... ...
......
1.0.2 1.1.0
...@@ -16,3 +16,7 @@ $(function(){ ...@@ -16,3 +16,7 @@ $(function(){
$('select#branch').selectmenu({style:'popup', width:200}); $('select#branch').selectmenu({style:'popup', width:200});
$('select#tag').selectmenu({style:'popup', width:200}); $('select#tag').selectmenu({style:'popup', width:200});
}); });
function updatePage(){
$.ajax({type: "GET", url: location.href, dataType: "script"});
}
...@@ -491,8 +491,14 @@ tbody tr:nth-child(2n) td, tbody tr.even td { ...@@ -491,8 +491,14 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
background: white; background: white;
} }
p { p {
margin-bottom: 3px; margin-bottom: 4px;
font-size: 12px; font-size: 13px;
color:#111;
}
}
cite {
&.ago {
color:#666;
} }
} }
} }
...@@ -515,7 +521,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td { ...@@ -515,7 +521,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
} }
.note_content { .note_content {
float:left; float:left;
width:750px; width:650px;
} }
.issue_notes { .issue_notes {
...@@ -605,7 +611,9 @@ tbody tr:nth-child(2n) td, tbody tr.even td { ...@@ -605,7 +611,9 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
} }
} }
.message{ .commit,
.message,
#notes-list{
.author { .author {
background: #eaeaea; background: #eaeaea;
color: #333; color: #333;
...@@ -614,3 +622,28 @@ tbody tr:nth-child(2n) td, tbody tr.even td { ...@@ -614,3 +622,28 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
margin-right:5px; margin-right:5px;
} }
} }
/* Note textare */
#note_note {
height:100px;
width:97%;
font-size:14px;
}
.wall_page {
#note_note {
height:25px;
}
.attach_holder {
display:none;
}
}
.field_with_errors {
input[type="text"],
input[type="password"],
textarea
{
background: none repeat scroll 0 0 #FFBBBB
}
}
...@@ -60,24 +60,21 @@ class ProjectsController < ApplicationController ...@@ -60,24 +60,21 @@ class ProjectsController < ApplicationController
end end
def show def show
if @project.repo_exists? return render "projects/empty" unless @project.repo_exists?
@date = case params[:view] @date = case params[:view]
when "week" then Date.today - 7.days when "week" then Date.today - 7.days
else Date.today when "day" then Date.today
end.at_beginning_of_day else nil
@heads = @project.repo.heads
@commits = @heads.map do |h|
@project.repo.log(h.name, nil, :since => @date)
end.flatten.uniq { |c| c.id }
@commits.sort! do |x, y|
y.committed_date <=> x.committed_date
end end
@messages = project.notes.since(@date).limit(40).order("created_at DESC") if @date
@date = @date.at_beginning_of_day
@commits = @project.commits_since(@date)
@messages = project.notes.since(@date).order("created_at DESC")
else else
return render "projects/empty" @commits = @project.fresh_commits
@messages = project.notes.fresh.limit(10)
end end
end end
...@@ -86,8 +83,15 @@ class ProjectsController < ApplicationController ...@@ -86,8 +83,15 @@ class ProjectsController < ApplicationController
# #
def wall def wall
@notes = @project.common_notes
@note = Note.new @note = Note.new
@notes = @project.common_notes.order("created_at DESC")
@notes = case params[:view]
when "week" then @notes.since((Date.today - 7.days).at_beginning_of_day)
when "all" then @notes.all
when "day" then @notes.since(Date.today.at_beginning_of_day)
else @notes.fresh.limit(10)
end
end end
# #
... ...
......
...@@ -53,25 +53,4 @@ module ApplicationHelper ...@@ -53,25 +53,4 @@ module ApplicationHelper
[projects, default_nav, project_nav].flatten.to_json [projects, default_nav, project_nav].flatten.to_json
end end
def handle_file_type(file_name, mime_type = nil)
if file_name =~ /(\.rb|\.ru|\.rake|Rakefile|\.gemspec|\.rbx|Gemfile)$/
:ruby
elsif file_name =~ /\.py$/
:python
elsif file_name =~ /(\.pl|\.scala|\.c|\.cpp|\.java|\.haml|\.html|\.sass|\.scss|\.xml|\.php|\.erb)$/
$1[1..-1].to_sym
elsif file_name =~ /\.js$/
:javascript
elsif file_name =~ /\.sh$/
:bash
elsif file_name =~ /\.coffee$/
:coffeescript
elsif file_name =~ /\.yml$/
:yaml
elsif file_name =~ /\.md$/
:minid
else
:text
end
end
end end
...@@ -24,6 +24,7 @@ class Note < ActiveRecord::Base ...@@ -24,6 +24,7 @@ class Note < ActiveRecord::Base
scope :last_week, where("created_at >= :date", :date => (Date.today - 7.days)) scope :last_week, where("created_at >= :date", :date => (Date.today - 7.days))
scope :since, lambda { |day| where("created_at >= :date", :date => (day)) } scope :since, lambda { |day| where("created_at >= :date", :date => (day)) }
scope :fresh, order("created_at DESC")
mount_uploader :attachment, AttachmentUploader mount_uploader :attachment, AttachmentUploader
end end
... ...
......
...@@ -35,6 +35,7 @@ class Project < ActiveRecord::Base ...@@ -35,6 +35,7 @@ class Project < ActiveRecord::Base
:presence => true :presence => true
validate :check_limit validate :check_limit
validate :repo_name
after_destroy :destroy_gitosis_project after_destroy :destroy_gitosis_project
after_save :update_gitosis_project after_save :update_gitosis_project
...@@ -126,6 +127,34 @@ class Project < ActiveRecord::Base ...@@ -126,6 +127,34 @@ class Project < ActiveRecord::Base
end end
end end
def heads
@heads ||= repo.heads
end
def fresh_commits
commits = heads.map do |h|
repo.commits(h.name, 10)
end.flatten.uniq { |c| c.id }
commits.sort! do |x, y|
y.committed_date <=> x.committed_date
end
commits[0..10]
end
def commits_since(date)
commits = heads.map do |h|
repo.log(h.name, nil, :since => date)
end.flatten.uniq { |c| c.id }
commits.sort! do |x, y|
y.committed_date <=> x.committed_date
end
commits
end
def tree(fcommit, path = nil) def tree(fcommit, path = nil)
fcommit = commit if fcommit == :head fcommit = commit if fcommit == :head
tree = fcommit.tree tree = fcommit.tree
...@@ -140,6 +169,12 @@ class Project < ActiveRecord::Base ...@@ -140,6 +169,12 @@ class Project < ActiveRecord::Base
errors[:base] << ("Cant check your ability to create project") errors[:base] << ("Cant check your ability to create project")
end end
def repo_name
if path == "gitosis-admin"
errors.add(:path, " like 'gitosis-admin' is not allowed")
end
end
def valid_repo? def valid_repo?
repo repo
rescue rescue
... ...
......
class Snippet < ActiveRecord::Base class Snippet < ActiveRecord::Base
include Utils::Colorize
belongs_to :project belongs_to :project
belongs_to :author, :class_name => "User" belongs_to :author, :class_name => "User"
has_many :notes, :as => :noteable has_many :notes, :as => :noteable
...@@ -28,6 +30,10 @@ class Snippet < ActiveRecord::Base ...@@ -28,6 +30,10 @@ class Snippet < ActiveRecord::Base
".js", ".sh", ".coffee", ".yml", ".md" ".js", ".sh", ".coffee", ".yml", ".md"
] ]
end end
def colorize
system_colorize(content, file_name)
end
end end
# == Schema Information # == Schema Information
# #
... ...
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
= link_to "Browse Code", tree_project_path(@project, :commit_id => commit.id), :class => "lite_button", :style => "float:right" = link_to "Browse Code", tree_project_path(@project, :commit_id => commit.id), :class => "lite_button", :style => "float:right"
= link_to truncate(commit.id.to_s, :length => 16), project_commit_path(@project, :id => commit.id), :class => "lite_button", :style => "width:120px;float:right" = link_to truncate(commit.id.to_s, :length => 16), project_commit_path(@project, :id => commit.id), :class => "lite_button", :style => "width:120px;float:right"
%span %span
%span %span.author
[ #{commit.author} ] = commit.author
= time_ago_in_words(commit.committed_date) = time_ago_in_words(commit.committed_date)
ago ago
= more_commits_link if @commits.size > 99 = more_commits_link if @commits.size > 99
- require "utils" .file_stats= render "commits/diff_head"
.file_stats
- @commit.diffs.each do |diff|
- if diff.deleted_file
%span.removed_file
%a{:href => "##{diff.a_path}"}
= diff.a_path
= image_tag "blueprint_delete.png"
- elsif diff.renamed_file
%span.moved_file
%a{:href => "##{diff.b_path}"}
= diff.a_path
= "->"
= diff.b_path
= image_tag "blueprint_notice.png"
- elsif diff.new_file
%span.new_file
%a{:href => "##{diff.b_path}"}
= diff.b_path
= image_tag "blueprint_add.png"
- else
%span.edit_file
%a{:href => "##{diff.b_path}"}
= diff.b_path
= image_tag "blueprint_info.png"
- @commit.diffs.each do |diff| - @commit.diffs.each do |diff|
- next if diff.diff.empty? - next if diff.diff.empty?
- file = (@commit.tree / diff.b_path) - file = (@commit.tree / diff.b_path)
...@@ -32,27 +9,15 @@ ...@@ -32,27 +9,15 @@
- if diff.deleted_file - if diff.deleted_file
%strong{:id => "#{diff.b_path}"}= diff.a_path %strong{:id => "#{diff.b_path}"}= diff.a_path
- else - else
= link_to tree_file_project_path(@project, @commit.id, diff.b_path) do
%strong{:id => "#{diff.b_path}"}= diff.b_path %strong{:id => "#{diff.b_path}"}= diff.b_path
%br/ %br/
.diff_file_content .diff_file_content
- if file.mime_type =~ /application|text/ && !Utils.binary?(file.data) - if file.text?
- lines_arr = diff.diff.lines.to_a = render :partial => "commits/text_file", :locals => { :diff => diff }
- line_old = lines_arr[2].match(/-(\d)/)[0].to_i.abs rescue 0 - elsif file.image?
- line_new = lines_arr[2].match(/\+(\d)/)[0].to_i.abs rescue 0
- lines = lines_arr[3..-1].join
- lines.each_line do |line|
= diff_line(line, line_new, line_old)
- if line[0] == "+"
- line_new += 1
- elsif
- line[0] == "-"
- line_old += 1
- else
- line_new += 1
- line_old += 1
- elsif file.mime_type =~ /image/
.diff_file_content_image .diff_file_content_image
%img{:src => "data:image/jpeg;base64,#{Base64.encode64(file.data)}"} %img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
- else - else
%p %p
%center No preview for this file type %center No preview for this file type
- @commit.diffs.each do |diff|
- if diff.deleted_file
%span.removed_file
%a{:href => "##{diff.a_path}"}
= diff.a_path
= image_tag "blueprint_delete.png"
- elsif diff.renamed_file
%span.moved_file
%a{:href => "##{diff.b_path}"}
= diff.a_path
= "->"
= diff.b_path
= image_tag "blueprint_notice.png"
- elsif diff.new_file
%span.new_file
%a{:href => "##{diff.b_path}"}
= diff.b_path
= image_tag "blueprint_add.png"
- else
%span.edit_file
%a{:href => "##{diff.b_path}"}
= diff.b_path
= image_tag "blueprint_info.png"
- lines_arr = diff.diff.lines.to_a
- line_old = lines_arr[2].match(/-(\d)/)[0].to_i.abs rescue 0
- line_new = lines_arr[2].match(/\+(\d)/)[0].to_i.abs rescue 0
- lines = lines_arr[3..-1].join
- lines.each_line do |line|
= diff_line(line, line_new, line_old)
- if line[0] == "+"
- line_new += 1
- elsif
- line[0] == "-"
- line_old += 1
- else
- line_new += 1
- line_old += 1
:plain -#:plain
$("#side-commit-preview").remove(); $("#side-commit-preview").remove();
var side = $("<div id='side-commit-preview'></div>"); var side = $("<div id='side-commit-preview'></div>");
side.html("#{escape_javascript(render "commits/show")}"); side.html("#{escape_javascript(render "commits/show")}");
$("##{dom_id(@project)}").parent().append(side); $("##{dom_id(@project)}").parent().append(side);
$("##{dom_id(@project)}").addClass("span-14"); $("##{dom_id(@project)}").addClass("span-14");
:plain
$("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}");
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
= f.label :note = f.label :note
%cite (255 symbols only) %cite (255 symbols only)
%br %br
= f.text_area :note, :style => "width:97%;height:100px", :size => 255 = f.text_area :note, :size => 255
%div %div.attach_holder
= f.label :attachment = f.label :attachment
%cite (less than 10 MB) %cite (less than 10 MB)
%br %br
... ...
......
- if controller.action_name == "wall"
%ul#notes-list= render "notes/notes_list" %ul#notes-list= render "notes/notes_list"
- else
%ul#notes-list= render "notes/notes_list"
%br %br
%br %br
- if can? current_user, :write_note, @project - if can? current_user, :write_note, @project
...@@ -23,7 +26,3 @@ ...@@ -23,7 +26,3 @@
$(function(){ $(function(){
var int =self.setInterval("updatePage()", 20000); var int =self.setInterval("updatePage()", 20000);
}); });
function updatePage(){
$.ajax({type: "GET", url: location.href, dataType: "script"});
}
%li{:id => dom_id(note)} %li{:id => dom_id(note)}
%div.note_author %div.note_author
= image_tag gravatar_icon(note.author.email), :class => "left", :width => 40, :style => "padding-right:5px;" = image_tag gravatar_icon(note.author.email), :class => "left", :width => 40, :style => "padding-right:5px;"
%div.note_content %div.note_content.left
= simple_format(html_escape(note.note)) = simple_format(html_escape(note.note))
- if note.attachment.url - if note.attachment.url
Attachment: Attachment:
= link_to note.attachment_identifier, note.attachment.url = link_to note.attachment_identifier, note.attachment.url, :target => "_blank"
%br %br
%span %span.author= note.author.name
%span %cite.ago
[ #{note.author.name} ]
&nbsp;
= time_ago_in_words(note.updated_at) = time_ago_in_words(note.updated_at)
ago ago
%br %br
... ...
......