about_page 0.0.1 → 0.0.2
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/Gemfile.lock +1 -1
- data/app/controllers/about_page/about_controller.rb +2 -1
- data/app/views/about_page/about/_generic_hash.html.erb +5 -0
- data/config/routes.rb +1 -0
- data/lib/about_page/configuration.rb +23 -3
- data/lib/about_page/fedora.rb +18 -1
- data/lib/about_page/solr.rb +11 -3
- data/lib/about_page/version.rb +1 -1
- metadata +3 -3
data/Gemfile.lock
CHANGED
@@ -7,7 +7,8 @@ module AboutPage
|
|
7
7
|
def index
|
8
8
|
@configuration = AboutPage.configuration
|
9
9
|
|
10
|
-
|
10
|
+
@configuration = @configuration.select { |key, value| (params[:filter].split(/[\W\+]/) + ["app"]).include? key.to_s } if params[:filter]
|
11
|
+
@configuration.set_headers!(response)
|
11
12
|
|
12
13
|
respond_to do |format|
|
13
14
|
format.html { render :status => @configuration.ok? ? 200 : 417 } # about_page.html.erb
|
data/config/routes.rb
CHANGED
@@ -8,6 +8,14 @@ module AboutPage
|
|
8
8
|
Hash[*@table.map { |k, v| [k, (v.to_h if v.respond_to? :to_h || v) ] }.flatten ]
|
9
9
|
end
|
10
10
|
|
11
|
+
def reject &block
|
12
|
+
self.class.new to_h.reject(&block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def select &block
|
16
|
+
self.class.new to_h.select(&block)
|
17
|
+
end
|
18
|
+
|
11
19
|
def to_xml(options = {})
|
12
20
|
@table
|
13
21
|
end
|
@@ -22,8 +30,16 @@ module AboutPage
|
|
22
30
|
delegate :to_xml, :to_h, :to_json, :to => :hash
|
23
31
|
delegate :each, :map, :to => :to_h
|
24
32
|
|
25
|
-
def initialize
|
26
|
-
@hash = OpenStructWithHashAccess.new
|
33
|
+
def initialize hash = nil
|
34
|
+
@hash = hash || OpenStructWithHashAccess.new
|
35
|
+
end
|
36
|
+
|
37
|
+
def reject &block
|
38
|
+
AboutPage::Configuration.new @hash.reject(&block)
|
39
|
+
end
|
40
|
+
|
41
|
+
def select &block
|
42
|
+
AboutPage::Configuration.new @hash.select(&block)
|
27
43
|
end
|
28
44
|
|
29
45
|
def method_missing *args
|
@@ -52,7 +68,7 @@ module AboutPage
|
|
52
68
|
end
|
53
69
|
|
54
70
|
def set_headers! response
|
55
|
-
|
71
|
+
messages.each { |m| add_header(response, m) }
|
56
72
|
end
|
57
73
|
|
58
74
|
def add_header response, text
|
@@ -64,6 +80,10 @@ module AboutPage
|
|
64
80
|
def ok?
|
65
81
|
true
|
66
82
|
end
|
83
|
+
|
84
|
+
def messages
|
85
|
+
[]
|
86
|
+
end
|
67
87
|
end
|
68
88
|
end
|
69
89
|
end
|
data/lib/about_page/fedora.rb
CHANGED
@@ -9,7 +9,24 @@ module AboutPage
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def to_h
|
12
|
-
rubydora.profile
|
12
|
+
rubydora.profile || {}
|
13
13
|
end
|
14
|
+
|
15
|
+
def ok?
|
16
|
+
!to_h.empty?
|
17
|
+
end
|
18
|
+
|
19
|
+
def messages
|
20
|
+
a = []
|
21
|
+
a << "Unable to connect to fedora: #{self.rubydora.inspect}" if rubydora.profile.nil?
|
22
|
+
|
23
|
+
a
|
24
|
+
end
|
25
|
+
|
26
|
+
def preflight request
|
27
|
+
# FIXME: ew.
|
28
|
+
self.rubydora.instance_variable_set('@profile', nil)
|
29
|
+
end
|
30
|
+
|
14
31
|
end
|
15
32
|
end
|
data/lib/about_page/solr.rb
CHANGED
@@ -23,14 +23,22 @@ module AboutPage
|
|
23
23
|
alias_method :to_h, :index
|
24
24
|
|
25
25
|
def ok?
|
26
|
-
|
26
|
+
return false if schema.empty?
|
27
|
+
return false if index[:numDocs].to_i < minimum_numdocs
|
28
|
+
|
29
|
+
true
|
27
30
|
end
|
28
31
|
|
29
|
-
def
|
30
|
-
|
32
|
+
def messages
|
33
|
+
a = []
|
34
|
+
a << "Unable to connect to solr: #{self.rsolr.inspect}" if schema.empty?
|
35
|
+
a << "Solr numDocs (#{index[:numDocs]}) is less than the minimum #{minimum_numdocs}" if !schema.empty? and index[:numDocs].to_i < minimum_numdocs
|
36
|
+
|
37
|
+
a
|
31
38
|
end
|
32
39
|
|
33
40
|
def preflight request
|
41
|
+
@schema = nil
|
34
42
|
@minimum_numdocs = request.params['solr.numDocs'].to_i if request.params['solr.numDocs'].to_i
|
35
43
|
end
|
36
44
|
|
data/lib/about_page/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: about_page
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -187,7 +187,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
187
|
version: '0'
|
188
188
|
segments:
|
189
189
|
- 0
|
190
|
-
hash:
|
190
|
+
hash: 823128254637505744
|
191
191
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
192
|
none: false
|
193
193
|
requirements:
|
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
196
|
version: '0'
|
197
197
|
segments:
|
198
198
|
- 0
|
199
|
-
hash:
|
199
|
+
hash: 823128254637505744
|
200
200
|
requirements: []
|
201
201
|
rubyforge_project:
|
202
202
|
rubygems_version: 1.8.24
|