Improve add_branch task. Fix projects list JSON generation. Refs #207, #279

This commit is contained in:
Pavel Chipiga 2012-03-24 00:48:15 +02:00
parent 6a8b8fec3a
commit cacd9eb301
3 changed files with 5 additions and 5 deletions

View File

@ -6,7 +6,7 @@
<% @projects.each do |project| %> <% @projects.each do |project| %>
[ [
"<%=j link_to("#{project.owner.respond_to?(:uname) ? project.owner.uname : project.owner.name} / #{project.name}", project) %>", "<%=j link_to("#{project.owner.respond_to?(:uname) ? project.owner.uname : project.owner.name} / #{project.name}", project) %>",
"<%= truncate(project.description || '', :length => 60).gsub("\n", ' ') %>", "<%= truncate(project.description || '', :length => 60).gsub("\n", ' ').gsub("\r", ' ') %>",
"<%=j link_to t("layout.add"), url_for(:controller => :repositories, :action => :add_project, :project_id => project.id) %>" "<%=j link_to t("layout.add"), url_for(:controller => :repositories, :action => :add_project, :project_id => project.id) %>"
]<%= project == @projects.last ? '' : ',' %> ]<%= project == @projects.last ? '' : ',' %>
<% end %> <% end %>

View File

@ -13,7 +13,7 @@
j(link_to("#{project.owner.respond_to?(:uname) ? project.owner.uname : project.owner.name} / #{project.name}", project)) + j(link_to("#{project.owner.respond_to?(:uname) ? project.owner.uname : project.owner.name} / #{project.name}", project)) +
"</div>").html_safe "</div>").html_safe
%>", %>",
"<%= truncate(project.description || '', :length => 60).gsub("\n", ' ') %>", "<%= truncate(project.description || '', :length => 60).gsub("\n", ' ').gsub("\r", ' ') %>",
"<%= "<%=
if can? :remove_project, @repository if can? :remove_project, @repository
j(link_to('<span class="delete">&nbsp;</span>'.html_safe, j(link_to('<span class="delete">&nbsp;</span>'.html_safe,

View File

@ -9,12 +9,12 @@ task :add_branch => :environment do
Platform.find_by_name(dst_branch).repositories.each do |r| Platform.find_by_name(dst_branch).repositories.each do |r|
say "=== Process #{r.name} repo" say "=== Process #{r.name} repo"
r.projects.find_each do |p| r.projects.find_each do |p|
next if p.branches.map(&:name).include?(dst_branch)
say "===== Process #{p.name} project" say "===== Process #{p.name} project"
tmp_path = Rails.root.join('tmp', p.name) tmp_path = Rails.root.join('tmp', p.name)
system("git clone #{p.path} #{tmp_path}") system("git clone #{p.path} #{tmp_path}")
system("cd #{tmp_path} && git checkout remotes/origin/#{src_branch}") or system("cd #{tmp_path} && git checkout master") system("cd #{tmp_path} && git checkout remotes/origin/#{src_branch} || git checkout master")
system("cd #{tmp_path} && git checkout -b #{dst_branch}") system("cd #{tmp_path} && git checkout -b #{dst_branch} && git push origin HEAD")
system("cd #{tmp_path} && git push origin HEAD")
FileUtils.rm_rf tmp_path FileUtils.rm_rf tmp_path
end end
end end