Commit 09558634 authored by Adam Leonard's avatar Adam Leonard

Merge branch 'master' of dev.gitlabhq.com:gitlabhq into feature/issues_search

parents 7087e11f f6a67fba
...@@ -28,24 +28,33 @@ sqlite as default db ...@@ -28,24 +28,33 @@ sqlite as default db
git clone git://github.com/gitlabhq/gitlabhq.git git clone git://github.com/gitlabhq/gitlabhq.git
cd gitlabhq/ cd gitlabhq/
# install this library first # install this library first
sudo easy_install pygments sudo easy_install pygments
# give your user access to remove git repo
# Ex.
# If you are going to use user 'gitlabhq' for rails server
# gitlabhq ALL = (git) NOPASSWD: /bin/rm" | sudo tee -a /etc/sudoers
#
echo "USERNAME ALL = (git) NOPASSWD: /bin/rm" | sudo tee -a /etc/sudoers
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 +72,7 @@ Install gitosis, edit conf/gitosis.yml & start server ...@@ -63,6 +72,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
...@@ -83,3 +93,8 @@ Install gitosis, edit conf/gitosis.yml & start server ...@@ -83,3 +93,8 @@ Install gitosis, edit conf/gitosis.yml & start server
echo "gem: --no-rdoc --no-ri" > ~/.gemrc echo "gem: --no-rdoc --no-ri" > ~/.gemrc
== Contribute
We develop project on our private server.
Want to help? Contact us on twitter or email to become a team member.
...@@ -638,3 +638,46 @@ tbody tr:nth-child(2n) td, tbody tr.even td { ...@@ -638,3 +638,46 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
display:none; display:none;
} }
} }
.field_with_errors {
input[type="text"],
input[type="password"],
textarea
{
background: none repeat scroll 0 0 #FFBBBB
}
}
.tag {
@include round-borders-all(4px);
padding:2px 4px;
border:none;
&.high {
background: #D12F19;
color:white;
}
&.today {
background: #44aa22;
color:white;
}
&.yours {
background: #4466cc;
color:white;
}
&.notes {
background: #2c5c66;
color:white;
}
}
#issues-table .issue {
&.critical {
td {
//background: #D12F19;
//color:#fff;
}
}
}
...@@ -12,7 +12,7 @@ class IssuesController < ApplicationController ...@@ -12,7 +12,7 @@ class IssuesController < ApplicationController
def index def index
@issues = case params[:f].to_i @issues = case params[:f].to_i
when 1 then @project.issues.all when 1 then @project.issues
when 2 then @project.issues.closed when 2 then @project.issues.closed
when 3 then @project.issues.opened.assigned(current_user) when 3 then @project.issues.opened.assigned(current_user)
else @project.issues.opened else @project.issues.opened
......
...@@ -8,35 +8,16 @@ class TeamMembersController < ApplicationController ...@@ -8,35 +8,16 @@ class TeamMembersController < ApplicationController
def show def show
@team_member = project.users_projects.find(params[:id]) @team_member = project.users_projects.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.js
end
end end
def new def new
@team_member = project.users_projects.new @team_member = project.users_projects.new
respond_to do |format|
format.html # new.html.erb
format.js
end
end end
def create def create
@team_member = UsersProject.new(params[:team_member]) @team_member = UsersProject.new(params[:team_member])
@team_member.project = project @team_member.project = project
@team_member.save
respond_to do |format|
if @team_member.save
format.html { redirect_to @team_member, notice: 'Team member was successfully created.' }
format.js
else
format.html { render action: "new" }
format.js
end
end
end end
def update def update
...@@ -45,7 +26,12 @@ class TeamMembersController < ApplicationController ...@@ -45,7 +26,12 @@ class TeamMembersController < ApplicationController
respond_to do |format| respond_to do |format|
format.js format.js
format.html { redirect_to team_project_path(@project)} format.html do
unless @team_member.valid?
flash[:alert] = "User should have at least one role"
end
redirect_to team_project_path(@project)
end
end end
end end
......
...@@ -21,13 +21,4 @@ module CommitsHelper ...@@ -21,13 +21,4 @@ module CommitsHelper
link_to "More", project_commits_path(@project, :offset => offset.to_i + limit.to_i, :limit => limit), link_to "More", project_commits_path(@project, :offset => offset.to_i + limit.to_i, :limit => limit),
:remote => true, :class => "lite_button vm", :style => "text-align:center; width:930px; ", :id => "more-commits-link" :remote => true, :class => "lite_button vm", :style => "text-align:center; width:930px; ", :id => "more-commits-link"
end end
# Cause some errors with trucate & encoding use this method
def truncate_commit_message(commit, size = 60)
message = commit.message
message.length > size ? (message[0..(size - 1)] + "...") : message
# if special characters occurs
rescue
commit.message
end
end end
...@@ -18,11 +18,22 @@ class Issue < ActiveRecord::Base ...@@ -18,11 +18,22 @@ class Issue < ActiveRecord::Base
:presence => true, :presence => true,
:length => { :within => 0..2000 } :length => { :within => 0..2000 }
scope :critical, where(:critical => true)
scope :non_critical, where(:critical => false)
scope :opened, where(:closed => false) scope :opened, where(:closed => false)
scope :closed, where(:closed => true) scope :closed, where(:closed => true)
scope :assigned, lambda { |u| where(:assignee_id => u.id)} scope :assigned, lambda { |u| where(:assignee_id => u.id)}
acts_as_list acts_as_list
def today?
Date.today == created_at.to_date
end
def new?
today? && created_at == updated_at
end
end end
# == Schema Information # == Schema Information
# #
......
...@@ -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
...@@ -168,6 +169,12 @@ class Project < ActiveRecord::Base ...@@ -168,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
......
...@@ -9,6 +9,7 @@ class UsersProject < ActiveRecord::Base ...@@ -9,6 +9,7 @@ class UsersProject < ActiveRecord::Base
validates_uniqueness_of :user_id, :scope => [:project_id] validates_uniqueness_of :user_id, :scope => [:project_id]
validates_presence_of :user_id validates_presence_of :user_id
validates_presence_of :project_id validates_presence_of :project_id
validate :user_has_a_role_selected
delegate :name, :email, :to => :user, :prefix => true delegate :name, :email, :to => :user, :prefix => true
...@@ -18,6 +19,10 @@ class UsersProject < ActiveRecord::Base ...@@ -18,6 +19,10 @@ class UsersProject < ActiveRecord::Base
end end
end end
def user_has_a_role_selected
errors.add(:base, "Please choose at least one Role in the Access list") unless read || write || admin
end
end end
# == Schema Information # == Schema Information
# #
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
= image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
%p %p
%strong %strong
= truncate_commit_message(commit) = truncate(commit.safe_message, :length => 60)
= 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
......
.file_stats .file_stats= render "commits/diff_head"
- @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)
...@@ -31,24 +9,12 @@ ...@@ -31,24 +9,12 @@
- 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.text? - 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
- 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.image? - elsif file.image?
.diff_file_content_image .diff_file_content_image
%img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} %img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
......
- @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"
- line_old = 0
- line_new = 0
- lines_arr = diff.diff.lines.to_a
- lines_arr.each do |line|
- next if line.match(/^--- a/)
- next if line.match(/^\+\+\+ b/)
- if line.match(/^@@ -/)
- line_old = line.match(/\-[0-9]*/)[0].to_i.abs rescue 0
- line_new = line.match(/\+[0-9]*/)[0].to_i.abs rescue 0
- next
= 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
%h3 %h3
= "[ #{@commit.committer} ] #{truncate_commit_message(@commit, 80)}" = "[ #{@commit.committer} ] #{truncate(@commit.safe_message)}"
-#= link_to 'Back', project_commits_path(@project), :class => "button" -#= link_to 'Back', project_commits_path(@project), :class => "button"
%table.round-borders %table.round-borders
%tr %tr
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
%td= @commit.committed_date %td= @commit.committed_date
%tr %tr
%td Message %td Message
%td= @commit.message %td= @commit.safe_message
%tr %tr
%td Tree %td Tree
%td= link_to 'Browse Code', tree_project_path(@project, :commit_id => @commit.id) %td= link_to 'Browse Code', tree_project_path(@project, :commit_id => @commit.id)
......
...@@ -5,17 +5,21 @@ ...@@ -5,17 +5,21 @@
- @issue.errors.full_messages.each do |msg| - @issue.errors.full_messages.each do |msg|
%li= msg %li= msg
.span-6 .span-8
= f.label :title = f.label :title
= f.text_field :title, :style => "width:450px" = f.text_field :title, :style => "width:450px"
.span-6 .span-8
= f.label :content = f.label :content
= f.text_area :content, :style => "width:450px; height:130px" = f.text_area :content, :style => "width:450px; height:130px"
.span-6.append-bottom .span-8.append-bottom
= f.label :assignee_id = f.label :assignee_id
= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }) = f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" })
.span-1
= f.label :critical, "Critical"
%br
= f.check_box :critical
- unless @issue.new_record? - unless @issue.new_record?
.span-3.right .span-2.right
= f.label :closed = f.label :closed
%br %br
= f.check_box :closed = f.check_box :closed
......
%table.round-borders#issues-table %table.round-borders#issues-table
%tr %tr
- if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0"
%th
%th Assignee %th Assignee
%th ID %th ID
%th Title %th Title
%th Closed? %th Closed?
%th %th
- @issues.each do |issue| - @issues.critical.each do |issue|
= render(:partial => 'show', :locals => {:issue => issue})
- @issues.non_critical.each do |issue|
= render(:partial => 'show', :locals => {:issue => issue}) = render(:partial => 'show', :locals => {:issue => issue})
%tr{ :id => dom_id(issue), :class => "issue", :url => project_issue_path(@project, issue) } %tr{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(@project, issue) }
- if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0"
%td %td
= image_tag "move.png" , :class => [:handle, :left] = image_tag "move.png" , :class => [:handle, :left]
%td
= image_tag gravatar_icon(issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;" = image_tag gravatar_icon(issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;"
= truncate issue.assignee.name, :lenght => 20 = truncate issue.assignee.name, :lenght => 20
%td ##{issue.id} %td ##{issue.id}
%td= html_escape issue.title %td
= html_escape issue.title
%br
- if issue.critical
%span.tag.high critical
- if issue.today?
%span.tag.today today
-#- if issue.author == current_user
-#%span.tag.yours yours
-#- if issue.notes.count > 0
-#%span.tag.notes
-#= issue.notes.count
-#notes
%td %td
- if can? current_user, :write_issue, @project - if can? current_user, :write_issue, @project
= form_for([@project, issue], :remote => true) do |f| = form_for([@project, issue], :remote => true) do |f|
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
= image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
%p{:style => "margin-bottom: 3px;"} %p{:style => "margin-bottom: 3px;"}
%strong %strong
= link_to truncate_commit_message(commit, 60), project_commit_path(@project, :id => commit.id) = link_to truncate(commit.safe_message, :length => 60), project_commit_path(@project, :id => commit.id)
%span %span
%span.author %span.author
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
- css_class = "dash_commit" - css_class = "dash_commit"
- commit = parent - commit = parent
- item_code = commit.author.email - item_code = commit.author.email
- link_item_name = truncate_commit_message(commit, 50) - link_item_name = truncate(commit.safe_message, :length => 50)
- link_to_item = project_commit_path(@project, :id => commit.id) - link_to_item = project_commit_path(@project, :id => commit.id)
- else - else
- css_class = "dash_wall" - css_class = "dash_wall"
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
%th Last Update %th Last Update
%th %th
Last commit Last commit
= link_to "history", project_commits_path(@project, :path => params[:path]), :class => "right" = link_to "history", project_commits_path(@project, :path => params[:path], :branch => params[:branch],:tag => params[:tag]), :class => "right"
- if params[:path] - if params[:path]
- file = File.join(params[:path], "..") - file = File.join(params[:path], "..")
%tr{ :class => "tree-item", :url => tree_file_project_path(@project, @commit.id, file) } %tr{ :class => "tree-item", :url => tree_file_project_path(@project, @commit.id, file) }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
%strong %strong
= name = name
= link_to "raw", blob_project_path(@project, :commit_id => @commit.id, :path => params[:path] ), :class => "right", :target => "_blank" = link_to "raw", blob_project_path(@project, :commit_id => @commit.id, :path => params[:path] ), :class => "right", :target => "_blank"
= link_to "history", project_commits_path(@project, :path => params[:path]), :class => "right", :style => "margin-right:10px;" = link_to "history", project_commits_path(@project, :path => params[:path], :branch => params[:branch], :tag => params[:tag] ), :class => "right", :style => "margin-right:10px;"
%br/ %br/
- if file.text? - if file.text?
.view_file_content .view_file_content
......
...@@ -12,4 +12,4 @@ ...@@ -12,4 +12,4 @@
= time_ago_in_words(content_commit.committed_date) = time_ago_in_words(content_commit.committed_date)
ago ago
%td %td
= link_to truncate_commit_message(content_commit, 40), project_commit_path(@project, content_commit) = link_to truncate(content_commit.safe_message, :length => 40), project_commit_path(@project, content_commit)
...@@ -6,3 +6,7 @@ Grit::Blob.class_eval do ...@@ -6,3 +6,7 @@ Grit::Blob.class_eval do
include Utils::FileHelper include Utils::FileHelper
include Utils::Colorize include Utils::Colorize
end end
Grit::Commit.class_eval do
include CommitExt
end
# Admin account
admin = User.create( admin = User.create(
:email => "admin@local.host", :email => "admin@local.host",
:name => "Administrator", :name => "Administrator",
...@@ -9,3 +8,12 @@ admin = User.create( ...@@ -9,3 +8,12 @@ admin = User.create(
admin.projects_limit = 10000 admin.projects_limit = 10000
admin.admin = true admin.admin = true
admin.save! admin.save!
if admin.valid?
puts %q[
Administrator account created:
login.........admin@local.host
password......5iveL!fe
]
end
...@@ -8,3 +8,12 @@ admin = User.create( ...@@ -8,3 +8,12 @@ admin = User.create(
admin.projects_limit = 10000 admin.projects_limit = 10000
admin.admin = true admin.admin = true
admin.save! admin.save!
if admin.valid?
puts %q[
Administrator account created:
login.........admin@local.host
password......5iveL!fe
]
end
class AddHighLabelToIssue < ActiveRecord::Migration
def change
add_column :issues, :critical, :boolean, :default => false, :null => false
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20111021101550) do ActiveRecord::Schema.define(:version => 20111025134235) do
create_table "issues", :force => true do |t| create_table "issues", :force => true do |t|
t.string "title" t.string "title"
...@@ -23,6 +23,7 @@ ActiveRecord::Schema.define(:version => 20111021101550) do ...@@ -23,6 +23,7 @@ ActiveRecord::Schema.define(:version => 20111021101550) do
t.datetime "updated_at" t.datetime "updated_at"
t.boolean "closed", :default => false, :null => false t.boolean "closed", :default => false, :null => false
t.integer "position", :default => 0 t.integer "position", :default => 0
t.boolean "critical", :default => false, :null => false
end end
create_table "keys", :force => true do |t| create_table "keys", :force => true do |t|
......
root_path = File.expand_path(File.dirname(__FILE__))
require File.join(root_path, "lib", "color")
include Color
#
# ruby ./update.rb development # or test or production (default)
#
envs = ["production", "test", "development"]
env = if envs.include?(ARGV[0])
ARGV[0]
else
"production"
end
puts green " == Install for ENV=#{env} ..."
# bundle install
`bundle install`
# migrate db
`bundle exec rake db:create RAILS_ENV=#{env}`
`bundle exec rake db:schema:load RAILS_ENV=#{env}`
`bundle exec rake db:seed_fu RAILS_ENV=#{env}`
puts green %q[
Administrator account created:
login.........admin@local.host
password......5iveL!fe
]
puts green " == Done! Now you can start server"
module CommitExt
def safe_message
message.encode("UTF-8",
:invalid => :replace,
:undef => :replace,
:universal_newline => true,
:replace => "")
rescue
"-- invalid encoding for commit message"
end
end
...@@ -42,7 +42,7 @@ class Gitosis ...@@ -42,7 +42,7 @@ class Gitosis
end end
def destroy_project(project) def destroy_project(project)
FileUtils.rm_rf(project.path_to_repo) `sudo -u git rm -rf #{project.path_to_repo}`
conf = IniFile.new(File.join(@local_dir,'gitosis','gitosis.conf')) conf = IniFile.new(File.join(@local_dir,'gitosis','gitosis.conf'))
......
...@@ -4,11 +4,15 @@ describe Project do ...@@ -4,11 +4,15 @@ describe Project do
describe "Associations" do describe "Associations" do
it { should have_many(:users) } it { should have_many(:users) }
it { should have_many(:users_projects) } it { should have_many(:users_projects) }
it { should have_many(:issues) }
it { should have_many(:notes) }
it { should have_many(:snippets) }
end end
describe "Validation" do describe "Validation" do
it { should validate_presence_of(:name) } it { should validate_presence_of(:name) }
it { should validate_presence_of(:path) } it { should validate_presence_of(:path) }
it { should validate_presence_of(:code) }
end end
describe "Respond to" do describe "Respond to" do
...@@ -31,6 +35,11 @@ describe Project do ...@@ -31,6 +35,11 @@ describe Project do
it { should respond_to(:commit) } it { should respond_to(:commit) }
end end
it "should not allow 'gitosis-admin' as repo name" do
should allow_value("blah").for(:path)
should_not allow_value("gitosis-admin").for(:path)
end
it "should return valid url to repo" do it "should return valid url to repo" do
project = Project.new(:path => "somewhere") project = Project.new(:path => "somewhere")
project.url_to_repo.should == "git@localhost:somewhere.git" project.url_to_repo.should == "git@localhost:somewhere.git"
......
...@@ -10,7 +10,9 @@ describe "TeamMembers" do ...@@ -10,7 +10,9 @@ describe "TeamMembers" do
describe "View profile" do describe "View profile" do
it "should be available" do it "should be available" do
visit(team_project_path(@project)) visit(team_project_path(@project))
find(:xpath, "//table[@id='team-table']//a[1]").click within "#team-table" do
click_link(@user.name)
end
page.should have_content @user.skype page.should have_content @user.skype
page.should_not have_content 'Twitter' page.should_not have_content 'Twitter'
end end
...@@ -29,19 +31,37 @@ describe "TeamMembers" do ...@@ -29,19 +31,37 @@ describe "TeamMembers" do
describe "fill in" do describe "fill in" do
before do before do
check "team_member_read"
click_link "Select user" click_link "Select user"
click_link @user_1.name click_link @user_1.name
#select @user_1.name, :from => "team_member_user_id"
within "#team_member_new" do
check "team_member_read"
check "team_member_write"
end
end end
it { expect { click_button "Save" }.to change {UsersProject.count}.by(1) } it { expect { click_button "Save";sleep(1) }.to change {UsersProject.count}.by(1) }
it "should add new member to table" do it "should add new member to table" do
click_button "Save" click_button "Save"
@member = UsersProject.last
page.should_not have_content("Add new member")
page.should have_content @user_1.name page.should have_content @user_1.name
@member.read.should be_true
@member.write.should be_true
@member.admin.should be_false
end
it "should not allow creation without access selected" do
within "#team_member_new" do
uncheck "team_member_read"
uncheck "team_member_write"
uncheck "team_member_admin"
end
expect { click_button "Save" }.to_not change {UsersProject.count}
page.should have_content("Please choose at least one Role in the Access list")
end end
end end
end end
......
root_path = File.expand_path(File.dirname(__FILE__))
require File.join(root_path, "lib", "color")
include Color
def version
File.read("VERSION")
end
#
# ruby ./update.rb development # or test or production (default)
#
envs = ["production", "test", "development"]
env = if envs.include?(ARGV[0])
ARGV[0]
else
"production"
end
puts yellow "== RAILS ENV | #{env}"
current_version = version
puts yellow "Your version is #{current_version}"
puts yellow "Check for new version: $ git pull origin 1x"
`git pull origin 1x` # pull from origin
# latest version
if version == current_version
puts yellow "You have a latest version"
else
puts green "Update to #{version}"
`bundle install`
# migrate db
if env == "development"
`bundle exec rake db:migrate RAILS_ENV=development`
`bundle exec rake db:migrate RAILS_ENV=test`
else
`bundle exec rake db:migrate RAILS_ENV=#{env}`
end
puts green "== Done! Now you can start/restart server"
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment