-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
216 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
class RepohooksController < ApplicationController | ||
def new | ||
@repohook = Repohook.new | ||
end | ||
|
||
def create | ||
@repohook = Repohook.new(params[:repohook]) | ||
if @repohook.save | ||
redirect_to root_url, :notice => "Repohook relation created!" | ||
else | ||
render "new" | ||
end | ||
end | ||
|
||
def destroy | ||
@repohook = Repohook.find(params[:id]) | ||
@repohook.destroy | ||
respond_to do |format| | ||
format.html { redirect_to repositories_path } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
def index | ||
@repohook = Repohook.all | ||
|
||
respond_to do |format| | ||
format.html # index.html.erb | ||
format.json { render json: @repohook } | ||
end | ||
end | ||
|
||
def edit | ||
@repohook = Repohook.find(params[:id]) | ||
end | ||
|
||
def show | ||
@repohook = Repohook.find(params[:id]) | ||
|
||
respond_to do |format| | ||
format.html # show.html.erb | ||
format.json { render json: @repohook } | ||
end | ||
end | ||
|
||
def update | ||
@repohook = Repohook.find(params[:id]) | ||
|
||
respond_to do |format| | ||
if @repohook.update_attributes(params[:repository]) | ||
format.html { redirect_to hooktorepos_path, notice: 'Repohook was successfully updated.' } | ||
format.json { head :no_content } | ||
else | ||
format.html { render action: "edit" } | ||
format.json { render json: @repohook.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class Repohook < ActiveRecord::Base | ||
attr_accessible :hook_name, :repository_id | ||
belongs_to :repository | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<%= form_for(@repohook) do |f| %> | ||
<% if @repohook.errors.any? %> | ||
<div id="error_explanation"> | ||
<h2><%= pluralize(@repohook.errors.count, "error") %> prohibited this relation from being saved:</h2> | ||
|
||
<ul> | ||
<% @repohook.errors.full_messages.each do |msg| %> | ||
<li><%= msg %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div class="field"> | ||
<%= f.label :hook_name %><br /> | ||
<%= f.text_field :hook_name %> | ||
</div> | ||
<div class="field"> | ||
<%= f.label :repository_id %><br /> | ||
<%= f.text_field :repository_id %> | ||
</div> | ||
<div class="actions"> | ||
<%= f.submit %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<h1>Hooktorepos#create</h1> | ||
<p>Find me in app/views/hooktorepos/create.html.erb</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<h1>Hooktorepos#destroy</h1> | ||
<p>Find me in app/views/hooktorepos/destroy.html.erb</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<h1>Editing relation</h1> | ||
|
||
<%= render 'form' %> | ||
|
||
<%= link_to 'Show', @repohook %> | | ||
<%= link_to 'Back', repohooks_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<h1>Listing relations</h1> | ||
|
||
<table> | ||
<tr> | ||
<th>Name</th> | ||
<th></th> | ||
</tr> | ||
|
||
<% @repohook.each do |f| %> | ||
<tr> | ||
<td><%= f.id %></td> | ||
<td><%= link_to 'Show', f %></td> | ||
<td><%= link_to 'Edit', edit_repohook_path(f) %></td> | ||
<td><%= link_to 'Destroy', f, confirm: 'Are you sure?', method: :delete %></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
|
||
<br /> | ||
|
||
<%= link_to 'New Relation', new_repohook_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<h1>RepoHook#new</h1> | ||
<%= form_for @repohook do |f| %> | ||
<p> | ||
<%= f.label :repository_id %> | ||
<%= f.collection_select :repository_id, Repository.all, :id, :repo_name %> | ||
</p> | ||
<p> | ||
<%= f.label :hook_name %> | ||
<%= f.text_field :hook_name %> | ||
</p> | ||
<p class="button"><%= f.submit %></p> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<p id="notice"><%= notice %></p> | ||
|
||
<p> | ||
<b>Relation id:</b><br/> | ||
<%= @repohook.id %> | ||
</p> | ||
<p> | ||
<b>Hook name:</b><br/> | ||
<%= @repohook.hook_name %> | ||
</p> | ||
<p> | ||
<b>Repository id:</b><br/> | ||
<%= @repohook.repository_id %> | ||
</p> | ||
|
||
<%= link_to 'Edit', edit_repohook_path(@repohook) %> | | ||
<%= link_to 'Back', repohooks_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<h1>Hooktorepos#update</h1> | ||
<p>Find me in app/views/hooktorepos/update.html.erb</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class CreateRepohooks < ActiveRecord::Migration | ||
def change | ||
create_table :repohooks do |t| | ||
t.string :hook_name | ||
t.references :repository | ||
|
||
t.timestamps | ||
end | ||
end | ||
|
||
def self.down | ||
drop_table :repohooks | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/sh | ||
abcdef | ||
# POST-COMMIT HOOK | ||
# | ||
# The post-commit hook is invoked after a commit. Subversion runs | ||
# this hook by invoking a program (script, executable, binary, etc.) | ||
# named 'post-commit' (for which this file is a template) with the | ||
# following ordered arguments: | ||
# | ||
# [1] REPOS-PATH (the path to this repository) | ||
# [2] REV (the number of the revision just committed) | ||
# | ||
# The default working directory for the invocation is undefined, so | ||
# the program should set one explicitly if it cares. | ||
# | ||
# Because the commit has already completed and cannot be undone, | ||
# the exit code of the hook program is ignored. The hook program | ||
# can use the 'svnlook' utility to help it examine the | ||
# newly-committed tree. | ||
# | ||
# On a Unix system, the normal procedure is to have 'post-commit' | ||
# invoke other programs to do the real work, though it may do the | ||
# work itself too. | ||
# | ||
# Note that 'post-commit' must be executable by the user(s) who will | ||
# invoke it (typically the user httpd runs as), and that user must | ||
# have filesystem-level permission to access the repository. | ||
# | ||
# On a Windows system, you should name the hook program | ||
# 'post-commit.bat' or 'post-commit.exe', | ||
# but the basic idea is the same. | ||
# | ||
# The hook program typically does not inherit the environment of | ||
# its parent process. For example, a common problem is for the | ||
# PATH environment variable to not be set to its usual value, so | ||
# that subprograms fail to launch unless invoked via absolute path. | ||
# If you're having unexpected problems with a hook program, the | ||
# culprit may be unusual (or missing) environment variables. | ||
# | ||
# Here is an example hook script, for a Unix /bin/sh interpreter. | ||
# For more examples and pre-written hooks, see those in | ||
# the Subversion repository at | ||
# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and | ||
# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/ | ||
REPOS="$1" | ||
REV="$2" | ||
commit-email.pl "$REPOS" "$REV" [email protected] | ||
log-commit.py --repository "$REPOS" --revision "$REV" | ||
|