about summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-10-03 11:40:37 +0200
committerfranck cuny <franck@lumberjaph.net>2010-10-03 11:40:37 +0200
commit6d2835f444a59a09a85866af6c9ed3f10c0e0a9b (patch)
tree7dd7c93d0427101d254c1e9a6a8b5e4a5bbf0556
parentupdate scripts to use dbic; chmod build-failed (diff)
downloadjitterbug-6d2835f444a59a09a85866af6c9ed3f10c0e0a9b.tar.gz
update config, view, tests
-rw-r--r--config.yml12
-rw-r--r--public/css/style.css2
-rw-r--r--t/003_hook_route.t59
-rw-r--r--t/data/test.yaml3
-rw-r--r--views/project/index.tt28
5 files changed, 60 insertions, 44 deletions
diff --git a/config.yml b/config.yml
index 75ce73a..de542de 100644
--- a/config.yml
+++ b/config.yml
@@ -18,4 +18,14 @@ jitterbug:
     dir: /tmp/build
   build_process:
     builder: ./scripts/capsule.sh
-    on_failure: ./scripts/on_failure.sh
+    on_failure: ./scripts/build-failed.sh
+
+plugins:
+  DBIC:
+    schema:
+      skip_automake: 1
+      pckg: "jitterbug::Schema"
+      connect_info:
+        - dbi:SQLite:dbname=jitterbug.db
+
+
diff --git a/public/css/style.css b/public/css/style.css
index 038fa80..2e546be 100644
--- a/public/css/style.css
+++ b/public/css/style.css
@@ -224,7 +224,7 @@ float: right;
 }
 
 .git {
-width:18em;padding:.8em 0 .8em 1.2em;border-left:1px solid #bedce7;color:#808080;;font-size:.85em;line-height:1.5em;
+width:23em;padding:.8em 0 .8em 1.2em;border-left:1px solid #bedce7;color:#808080;;font-size:.85em;line-height:1.5em;
 }
 
 .message {
diff --git a/t/003_hook_route.t b/t/003_hook_route.t
index 9929553..b9d7e1f 100644
--- a/t/003_hook_route.t
+++ b/t/003_hook_route.t
@@ -1,43 +1,44 @@
-use Test::More tests => 1;
+use Test::More tests => 4;
 use strict;
 use warnings;
-ok 1;
-#use jitterbug;
-#use JSON;
-#use YAML qw/LoadFile/;
-#use Dancer::Test;
-#use Dancer::Config qw/setting/;
+#ok 1;
+use jitterbug;
+use JSON;
+use YAML qw/LoadFile/;
+use Dancer::Test;
+use Dancer::Config qw/setting/;
 
-#my $content = LoadFile('t/data/test.yaml');
+my $content = LoadFile('t/data/test.yaml');
 
-#setting jitterbug => { namespace => 'jitterbug_test' };
+setting jitterbug => { namespace => 'jitterbug_test' };
 
-#route_exists [ POST => '/hook/' ], 'a route handle is defined for /';
+route_exists [ POST => '/hook/' ], 'a route handle is defined for /';
 
-#my $response;
+my $response;
 
-#{
-    #$response = dancer_response( POST => '/hook', );
-    #is $response->{status}, 200, '200 with empty post';
-#}
+{
+    $response = dancer_response( POST => '/hook', );
+    is $response->{status}, 200, '200 with empty post';
+}
 
-#{
-    #my $payload = "payload=" . JSON::encode_json($content);
+{
+    my $payload = "payload=" . JSON::encode_json($content);
     #open my $in, '<', \$payload;
 
     #$ENV{'CONTENT_LENGTH'} = length($payload);
     #$ENV{'CONTENT_TYPE'}   = 'application/x-www-form-urlencoded';
     #$ENV{'psgi.input'}     = $in;
 
-    #$response = dancer_response(
-        #POST => '/hook/',
-        #{
-            #headers => [ 'Content-Length' => length($payload) ],
-            #body    => $payload
-        #}
-    #);
-
-    #is $response->{status}, 200;
-    #is_deeply JSON::decode_json( $response->{content} ),
-      #{ updated => 'Dancer' };
-#}
+    $response = dancer_response(
+        POST => '/hook/',
+        {
+            headers =>
+              [ 'Content-Type' => 'application/x-www-form-urlencoded' ],
+            body => $payload
+        }
+    );
+#use YAML::Syck; warn Dump $response;
+    is $response->{status}, 200;
+    is_deeply JSON::decode_json( $response->{content} ),
+      { updated => 'Dancer' };
+}
diff --git a/t/data/test.yaml b/t/data/test.yaml
index 9636611..c8e1a63 100644
--- a/t/data/test.yaml
+++ b/t/data/test.yaml
@@ -8,7 +8,8 @@ commits:
     author: 
       email: franck@lumberjaph.net
       name: franck cuny
-    id: 8c3c1d6be0fa27ada4f03258ddea7683c967a925
+    #id: 8c3c1d6be0fa27ada4f03258ddea7683c967a925
+    id: ba54d9b7d82eabe4ba35ec212eb24d00869119d5
     message: test
     modified: 
       - lib/Dancer.pm
diff --git a/views/project/index.tt b/views/project/index.tt
index 2749989..7f3ee1f 100644
--- a/views/project/index.tt
+++ b/views/project/index.tt
@@ -1,33 +1,37 @@
 <div id="page">
   <div id="content">
-    <h2><a href="<: $url :>"><: $project :></a> / build history <a href="<: $base_uri :>/project/<: $project :>/feed"><img src="<: $uri_base :>/images/feed.png" /></a></h2>
+    <h2><a href="<: $project.url :>"><: $project.name :></a> / build history <a href="<: $base_uri :>/project/<: $project.name :>/feed"><img src="<: $uri_base :>/images/feed.png" /></a></h2>
 
-    <strong>"<: $description :>"</strong>
+    <strong>"<: $project.description :>"</strong>
 
     :for $days -> $day {
       <h3 class="builds-day" id="builds-day-<: $day :>"><: $day :></h3>
       <div class="commits" id="commits-day-<: $day :>">
-        :for $builds[$day] -> $build {
-          <div class="commit" id="<: $build.commit :>">
+        :for $commits[$day] -> $commit {
+          <div class="commit" id="<: $commit.id :>">
             <div class="description">
-              <div class="message"><pre><: $build.message :></pre></div>
-              <div class="name"><: $build.author.name :></div>
-              <div class="date"><: $build.timestamp :></div>
+              <div class="message"><pre><: $commit.message :></pre></div>
+              <div class="name"><: $commit.author.name :></div>
+              <br />
               <div class="builds">
-                :for $build.version.keys() -> $version {
-                  <a href="<: $uri_base :>/api/build/<: $project :>/<: $build.commit :>/<: $version :>"><: $version :></a> <span class="<: $build.version[$version] :>"><: $build.version[$version] :></span>
+                :for $commit.build.version.keys() -> $version {
+                  <a href="<: $uri_base :>/api/build/<: $project.name :>/<: $commit.id :>/<: $version :>"><: $version :></a> <span class="<: $commit.build.version[$version] :>"><: $commit.build.version[$version] :></span>
                 :}
               </div>
             </div>
             <div class="git">
-              commit&nbsp;&nbsp;<a href="<: $build.url :>"><: $build.commit :></a><br />
+              commit&nbsp;&nbsp;&nbsp;<a href="<: $commit.url :>"><: $commit.id :></a><br />
+              commited&nbsp;<: $commit.timestamp :><br />
+              ref&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<: $commit.ref :><br />
+              <: if $commit.build { :>
+                built in&nbsp;<: $commit.build.end_time - $commit.build.start_time :>&nbsp;seconds</br >
+              <: } :>
             </div>
           </div>
-          <div class="display_test_result" style="display: none" id="result-<: $build.commit :>">
+          <div class="display_test_result" style="display: none" id="result-<: $commit.id :>">
           </div>
         :}
       </div>
-      <hr />
       :}
   </div>
 </div>