publish_my_data 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/controllers/publish_my_data/application_controller.rb +3 -2
- data/app/controllers/publish_my_data/datasets_controller.rb +1 -1
- data/app/controllers/publish_my_data/resources_controller.rb +14 -9
- data/app/controllers/publish_my_data/themes_controller.rb +2 -2
- data/lib/publish_my_data/version.rb +1 -1
- data/spec/controllers/publish_my_data/resources_controller_spec.rb +9 -0
- data/spec/dummy/log/test.log +27890 -0
- metadata +15 -15
@@ -9,12 +9,13 @@ module PublishMyData
|
|
9
9
|
|
10
10
|
private
|
11
11
|
|
12
|
-
def is_request_html_format?
|
13
|
-
(request.format.to_sym || :html) == :html
|
12
|
+
def is_request_html_format?(c=self)
|
13
|
+
(c.request.format.to_sym || :html) == :html
|
14
14
|
end
|
15
15
|
# TODO: deal with javaascript errors - respond with 200
|
16
16
|
|
17
17
|
def handle_uncaught_error(e)
|
18
|
+
|
18
19
|
@e = e
|
19
20
|
|
20
21
|
if defined?(Raven)
|
@@ -6,7 +6,7 @@ module PublishMyData
|
|
6
6
|
respond_to :html, :ttl, :rdf, :nt, :json, :text
|
7
7
|
|
8
8
|
caches_action :show, :index,
|
9
|
-
:cache_path => Proc.new { |c| c.params }, :if => Proc.new { |c| c
|
9
|
+
:cache_path => Proc.new { |c| c.params }, :if => Proc.new { |c| is_request_html_format?(c) }
|
10
10
|
|
11
11
|
# /data/:id (where :id is the dataset 'slug')
|
12
12
|
def show
|
@@ -6,7 +6,7 @@ module PublishMyData
|
|
6
6
|
respond_to :html, :ttl, :rdf, :nt, :json, :text
|
7
7
|
|
8
8
|
caches_action :show, :index, :doc, :definition,
|
9
|
-
:cache_path => Proc.new { |c| c.params }, :if => Proc.new { |c| c
|
9
|
+
:cache_path => Proc.new { |c| c.params }, :if => Proc.new { |c| is_request_html_format?(c) }
|
10
10
|
|
11
11
|
# /resources
|
12
12
|
# /resources?type=[http://type-uri]&dataset=[dataset-slug]
|
@@ -27,15 +27,20 @@ module PublishMyData
|
|
27
27
|
# RubyProf.start
|
28
28
|
|
29
29
|
uri = params[:uri]
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
30
|
+
|
31
|
+
if uri.present?
|
32
|
+
begin
|
33
|
+
render_resource_with_uri(uri)
|
34
|
+
rescue Tripod::Errors::ResourceNotFound
|
35
|
+
# if it's not there
|
36
|
+
respond_to do |format|
|
37
|
+
format.html { redirect_to uri }
|
38
|
+
# This is meant for UI browsing only, really. Just 404 for other mimes.
|
39
|
+
format.any { render :nothing => true, :status => 404, :content_type => 'text/plain' }
|
40
|
+
end
|
38
41
|
end
|
42
|
+
else
|
43
|
+
raise Tripod::Errors::ResourceNotFound.new
|
39
44
|
end
|
40
45
|
end
|
41
46
|
|
@@ -4,9 +4,9 @@ module PublishMyData
|
|
4
4
|
class ThemesController < ApplicationController
|
5
5
|
|
6
6
|
caches_action :show, :index,
|
7
|
-
:cache_path => Proc.new { |c| c.params }, :if => Proc.new { |c| c
|
7
|
+
:cache_path => Proc.new { |c| c.params }, :if => Proc.new { |c| is_request_html_format?(c) }
|
8
8
|
|
9
|
-
respond_to :html, :ttl, :rdf, :nt, :json
|
9
|
+
respond_to :html, :ttl, :rdf, :nt, :json, :text
|
10
10
|
|
11
11
|
def index
|
12
12
|
# don't bother paginating this for now - there probably wont be that many themes
|
@@ -188,6 +188,15 @@ module PublishMyData
|
|
188
188
|
|
189
189
|
describe "#show" do
|
190
190
|
|
191
|
+
context "with no uri parameter" do
|
192
|
+
before do
|
193
|
+
get :show, use_route: :publish_my_data
|
194
|
+
end
|
195
|
+
it "should respond with not found" do
|
196
|
+
response.should be_not_found
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
191
200
|
context "with a resource not in our database" do
|
192
201
|
|
193
202
|
uri = "http://purl.org/linked-data/sdmx/2009/dimension%23refArea"
|