blacklight-hierarchy 0.2.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09adfc50b7ac284a10660f6286195c933b83c9a9
4
- data.tar.gz: b43755bedbfebb4edbf29e47c780fd6396b53e2f
3
+ metadata.gz: 012ebd86d5d29ce741c86b58a1d78705bec85881
4
+ data.tar.gz: dc580c62ac00e64bc2afcbf4b6a38e02bde54e06
5
5
  SHA512:
6
- metadata.gz: ce12c726de86668634fd4d85f5e8f1a48621c8de7856d9bb42b94018f6d89ae96a351ac4cc1054f5463061aa8dea7d6cfa7fd67aa550588543652338760e3894
7
- data.tar.gz: 9ea282ea66826a20d233ee8df327925bda14f12c2e01d4441d78f7ea8ff51143f5e3b1f8c92cd09a54d6033b0dc72df6b5f18e1dda5ee7a9b010eed31a4ad398
6
+ metadata.gz: 7da5e0f9a81a1dcaefdc27b18a375f241bba50bb9f4452ce34e70d9fadfda8e482c4d5feb95fe6b90626b62cbaccc04b4d9a9b201486a3087009b9e4dc25934a
7
+ data.tar.gz: 974e9e27e9d5a5e7e6767cf7bbc8d8f0fad42f39077d6aa72938abb3f2833c235034f25d8ca6b8ed2f70a21245adc01d631847d0ff22989da4d5a7a985bcf77f
data/.rubocop.yml ADDED
@@ -0,0 +1,17 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ # rspec expect{...} is conventional
4
+ Style/SpaceBeforeBlockBraces:
5
+ Exclude:
6
+ - 'spec/**/*_spec.rb'
7
+
8
+ Style/EmptyLineBetweenDefs:
9
+ AllowAdjacentOneLineDefs: true
10
+
11
+ # allow for alignment
12
+ Style/SpaceAroundOperators:
13
+ AllowForAlignment: true
14
+
15
+ # Configuration parameters: AllowURI, URISchemes.
16
+ Metrics/LineLength:
17
+ Max: 200
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,69 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2016-02-29 14:59:02 -0800 using RuboCop version 0.37.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 5
10
+ Metrics/AbcSize:
11
+ Max: 49
12
+
13
+ # Offense count: 1
14
+ Metrics/CyclomaticComplexity:
15
+ Max: 7
16
+
17
+ # Offense count: 3
18
+ # Configuration parameters: CountComments.
19
+ Metrics/MethodLength:
20
+ Max: 19
21
+
22
+ # Offense count: 1
23
+ # Configuration parameters: CountComments.
24
+ Metrics/ModuleLength:
25
+ Max: 110
26
+
27
+ # Offense count: 1
28
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
29
+ # SupportedStyles: nested, compact
30
+ Style/ClassAndModuleChildren:
31
+ Exclude:
32
+ - 'app/helpers/blacklight/hierarchy_helper.rb'
33
+
34
+ # Offense count: 5
35
+ Style/Documentation:
36
+ Exclude:
37
+ - 'spec/**/*'
38
+ - 'test/**/*'
39
+ - 'app/helpers/blacklight/hierarchy_helper.rb'
40
+ - 'lib/blacklight/hierarchy.rb'
41
+ - 'lib/blacklight/hierarchy/hierarchical_facet.rb'
42
+ - 'lib/generators/blacklight_hierarchy/install_generator.rb'
43
+
44
+ # Offense count: 1
45
+ # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts.
46
+ Style/FileName:
47
+ Exclude:
48
+ - 'lib/blacklight-hierarchy.rb'
49
+
50
+ # Offense count: 1
51
+ # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
52
+ # NamePrefix: is_, has_, have_
53
+ # NamePrefixBlacklist: is_, has_, have_
54
+ # NameWhitelist: is_a?
55
+ Style/PredicateName:
56
+ Exclude:
57
+ - 'app/helpers/blacklight/hierarchy_helper.rb'
58
+
59
+ # Offense count: 1
60
+ # Cop supports --auto-correct.
61
+ # Configuration parameters: AllowAsExpressionSeparator.
62
+ Style/Semicolon:
63
+ Exclude:
64
+ - 'app/helpers/blacklight/hierarchy_helper.rb'
65
+
66
+ # Offense count: 1
67
+ Style/ZeroLengthPredicate:
68
+ Exclude:
69
+ - 'app/helpers/blacklight/hierarchy_helper.rb'
data/.travis.yml CHANGED
@@ -5,7 +5,6 @@ rvm:
5
5
 
6
6
  notifications:
7
7
  email:
8
- - ndushay@stanford.edu
9
8
  - cbeer@stanford.edu
10
9
 
11
10
  env:
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Declare gem dependencies in blacklight-hierarchy-facets.gemspec.
4
4
  gemspec
@@ -9,10 +9,10 @@ gemspec
9
9
  # your gem to rubygems.org.
10
10
 
11
11
  # BEGIN ENGINE_CART BLOCK
12
- # engine_cart: 0.8.0
13
- # engine_cart stanza: 0.8.0
12
+ # engine_cart: 1.0.1
13
+ # engine_cart stanza: 0.10.0
14
14
  # the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
15
- file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path(".internal_test_app", File.dirname(__FILE__)))
15
+ file = File.expand_path('Gemfile', ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app', File.dirname(__FILE__)))
16
16
  if File.exist?(file)
17
17
  begin
18
18
  eval_gemfile file
@@ -23,13 +23,22 @@ if File.exist?(file)
23
23
  else
24
24
  Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"
25
25
 
26
- gem 'rails', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']
26
+ if ENV['RAILS_VERSION']
27
+ if ENV['RAILS_VERSION'] == 'edge'
28
+ gem 'rails', github: 'rails/rails'
29
+ ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
30
+ else
31
+ gem 'rails', ENV['RAILS_VERSION']
32
+ end
33
+ end
27
34
 
28
- if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] =~ /^4.2/
29
- gem 'responders', "~> 2.0"
30
- gem 'sass-rails', ">= 5.0"
31
- else
32
- gem 'sass-rails', "< 5.0"
35
+ case ENV['RAILS_VERSION']
36
+ when /^4.2/
37
+ gem 'responders', '~> 2.0'
38
+ gem 'sass-rails', '>= 5.0'
39
+ gem 'coffee-rails', '~> 4.1.0'
40
+ when /^4.[01]/
41
+ gem 'sass-rails', '< 5.0'
33
42
  end
34
43
  end
35
- # END ENGINE_CART BLOCK
44
+ # END ENGINE_CART BLOCK
data/README.md CHANGED
@@ -3,28 +3,34 @@
3
3
 
