Added integration with git-daemon.
In the configuration it is possible to give a git daemon url to have it displayed in the source view.
This commit is contained in:
parent
da1ddc4179
commit
6ad7ee8c71
@ -287,4 +287,36 @@ class IDF_Project extends Pluf_Model
|
||||
}
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the git repository.
|
||||
*
|
||||
* @return string Path to the git repository
|
||||
*/
|
||||
public function getGitRepository()
|
||||
{
|
||||
$gitrep = Pluf::f('git_repository');
|
||||
if (substr($gitrep, -4) == '.git') {
|
||||
return $gitrep;
|
||||
}
|
||||
// here we consider that the git_repository is a folder
|
||||
// containing a series of git repositories
|
||||
return $gitrep.'/'.$this->shortname.'.git';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the url to the repository through git daemon.
|
||||
*
|
||||
* @return string Path to the git daemon.
|
||||
*/
|
||||
public function getGitDaemonUrl()
|
||||
{
|
||||
$gitrep = Pluf::f('git_daemon_url');
|
||||
if (substr($gitrep, -4) == '.git') {
|
||||
return $gitrep;
|
||||
}
|
||||
// here we consider that the git_repository is a folder
|
||||
// containing a series of git repositories
|
||||
return $gitrep.'/'.$this->shortname.'.git';
|
||||
}
|
||||
}
|
@ -34,7 +34,7 @@ class IDF_Views_Source
|
||||
public function changeLog($request, $match)
|
||||
{
|
||||
$title = sprintf('%s Git Change Log', (string) $request->project);
|
||||
$git = new IDF_Git(Pluf::f('git_repository'));
|
||||
$git = new IDF_Git($request->project->getGitRepository());
|
||||
$branches = $git->getBranches();
|
||||
$commit = $match[2];
|
||||
$res = $git->getChangeLog($commit, 50);
|
||||
@ -52,7 +52,7 @@ class IDF_Views_Source
|
||||
public function treeBase($request, $match)
|
||||
{
|
||||
$title = sprintf('%s Git Source Tree', (string) $request->project);
|
||||
$git = new IDF_Git(Pluf::f('git_repository'));
|
||||
$git = new IDF_Git($request->project->getGitRepository());
|
||||
$commit = $match[2];
|
||||
$branches = $git->getBranches();
|
||||
if ('commit' != $git->testHash($commit)) {
|
||||
@ -81,7 +81,7 @@ class IDF_Views_Source
|
||||
public function tree($request, $match)
|
||||
{
|
||||
$title = sprintf('%s Git Source Tree', (string) $request->project);
|
||||
$git = new IDF_Git(Pluf::f('git_repository'));
|
||||
$git = new IDF_Git($request->project->getGitRepository());
|
||||
$branches = $git->getBranches();
|
||||
$commit = $match[2];
|
||||
if ('commit' != $git->testHash($commit)) {
|
||||
@ -148,7 +148,7 @@ class IDF_Views_Source
|
||||
|
||||
public function commit($request, $match)
|
||||
{
|
||||
$git = new IDF_Git(Pluf::f('git_repository'));
|
||||
$git = new IDF_Git($request->project->getGitRepository());
|
||||
$commit = $match[2];
|
||||
$branches = $git->getBranches();
|
||||
if ('commit' != $git->testHash($commit)) {
|
||||
@ -182,7 +182,7 @@ class IDF_Views_Source
|
||||
public function download($request, $match)
|
||||
{
|
||||
$commit = trim($match[2]);
|
||||
$git = new IDF_Git(Pluf::f('git_repository'));
|
||||
$git = new IDF_Git($request->project->getGitRepository());
|
||||
$branches = $git->getBranches();
|
||||
if ('commit' != $git->testHash($commit)) {
|
||||
// Redirect to the first branch
|
||||
|
@ -23,31 +23,37 @@
|
||||
|
||||
$cfg = array();
|
||||
|
||||
// to start with, it can be practical.
|
||||
$cfg['debug'] = false;
|
||||
$cfg['installed_apps'] = array('Pluf', 'IDF');
|
||||
$cfg['pluf_use_rowpermission'] = true;
|
||||
|
||||
// if you have a single git repository, just put the full path to it
|
||||
// without trailing slash.
|
||||
// If within a folder you have a series of git repository, just put
|
||||
// the folder without a trailing slash.
|
||||
// InDefero will automatically append a slash, the project shortname
|
||||
// and .git to create the name of the repository.
|
||||
// $cfg['git_repository'] = '/home/git/repositories';
|
||||
$cfg['git_repository'] = '/home/git/repositories/indefero.git';
|
||||
$cfg['middleware_classes'] = array(
|
||||
'IDF_Middleware',
|
||||
'Pluf_Middleware_Session',
|
||||
'Pluf_Middleware_Translation',
|
||||
);
|
||||
|
||||
$cfg['template_context_processors'] = array('IDF_Middleware_ContextPreProcessor');
|
||||
// As for the 'git_repository' case, you can either have it ending
|
||||
// with .git in the case of a single repository or let it append
|
||||
// '/'.$project_shortname.'.git' to make the path.
|
||||
$cfg['git_daemon_url'] = 'git://projects.ceondo.com/indefero.git';
|
||||
|
||||
// admins will get an email in case of errors in the system in non
|
||||
// debug mode.
|
||||
$cfg['admins'] = array(
|
||||
// admins will get an email in case of errors
|
||||
// in the system in non debug mode.
|
||||
array('Admin', 'you@example.com'),
|
||||
);
|
||||
|
||||
// Email configuration
|
||||
$cfg['send_emails'] = true;
|
||||
$cfg['mail_backend'] = 'smtp';
|
||||
$cfg['mail_host'] = 'localhost';
|
||||
$cfg['mail_port'] = 25;
|
||||
$cfg['pear_path'] = '/usr/share/php';
|
||||
|
||||
|
||||
// Paths/Url configuration
|
||||
$cfg['idf_base'] = ''; // put '/whatever/index.php if you are not
|
||||
// using mod_rewrite and installing in a
|
||||
// subfolder.
|
||||
@ -59,36 +65,27 @@ $cfg['upload_path'] = '/path/to/media/upload';
|
||||
$cfg['login_success_url'] = '/';
|
||||
$cfg['after_logout_page'] = '/';
|
||||
|
||||
$cfg['secret_key'] = ''; // write here a long random string unique for
|
||||
// this installation.
|
||||
// write here a long random string unique for this installation. This
|
||||
// is critical to put a long string.
|
||||
$cfg['secret_key'] = '';
|
||||
|
||||
// the sender of all the emails.
|
||||
$cfg['from_email'] = 'sender@example.com';
|
||||
|
||||
$cfg['from_email'] = 'sender@example.com'; // the sender of all the emails.
|
||||
// Email address for the bounced messages.
|
||||
$cfg['bounce_email'] = 'no-reply@example.com';
|
||||
|
||||
|
||||
$cfg['idf_views'] = dirname(__FILE__).'/views.php';
|
||||
|
||||
// Temporary folder where the script is writing the compiled templates,
|
||||
// cached data and other temporary resources.
|
||||
// It must be writeable by your webserver instance.
|
||||
// It is mandatory if you are using the template system.
|
||||
$cfg['tmp_folder'] = '/tmp';
|
||||
|
||||
// The folder in which the templates of the application are located.
|
||||
$cfg['template_folders'] = array(
|
||||
dirname(__FILE__).'/../templates',
|
||||
);
|
||||
|
||||
$cfg['template_tags'] = array(
|
||||
'hotkey' => 'IDF_Template_HotKey',
|
||||
'issuetext' => 'IDF_Template_IssueComment',
|
||||
);
|
||||
$cfg['template_modifiers'] = array(
|
||||
'size' => 'IDF_Views_Source_PrettySize',
|
||||
'markdown' => 'IDF_Template_Markdown_filter',
|
||||
);
|
||||
|
||||
|
||||
// Database configuration
|
||||
// For testing we are using in memory SQLite database.
|
||||
$cfg['db_login'] = 'www';
|
||||
@ -99,5 +96,22 @@ $cfg['db_table_prefix'] = '';
|
||||
$cfg['db_engine'] = 'PostgreSQL'; // SQLite is also well tested or MySQL
|
||||
$cfg['db_database'] = 'website';
|
||||
|
||||
// From this point you should not need to update anything.
|
||||
$cfg['installed_apps'] = array('Pluf', 'IDF');
|
||||
$cfg['pluf_use_rowpermission'] = true;
|
||||
$cfg['middleware_classes'] = array(
|
||||
'IDF_Middleware',
|
||||
'Pluf_Middleware_Session',
|
||||
'Pluf_Middleware_Translation',
|
||||
);
|
||||
$cfg['template_context_processors'] = array('IDF_Middleware_ContextPreProcessor');
|
||||
$cfg['idf_views'] = dirname(__FILE__).'/views.php';
|
||||
$cfg['template_tags'] = array(
|
||||
'hotkey' => 'IDF_Template_HotKey',
|
||||
'issuetext' => 'IDF_Template_IssueComment',
|
||||
);
|
||||
$cfg['template_modifiers'] = array(
|
||||
'size' => 'IDF_Views_Source_PrettySize',
|
||||
'markdown' => 'IDF_Template_Markdown_filter',
|
||||
);
|
||||
return $cfg;
|
||||
|
||||
|
@ -44,6 +44,7 @@
|
||||
</table>
|
||||
{aurl 'url', 'IDF_Views_Source::download', array($project.shortname, $commit)}
|
||||
<p class="right"><a href="{$url}"><img style="vertical-align: text-bottom;" src="{media '/idf/img/package.png'}" alt="{trans 'Archive'}" align="bottom" /></a> <a href="{$url}">{trans 'Download this version'}</a></p>
|
||||
<p class="right"><kbd>git clone {$project.getGitDaemonUrl()}</kbd></p>
|
||||
|
||||
{/block}
|
||||
{block context}
|
||||
|
Loading…
Reference in New Issue
Block a user