Merge pull request #50 from flozzone/clone_path_setting
Clone path setting
This commit is contained in:
commit
b045626ab9
@ -6,9 +6,6 @@ require_dependency 'redmine_git_remote/poor_mans_capture3'
|
||||
|
||||
class Repository::GitRemote < Repository::Git
|
||||
|
||||
PLUGIN_ROOT = Pathname.new(__FILE__).join("../../../..").realpath.to_s
|
||||
PATH_PREFIX = PLUGIN_ROOT + "/repos/"
|
||||
|
||||
before_validation :initialize_clone
|
||||
|
||||
safe_attributes 'extra_info', :if => lambda {|repository, _user| repository.new_record?}
|
||||
@ -81,7 +78,11 @@ class Repository::GitRemote < Repository::Git
|
||||
|
||||
p = parse(attributes["extra_info"]["extra_clone_url"])
|
||||
self.identifier = p[:identifier] if identifier.empty?
|
||||
self.url = PATH_PREFIX + p[:path] if url.empty?
|
||||
|
||||
base_path = Setting.plugin_redmine_git_remote['git_remote_repo_clone_path']
|
||||
base_path = base_path + "/" unless base_path.end_with?("/")
|
||||
|
||||
self.url = base_path + p[:path] if url.empty?
|
||||
|
||||
err = ensure_possibly_empty_clone_exists
|
||||
errors.add :extra_clone_url, err if err
|
||||
|
7
app/views/settings/_git_remote_settings.html.erb
Normal file
7
app/views/settings/_git_remote_settings.html.erb
Normal file
@ -0,0 +1,7 @@
|
||||
<h3><%= t('config.title') %></h3>
|
||||
|
||||
<p>
|
||||
<label><%= t('config.repo_clone_path') %></label>
|
||||
<%= text_field_tag 'settings[git_remote_repo_clone_path]', @settings['git_remote_repo_clone_path'], :size => '60' %>
|
||||
<%= t('config.clone_path_hint') %>
|
||||
</p>
|
@ -2,3 +2,7 @@ en:
|
||||
field_extra_clone_url: Clone URL
|
||||
text_git_remote_url_note: The URL to clone from.
|
||||
text_git_remote_path_note: The absolute filesystem path to clone to. Leave blank to auto-populate from URL.
|
||||
config:
|
||||
title: Git Remote Settings
|
||||
repo_clone_path: Repository clone path
|
||||
clone_path_hint: Path where repository is cloned. Relative to plugin directory.
|
||||
|
6
init.rb
6
init.rb
@ -8,5 +8,9 @@ Redmine::Plugin.register :redmine_git_remote do
|
||||
author 'Alex Dergachev'
|
||||
url 'https://github.com/dergachev/redmine_git_remote'
|
||||
description 'Automatically clone and fetch remote git repositories'
|
||||
version '0.0.1'
|
||||
version '0.0.2'
|
||||
|
||||
settings :default => {
|
||||
'git_remote_repo_clone_path' => Pathname.new(__FILE__).join("../").realpath.to_s + "/repos",
|
||||
}, :partial => 'settings/git_remote_settings'
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user