4
4
  This plugin provides hierarchical facets for [Blacklight](https://github.com/projectblacklight/blacklight).
5
5
 
6
+ Please note this is does not directly follow any of the competing approaches of [Hierarchical Facets in Solr](http://wiki.apache.org/solr/HierarchicalFaceting), including Solr PivotFacets.
7
+
6
8
  ## Usage
7
9
 
8
- Add the plugin to your Blacklight app's Gemfile
9
-
10
- gem 'blacklight-hierarchy'
11
-
12
- Index your hierarchies in colon-separated list. For example, items in a "processing" queue with a "copy" action, might be indexed as
13
-
14
- <doc>
15
- <field name="id">foo</field>
16
- <field name="queue_status_facet">processing</field>
17
- <field name="queue_status_facet">processing:copy</field>
18
- <field name="queue_status_facet">processing:copy:waiting</field>
19
- </doc>
20
- <doc>
21
- <field name="id">bar</field>
22
- <field name="queue_status_facet">processing</field>
23
- <field name="queue_status_facet">processing:copy</field>
24
- <field name="queue_status_facet">processing:copy:completed</field>
25
- </doc>
26
-
27
- That would cause the facet count to appear at all three levels
10
+ Add the plugin to your Blacklight app's Gemfile.
11
+
12
+ ```ruby
13
+ gem 'blacklight-hierarchy'
14
+ ```
15
+
16
+ Index your hierarchies in a (colon-)separated list. For example, items in a "processing" queue with a "copy" action, might be indexed as:
17
+
18
+ ```xml
19
+ <doc>
20
+ <field name="id">foo</field>
21
+ <field name="queue_status_facet">processing</field>
22
+ <field name="queue_status_facet">processing:copy</field>
23
+ <field name="queue_status_facet">processing:copy:waiting</field>
24
+ </doc>
25
+ <doc>
26
+ <field name="id">bar</field>
27
+ <field name="queue_status_facet">processing</field>
28
+ <field name="queue_status_facet">processing:copy</field>
29
+ <field name="queue_status_facet">processing:copy:completed</field>
30
+ </doc>
31
+ ```
32
+
33
+ That would cause the facet count to appear at all three levels:
28
34
 
29
35
  - [processing](#) (2)
30
36
  - [copy](#) (2)
@@ -38,24 +44,45 @@ You can skip as many levels as you'd like, as long as the "leaf" values are inde
38
44
  - [completed](#) (1)
39
45
  - [waiting](#) (1)
40
46
 
41
- (**Note**: If you use Solr's built-in [PathHierarchyTokenizerFactory](http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.PathHierarchyTokenizerFactory), you can index the entire depth by supplying only the leaf nodes.)
47
+ **Note**: If you use Solr's built-in [PathHierarchyTokenizerFactory](http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.PathHierarchyTokenizerFactory), you can index the entire depth by supplying only the leaf nodes. Otherwise you are expected to build the permutations yourself before loading.
42
48
 
43
- In your Blacklight controller configuration (usually `CatalogController`), tell Blacklight to render the facet using the hierarchy partial
49
+ In your Blacklight controller configuration (usually `CatalogController`), tell Blacklight to render the facet using the hierarchy partial.
44
50
 
45
- config.add_facet_field 'queue_status_facet', :label => 'Queue Status',
46
- :partial => 'blacklight/hierarchy/facet_hierarchy'
47
51
 
52
+ ```ruby
53
+ config.add_facet_field 'queue_wps', :label => 'Queue Status', :partial => 'blacklight/hierarchy/facet_hierarchy'
54
+ config.add_facet_field 'queue_wsp', :label => 'Queue Status', :partial => 'blacklight/hierarchy/facet_hierarchy'
55
+ config.add_facet_field 'queue_swp', :label => 'Queue Status', :partial => 'blacklight/hierarchy/facet_hierarchy'
56
+ config.add_facet_field 'callnum_top', :label => 'Callnumber', :partial => 'blacklight/hierarchy/facet_hierarchy'
57
+ config.add_facet_field 'foo_trunk', :label => 'Foo L1', :partial => 'blacklight/hierarchy/facet_hierarchy'
58
+ config.add_facet_field 'foo_branch', :label => 'Foo L2', :partial => 'blacklight/hierarchy/facet_hierarchy'
59
+ config.add_facet_field 'foo_leaves', :label => 'Foo L3', :partial => 'blacklight/hierarchy/facet_hierarchy'
60
+ config.add_facet_field 'tag_facet', :label => 'Tag', :partial => 'blacklight/hierarchy/facet_hierarchy'
61
+ ```
48
62
 
49
- Add the hierarchy-specific options to the controller configuration
63
+ Add your hierarchy-specific options to the controller configuration:
50
64
 
51
- config.facet_display = {
52
- :hierarchy => {
53
- 'queue_status' => [['facet'], ':']
54
- }
55
- }
65
+ ```ruby
66
+ config.facet_display = {
67
+ :hierarchy => {
68
+ 'queue' => [['wps','wsp','swp'], ':'], # values are arrays: 1st element is array, 2nd is delimiter string
69
+ 'callnum' => [['top'], '/'],
70
+ 'foo' => [['trunk', 'branch', 'leaves']], # implied default delimiter
71
+ 'tag' => [[nil]] # TODO: explain
72
+ }
73
+ }
74
+ ```
56
75
 
57
76
  In the above configuration, 'queue_status_facet' is the full Solr field name, and ':' is the delimiter within the field. Note that suffixes ('facet' in the above example) should not contain underscores, since the methods that deal with the Solr fields and match them to the config assume the "prefix" ('queue_status' in the above example) will be everything up to the last underscore in the field name. See the facet_tree method for further explanation and some relevant code, as well as the render_hierarchy method for relevant code.
58
77
 
78
+ The `[nil]` value is present in support of rotatable facet hierarchies, a totally undocumented feature.
79
+
80
+ Facet fields should be added for each permutation of hierarchy key and term values, joined by **_**. Or, the output of:
81
+
82
+ ```ruby
83
+ config.facet_display[:hierarchy].each{ |k,v| puts "#{k}_#{v}" }
84
+ ```
85
+
59
86
  ## Caveats
60
87
 
61
88
  This code was ripped out of another project, and is still quite immature as a standalone project. Every effort has been made to make it as plug-and-play as possible, but it may stomp on Blacklight in unintended ways (e.g., ways that made sense in context of its former host app, but which aren't compatible with generic Blacklight). Proceed with caution, and report issues.
@@ -64,4 +91,5 @@ This code was ripped out of another project, and is still quite immature as a st
64
91
 
65
92
  - WRITE TESTS
66
93
  - Switch internal facet management from hack-y Hash to `Blacklight::Hierarchy::FacetGroup` class (already implemented, but not plumbed up)
67
- - Add configuration support for hierarchy delimiters other than `/\s*:\s*/` (baked into `Blacklight::Hierarchy::FacetGroup`, but again, requiring additional plumbing)
94
+ - Add configuration support for hierarchy delimiters other than `/\s*:\s*/` (baked into `Blacklight::Hierarchy::FacetGroup`, but again, requiring additional plumbing)
95
+ - Clarify when suffix is applied/required/etc.
data/Rakefile CHANGED
@@ -7,23 +7,21 @@ rescue LoadError
7
7
  end
8
8
 
9
9
  require 'engine_cart/rake_task'
10
- TEST_APP_TEMPLATES = 'spec/test_app_templates'
11
- TEST_APP = 'spec/internal'
12
- #ZIP_URL = "https://github.com/projectblacklight/blacklight-jetty/archive/v4.0.0.zip"
13
- APP_ROOT = File.expand_path("..", __FILE__)
14
-
15
- task :default => :ci
10
+ TEST_APP_TEMPLATES = 'spec/test_app_templates'.freeze
11
+ TEST_APP = 'spec/internal'.freeze
12
+ # ZIP_URL = "https://github.com/projectblacklight/blacklight-jetty/archive/v4.0.0.zip"
13
+ APP_ROOT = File.expand_path('..', __FILE__)
16
14
 
15
+ task default: :ci
17
16
 
18
17
  require 'rspec/core/rake_task'
19
18
 
20
- desc "Run specs"
19
+ desc 'Run specs'
21
20
  RSpec::Core::RakeTask.new(:rspec)
22
- task :spec => :rspec
23
-
21
+ task spec: :rspec
24
22
 
25
- desc "Execute Continuous Integration Build"
26
- task :ci => ['engine_cart:clean', 'engine_cart:generate', 'rspec']
23
+ desc 'Execute Continuous Integration Build'
24
+ task ci: ['engine_cart:clean', 'engine_cart:generate', 'rspec']
27
25
 
28
26
  begin
29
27
  require 'rdoc/task'
@@ -33,7 +31,7 @@ rescue LoadError
33
31
  RDoc::Task = Rake::RDocTask
34
32
  end
35
33
 
36
- desc "Create rdoc"
34
+ desc 'Create rdoc'
37
35
  RDoc::Task.new(:rdoc) do |rdoc|
38
36
  rdoc.rdoc_dir = 'rdoc'
39
37
  rdoc.title = 'Blacklight::Hierarchy'
@@ -1,22 +1,20 @@
1
1
  module Blacklight::HierarchyHelper
2
-
3
2
  # Putting bare HTML strings in a helper sucks. But in this case, with a
4
3
  # lot of recursive tree-walking going on, it's an order of magnitude faster
5
4
  # than either render(:partial) or content_tag
6
5
  def render_facet_hierarchy_item(field_name, data, key)
7
6
  item = data[:_]
8
- subset = data.reject { |k,v| ! k.is_a?(String) }
7
+ subset = data.reject { |k, _v| !k.is_a?(String) }
9
8
 
10
9
  li_class = subset.empty? ? 'h-leaf' : 'h-node'
11
- li = ul = ''
12
-
13
- if item.nil?
14
- li = key
15
- elsif facet_in_params?(field_name, item.qvalue)
16
- li = render_selected_qfacet_value(field_name, item)
17
- else
18
- li = render_qfacet_value(field_name, item)
19
- end
10
+ ul = ''
11
+ li = if item.nil?
12
+ key
13
+ elsif facet_in_params?(field_name, item.qvalue)
14
+ render_selected_qfacet_value(field_name, item)
15
+ else
16
+ render_qfacet_value(field_name, item)
17
+ end
20
18
 
21
19
  unless subset.empty?
22
20
  subul = subset.keys.sort.collect do |subkey|
@@ -25,32 +23,35 @@ module Blacklight::HierarchyHelper
25
23
  ul = "<ul>#{subul}</ul>".html_safe
26
24
  end
27
25
 
28
- %{<li class="#{li_class}">#{li.html_safe}#{ul.html_safe}</li>}.html_safe
26
+ %(<li class="#{li_class}">#{li.html_safe}#{ul.html_safe}</li>).html_safe
29
27
  end
30
28
 
31
29
  # @param [Blacklight::Configuration::FacetField] as defined in controller with config.add_facet_field (and with :partial => 'blacklight/hierarchy/facet_hierarchy')
32
30
  # @return [String] html for the facet tree
33
- def render_hierarchy(bl_facet_field, delim='_')
31
+ def render_hierarchy(bl_facet_field, delim = '_')
34
32
  field_name = bl_facet_field.field
35
33
  prefix = field_name.gsub("#{delim}#{field_name.split(/#{delim}/).last}", '')
36
-
37
34
  facet_tree_for_prefix = facet_tree(prefix)
38
35
  tree = facet_tree_for_prefix ? facet_tree_for_prefix[field_name] : nil
39
- return '' unless tree
40
36
 
37
+ return '' unless tree
41
38
  tree.keys.sort.collect do |key|
42
39
  render_facet_hierarchy_item(field_name, tree[key], key)
43
40
  end.join("\n").html_safe
44
41
  end
45
42
 
46
- def render_qfacet_value(facet_solr_field, item, options ={})
47
- (link_to_unless(options[:suppress_link], item.value, search_state.add_facet_params(facet_solr_field, item.qvalue), :class=>"facet_select") + " " + render_facet_count(item.hits)).html_safe
43
+ def render_qfacet_value(facet_solr_field, item, options = {})
44
+ (link_to_unless(options[:suppress_link], item.value, search_state.add_facet_params(facet_solr_field, item.qvalue), class: 'facet_select') + ' ' + render_facet_count(item.hits)).html_safe
48
45
  end
49
46
 
50
47
  # Standard display of a SELECTED facet value, no link, special span with class, and 'remove' button.
51
48
  def render_selected_qfacet_value(facet_solr_field, item)
52
- content_tag(:span, render_qfacet_value(facet_solr_field, item, :suppress_link => true), :class => "selected") + " " +
53
- link_to(content_tag(:span, '', :class => "glyphicon glyphicon-remove") + content_tag(:span, '[remove]', :class => 'sr-only'), remove_facet_params(facet_solr_field, item.qvalue, params), :class=>"remove")
49
+ content_tag(:span, render_qfacet_value(facet_solr_field, item, suppress_link: true), class: 'selected') + ' ' +
50
+ link_to(content_tag(:span, '', class: 'glyphicon glyphicon-remove') +
51
+ content_tag(:span, '[remove]', class: 'sr-only'),
52
+ remove_facet_params(facet_solr_field, item.qvalue, params),
53
+ class: 'remove'
54
+ )
54
55
  end
55
56
 
56
57
  HierarchicalFacetItem = Struct.new :qvalue, :value, :hits
@@ -68,11 +69,11 @@ module Blacklight::HierarchyHelper
68
69
  #
69
70
  # the key in the :hierarchy hash is the "prefix" for the solr field with the hierarchy info. the value
70
71
  # in the hash is a list, where the first element is a list of suffixes, and the second element is the delimiter
71
- # used to break up the sections of hierarchical data in the solr field being read. when joined, the prefix and
72
+ # used to break up the sections of hierarchical data in the solr field being read. when joined, the prefix and
72
73
  # suffix should form the field name. so, for example, 'wf_wps', 'wf_wsp', 'wf_swp', 'callnum_top_facet', and
73
- # 'exploded_tag_ssim' would be the solr fields with blacklight-hierarchy related configuration according to the
74
- # hash above. ':' would be the delimiter used in all of those fields except for 'callnum_top_facet', which would
75
- # use '/'. exploded_tag_ssim might contain values like ['Book', 'Book : Multi-Volume Work'], and callnum_top_facet
74
+ # 'exploded_tag_ssim' would be the solr fields with blacklight-hierarchy related configuration according to the
75
+ # hash above. ':' would be the delimiter used in all of those fields except for 'callnum_top_facet', which would
76
+ # use '/'. exploded_tag_ssim might contain values like ['Book', 'Book : Multi-Volume Work'], and callnum_top_facet
76
77
  # might contain values like ['LB', 'LB/2395', 'LB/2395/.C65', 'LB/2395/.C65/1991'].
77
78
  # note: the suffixes (e.g. 'ssim' for 'exploded_tag' in the above example) can't have underscores, otherwise things break.
78
79
  def facet_tree(hkey)
@@ -80,35 +81,32 @@ module Blacklight::HierarchyHelper
80
81
  return @facet_tree[hkey] unless @facet_tree[hkey].nil?
81
82
  return @facet_tree[hkey] unless blacklight_config.facet_display[:hierarchy] && blacklight_config.facet_display[:hierarchy][hkey]
82
83
  @facet_tree[hkey] = {}
83
- facet_config= blacklight_config.facet_display[:hierarchy][hkey]
84
+ facet_config = blacklight_config.facet_display[:hierarchy][hkey]
84
85
  split_regex = Regexp.new("\s*#{Regexp.escape(facet_config.length >= 2 ? facet_config[1] : ':')}\s*")
85
- facet_config.first.each { |key|
86
+ facet_config.first.each do |key|
86
87
  # TODO: remove baked in notion of underscores being part of the blacklight facet field names
87
- facet_field = [hkey,key].compact.join('_')
88
+ facet_field = [hkey, key].compact.join('_')
88
89
  @facet_tree[hkey][facet_field] ||= {}
89
90
  data = @response.aggregations[facet_field]
90
91
  next if data.nil?
91
-
92
- data.items.each { |facet_item|
92
+ data.items.each do |facet_item|
93
93
  path = facet_item.value.split(split_regex)
94
94
  loc = @facet_tree[hkey][facet_field]
95
- while path.length > 0
96
- loc = loc[path.shift] ||= {}
97
- end
95
+ loc = loc[path.shift] ||= {} while path.length > 0
98
96
  loc[:_] = HierarchicalFacetItem.new(facet_item.value, facet_item.value.split(split_regex).last, facet_item.hits)
99
- }
100
- }
97
+ end
98
+ end
101
99
  @facet_tree[hkey]
102
100
  end
103
101
 
104
- # --------------------------------------------------------------------------------------------------------------------------------
105
- # below are methods pertaining to the "rotate" notion where you may want to look at the same tree data organized another way
106
- # --------------------------------------------------------------------------------------------------------------------------------
102
+ # --------------------------------------------------------------------------------------------------------------------------------
103
+ # below are methods pertaining to the "rotate" notion where you may want to look at the same tree data organized another way
104
+ # --------------------------------------------------------------------------------------------------------------------------------
107
105
 
108
- # FIXME: remove baked in underscore separator in field name
106
+ # FIXME: remove baked in underscore separator in field name
109
107
  def is_hierarchical?(field_name)
110
- (prefix,order) = field_name.split(/_/, 2)
111
- list = blacklight_config.facet_display[:hierarchy][prefix] and list.include?(order)
108
+ (prefix, order) = field_name.split(/_/, 2)
109
+ (list = blacklight_config.facet_display[:hierarchy][prefix]) && list.include?(order)
112
110
  end
113
111
 
114
112
  def facet_order(prefix)
@@ -118,35 +116,27 @@ module Blacklight::HierarchyHelper
118
116
 
119
117
  def facet_after(prefix, order)
120
118
  orders = blacklight_config.facet_display[:hierarchy][prefix]
121
- orders[orders.index(order)+1] || orders.first
119
+ orders[orders.index(order) + 1] || orders.first
122
120
  end
123
121
 
124
- # FIXME: remove baked in underscore separator in field name
122
+ # FIXME: remove baked in underscore separator in field name
125
123
  def hide_facet?(field_name)
126
- if is_hierarchical?(field_name)
127
- prefix = field_name.split(/_/).first
128
- field_name != "#{prefix}_#{facet_order(prefix)}"
129
- else
130
- false
131
- end
124
+ return false unless is_hierarchical?(field_name)
125
+ prefix = field_name.split(/_/).first
126
+ field_name != "#{prefix}_#{facet_order(prefix)}"
132
127
  end
133
128
 
134
- # FIXME: remove baked in colon separator
129
+ # FIXME: remove baked in colon separator
135
130
  def rotate_facet_value(val, from, to)
136
131
  components = Hash[from.split(//).zip(val.split(/:/))]
137
- new_values = components.values_at(*(to.split(//)))
138
- while new_values.last.nil?
139
- new_values.pop
140
- end
141
- if new_values.include?(nil)
142
- nil
143
- else
144
- new_values.compact.join(':')
145
- end
132
+ new_values = components.values_at(*to.split(//))
133
+ new_values.pop while new_values.last.nil?
134
+ return nil if new_values.include?(nil)
135
+ new_values.compact.join(':')
146
136
  end
147
137
 
148
- # FIXME: remove baked in underscore separator in field name
149
- def rotate_facet_params(prefix, from, to, p=params.dup)
138
+ # FIXME: remove baked in underscore separator in field name
139
+ def rotate_facet_params(prefix, from, to, p = params.dup)
150
140
  return p if from == to
151
141
  from_field = "#{prefix}_#{from}"
152
142
  to_field = "#{prefix}_#{to}"
@@ -160,18 +150,14 @@ module Blacklight::HierarchyHelper
160
150
  p
161
151
  end
162
152
 
163
- # FIXME: remove baked in underscore separator in field name
153
+ # FIXME: remove baked in underscore separator in field name
164
154
  def render_facet_rotate(field_name)
165
- if is_hierarchical?(field_name)
166
- (prefix,order) = field_name.split(/_/, 2)
167
-
168
- return if blacklight_config.facet_display[:hierarchy][prefix].length < 2
169
-
170
- new_order = facet_after(prefix,order)
171
- new_params = rotate_facet_params(prefix,order,new_order)
172
- new_params["#{prefix}_facet_order"] = new_order
173
- link_to image_tag('icons/rotate.png', :title => new_order.upcase).html_safe, new_params, :class => 'no-underline'
174
- end
155
+ return unless is_hierarchical?(field_name)
156
+ (prefix, order) = field_name.split(/_/, 2)
157
+ return if blacklight_config.facet_display[:hierarchy][prefix].length < 2
158
+ new_order = facet_after(prefix, order)
159
+ new_params = rotate_facet_params(prefix, order, new_order)
160
+ new_params["#{prefix}_facet_order"] = new_order
161
+ link_to image_tag('icons/rotate.png', title: new_order.upcase).html_safe, new_params, class: 'no-underline'
175
162
  end
176
-
177
163
  end
@@ -3,29 +3,29 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'blacklight/hierarchy/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.name = "blacklight-hierarchy"
6
+ s.name = 'blacklight-hierarchy'
7
7
  s.version = Blacklight::Hierarchy::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["Michael B. Klein"]
10
- s.email = ["dlss-dev@lists.stanford.edu"]
11
- s.homepage = "https://github.com/sul-dlss/blacklight-hierarchy"
12
- s.summary = "Hierarchical Facets for Blacklight"
13
- s.description = "Allows delimited Solr facets to become hierarchical trees in Blacklight."
9
+ s.authors = ['Michael B. Klein']
10
+ s.email = ['dlss-dev@lists.stanford.edu']
11
+ s.homepage = 'https://github.com/sul-dlss/blacklight-hierarchy'
12
+ s.summary = 'Hierarchical Facets for Blacklight'
13
+ s.description = 'Allows delimited Solr facets to become hierarchical trees in Blacklight.'
14
14
 
15
15
  s.files = `git ls-files -z`.split("\x0")
16
16
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
17
17
  s.bindir = 'exe'
18
18
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
- s.require_paths = ["lib"]
19
+ s.require_paths = ['lib']
20
20
 
21
- s.add_dependency "rails", '~> 4.1'
22
- s.add_dependency "jquery-rails"
23
- s.add_dependency "blacklight", ">= 6.0.0.pre3", "< 7"
24
-
25
- s.add_development_dependency "rsolr"
26
- s.add_development_dependency "rspec-rails"
27
- s.add_development_dependency "sqlite3"
28
- s.add_development_dependency "engine_cart", '~> 0.8'
29
- s.add_development_dependency "capybara"
30
- s.add_development_dependency "coveralls"
21
+ s.add_dependency 'rails', '~> 4.1'
22
+ s.add_dependency 'jquery-rails'
23
+ s.add_dependency 'blacklight', '~> 6.0'
24
+
25
+ s.add_development_dependency 'rsolr'
26
+ s.add_development_dependency 'rspec-rails'
27
+ s.add_development_dependency 'sqlite3'
28
+ s.add_development_dependency 'engine_cart', '~> 1.0'
29
+ s.add_development_dependency 'capybara'
30
+ s.add_development_dependency 'coveralls'
31
31
  end
@@ -1 +1 @@
1
- require 'blacklight/hierarchy'
1
+ require 'blacklight/hierarchy'
@@ -2,21 +2,21 @@ module Blacklight
2
2
  module Hierarchy
3
3
  class FacetItem
4
4
  attr_reader :qname, :hits
5
-
5
+
6
6
  def initialize(qname, hits, facet)
7
7
  @qname = qname
8
8
  @hits = hits
9
9
  @facet = facet
10
10
  end
11
-
11
+
12
12
  def [](value)
13
- @facet.facets([qname,value].select(&:present?).join(@facet.delimiter))
13
+ @facet.facets([qname, value].select(&:present?).join(@facet.delimiter))
14
14
  end
15
15
 
16
16
  def each_pair
17
17
  keys.each { |k| yield k, self[k] }
18
18
  end
19
-
19
+
20
20
  def keys
21
21
  @facet.keys(qname)
22
22
  end
@@ -24,11 +24,11 @@ module Blacklight
24
24
  def path
25
25
  @qname.split(@facet.delimiter)[0..-2]
26
26
  end
27
-
27
+
28
28
  def name
29
29
  @qname.split(@facet.delimiter).last
30
30
  end
31
-
31
+
32
32
  def inspect
33
33
  "#<#{self.class.name}:#{name}=>#{hits.inspect} (#{keys.join ', '})>"
34
34
  end
@@ -37,36 +37,36 @@ module Blacklight
37
37
  class FacetGroup
38
38
  attr_reader :facet_data, :qname, :hits, :delimiter
39
39
  include Enumerable
40
-
41
- def initialize(facet_data, delimiter=":")
40
+
41
+ def initialize(facet_data, delimiter = ':')
42
42
  @facet_data = Hash[*facet_data]
43
43
  @delimiter = delimiter
44
44
  end
45
-
46
- def each &block
45
+
46
+ def each(&block)
47
47
  facets.each &block
48
48
  end
49
-
49
+
50
50
  def each_pair
51
51
  facets.each { |f| yield f.name, f }
52
52
  end
53
-
54
- def keys(prefix=nil)
53
+
54
+ def keys(prefix = nil)
55
55
  if prefix.nil?
56
- facet_data.collect { |k,v| k.split(delimiter).first }.uniq
56
+ facet_data.collect { |k, _v| k.split(delimiter).first }.uniq
57
57
  else
58
58
  path = prefix.to_s.split(delimiter)
59
- facet_data.collect do |k,v|
59
+ facet_data.collect do |k, _v|
60
60
  facet_path = k.split(delimiter)
61
- facet_path[0..path.length-1] == path ? facet_path[path.length] : nil
61
+ facet_path[0..path.length - 1] == path ? facet_path[path.length] : nil
62
62
  end.compact.uniq
63
63
  end
64
64
  end
65
-
66
- def facets(prefix=nil)
67
- FacetItem.new(prefix.to_s,facet_data[prefix],self)
65
+
66
+ def facets(prefix = nil)
67
+ FacetItem.new(prefix.to_s, facet_data[prefix], self)
68
68
  end
69
-
69
+
70
70
  def [](value)
71
71
  facets(value)
72
72
  end
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Hierarchy
3
- VERSION = "0.2.0"
3
+ VERSION = '1.0.0'.freeze
4
4
  end
5
5
  end
@@ -5,8 +5,8 @@ module BlacklightHierarchy
5
5
  source_root File.expand_path('../templates', __FILE__)
6
6
 
7
7
  def assets
8
- copy_file "blacklight_hierarchy.css.scss", "app/assets/stylesheets/blacklight_hierarchy.css.scss"
9
- copy_file "blacklight_hierarchy.js", "app/assets/javascripts/blacklight_hierarchy.js"
8
+ copy_file 'blacklight_hierarchy.scss', 'app/assets/stylesheets/blacklight_hierarchy.scss'
9
+ copy_file 'blacklight_hierarchy.js', 'app/assets/javascripts/blacklight_hierarchy.js'
10
10
  end
11
11
  end
12
- end
12
+ end
@@ -1,113 +1,111 @@
1
1
  require 'spec_helper'
2
2
 
3
- shared_examples "catalog" do
4
-
5
- context "facet tree without repeated nodes" do
6
- before {
7
- solr_facet_resp = {'responseHeader'=>{'status'=>0, 'QTime'=>4, 'params'=>{'wt'=>'ruby','rows'=>'0'}},
8
- 'response'=>{'numFound'=>30, 'start'=>0, 'maxScore'=>1.0, 'docs' => []},
9
- 'facet_counts' => {
10
- 'facet_queries' => {},
11
- 'facet_fields' => {
12
- 'tag_facet' => [
13
- 'a:b:c', 30,
14
- 'a:b:d', 25,
15
- 'a:c:d', 5,
16
- 'p:r:q', 25,
17
- 'x:y', 5,
18
- 'n', 1 ],
19
- 'my_top_facet' => [
20
- 'f/g/h', 30,
21
- 'j/k', 5,
22
- 'z', 1 ],
23
- },
24
- 'facet_dates' => {},
25
- 'facet_ranges' => {}
26
- }
3
+ shared_examples 'catalog' do
4
+ context 'facet tree without repeated nodes' do
5
+ before do
6
+ solr_facet_resp = { 'responseHeader' => { 'status' => 0, 'QTime' => 4, 'params' => { 'wt' => 'ruby', 'rows' => '0' } },
7
+ 'response' => { 'numFound' => 30, 'start' => 0, 'maxScore' => 1.0, 'docs' => [] },
8
+ 'facet_counts' => {
9
+ 'facet_queries' => {},
10
+ 'facet_fields' => {
11
+ 'tag_facet' => [
12
+ 'a:b:c', 30,
13
+ 'a:b:d', 25,
14
+ 'a:c:d', 5,
15
+ 'p:r:q', 25,
16
+ 'x:y', 5,
17
+ 'n', 1],
18
+ 'my_top_facet' => [
19
+ 'f/g/h', 30,
20
+ 'j/k', 5,
21
+ 'z', 1]
22
+ },
23
+ 'facet_dates' => {},
24
+ 'facet_ranges' => {}
25
+ }
27
26
  }
28
- rsolr_client = double("rsolr_client")
27
+ rsolr_client = double('rsolr_client')
29
28
  expect(rsolr_client).to receive(:send_and_receive).and_return solr_facet_resp
30
29
  expect(RSolr).to receive(:connect).and_return rsolr_client
31
- }
30
+ end
32
31
 
33
- it "should display the hierarchy" do
32
+ it 'should display the hierarchy' do
34
33
  visit '/'
35
- expect(page).to have_selector('li.h-node', :text => 'a')
36
- expect(page).to have_selector('li.h-node > ul > li.h-node', :text => 'b')
37
- expect(page).to have_selector('li.h-node li.h-leaf', :text => 'c 30')
38
- expect(page).to have_selector('li.h-node li.h-leaf', :text => 'd 25')
39
- expect(page).to have_selector('li.h-node > ul > li.h-node', :text => 'c')
40
- expect(page).to have_selector('li.h-node li.h-leaf', :text => 'd 5')
41
- expect(page).to have_selector('li.h-node', :text => 'p')
42
- expect(page).to have_selector('li.h-node > ul > li.h-node', :text => 'r')
43
- expect(page).to have_selector('li.h-node li.h-leaf', :text => 'q 25')
44
- expect(page).to have_selector('li.h-node', :text => 'x')
45
- expect(page).to have_selector('li.h-node li.h-leaf', :text => 'y 5')
46
- expect(page).to have_selector('.facet-hierarchy > li.h-leaf', :text => 'n 1')
34
+ expect(page).to have_selector('li.h-node', text: 'a')
35
+ expect(page).to have_selector('li.h-node > ul > li.h-node', text: 'b')
36
+ expect(page).to have_selector('li.h-node li.h-leaf', text: 'c 30')
37
+ expect(page).to have_selector('li.h-node li.h-leaf', text: 'd 25')
38
+ expect(page).to have_selector('li.h-node > ul > li.h-node', text: 'c')
39
+ expect(page).to have_selector('li.h-node li.h-leaf', text: 'd 5')
40
+ expect(page).to have_selector('li.h-node', text: 'p')
41
+ expect(page).to have_selector('li.h-node > ul > li.h-node', text: 'r')
42
+ expect(page).to have_selector('li.h-node li.h-leaf', text: 'q 25')
43
+ expect(page).to have_selector('li.h-node', text: 'x')
44
+ expect(page).to have_selector('li.h-node li.h-leaf', text: 'y 5')
45
+ expect(page).to have_selector('.facet-hierarchy > li.h-leaf', text: 'n 1')
47
46
  end
48
47
 
49
- it "should properly link the hierarchy" do
48
+ it 'should properly link the hierarchy' do
50
49
  visit '/'
51
50
  expect(page.all(:css, 'li.h-leaf a').map { |a| a[:href].to_s }).to include(root_path('f' => { 'tag_facet' => ['n'] }))
52
51
  expect(page.all(:css, 'li.h-leaf a').map { |a| a[:href].to_s }).to include(root_path('f' => { 'tag_facet' => ['a:b:c'] }))
53
52
  expect(page.all(:css, 'li.h-leaf a').map { |a| a[:href].to_s }).to include(root_path('f' => { 'tag_facet' => ['x:y'] }))
54
53
  end
55
54
 
56
- it "should work with a different value delimiter" do
55
+ it 'should work with a different value delimiter' do
57
56
  visit '/'
58
- expect(page).to have_selector('li.h-node', :text => 'f')
59
- expect(page).to have_selector('li.h-node > ul > li.h-node', :text => 'g')
60
- expect(page).to have_selector('li.h-node li.h-leaf', :text => 'h 30')
61
- expect(page).to have_selector('li.h-node', :text => 'j')
62
- expect(page).to have_selector('li.h-node li.h-leaf', :text => 'k 5')
63
- expect(page).to have_selector('.facet-hierarchy > li.h-leaf', :text => 'z 1')
57
+ expect(page).to have_selector('li.h-node', text: 'f')
58
+ expect(page).to have_selector('li.h-node > ul > li.h-node', text: 'g')
59
+ expect(page).to have_selector('li.h-node li.h-leaf', text: 'h 30')
60
+ expect(page).to have_selector('li.h-node', text: 'j')
61
+ expect(page).to have_selector('li.h-node li.h-leaf', text: 'k 5')
62
+ expect(page).to have_selector('.facet-hierarchy > li.h-leaf', text: 'z 1')
64
63
  end
65
64
  end # facet tree without repeated nodes
66
65
 
67
- context "facet tree with repeated nodes" do
66
+ context 'facet tree with repeated nodes' do
68
67
  before do
69
- facet_resp = {'responseHeader'=>{'status'=>0, 'QTime'=>4, 'params'=>{'wt'=>'ruby','rows'=>'0'}},
70
- 'response'=>{'numFound'=>30, 'start'=>0, 'maxScore'=>1.0, 'docs' => []},
71
- 'facet_counts' => {
72
- 'facet_queries' => {},
73
- 'facet_fields' => {
74
- 'tag_facet' => [
75
- 'm:w:w:t', 15,
76
- 'm:w:v:z', 10],
77
- },
78
- 'facet_dates' => {},
79
- 'facet_ranges' => {}
80
- }
68
+ facet_resp = { 'responseHeader' => { 'status' => 0, 'QTime' => 4, 'params' => { 'wt' => 'ruby', 'rows' => '0' } },
69
+ 'response' => { 'numFound' => 30, 'start' => 0, 'maxScore' => 1.0, 'docs' => [] },
70
+ 'facet_counts' => {
71
+ 'facet_queries' => {},
72
+ 'facet_fields' => {
73
+ 'tag_facet' => [
74
+ 'm:w:w:t', 15,
75
+ 'm:w:v:z', 10]
76
+ },
77
+ 'facet_dates' => {},
78
+ 'facet_ranges' => {}
79
+ }
81
80
  }
82
- my_rsolr_client = double("rsolr_client")
81
+ my_rsolr_client = double('rsolr_client')
83
82
  expect(my_rsolr_client).to receive(:send_and_receive).and_return facet_resp
84
83
  expect(RSolr).to receive(:connect).and_return my_rsolr_client
85
84
  end
86
- it "should display all child nodes when a node value is repeated at its child level" do
85
+ it 'should display all child nodes when a node value is repeated at its child level' do
87
86
  visit '/'
88
- expect(page).to have_selector('li.h-node', :text => 'm')
89
- expect(page).to have_selector('li.h-node > ul > li.h-node', :text => 'w')
90
- expect(page).to have_selector('li.h-node > ul > li.h-node > ul > li.h-node', :text => 'w')
91
- expect(page).to have_selector('li.h-node > ul > li.h-node > ul > li.h-node', :text => 'v')
92
- expect(page).to have_selector('li.h-node li.h-leaf', :text => 't 15')
93
- expect(page).to have_selector('li.h-node li.h-leaf', :text => 'z 10')
87
+ expect(page).to have_selector('li.h-node', text: 'm')
88
+ expect(page).to have_selector('li.h-node > ul > li.h-node', text: 'w')
89
+ expect(page).to have_selector('li.h-node > ul > li.h-node > ul > li.h-node', text: 'w')
90
+ expect(page).to have_selector('li.h-node > ul > li.h-node > ul > li.h-node', text: 'v')
91
+ expect(page).to have_selector('li.h-node li.h-leaf', text: 't 15')
92
+ expect(page).to have_selector('li.h-node li.h-leaf', text: 'z 10')
94
93
  end
95
94
  end
96
-
97
95
  end
98
96
 
99
- describe "config_1" do
100
- it_behaves_like "catalog" do
97
+ describe 'config_1' do
98
+ it_behaves_like 'catalog' do
101
99
  before do
102
100
  CatalogController.blacklight_config = Blacklight::Configuration.new
103
101
  CatalogController.configure_blacklight do |config|
104
- # config.add_facet_field 'rotate_tag_facet', :label => 'Tag', :partial => 'blacklight/hierarchy/facet_hierarchy'
105
- config.add_facet_field 'tag_facet', :label => 'Tag', :partial => 'blacklight/hierarchy/facet_hierarchy'
106
- config.add_facet_field 'my_top_facet', :label => 'Slash Delim', :partial => 'blacklight/hierarchy/facet_hierarchy'
102
+ # config.add_facet_field 'rotate_tag_facet', :label => 'Tag', :partial => 'blacklight/hierarchy/facet_hierarchy'
103
+ config.add_facet_field 'tag_facet', label: 'Tag', partial: 'blacklight/hierarchy/facet_hierarchy'
104
+ config.add_facet_field 'my_top_facet', label: 'Slash Delim', partial: 'blacklight/hierarchy/facet_hierarchy'
107
105
  config.facet_display = {
108
- :hierarchy => {
109
- # 'rotate' => [['tag' ], ':'], # this would work if config.add_facet_field was called rotate_tag_facet, instead of tag_facet, I think.
110
- 'tag' => [['facet'], ':'], # stupidly, the facet field is expected to have an underscore followed by SOMETHING; in this case it is "facet"
106
+ hierarchy: {
107
+ # 'rotate' => [['tag' ], ':'], # this would work if config.add_facet_field was called rotate_tag_facet, instead of tag_facet, I think.
108
+ 'tag' => [['facet'], ':'], # stupidly, the facet field is expected to have an underscore followed by SOMETHING; in this case it is "facet"
111
109
  'my_top' => [['facet'], '/']
112
110
  }
113
111
  }
@@ -116,16 +114,16 @@ describe "config_1" do
116
114
  end
117
115
  end
118
116
 
119
- describe "config_2" do
120
- it_behaves_like "catalog" do
117
+ describe 'config_2' do
118
+ it_behaves_like 'catalog' do
121
119
  before do
122
120
  CatalogController.blacklight_config = Blacklight::Configuration.new
123
121
  CatalogController.configure_blacklight do |config|
124
- config.add_facet_field 'tag_facet', :label => 'Tag', :partial => 'blacklight/hierarchy/facet_hierarchy'
125
- config.add_facet_field 'my_top_facet', :label => 'Slash Delim', :partial => 'blacklight/hierarchy/facet_hierarchy'
122
+ config.add_facet_field 'tag_facet', label: 'Tag', partial: 'blacklight/hierarchy/facet_hierarchy'
123
+ config.add_facet_field 'my_top_facet', label: 'Slash Delim', partial: 'blacklight/hierarchy/facet_hierarchy'
126
124
  config.facet_display = {
127
- :hierarchy => {
128
- 'tag' => [['facet']], # rely on default delim
125
+ hierarchy: {
126
+ 'tag' => [['facet']], # rely on default delim
129
127
  'my_top' => [['facet'], '/']
130
128
  }
131
129
  }
@@ -1,10 +1,10 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Blacklight::HierarchyHelper do
4
4
  describe '#render_hierarchy' do
5
5
  it 'should remove the _suffix from the field name' do
6
- field = OpenStruct.new(field: "the_field_name_facet")
7
- expect(helper).to receive(:facet_tree).with("the_field_name").and_return({})
6
+ field = OpenStruct.new(field: 'the_field_name_facet')
7
+ expect(helper).to receive(:facet_tree).with('the_field_name').and_return({})
8
8
  helper.render_hierarchy(field)
9
9
  end
10
10
  end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- ENV["RAILS_ENV"] ||= "test"
1
+ ENV['RAILS_ENV'] ||= 'test'
2
2
 
3
3
  require 'rsolr'
4
4
 
@@ -4,17 +4,12 @@ class TestAppGenerator < Rails::Generators::Base
4
4
  def add_gems
5
5
  gem 'blacklight'
6
6
  Bundler.with_clean_env do
7
- run "bundle install"
7
+ run 'bundle install'
8
8
  end
9
9
  end
10
10
 
11
- # This is only necessary for Rails 3
12
- def remove_index
13
- remove_file "public/index.html"
14
- end
15
-
16
11
  def run_blacklight_generator
17
- say_status("warning", "GENERATING BL", :yellow)
12
+ say_status('warning', 'GENERATING BL', :yellow)
18
13
 
19
14
  generate 'blacklight:install'
20
15
  end
@@ -22,5 +17,4 @@ class TestAppGenerator < Rails::Generators::Base
22
17
  def run_hierarchy_install
23
18
  generate 'blacklight_hierarchy:install'
24
19
  end
25
-
26
- end
20
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-hierarchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael B. Klein
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-29 00:00:00.000000000 Z
11
+ date: 2016-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -42,22 +42,16 @@ dependencies:
42
42
  name: blacklight
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: 6.0.0.pre3
48
- - - "<"
45
+ - - "~>"
49
46
  - !ruby/object:Gem::Version
50
- version: '7'
47
+ version: '6.0'
51
48
  type: :runtime
52
49
  prerelease: false
53
50
  version_requirements: !ruby/object:Gem::Requirement
54
51
  requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: 6.0.0.pre3
58
- - - "<"
52
+ - - "~>"
59
53
  - !ruby/object:Gem::Version
60
- version: '7'
54
+ version: '6.0'
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: rsolr
63
57
  requirement: !ruby/object:Gem::Requirement
@@ -106,14 +100,14 @@ dependencies:
106
100
  requirements:
107
101
  - - "~>"
108
102
  - !ruby/object:Gem::Version
109
- version: '0.8'
103
+ version: '1.0'
110
104
  type: :development
111
105
  prerelease: false
112
106
  version_requirements: !ruby/object:Gem::Requirement
113
107
  requirements:
114
108
  - - "~>"
115
109
  - !ruby/object:Gem::Version
116
- version: '0.8'
110
+ version: '1.0'
117
111
  - !ruby/object:Gem::Dependency
118
112
  name: capybara
119
113
  requirement: !ruby/object:Gem::Requirement
@@ -152,6 +146,8 @@ files:
152
146
  - ".coveralls.yml"
153
147
  - ".gitignore"
154
148
  - ".rspec"
149
+ - ".rubocop.yml"
150
+ - ".rubocop_todo.yml"
155
151
  - ".travis.yml"
156
152
  - Gemfile
157
153
  - LICENSE
@@ -163,7 +159,7 @@ files:
163
159
  - app/assets/images/minus_arrow.png
164
160
  - app/assets/images/plus_arrow.png
165
161
  - app/assets/javascripts/blacklight/hierarchy/hierarchy.js
166
- - app/assets/stylesheets/blacklight/hierarchy/hierarchy.css.scss
162
+ - app/assets/stylesheets/blacklight/hierarchy/hierarchy.scss
167
163
  - app/helpers/blacklight/hierarchy_helper.rb
168
164
  - app/views/blacklight/hierarchy/_facet_hierarchy.html.erb
169
165
  - app/views/blacklight/hierarchy/_facet_hierarchy_item.html.erb
@@ -174,8 +170,8 @@ files:
174
170
  - lib/blacklight/hierarchy/hierarchical_facet.rb
175
171
  - lib/blacklight/hierarchy/version.rb
176
172
  - lib/generators/blacklight_hierarchy/install_generator.rb
177
- - lib/generators/blacklight_hierarchy/templates/blacklight_hierarchy.css.scss
178
173
  - lib/generators/blacklight_hierarchy/templates/blacklight_hierarchy.js
174
+ - lib/generators/blacklight_hierarchy/templates/blacklight_hierarchy.scss
179
175
  - spec/features/basic_spec.rb
180
176
  - spec/helpers/hierarchy_helper_spec.rb
181
177
  - spec/spec_helper.rb
@@ -199,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
195
  version: '0'
200
196
  requirements: []
201
197
  rubyforge_project:
202
- rubygems_version: 2.4.5.1
198
+ rubygems_version: 2.6.7
203
199
  signing_key:
204
200
  specification_version: 4
205
201
  summary: Hierarchical Facets for Blacklight