[refs #2249] Global name to description and unixname to name renames
This commit is contained in:
parent
cfceda9c53
commit
148a0fec28
|
@ -15,7 +15,7 @@ class AutoBuildListsController < ApplicationController
|
|||
|
||||
def create
|
||||
@auto_build_list = AutoBuildList.new(
|
||||
:bpl_id => Platform.find_by_unixname('mandriva2011').try(:id),
|
||||
:bpl_id => Platform.find_by_name('mandriva2011').try(:id),
|
||||
:pl_id => current_user.personal_platform.id,
|
||||
:arch_id => Arch.find_by_name('i586').id,
|
||||
:project_id => params[:project_id])
|
||||
|
|
|
@ -28,7 +28,7 @@ class PersonalRepositoriesController < ApplicationController
|
|||
if params[:project_id]
|
||||
@project = Project.find(params[:project_id])
|
||||
# params[:project_id] = nil
|
||||
unless @repository.projects.find_by_unixname(@project.unixname)
|
||||
unless @repository.projects.find_by_name(@project.name)
|
||||
@repository.projects << @project
|
||||
flash[:notice] = t('flash.repository.project_added')
|
||||
else
|
||||
|
|
|
@ -16,10 +16,10 @@ class PlatformsController < ApplicationController
|
|||
format.json do
|
||||
render :json => {
|
||||
:platforms => @platforms.map do |p|
|
||||
{:name => p.unixname,
|
||||
{:name => p.name,
|
||||
:architectures => ['i586', 'x86_64'],
|
||||
:repositories => p.repositories.map(&:unixname),
|
||||
:url => "http://#{request.host_with_port}/downloads/#{p.unixname}/repository/"}
|
||||
:repositories => p.repositories.map(&:name),
|
||||
:url => "http://#{request.host_with_port}/downloads/#{p.name}/repository/"}
|
||||
end
|
||||
}
|
||||
end
|
||||
|
@ -77,7 +77,7 @@ class PlatformsController < ApplicationController
|
|||
|
||||
def clone
|
||||
if request.post?
|
||||
@cloned = @platform.make_clone(:name => params[:platform]['name'], :unixname => params[:platform]['unixname'],
|
||||
@cloned = @platform.make_clone(:name => params[:platform]['name'], :description => params[:platform]['description'],
|
||||
:owner_id => current_user.id, :owner_type => current_user.class.to_s)
|
||||
if @cloned.persisted?
|
||||
flash[:notice] = 'Клонирование успешно'
|
||||
|
@ -88,7 +88,7 @@ class PlatformsController < ApplicationController
|
|||
else
|
||||
@cloned = Platform.new
|
||||
@cloned.name = @platform.name + "_clone"
|
||||
@cloned.unixname = @platform.unixname + "_clone"
|
||||
@cloned.description = @platform.description + "_clone"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -64,9 +64,9 @@ class ProjectsController < ApplicationController
|
|||
|
||||
# TODO remove this?
|
||||
def auto_build
|
||||
uname, unixname = params[:git_repo].split('/')
|
||||
uname, name = params[:git_repo].split('/')
|
||||
owner = User.find_by_uname(uname) || Group.find_by_uname(uname)
|
||||
project = Project.where(:owner_id => owner.id, :owner_type => owner.class).find_by_unixname!(unixname)
|
||||
project = Project.where(:owner_id => owner.id, :owner_type => owner.class).find_by_name!(name)
|
||||
project.delay.auto_build # TODO don't queue duplicates
|
||||
|
||||
# p = params.delete_if{|k,v| k == 'controller' or k == 'action'}
|
||||
|
@ -79,7 +79,7 @@ class ProjectsController < ApplicationController
|
|||
def build
|
||||
@arches = Arch.recent
|
||||
@bpls = Platform.main
|
||||
@pls = @project.repositories.collect { |rep| ["#{rep.platform.name}/#{rep.unixname}", rep.platform.id] }
|
||||
@pls = @project.repositories.collect { |rep| ["#{rep.platform.name}/#{rep.name}", rep.platform.id] }
|
||||
@project_versions = @project.collected_project_versions
|
||||
end
|
||||
|
||||
|
@ -101,7 +101,7 @@ class ProjectsController < ApplicationController
|
|||
if !check_arches || !check_project_versions
|
||||
@arches = Arch.recent
|
||||
@bpls = Platform.main
|
||||
@pls = @project.repositories.collect { |rep| ["#{rep.platform.name}/#{rep.unixname}", rep.platform.id] }
|
||||
@pls = @project.repositories.collect { |rep| ["#{rep.platform.name}/#{rep.name}", rep.platform.id] }
|
||||
|
||||
render :action => "build"
|
||||
else
|
||||
|
|
|
@ -54,7 +54,7 @@ class RepositoriesController < ApplicationController
|
|||
if params[:project_id]
|
||||
@project = Project.find(params[:project_id])
|
||||
# params[:project_id] = nil
|
||||
unless @repository.projects.find_by_unixname(@project.unixname)
|
||||
unless @repository.projects.find_by_name(@project.name)
|
||||
@repository.projects << @project
|
||||
flash[:notice] = t('flash.repository.project_added')
|
||||
else
|
||||
|
|
|
@ -12,12 +12,12 @@ class RpcController < ApplicationController
|
|||
|
||||
def platforms
|
||||
ActiveSupport::Notifications.instrument("event_log.observer", :message => 'список платформ')
|
||||
Platform.select('unixname').where("platform_type = ?", 'main').map(&:unixname)
|
||||
Platform.select('name').where("platform_type = ?", 'main').map(&:name)
|
||||
end
|
||||
|
||||
def user_projects
|
||||
ActiveSupport::Notifications.instrument("event_log.observer", :message => 'список пользовательских проектов')
|
||||
current_user.projects.map{|p| { :id => p.id, :unixname => p.unixname } }
|
||||
current_user.projects.map{|p| { :id => p.id, :name => p.name } }
|
||||
end
|
||||
|
||||
def project_versions id
|
||||
|
|
|
@ -5,6 +5,6 @@ class AutoBuildList < ActiveRecord::Base
|
|||
belongs_to :bpl, :class_name => 'Platform'
|
||||
|
||||
def event_log_message
|
||||
{:project => project.unixname}.inspect
|
||||
{:project => project.name}.inspect
|
||||
end
|
||||
end
|
||||
|
|
|
@ -125,7 +125,7 @@ class BuildList < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def event_log_message
|
||||
{:project => project.unixname, :version => project_version, :arch => arch.name}.inspect
|
||||
{:project => project.name, :version => project_version, :arch => arch.name}.inspect
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -136,7 +136,7 @@ class BuildList < ActiveRecord::Base
|
|||
|
||||
def place_build
|
||||
#XML-RPC params: project_name, project_version, plname, arch, bplname, update_type, build_requires, id_web
|
||||
self.status = BuildServer.add_build_list project.name, project_version, pl.unixname, arch.name, (pl_id == bpl_id ? '' : bpl.unixname), update_type, build_requires, id
|
||||
self.status = BuildServer.add_build_list project.name, project_version, pl.name, arch.name, (pl_id == bpl_id ? '' : bpl.name), update_type, build_requires, id
|
||||
self.status = BUILD_PENDING if self.status == 0
|
||||
save
|
||||
end
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#require 'lib/build_server.rb'
|
||||
class Platform < ActiveRecord::Base
|
||||
VISIBILITIES = ['open', 'hidden']
|
||||
|
||||
belongs_to :parent, :class_name => 'Platform', :foreign_key => 'parent_platform_id'
|
||||
|
@ -13,8 +11,8 @@ class Platform < ActiveRecord::Base
|
|||
has_many :members, :through => :objects, :source => :object, :source_type => 'User'
|
||||
has_many :groups, :through => :objects, :source => :object, :source_type => 'Group'
|
||||
|
||||
validates :name, :presence => true, :uniqueness => true
|
||||
validates :unixname, :uniqueness => true, :presence => true, :format => { :with => /^[a-zA-Z0-9_]+$/ }
|
||||
validates :description, :presence => true, :uniqueness => true
|
||||
validates :name, :uniqueness => true, :presence => true, :format => { :with => /^[a-zA-Z0-9_]+$/ }
|
||||
validates :distrib_type, :presence => true, :inclusion => {:in => APP_CONFIG['distr_types']}
|
||||
|
||||
before_create :xml_rpc_create, :unless => lambda {Thread.current[:skip]}
|
||||
|
@ -45,11 +43,11 @@ class Platform < ActiveRecord::Base
|
|||
if pl.distrib_type == APP_CONFIG['distr_types'].first
|
||||
Arch.all.each do |arch|
|
||||
tail = "/#{arch.name}/main/release"
|
||||
urpmi_commands[pl.name] << "urpmi.addmedia #{unixname} #{head}#{unixname}/repository/#{pl.unixname}#{tail}"
|
||||
urpmi_commands[pl.name] << "urpmi.addmedia #{name} #{head}#{name}/repository/#{pl.name}#{tail}"
|
||||
end
|
||||
else
|
||||
tail = ''
|
||||
urpmi_commands[pl.name] << "urpmi.addmedia #{unixname} #{head}#{unixname}/repository/#{pl.unixname}#{tail}"
|
||||
urpmi_commands[pl.name] << "urpmi.addmedia #{name} #{head}#{name}/repository/#{pl.name}#{tail}"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -57,7 +55,7 @@ class Platform < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def path
|
||||
build_path(unixname)
|
||||
build_path(name)
|
||||
end
|
||||
|
||||
def hidden?
|
||||
|
@ -68,7 +66,7 @@ class Platform < ActiveRecord::Base
|
|||
platform_type == 'personal'
|
||||
end
|
||||
|
||||
def full_clone(attrs) # :name, :unixname, :owner
|
||||
def full_clone(attrs) # :description, :name, :owner
|
||||
clone.tap do |c|
|
||||
c.attributes = attrs
|
||||
c.updated_at = nil; c.created_at = nil # :id = nil
|
||||
|
@ -84,7 +82,7 @@ class Platform < ActiveRecord::Base
|
|||
p = full_clone(attrs)
|
||||
begin
|
||||
Thread.current[:skip] = true
|
||||
p.save and xml_rpc_clone(attrs[:unixname])
|
||||
p.save and xml_rpc_clone(attrs[:name])
|
||||
ensure
|
||||
Thread.current[:skip] = false
|
||||
end
|
||||
|
@ -106,19 +104,19 @@ class Platform < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def mount_directory_for_rsync
|
||||
FileUtils.rm_rf "#{ Rails.root.join('tmp', 'umount', self.unixname) }" if File.exist? "#{ Rails.root.join('tmp', 'umount', unixname) }"
|
||||
FileUtils.mkdir_p "#{ Rails.root.join('tmp', 'mount', unixname) }"
|
||||
FileUtils.rm_rf "#{ Rails.root.join('tmp', 'umount', self.name) }" if File.exist? "#{ Rails.root.join('tmp', 'umount', name) }"
|
||||
FileUtils.mkdir_p "#{ Rails.root.join('tmp', 'mount', name) }"
|
||||
Arch.all.each do |arch|
|
||||
host = EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host]
|
||||
url = "http://#{host}/downloads/#{unixname}/repository/"
|
||||
url = "http://#{host}/downloads/#{name}/repository/"
|
||||
str = "country=Russian Federation,city=Moscow,latitude=52.18,longitude=48.88,bw=1GB,version=2011,arch=#{arch.name},type=distrib,url=#{url}\n"
|
||||
File.open(Rails.root.join('tmp', 'mount', unixname, "#{unixname}.#{arch.name}.list"), 'w') {|f| f.write(str) }
|
||||
File.open(Rails.root.join('tmp', 'mount', name, "#{name}.#{arch.name}.list"), 'w') {|f| f.write(str) }
|
||||
end
|
||||
end
|
||||
|
||||
def umount_directory_for_rsync
|
||||
FileUtils.rm_rf "#{ Rails.root.join('tmp', 'mount', unixname) }" if File.exist? "#{ Rails.root.join('tmp', 'mount', unixname) }"
|
||||
FileUtils.mkdir_p "#{ Rails.root.join('tmp', 'umount', unixname) }"
|
||||
FileUtils.rm_rf "#{ Rails.root.join('tmp', 'mount', name) }" if File.exist? "#{ Rails.root.join('tmp', 'mount', name) }"
|
||||
FileUtils.mkdir_p "#{ Rails.root.join('tmp', 'umount', name) }"
|
||||
end
|
||||
|
||||
protected
|
||||
|
@ -128,35 +126,35 @@ class Platform < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def xml_rpc_create
|
||||
result = BuildServer.add_platform unixname, APP_CONFIG['root_path'] + '/platforms' , distrib_type
|
||||
result = BuildServer.add_platform name, APP_CONFIG['root_path'] + '/platforms' , distrib_type
|
||||
if result == BuildServer::SUCCESS
|
||||
return true
|
||||
else
|
||||
raise "Failed to create platform #{name} with code #{result}. Path: #{build_path(unixname)}"
|
||||
raise "Failed to create platform #{name} with code #{result}. Path: #{build_path(name)}"
|
||||
end
|
||||
end
|
||||
|
||||
def xml_rpc_destroy
|
||||
result = BuildServer.delete_platform unixname
|
||||
result = BuildServer.delete_platform name
|
||||
if result == BuildServer::SUCCESS
|
||||
return true
|
||||
else
|
||||
raise "Failed to delete platform #{unixname} with code #{result}."
|
||||
raise "Failed to delete platform #{name} with code #{result}."
|
||||
end
|
||||
end
|
||||
|
||||
def xml_rpc_clone(new_unixname)
|
||||
result = BuildServer.clone_platform new_unixname, self.unixname, APP_CONFIG['root_path'] + '/platforms'
|
||||
def xml_rpc_clone(new_name)
|
||||
result = BuildServer.clone_platform new_name, self.name, APP_CONFIG['root_path'] + '/platforms'
|
||||
if result == BuildServer::SUCCESS
|
||||
return true
|
||||
else
|
||||
raise "Failed to clone platform #{name} with code #{result}. Path: #{build_path(unixname)} to platform #{new_unixname}"
|
||||
raise "Failed to clone platform #{name} with code #{result}. Path: #{build_path(name)} to platform #{new_name}"
|
||||
end
|
||||
end
|
||||
|
||||
def check_freezing
|
||||
if released_changed?
|
||||
BuildServer.freeze_platform self.unixname
|
||||
BuildServer.freeze_platform self.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ class PrivateUser < ActiveRecord::Base
|
|||
validate :login, :uniqueness => true
|
||||
|
||||
def event_log_message
|
||||
{:platform => platform.unixname, :user => user.uname}.inspect
|
||||
{:platform => platform.name, :user => user.uname}.inspect
|
||||
end
|
||||
|
||||
class << self
|
||||
|
|
|
@ -30,7 +30,7 @@ class ProductBuildList < ActiveRecord::Base
|
|||
return true
|
||||
else
|
||||
# return false
|
||||
raise "Failed to create product_build_list #{id} inside platform #{product.platform.unixname} with code #{result}."
|
||||
raise "Failed to create product_build_list #{id} inside platform #{product.platform.name} tar url #{tar_url} with code #{result}."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,13 +14,13 @@ class Project < ActiveRecord::Base
|
|||
has_many :collaborators, :through => :relations, :source => :object, :source_type => 'User'
|
||||
has_many :groups, :through => :relations, :source => :object, :source_type => 'Group'
|
||||
|
||||
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type]}, :presence => true
|
||||
validates :unixname, :uniqueness => {:scope => [:owner_id, :owner_type]}, :presence => true, :format => { :with => /^[a-zA-Z0-9_\-\+\.]+$/ }
|
||||
validates :description, :uniqueness => {:scope => [:owner_id, :owner_type]}, :presence => true
|
||||
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type]}, :presence => true, :format => { :with => /^[a-zA-Z0-9_\-\+\.]+$/ }
|
||||
validates :owner, :presence => true
|
||||
# validate {errors.add(:base, I18n.t('flash.project.save_warning_ssh_key')) if owner.ssh_key.blank?}
|
||||
|
||||
#attr_accessible :category_id, :name, :unixname, :description, :visibility
|
||||
attr_readonly :unixname
|
||||
#attr_accessible :category_id, :name, :description, :visibility
|
||||
attr_readonly :name
|
||||
|
||||
scope :recent, order("name ASC")
|
||||
scope :by_name, lambda { |name| where('name like ?', '%' + name + '%') }
|
||||
|
@ -72,7 +72,7 @@ class Project < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def git_repo_name
|
||||
File.join owner.uname, unixname
|
||||
File.join owner.uname, name
|
||||
end
|
||||
|
||||
def public?
|
||||
|
@ -93,16 +93,16 @@ class Project < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def xml_rpc_create(repository)
|
||||
result = BuildServer.create_project unixname, repository.platform.unixname, repository.unixname, path
|
||||
result = BuildServer.create_project name, repository.platform.name, repository.name, path
|
||||
if result == BuildServer::SUCCESS
|
||||
return true
|
||||
else
|
||||
raise "Failed to create project #{unixname} (repo #{repository.unixname}) inside platform #{repository.platform.unixname} in path #{path} with code #{result}."
|
||||
raise "Failed to create project #{name} (repo #{repository.name}) inside platform #{repository.platform.name} in path #{path} with code #{result}."
|
||||
end
|
||||
end
|
||||
|
||||
def xml_rpc_destroy(repository)
|
||||
result = BuildServer.delete_project unixname, repository.platform.unixname
|
||||
result = BuildServer.delete_project name, repository.platform.name
|
||||
if result == BuildServer::SUCCESS
|
||||
return true
|
||||
else
|
||||
|
|
|
@ -10,8 +10,8 @@ class Repository < ActiveRecord::Base
|
|||
has_many :members, :through => :objects, :source => :object, :source_type => 'User'
|
||||
has_many :groups, :through => :objects, :source => :object, :source_type => 'Group'
|
||||
|
||||
validates :name, :uniqueness => {:scope => :platform_id}, :presence => true
|
||||
validates :unixname, :uniqueness => {:scope => :platform_id}, :presence => true, :format => { :with => /^[a-z0-9_]+$/ }
|
||||
validates :description, :uniqueness => {:scope => :platform_id}, :presence => true
|
||||
validates :name, :uniqueness => {:scope => :platform_id}, :presence => true, :format => { :with => /^[a-z0-9_]+$/ }
|
||||
# validates :platform_id, :presence => true # if you uncomment this platform clone will not work
|
||||
|
||||
scope :recent, order("name ASC")
|
||||
|
@ -19,7 +19,7 @@ class Repository < ActiveRecord::Base
|
|||
before_create :xml_rpc_create, :unless => lambda {Thread.current[:skip]}
|
||||
before_destroy :xml_rpc_destroy
|
||||
|
||||
attr_accessible :name, :unixname #, :platform_id
|
||||
attr_accessible :description, :name #, :platform_id
|
||||
|
||||
def full_clone(attrs) # owner
|
||||
clone.tap do |c| # dup
|
||||
|
@ -34,7 +34,7 @@ class Repository < ActiveRecord::Base
|
|||
protected
|
||||
|
||||
def xml_rpc_create
|
||||
result = BuildServer.create_repo unixname, platform.unixname
|
||||
result = BuildServer.create_repo name, platform.name
|
||||
if result == BuildServer::SUCCESS
|
||||
return true
|
||||
else
|
||||
|
@ -43,7 +43,7 @@ class Repository < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def xml_rpc_destroy
|
||||
result = BuildServer.delete_repo unixname, platform.unixname
|
||||
result = BuildServer.delete_repo name, platform.name
|
||||
if result == BuildServer::SUCCESS
|
||||
return true
|
||||
else
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
= @repository.name
|
||||
%p
|
||||
%b
|
||||
= t("activerecord.attributes.repository.unixname")
|
||||
= t("activerecord.attributes.repository.description")
|
||||
\:
|
||||
= @repository.unixname
|
||||
= @repository.description
|
||||
%p
|
||||
%b
|
||||
= t("activerecord.attributes.repository.platform")
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
= f.text_field :name, :class => 'text_field'
|
||||
|
||||
.group
|
||||
= f.label :unixname, :class => :label
|
||||
= f.text_field :unixname, :class => 'text_field'
|
||||
= f.label :description, :class => :label
|
||||
= f.text_field :description, :class => 'text_field'
|
||||
|
||||
.group
|
||||
= f.label :distrib_type, :class => :label
|
||||
|
@ -12,7 +12,7 @@
|
|||
|
||||
.group
|
||||
= f.label :parent, :class => :label
|
||||
= f.collection_select :parent_platform_id, Platform.all, :id, :name, :include_blank => true
|
||||
= f.collection_select :parent_platform_id, Platform.all, :id, :description, :include_blank => true
|
||||
|
||||
.group
|
||||
= f.label :released, :class => :label
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
= f.text_field :name, :class => 'text_field'
|
||||
|
||||
.group
|
||||
= f.label :unixname, :class => :label
|
||||
= f.text_field :unixname, :class => 'text_field'
|
||||
= f.label :description, :class => :label
|
||||
= f.text_field :description, :class => 'text_field'
|
||||
|
||||
.group.navform.wat-cf
|
||||
%button.button{:type => "submit"}
|
||||
|
|
|
@ -14,16 +14,16 @@
|
|||
= @platform.name
|
||||
%p
|
||||
%b
|
||||
= t("activerecord.attributes.platform.unixname")
|
||||
= t("activerecord.attributes.platform.description")
|
||||
\:
|
||||
= @platform.unixname
|
||||
= @platform.description
|
||||
- if @platform.parent
|
||||
%p
|
||||
%b
|
||||
= t("activerecord.attributes.platform.parent")
|
||||
\:
|
||||
- if @platform.parent
|
||||
= link_to @platform.parent.name, platform_path(@platform.parent)
|
||||
= link_to @platform.parent.description, platform_path(@platform.parent)
|
||||
%p
|
||||
%b
|
||||
= t('layout.platforms.location')
|
||||
|
@ -76,12 +76,12 @@
|
|||
.inner
|
||||
%table.table
|
||||
%tr
|
||||
%th.first= t("activerecord.attributes.repository.name")
|
||||
%th.first= t("activerecord.attributes.repository.description")
|
||||
%th.last
|
||||
- @platform.repositories.recent.each do |repository|
|
||||
%tr{:class => cycle("odd", "even")}
|
||||
%td
|
||||
= link_to repository.name, platform_repository_path(@platform, repository)
|
||||
= link_to repository.description, platform_repository_path(@platform, repository)
|
||||
%td.last
|
||||
= link_to t("layout.show"), platform_repository_path(@platform, repository)
|
||||
|
|
||||
|
|
|
@ -3,10 +3,7 @@
|
|||
= f.grouped_collection_select :category_id, Category.roots, :children, :name, :id, :name, :include_blank => true
|
||||
.group
|
||||
= f.label :name, t("activerecord.attributes.project.name"), :class => :label
|
||||
= f.text_field :name, :class => 'text_field'
|
||||
.group
|
||||
= f.label :unixname, t("activerecord.attributes.project.unixname"), :class => :label
|
||||
= f.text_field :unixname, :class => 'text_field', :disabled => f.object.try(:persisted?)
|
||||
= f.text_field :name, :class => 'text_field', :disabled => f.object.try(:persisted?)
|
||||
.group
|
||||
= f.label :visibility, t("activerecord.attributes.project.visibility"), :class => :label
|
||||
= f.select :visibility, Project::VISIBILITIES
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%th.last
|
||||
- @projects.each do |project|
|
||||
%tr{:class => cycle("odd", "even")}
|
||||
%td= link_to "#{project.name} (#{project.unixname})", project
|
||||
%td= link_to "#{project.name} (#{project.name})", project
|
||||
%td= link_to "#{project.owner.name} (#{project.owner.uname})", project.owner
|
||||
%td
|
||||
= link_to t("layout.edit"), edit_project_path(project) if can? :update, project
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%ul
|
||||
- @own_projects.each do |project|
|
||||
%li
|
||||
= link_to project.unixname, project_path(project)
|
||||
= link_to project.name, project_path(project)
|
||||
.block.notice
|
||||
%h3= t("layout.users.part_projects")
|
||||
.content
|
||||
|
@ -13,4 +13,4 @@
|
|||
%ul
|
||||
- @part_projects.each do |project|
|
||||
%li
|
||||
= link_to project.owner.uname + '/' + project.unixname + ' (' + project.name + ')', project_path(project)
|
||||
= link_to project.owner.uname + '/' + project.name + ' (' + project.name + ')', project_path(project)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
%tr{:class => cycle("odd", "even")}
|
||||
%td= link_to project.name, project_path(project)
|
||||
%td= project.unixname
|
||||
%td= project.name
|
||||
%td= project.description
|
|
@ -14,11 +14,6 @@
|
|||
= t("activerecord.attributes.project.name")
|
||||
\:
|
||||
= @project.name
|
||||
%p
|
||||
%b
|
||||
= t("activerecord.attributes.project.unixname")
|
||||
\:
|
||||
= @project.unixname
|
||||
%p
|
||||
%b
|
||||
= t("activerecord.attributes.project.owner")
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
= f.label :name, t("activerecord.attributes.repository.name"), :class => :label
|
||||
= f.text_field :name, :class => 'text_field'
|
||||
.group
|
||||
= f.label :unixname, t("activerecord.attributes.repository.unixname"), :class => :label
|
||||
= f.text_field :unixname, :class => 'text_field'
|
||||
= f.label :description, t("activerecord.attributes.repository.description"), :class => :label
|
||||
= f.text_field :description, :class => 'text_field'
|
||||
|
||||
.group.navform.wat-cf
|
||||
%button.button{:type => "submit"}
|
||||
|
|
|
@ -13,19 +13,19 @@
|
|||
= @repository.name
|
||||
%p
|
||||
%b
|
||||
= t("activerecord.attributes.repository.unixname")
|
||||
= t("activerecord.attributes.repository.description")
|
||||
\:
|
||||
= @repository.unixname
|
||||
= @repository.description
|
||||
%p
|
||||
%b
|
||||
= t("activerecord.attributes.repository.platform")
|
||||
\:
|
||||
= link_to @repository.platform.name, url_for(@repository.platform)
|
||||
= link_to @repository.platform.description, url_for(@repository.platform)
|
||||
%p
|
||||
%b
|
||||
= t("activerecord.attributes.repository.owner")
|
||||
\:
|
||||
= link_to @repository.owner.try(:name), url_for(@repository.owner)
|
||||
= link_to @repository.owner.try(:description), url_for(@repository.owner)
|
||||
.wat-cf
|
||||
= link_to image_tag("web-app-theme/icons/cross.png", :alt => t("layout.delete")) + " " + t("layout.delete"), @repository_path, :method => "delete", :class => "button", :confirm => t("layout.repositories.confirm_delete")
|
||||
|
||||
|
|
|
@ -13,19 +13,19 @@
|
|||
= @repository.name
|
||||
%p
|
||||
%b
|
||||
= t("activerecord.attributes.repository.unixname")
|
||||
= t("activerecord.attributes.repository.description")
|
||||
\:
|
||||
= @repository.unixname
|
||||
= @repository.description
|
||||
%p
|
||||
%b
|
||||
= t("activerecord.attributes.repository.platform")
|
||||
\:
|
||||
= link_to @repository.platform.name, url_for(@repository.platform)
|
||||
= link_to @repository.platform.description, url_for(@repository.platform)
|
||||
%p
|
||||
%b
|
||||
= t("activerecord.attributes.repository.owner")
|
||||
\:
|
||||
= link_to @repository.owner.try(:name), url_for(@repository.owner)
|
||||
= link_to @repository.owner.try(:description), url_for(@repository.owner)
|
||||
.wat-cf
|
||||
= link_to image_tag("web-app-theme/icons/cross.png", :alt => t("layout.delete")) + " " + t("layout.delete"), @repository_path, :method => "delete", :class => "button", :confirm => t("layout.repositories.confirm_delete") if can? :destroy, @repository
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
class RenameNameAndUnixname < ActiveRecord::Migration
|
||||
def self.up
|
||||
rename_column :projects, :name, :description
|
||||
rename_column :projects, :unixname, :name
|
||||
rename_column :platforms, :name, :description
|
||||
rename_column :platforms, :unixname, :name
|
||||
rename_column :repositories, :name, :description
|
||||
rename_column :repositories, :unixname, :name
|
||||
end
|
||||
|
||||
def self.down
|
||||
rename_column :projects, :description, :name
|
||||
rename_column :projects, :name, :unixname
|
||||
rename_column :platforms, :description, :name
|
||||
rename_column :platforms, :name, :unixname
|
||||
rename_column :repositories, :description, :name
|
||||
rename_column :repositories, :name, :unixname
|
||||
end
|
||||
end
|
|
@ -33,10 +33,10 @@ module Grack
|
|||
|
||||
def project
|
||||
@project ||= begin
|
||||
uname, unixname = @env['PATH_INFO'].split('/')[1,2]
|
||||
unixname.gsub! /\.git$/, ''
|
||||
uname, name = @env['PATH_INFO'].split('/')[1,2]
|
||||
name.gsub! /\.git$/, ''
|
||||
owner = User.find_by_uname(uname) || Group.find_by_uname(uname)
|
||||
Project.where(:owner_id => owner.id, :owner_type => owner.class).find_by_unixname(unixname)
|
||||
Project.where(:owner_id => owner.id, :owner_type => owner.class).find_by_name(name)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ module Modules
|
|||
pl = platforms.build
|
||||
pl.owner = self
|
||||
pl.name = "#{self.uname}_personal"
|
||||
pl.unixname = "#{self.uname}_personal"
|
||||
pl.name = "#{self.uname}_personal"
|
||||
pl.platform_type = 'personal'
|
||||
pl.distrib_type = APP_CONFIG['distr_types'].first
|
||||
pl.visibility = 'hidden'
|
||||
|
@ -21,7 +21,7 @@ module Modules
|
|||
rep = pl.repositories.build
|
||||
rep.owner = pl.owner
|
||||
rep.name = 'main'
|
||||
rep.unixname = 'main'
|
||||
rep.name = 'main'
|
||||
rep.save!
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace :import do
|
|||
print "Import #{name}..."
|
||||
owner = User.find(1) # I am
|
||||
# owner = Group.find(1) # Core Team
|
||||
p = Project.find_or_create_by_name_and_unixname(name, name) {|p| p.owner = owner}
|
||||
p = Project.find_or_create_by_name_and_name(name, name) {|p| p.owner = owner}
|
||||
puts p.persisted? ? "Ok!" : "Fail!"
|
||||
end
|
||||
puts 'DONE'
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace :repositories do
|
|||
next
|
||||
end
|
||||
|
||||
project = main.projects.create(:name => project_name, :unixname => project_name)
|
||||
project = main.projects.create(:name => project_name, :name => project_name)
|
||||
|
||||
puts "Executing: 'rm -rf #{project.path}'"
|
||||
`rm -rf #{project.path}`
|
||||
|
|
Loading…
Reference in New Issue