Branch 'devel' - restful/restful.pl
by Adam Stokes
restful/restful.pl | 43 ++++++++++---------------------------------
1 file changed, 10 insertions(+), 33 deletions(-)
New commits:
commit 20e067e9c59958d08f232e95409545e4628a37eb
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue Apr 20 14:56:40 2010 -0400
update restful
diff --git a/restful/restful.pl b/restful/restful.pl
index 006dae0..a62bee9 100755
--- a/restful/restful.pl
+++ b/restful/restful.pl
@@ -2,7 +2,7 @@
use 5.010;
use strict;
use warnings;
-use CGI ':standard';
+use CGI qw(:standard);
use JSON;
use Config::IniFiles;
use Data::Dumper;
@@ -17,40 +17,17 @@ my $cas_conf = "/etc/cas.conf";
my $cfg = new Config::IniFiles( -file => $cas_conf ) or die "Can not load config";
# start access to web service
-print header;
-print start_html("RESTful web service.");
-&main;
-print end_html;
+my %actions = map {$_=>1} param('action');
-# RESTful services
-
-sub main {
- # parse action
- given(url_param('action')) {
- when (/^jobs/) {
- &jobs;
- }
- when (/^status/) {
- say "return status";
- }
- when (/^timestamp/) {
- say "return timestamp";
- }
- when (/^create/) {
- &create;
- }
- default { return 1; }
- }
+if ($actions{jobs}) {
+ print header('application/json');
+ job();
}
-sub jobs {
- if(url_param('id')) {
- say "return " . url_param('id');
- } else {
- say "returning all jobs in queue";
- }
-}
+print header();
-sub create {
- # moo
+sub job {
+ my @t_array = qw(hi test name wtf);
+ print $json->to_json(\@t_array);
+ exit 0;
}
14 years
Branch 'devel' - casweb/cas.py casweb/__init__.py casweb/media casweb/README casweb/templates restful/restful.pl
by Adam Stokes
casweb/README | 27 -------------------
casweb/cas.py | 60 --------------------------------------------
casweb/media/css/main.css | 31 ----------------------
casweb/templates/base.html | 21 ---------------
casweb/templates/index.html | 22 ----------------
casweb/templates/job.html | 13 ---------
casweb/templates/jobs.html | 16 -----------
dev/null |binary
restful/restful.pl | 56 +++++++++++++++++++++++++++++++++++++++++
9 files changed, 56 insertions(+), 190 deletions(-)
New commits:
commit a88e273df8bc3be96fcd0edfd9bbd2056a30aa37
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Mon Apr 19 16:48:44 2010 -0400
setup restful environment for work with cas clients
diff --git a/casweb/README b/casweb/README
deleted file mode 100644
index 3472d2e..0000000
--- a/casweb/README
+++ /dev/null
@@ -1,27 +0,0 @@
-installation:
-- see http://webpy.org/install for getting framework installed
- and setup on webserver
-- make sure to do wsgi installation, so httpd and mod_wsgi needs
- to be installed.
- # yum install httpd mod_wsgi
-
-- example for virtual host on ip alias 192.168.1.103
-<VirtualHost 192.168.1.103:80>
- ServerName casweb
- WSGIScriptAlias / /mnt/usbdrive/projects/casweb/cas.py
- Alias /media /mnt/usbdrive/projects/casweb/media
- <Directory "/mnt/usbdrive/projects/casweb">
- Options FollowSymlinks
- AllowOverride None
- Order allow,deny
- Allow from all
- </Directory>
- <Location /media>
- Options All
- SetHandler None
- </Location>
-</VirtualHost>
-
-/* vim:ts=2 sw=2 et
- * /
-
diff --git a/casweb/__init__.py b/casweb/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/casweb/cas.py b/casweb/cas.py
deleted file mode 100644
index 25a60f4..0000000
--- a/casweb/cas.py
+++ /dev/null
@@ -1,60 +0,0 @@
-import web
-import os
-import ConfigParser
-import glob
-
-try:
- from cas.db import CasStorage
-except ImportError:
- raise Exception("Unable to import CasStorage, make sure CAS is installed")
-
-global settings
-config = ConfigParser.ConfigParser()
-config.read("/etc/cas.conf")
-settings = {}
-if config.has_section("settings"):
- for opt, val in config.items("settings"):
- settings[opt.upper()] = val
-
-# do not edit below this line unless you know what you are doing
-render = web.template.render(os.path.join(os.path.dirname(__file__),'templates').replace('\\','/'), cache=False)
-web.template.Template.globals['ctx'] = web.ctx
-
-urls = (
- '/', 'index',
- '/job/(\d+)/(.*)', 'job',
- '/jobs', 'jobs',
- '/job_submit', 'job_submit',
-)
-
-# build connection
-global casDB
-casDB=CasStorage('/var/db/cas/cas.db')
-casDB.connect()
-
-class index:
- def GET(self):
- userdoc = glob.glob('/usr/share/doc/cas*/index.html')[0]
- return render.base(render.index(userdoc))
-
-class job:
- def GET(self, id, timestamp):
- path_construct = os.path.join(settings["WORKDIRECTORY"],id)
- path_construct = os.path.join(path_construct, timestamp)
- path_construct = os.path.join(path_construct, '%d.log' % (int(id),))
- if os.path.isfile(path_construct):
- fp = open(path_construct, 'r').readlines()
- return render.base(render.job(id, fp))
-
-class jobs:
- def GET(self):
- allJobs = casDB.getAllJobs()
- return render.base(render.jobs(allJobs))
-
-class job_submit:
- def POST(self):
- i = web.input()
- raise web.seeother('/')
-
-app = web.application(urls, globals(), autoreload=False)
-application = app.wsgifunc()
diff --git a/casweb/media/css/main.css b/casweb/media/css/main.css
deleted file mode 100644
index cb6ca6a..0000000
--- a/casweb/media/css/main.css
+++ /dev/null
@@ -1,31 +0,0 @@
-body {
- font-size: 1em;
- font-family: sans-serif;
-}
-
-#header {
- width: 750px;
- margin-left: auto;
- margin-right: auto;
- font-size: .7em;
-}
-
-#header .menu {
- float:right;
- border: 1px solid black;
- padding: 5px;
-}
-
-#content {
- width: 750px;
- margin-left: auto;
- margin-right: auto;
- clear:both;
-}
-
-#content .jobstatus {
- font-size: .7em;
-}
-
-/* vim:ts=2 sw=2 et
- * /
diff --git a/casweb/media/img/cas_logo.png b/casweb/media/img/cas_logo.png
deleted file mode 100644
index 39e2302..0000000
Binary files a/casweb/media/img/cas_logo.png and /dev/null differ
diff --git a/casweb/templates/base.html b/casweb/templates/base.html
deleted file mode 100644
index 0fbef41..0000000
--- a/casweb/templates/base.html
+++ /dev/null
@@ -1,21 +0,0 @@
-$def with (page)
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html><head><title>casweb</title>
- <link rel="stylesheet" type="text/css" href="/media/css/main.css"/>
-</head>
-<body>
-<div id="header">
- <img src="/media/img/cas_logo.png"/>
- <div class="menu">
- <strong>navigator</strong><br/>
- <a href="$ctx.homepath/">home</a><br/>
- <a href="$ctx.homepath/jobs">jobs</a>
- </div>
-</div>
-<div id="content">
- $:page
-</div>
-</body>
-</html>
-
-$# vim:ts=2 sw=2 et
diff --git a/casweb/templates/index.html b/casweb/templates/index.html
deleted file mode 100644
index 33bd838..0000000
--- a/casweb/templates/index.html
+++ /dev/null
@@ -1,22 +0,0 @@
-$def with (userdoc)
-<h3>CAS Web Administration</h3>
- Welcome to the CAS web frontend. This application gives the ability to view recent jobs,
-schedule new jobs, and perform minor maintenance work through the administration panel.
-
-<h3>Submit Job</h3>
-<form method="post" action="$ctx.homepath/job_submit">
- <fieldset>
- <legend>Requirements</legend>
- <label for="id">Unique ID</label>
- <input type="text" name="id" size="15" /><br/>
- <label for="email">Email</label>
- <input type="text" name="email" size="15" /><br/>
- <label for="file_url">Location</label>
- <input type="text" name="file_url" size="50" /><br/>
- <input type="submit" value="Create Job"/>
- </fieldset>
-</form>
-
-<h3>Documentation</h3>
-Latest CAS Documentation is located @ $:userdoc
-$# vim:ts=2 sw=2 et
diff --git a/casweb/templates/job.html b/casweb/templates/job.html
deleted file mode 100644
index 8f0f53e..0000000
--- a/casweb/templates/job.html
+++ /dev/null
@@ -1,13 +0,0 @@
-$def with (id, fp)
-
-<h3>Job Status</h3>
-Job ID:$id
-<div class="jobstatus">
-<ul>
-$if fp:
- $for line in fp:
- <li>$:line</li>
-$else:
- No information available.
-</ul>
-</div>
diff --git a/casweb/templates/jobs.html b/casweb/templates/jobs.html
deleted file mode 100644
index c89d0dd..0000000
--- a/casweb/templates/jobs.html
+++ /dev/null
@@ -1,16 +0,0 @@
-$def with (allJobs)
-
-<h3>Recent Jobs</h3>
-<table>
-<tr>
- <th width="50%">submitter</th><th width="50%">jobid</th>
-</tr>
-$for job in allJobs[:25]:
- $code:
- dbid, jobid, timestamp, email = job
- <tr>
- <td>$:email</td><td>$:jobid | <a href="$ctx.homepath/job/$jobid/$timestamp">$:timestamp</a></td>
- </tr>
-</table>
-
-
diff --git a/restful/restful.pl b/restful/restful.pl
new file mode 100755
index 0000000..006dae0
--- /dev/null
+++ b/restful/restful.pl
@@ -0,0 +1,56 @@
+#!/usr/bin/perl
+use 5.010;
+use strict;
+use warnings;
+use CGI ':standard';
+use JSON;
+use Config::IniFiles;
+use Data::Dumper;
+
+# setup json
+my $json = JSON->new->allow_nonref;
+
+# location of CAS configuration file
+my $cas_conf = "/etc/cas.conf";
+
+# load configuration
+my $cfg = new Config::IniFiles( -file => $cas_conf ) or die "Can not load config";
+
+# start access to web service
+print header;
+print start_html("RESTful web service.");
+&main;
+print end_html;
+
+# RESTful services
+
+sub main {
+ # parse action
+ given(url_param('action')) {
+ when (/^jobs/) {
+ &jobs;
+ }
+ when (/^status/) {
+ say "return status";
+ }
+ when (/^timestamp/) {
+ say "return timestamp";
+ }
+ when (/^create/) {
+ &create;
+ }
+ default { return 1; }
+ }
+}
+
+sub jobs {
+ if(url_param('id')) {
+ say "return " . url_param('id');
+ } else {
+ say "returning all jobs in queue";
+ }
+}
+
+sub create {
+ # moo
+}
14 years
Changes to 'devel'
by Adam Stokes
New branch 'devel' available with the following commits:
14 years
2 commits - githooks/makerpm githooks/maketests Makefile
by Adam Stokes
Makefile | 1 +
githooks/makerpm | 22 ----------------------
githooks/maketests | 24 ++++++++++++++++++++++++
3 files changed, 25 insertions(+), 22 deletions(-)
New commits:
commit bdc64fe879451c0725e868267c8c4f003768b8f7
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Fri Apr 16 17:25:43 2010 -0400
yawn
diff --git a/Makefile b/Makefile
index 8779250..8e41c4a 100644
--- a/Makefile
+++ b/Makefile
@@ -64,3 +64,4 @@ clean:
rm $$i; \
done; \
for d in $(SUBDIRS); do make -C $$d clean ; done
+
diff --git a/githooks/maketests b/githooks/maketests
index 833cbcc..5ded6f0 100755
--- a/githooks/maketests
+++ b/githooks/maketests
@@ -12,8 +12,10 @@ attempts to build rpm before a git commit
use strict;
use warnings;
+use feature qw ( say );
# Run make rpm
+say "Running build";
my $exitcode = system("make build");
if ($exitcode > 0) {
exit 128;
commit c195d6e4e4983dd23b62c4188095b8b3a9e20953
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Fri Apr 16 17:19:01 2010 -0400
update to run some tests
diff --git a/githooks/makerpm b/githooks/makerpm
deleted file mode 100755
index 0b1aa2a..0000000
--- a/githooks/makerpm
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/perl
-
-=head1 NAME
-
-makerpm
-
-=head1 DESCRIPTION
-
-attempts to build rpm before a git commit
-
-=cut
-
-use strict;
-use warnings;
-
-# Run make rpm
-my $exitcode = system("make rpm");
-if ($exitcode > 0) {
- exit 128;
-} else {
- exit 0;
-}
diff --git a/githooks/maketests b/githooks/maketests
new file mode 100755
index 0000000..833cbcc
--- /dev/null
+++ b/githooks/maketests
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+=head1 NAME
+
+makerpm
+
+=head1 DESCRIPTION
+
+attempts to build rpm before a git commit
+
+=cut
+
+use strict;
+use warnings;
+
+# Run make rpm
+my $exitcode = system("make build");
+if ($exitcode > 0) {
+ exit 128;
+} else {
+ exit 0;
+}
14 years
githooks/makerpm
by Adam Stokes
githooks/makerpm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
New commits:
commit 440f8f139fd4e3dbd8571a70ac7a9eaa6019c715
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Fri Apr 16 17:15:23 2010 -0400
simple hooks
diff --git a/githooks/makerpm b/githooks/makerpm
new file mode 100755
index 0000000..0b1aa2a
--- /dev/null
+++ b/githooks/makerpm
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+=head1 NAME
+
+makerpm
+
+=head1 DESCRIPTION
+
+attempts to build rpm before a git commit
+
+=cut
+
+use strict;
+use warnings;
+
+# Run make rpm
+my $exitcode = system("make rpm");
+if ($exitcode > 0) {
+ exit 128;
+} else {
+ exit 0;
+}
14 years
cas.conf
by Adam Stokes
cas.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 528b54457bdb06e2a60a02c56c65c0fb35ebd942
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Fri Apr 16 16:56:51 2010 -0400
updating
diff --git a/cas.conf b/cas.conf
index bf71c63..c30d96c 100644
--- a/cas.conf
+++ b/cas.conf
@@ -22,7 +22,7 @@ sshkey=dss
# indefinately recursive
kernels=/mnt/kernels
-# Compose emacs regular expression for determing what
+# Compose emacs regular expression for determining what
# kernel debug rpms you wish to search for
rpmFilter=.*kerne.+-debuginfo-[0-9].*\.rpm
14 years
cas.spec
by Adam Stokes
cas.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 88bf34bf7d3f7fd84de0b25e8029e8d3bd5733dd
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Fri Apr 16 11:18:14 2010 -0400
rpmbuild update
diff --git a/cas.spec b/cas.spec
index a32fb21..abe837b 100644
--- a/cas.spec
+++ b/cas.spec
@@ -30,7 +30,7 @@ make
%install
rm -rf ${RPM_BUILD_ROOT}
-make DESTDIR=${RPM_BUILD_DIR} install
+make DESTDIR=${RPM_BUILD_ROOT} install
%clean
rm -rf ${RPM_BUILD_ROOT}
14 years
Makefile
by Adam Stokes
Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit 5b070fffd735fd681f36e95428461fb68d7b5f2b
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Fri Apr 16 11:15:05 2010 -0400
rpmbuild update
diff --git a/Makefile b/Makefile
index 1dfc8a4..8779250 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,8 @@ RPM_WITH_DIRS = $(RPM) $(RPM_DEFINES)
MD5_DEFINES=--define "_source_filedigest_algorithm md5" \
--define "_binary_filedigest_algorithm md5"
-build: for d in $(SUBDIRS); do make -C $$d; [ $$? = 0 ] || exit 1 ; done
+build:
+ for d in $(SUBDIRS); do make -C $$d; [ $$? = 0 ] || exit 1 ; done
install:
mkdir -p $(DESTDIR)/usr/bin
14 years
Makefile
by Adam Stokes
Makefile | 1 +
1 file changed, 1 insertion(+)
New commits:
commit bceb1d5eedb5ea187558b550563419aac858618f
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Fri Apr 16 11:11:42 2010 -0400
rpmbuild update
diff --git a/Makefile b/Makefile
index 47871d2..1dfc8a4 100644
--- a/Makefile
+++ b/Makefile
@@ -42,6 +42,7 @@ install:
$(NAME)-$(VERSION).tar.gz: clean
mkdir -p $(RPM_BUILD_DIR)/$(NAME)-$(VERSION)
git clone $(PWD) $(RPM_BUILD_DIR)/$(NAME)-$(VERSION)
+ rm -rf $(RPM_BUILD_DIR)/$(NAME)-$(VERSION)/.git
tar Ccvzf $(RPM_BUILD_DIR) $(RPM_BUILD_DIR)/$(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION)
srpm-rhel5: clean $(NAME)-$(VERSION).tar.gz
14 years