diff options
author | Martin Gütlein <martin.guetlein@gmail.com> | 2010-02-26 09:59:18 +0100 |
---|---|---|
committer | Martin Gütlein <martin.guetlein@gmail.com> | 2010-02-26 09:59:18 +0100 |
commit | ae962c2f3462951b3957dd2effbb6537c4b9dc44 (patch) | |
tree | 40d5c4477fd35281b44a44ac73322c7929f4797c | |
parent | a825ad79d0f06a40c7df4024d4554e32181d7c32 (diff) | |
parent | e639230dcbd34319784c76d3317525984bdd0595 (diff) |
resolved conflict
-rw-r--r-- | application.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/application.rb b/application.rb index bae6572..36bd845 100644 --- a/application.rb +++ b/application.rb @@ -8,8 +8,8 @@ class Task property :id, Serial property :parent_id, Integer property :pid, Integer - property :uri, String, :length => 100 - property :resource, String, :length => 100 + property :uri, String, :length => 255 + property :resource, String, :length => 255 property :status, String, :default => "created" property :created_at, DateTime property :finished_at, DateTime @@ -20,16 +20,19 @@ end DataMapper.auto_upgrade! get '/?' do + response['Content-Type'] = 'text/uri-list' Task.all.collect{|t| t.uri}.join("\n") end get '/:id/?' do + response['Content-Type'] = 'application/x-yaml' task = Task.get(params[:id]) task.to_yaml end # dynamic access to Task properties get '/:id/:property/?' do + response['Content-Type'] = 'text/plain' task = Task.get(params[:id]) eval("task.#{params[:property]}").to_s end @@ -40,7 +43,7 @@ post '/?' do task.save # needed to create id task.uri = url_for("/#{task.id}", :full) raise "could not save" unless task.save - LOGGER.debug "task created" + response['Content-Type'] = 'text/uri-list' task.uri end @@ -72,6 +75,7 @@ delete '/:id/?' do "Cannot kill task with pid #{task.pid}" end task.destroy! + response['Content-Type'] = 'text/plain' "Task #{params[:id]} deleted." end @@ -82,7 +86,9 @@ delete '/?' do rescue "Cannot kill task with pid #{task.pid}" end - task.destroy! + #task.destroy! end + Task.auto_migrate! + response['Content-Type'] = 'text/plain' "All tasks deleted." end |