about_page 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +3 -3
- data/app/assets/stylesheets/about_page.scss +4 -0
- data/app/views/about_page/about/_dependencies.html.erb +3 -3
- data/lib/about_page/dependencies.rb +41 -8
- data/lib/about_page/solr.rb +10 -4
- data/lib/about_page/version.rb +1 -1
- data/spec/lib/solr_spec.rb +2 -2
- metadata +5 -6
- data/app/views/about_page/about/_dependency_tree.html.erb +0 -10
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
about_page (0.0.
|
4
|
+
about_page (0.0.5)
|
5
5
|
rails (~> 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -120,10 +120,10 @@ GEM
|
|
120
120
|
sqlite3 (1.3.6)
|
121
121
|
thor (0.14.6)
|
122
122
|
tilt (1.3.3)
|
123
|
-
treetop (1.4.
|
123
|
+
treetop (1.4.14)
|
124
124
|
polyglot
|
125
125
|
polyglot (>= 0.3.1)
|
126
|
-
tzinfo (0.3.
|
126
|
+
tzinfo (0.3.37)
|
127
127
|
xpath (0.1.4)
|
128
128
|
nokogiri (~> 1.3)
|
129
129
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
<h1>
|
1
|
+
<h1>Dependencies</h1>
|
2
2
|
<div class="dependencies">
|
3
3
|
<ul>
|
4
|
-
<% profile.
|
5
|
-
<li class="dependency
|
4
|
+
<% profile.spec_list.each do |dep,version,groups| %>
|
5
|
+
<li class="dependency<%=groups.present? ? ' required' : ''%>"><%=dep%> (<%=version%>)</li>
|
6
6
|
<% end %>
|
7
7
|
</ul>
|
8
8
|
</div>
|
@@ -1,8 +1,35 @@
|
|
1
1
|
module AboutPage
|
2
2
|
class Dependencies < AboutPage::Configuration::Node
|
3
3
|
delegate :each_pair, :to_xml, :to_json, :to => :to_h
|
4
|
+
attr_reader :max_depth
|
5
|
+
|
6
|
+
def initialize(max_depth=100)
|
7
|
+
@max_depth = max_depth
|
8
|
+
end
|
9
|
+
|
4
10
|
def to_h
|
5
|
-
@dependencies ||=
|
11
|
+
@dependencies ||= spec_list.inject({}) { |h,data|
|
12
|
+
spec = { :name => data[0], :version => data[1] }
|
13
|
+
if data[2].nil?
|
14
|
+
h[:implied] ||= []
|
15
|
+
h[:implied] << spec
|
16
|
+
else
|
17
|
+
data[2].each { |g|
|
18
|
+
h[g] ||= []
|
19
|
+
h[g] << spec
|
20
|
+
}
|
21
|
+
end
|
22
|
+
h
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def spec_list
|
27
|
+
required = environment.current_dependencies.inject({}) { |h,d| h[d.name] = d.groups; h }
|
28
|
+
list = environment.specs.sort { |a,b| a.name <=> b.name }.collect { |s| [
|
29
|
+
s.name,
|
30
|
+
[s.version.to_s, s.git_version.to_s].join,
|
31
|
+
required[s.name]
|
32
|
+
]}
|
6
33
|
end
|
7
34
|
|
8
35
|
private
|
@@ -14,19 +41,25 @@ module AboutPage
|
|
14
41
|
@groups ||= environment.current_dependencies.group_by { |d| d.groups.first.to_s }
|
15
42
|
end
|
16
43
|
|
17
|
-
def
|
18
|
-
|
44
|
+
def specs
|
45
|
+
@specs ||= environment.specs
|
46
|
+
end
|
47
|
+
|
48
|
+
def dependency_version(key)
|
49
|
+
spec = environment.specs.find { |s| s.name == key }
|
19
50
|
rev = spec.git_version
|
20
51
|
rev.strip! unless rev.nil?
|
21
52
|
location = [spec.source.options.values_at('path','uri').compact.first,rev].compact.join('@')
|
22
53
|
[spec.version.to_s,location].compact.join(' ').strip
|
23
54
|
end
|
24
55
|
|
25
|
-
def dependency_hash(
|
26
|
-
graph = Bundler::Graph.new(
|
27
|
-
result = { :version => dependency_version(
|
28
|
-
|
29
|
-
|
56
|
+
def dependency_hash(key, graph=nil, depth=0)
|
57
|
+
graph = Bundler::Graph.new(environment,'/dev/null') if graph.nil?
|
58
|
+
result = { :version => dependency_version(key) }
|
59
|
+
if depth < @max_depth
|
60
|
+
deps = Hash[graph.relations[key].collect { |dep| [dep, dependency_hash(dep, graph, depth+1)]}]
|
61
|
+
result[:dependencies] = deps unless deps.empty?
|
62
|
+
end
|
30
63
|
result
|
31
64
|
end
|
32
65
|
end
|
data/lib/about_page/solr.rb
CHANGED
@@ -15,14 +15,20 @@ module AboutPage
|
|
15
15
|
def initialize rsolr_instance, options = {}
|
16
16
|
self.rsolr = rsolr_instance
|
17
17
|
self.options = options
|
18
|
-
self.options[:
|
18
|
+
self.options[:luke] ||= 'admin/luke'
|
19
|
+
if self.options[:registry] == :registry
|
20
|
+
self.options[:registry] = 'admin/registry.jsp'
|
21
|
+
else
|
22
|
+
self.options[:registry] ||= 'admin/mbeans'
|
23
|
+
end
|
24
|
+
self.options[:expects] ||= {}
|
19
25
|
self.options[:expects][:numDocs] ||= 1
|
20
26
|
|
21
27
|
@request_expectations = {}
|
22
28
|
end
|
23
29
|
|
24
30
|
def schema
|
25
|
-
@schema ||= rsolr.luke
|
31
|
+
@schema ||= rsolr.get self.options[:luke], :params => { :show => 'schema', :numTerms => 0 }
|
26
32
|
rescue
|
27
33
|
{}
|
28
34
|
end
|
@@ -30,7 +36,7 @@ module AboutPage
|
|
30
36
|
def registry
|
31
37
|
@registry ||= begin
|
32
38
|
h = {}
|
33
|
-
resp = rsolr.get
|
39
|
+
resp = rsolr.get self.options[:registry], :params => { :wt => 'xml' }
|
34
40
|
doc = Nokogiri::XML resp
|
35
41
|
|
36
42
|
doc.xpath('/solr/*').each do |node|
|
@@ -49,7 +55,7 @@ module AboutPage
|
|
49
55
|
end
|
50
56
|
|
51
57
|
def to_h
|
52
|
-
index
|
58
|
+
index#.merge(registry)
|
53
59
|
end
|
54
60
|
|
55
61
|
def numDocs; index[:numDocs]; end
|
data/lib/about_page/version.rb
CHANGED
data/spec/lib/solr_spec.rb
CHANGED
@@ -9,11 +9,11 @@ describe AboutPage::Solr do
|
|
9
9
|
|
10
10
|
describe "#schema" do
|
11
11
|
it "should be empty if the connection to solr fails" do
|
12
|
-
@mock_solr_connection.should_receive(:
|
12
|
+
@mock_solr_connection.should_receive(:get).with('admin/luke', an_instance_of(Hash)).and_throw(:msg)
|
13
13
|
subject.schema.should be_empty
|
14
14
|
end
|
15
15
|
it "should retrieve index information from luke" do
|
16
|
-
@mock_solr_connection.should_receive(:
|
16
|
+
@mock_solr_connection.should_receive(:get).with('admin/luke', an_instance_of(Hash)).and_return { Hash.new }
|
17
17
|
subject.schema.should be_a_kind_of(Hash)
|
18
18
|
end
|
19
19
|
end
|
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.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-07-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -114,7 +114,6 @@ files:
|
|
114
114
|
- app/helpers/about_page/about_helper.rb
|
115
115
|
- app/views/about_page/about/_app.html.erb
|
116
116
|
- app/views/about_page/about/_dependencies.html.erb
|
117
|
-
- app/views/about_page/about/_dependency_tree.html.erb
|
118
117
|
- app/views/about_page/about/_environment.html.erb
|
119
118
|
- app/views/about_page/about/_exception.html.erb
|
120
119
|
- app/views/about_page/about/_generic_hash.html.erb
|
@@ -187,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
186
|
version: '0'
|
188
187
|
segments:
|
189
188
|
- 0
|
190
|
-
hash:
|
189
|
+
hash: 1201806507108649834
|
191
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
191
|
none: false
|
193
192
|
requirements:
|
@@ -196,10 +195,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
195
|
version: '0'
|
197
196
|
segments:
|
198
197
|
- 0
|
199
|
-
hash:
|
198
|
+
hash: 1201806507108649834
|
200
199
|
requirements: []
|
201
200
|
rubyforge_project:
|
202
|
-
rubygems_version: 1.8.
|
201
|
+
rubygems_version: 1.8.23
|
203
202
|
signing_key:
|
204
203
|
specification_version: 3
|
205
204
|
summary: Summary of AboutPage.
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<ul class="dependency">
|
2
|
-
<% graph.keys.sort.each do |name| spec = graph[name] %>
|
3
|
-
<li class="dependency">
|
4
|
-
<b><%= name %></b> (<%= spec[:version] %>)
|
5
|
-
<% if spec[:dependencies] %>
|
6
|
-
<%= render :partial => 'dependency_tree', :locals => { :graph => spec[:dependencies] }%>
|
7
|
-
<% end %>
|
8
|
-
</li>
|
9
|
-
<% end %>
|
10
|
-
</ul>
|