<% use Text::Markdown::Hoedown; my $state; # API my $api = gitprep_api; # Git my $git = app->git; # Parameters my $user = param('user'); my $project = param('project'); my $rev = app->manager->default_branch($user, $project); unless (app->manager->exists_project($user, $project)) { $self->render_not_found; return; } # Repository description my $desc = $git->description($user, $project); # Check exsitence my $commits_number; if ($git->exists_branch($user, $project)) { # Commit my $commit = $git->get_commit($user, $project, $rev); # Tree my $trees = $git->trees($user, $project, $rev); # Commits number $commits_number = $git->commits_number($user, $project, $rev); # Variable for included template stash( commit => $commit, trees => $trees, rev => $rev, title => "$user/$project", ); $state = 'display'; } else { $state = 'init' } my $url = url_for->to_abs; $url->base(undef); my $ssh_port = config->{basic}{ssh_port}; my $rep_home = app->git->rep_home; my $execute_user = getpwuid($>); my $ssh_rep_url = "ssh://$execute_user\@" . $url->host . ($ssh_port ? ":$ssh_port" : '') . "$rep_home/$user/$project.git"; %> % layout 'common', title => "$user/$project"; % my $logined = $api->logined; %= javascript begin $(document).ready(function () { var http_rep_url = '<%= url_for("$user/$project.git")->to_abs %>'; % my $rep = $git->rep($user, $project); % my $ssh_port = config->{basic}{ssh_port} || ''; var logined = <%= $logined ? 'true' : 'false' %>; var ssh_rep_url = ''; if (logined) { ssh_rep_url = '<%= $ssh_rep_url %>'; } // Click HTTP button $('#btn_http').on('click', function () { $('#rep_url').val(http_rep_url); $('#access').text('Read-write'); }); // Click SSH(old) button $('#btn_ssh').on('click', function () { $('#rep_url').val(ssh_rep_url); $('#access').text('Read-write'); }); // Initialize $('#btn_http').trigger('click'); // URL is automatically selected var url_selected_count = 0; $('#rep_url').on('mouseup', function () { if (url_selected_count == 0) { $(this).select(); } url_selected_count += 1; }); $('#rep_url').on('blur', function () { url_selected_count = 0; }); }); % end %= include '/include/header';
%= include '/include/message', message => flash('message'); %= include '/include/project_header';

<%= $desc %>

% if ($state eq 'display') {
"> ZIP
% if ($logined) { % }
access
%= include '/include/code_menu', display => 'files';
%= include '/include/tree';
%= include '/include/readme'; % } elsif ($state eq 'init' && $api->logined($user)) {

SSH

Create a new repository on the command line via ssh
touch README
git init
git add README
git commit -m "first commit"
git remote add origin <%= $ssh_rep_url %>
git push -u origin master
Push an existing repository from the command line via ssh
git remote add origin <%= $ssh_rep_url %>
git push -u origin master

% my $http_rep_url = url_for("$user/$project.git")->to_abs;

<%= uc url_for->to_abs->scheme %>

Create a new repository on the command line via <%= url_for->to_abs->scheme %>
touch README
git init
git add README
git commit -m "first commit"
git remote add origin <%= $http_rep_url %>
git push -u origin master
Push an existing repository from the command line via <%= url_for->to_abs->scheme %>
git remote add origin <%= $http_rep_url %>
git push -u origin master
% } else {
Repository is not yet created.
% }
%= include '/include/footer';