speedy-af 0.1.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9543a6894a435f975c44ed9bd36e06c94210221a
4
+ data.tar.gz: fc8a10a2b7ddb4dbcc0ac34ae5b3b6dbfa363814
5
+ SHA512:
6
+ metadata.gz: c109886552ed1cee26065b2a81edb34f844877a153591045cbaadc2d2ff11e7b8d366959667062d3a717248a0e82b518c64c611ea0a5f4c02f767a1ebf4b7106
7
+ data.tar.gz: 41b7a88ff6a723b158864541af9d645c7eff332112a789404f20e857acc25e77dc447990aa4d6a1a389cc6b4f4d1f2932caf99355c5998ee59ba44d286bfcc1f
@@ -0,0 +1,4 @@
1
+ coverage
2
+ fcrepo4-test-data
3
+ Gemfile.lock
4
+ config
@@ -0,0 +1,178 @@
1
+ require: rubocop-rspec
2
+
3
+ inherit_from:
4
+ - .rubocop_todo.yml
5
+
6
+ AllCops:
7
+ TargetRubyVersion: 2.2
8
+ DisplayCopNames: true
9
+ Include:
10
+ - '**/Rakefile'
11
+ Exclude:
12
+ - 'script/**/*'
13
+ - 'vendor/**/*'
14
+
15
+ Lint/HandleExceptions:
16
+ Exclude:
17
+ - 'spec/unit/**/*'
18
+
19
+ Lint/AssignmentInCondition:
20
+ Enabled: false
21
+
22
+ Metrics/LineLength:
23
+ Enabled: false
24
+
25
+ Metrics/AbcSize:
26
+ Enabled: false
27
+
28
+ Metrics/BlockNesting:
29
+ Exclude:
30
+
31
+ Metrics/CyclomaticComplexity:
32
+ Max: 7
33
+ Severity: warning
34
+ Exclude:
35
+
36
+ Metrics/PerceivedComplexity:
37
+ Exclude:
38
+
39
+ Metrics/ModuleLength:
40
+ Exclude:
41
+
42
+ Metrics/ClassLength:
43
+ Enabled: false
44
+
45
+ Metrics/MethodLength:
46
+ Enabled: false
47
+
48
+ Style/MethodName:
49
+ Exclude:
50
+
51
+ Style/AndOr:
52
+ Exclude:
53
+
54
+ Style/AccessorMethodName:
55
+ Exclude:
56
+
57
+ Style/PredicateName:
58
+ Exclude:
59
+
60
+ Style/GuardClause:
61
+ Exclude:
62
+
63
+ Style/TrivialAccessors:
64
+ Exclude:
65
+
66
+ Style/EachWithObject:
67
+ Exclude:
68
+
69
+ Style/CaseEquality:
70
+ Exclude:
71
+
72
+ Style/BlockDelimiters:
73
+ Exclude:
74
+ - 'spec/**/*'
75
+
76
+ Style/BlockEndNewline:
77
+ Exclude:
78
+ - 'spec/**/*'
79
+
80
+ Style/MultilineBlockLayout:
81
+ Exclude:
82
+ - 'spec/**/*'
83
+
84
+ Style/Semicolon:
85
+ Exclude:
86
+ - 'spec/**/*'
87
+
88
+ Style/Lambda:
89
+ Exclude:
90
+ - 'spec/**/*'
91
+
92
+ Style/IndentationConsistency:
93
+ EnforcedStyle: rails
94
+
95
+ Style/CollectionMethods:
96
+ PreferredMethods:
97
+ collect: 'map'
98
+ collect!: 'map!'
99
+ inject: 'reduce'
100
+ detect: 'find'
101
+ find_all: 'select'
102
+
103
+ Style/WordArray:
104
+ Enabled: false
105
+
106
+ Style/RegexpLiteral:
107
+ Enabled: false
108
+
109
+ Style/StringLiterals:
110
+ Enabled: false
111
+
112
+ Style/ClassAndModuleChildren:
113
+ Enabled: false
114
+
115
+ Style/Documentation:
116
+ Enabled: false
117
+
118
+ Style/GlobalVars:
119
+ Exclude:
120
+ - 'spec/**/*'
121
+
122
+ Style/SingleLineBlockParams:
123
+ Enabled: false
124
+
125
+ Style/ClassVars:
126
+ Exclude:
127
+
128
+ Style/SignalException:
129
+ Enabled: false
130
+
131
+ Style/FileName:
132
+ Exclude:
133
+ - 'lib/speedy-af.rb'
134
+
135
+ Style/ZeroLengthPredicate:
136
+ Exclude:
137
+
138
+ Performance/RedundantMerge:
139
+ Exclude:
140
+
141
+ Rails:
142
+ Enabled: true
143
+
144
+ Rails/Output:
145
+ Exclude:
146
+
147
+ Rails/Date:
148
+ Enabled: false
149
+
150
+ Rails/TimeZone:
151
+ Enabled: false
152
+
153
+ RSpec/AnyInstance:
154
+ Enabled: false
155
+
156
+ RSpec/ExampleWording:
157
+ CustomTransform:
158
+ be: is
159
+ have: has
160
+ not: does not
161
+ NOT: does NOT
162
+ IgnoredWords:
163
+ - only
164
+
165
+ RSpec/FilePath:
166
+ Enabled: false
167
+
168
+ RSpec/InstanceVariable:
169
+ Enabled: false
170
+
171
+ RSpec/DescribeClass:
172
+ Exclude:
173
+
174
+ RSpec/DescribedClass:
175
+ Exclude:
176
+
177
+ RSpec/NotToNot:
178
+ Enabled: false
@@ -0,0 +1,55 @@
1
+ require: rubocop-rspec
2
+
3
+ # This configuration was generated by
4
+ # `rubocop --auto-gen-config`
5
+ # on 2016-08-25 16:34:38 -0700 using RuboCop version 0.42.0.
6
+ # The point is for the user to remove these configuration records
7
+ # one by one as the offenses are removed from the code base.
8
+ # Note that changes in the inspected code, or installation of new
9
+ # versions of RuboCop, may require this file to be generated again.
10
+
11
+ # Offense count: 116
12
+ # Configuration parameters: Max.
13
+ RSpec/ExampleLength:
14
+ Enabled: false
15
+
16
+ # Offense count: 40
17
+ RSpec/LeadingSubject:
18
+ Enabled: false
19
+
20
+ # Offense count: 15
21
+ RSpec/LetSetup:
22
+ Exclude:
23
+ - 'spec/integration/collection_association_spec.rb'
24
+ - 'spec/integration/delete_all_spec.rb'
25
+ - 'spec/integration/has_many_associations_spec.rb'
26
+ - 'spec/integration/nested_attribute_spec.rb'
27
+ - 'spec/integration/persistence_spec.rb'
28
+ - 'spec/unit/has_and_belongs_to_many_association_spec.rb'
29
+
30
+ # Offense count: 1
31
+ RSpec/MessageChain:
32
+ Exclude:
33
+ - 'spec/unit/file_spec.rb'
34
+
35
+ # Offense count: 218
36
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
37
+ # SupportedStyles: allow, expect
38
+ RSpec/MessageExpectation:
39
+ Enabled: false
40
+
41
+ # Offense count: 238
42
+ RSpec/MultipleExpectations:
43
+ Max: 8
44
+
45
+ # Offense count: 394
46
+ # Configuration parameters: MaxNesting.
47
+ RSpec/NestedGroups:
48
+ Enabled: false
49
+
50
+ # Offense count: 94
51
+ RSpec/SubjectStub:
52
+ Enabled: false
53
+
54
+ RSpec/VerifiedDoubles:
55
+ Enabled: false
@@ -0,0 +1,15 @@
1
+ language: ruby
2
+ cache: bundler
3
+ sudo: false
4
+ rvm: 2.4.0
5
+ matrix:
6
+ include:
7
+ - rvm: 2.3.3
8
+ env: "RAILS_VERSION=4.2.7.1"
9
+ - env: "RSOLR_VERSION=2.0.0.pre1"
10
+ global_env:
11
+ - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
12
+ before_install:
13
+ - gem update --system
14
+ before_script:
15
+ - jdk_switcher use oraclejdk8
@@ -0,0 +1,113 @@
1
+ # How to Contribute
2
+
3
+ We want your help to make Project Hydra great.
4
+ There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
5
+
6
+ ## Hydra Project Intellectual Property Licensing and Ownership
7
+
8
+ All code contributors must have an Individual Contributor License Agreement (iCLA) on file with the Hydra Project Steering Group.
9
+ If the contributor works for an institution, the institution must have a Corporate Contributor License Agreement (cCLA) on file.
10
+
11
+ https://wiki.duraspace.org/display/hydra/Hydra+Project+Intellectual+Property+Licensing+and+Ownership
12
+
13
+ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the project.
14
+
15
+ ## Contribution Tasks
16
+
17
+ * Reporting Issues
18
+ * Making Changes
19
+ * Submitting Changes
20
+ * Merging Changes
21
+
22
+ ### Reporting Issues
23
+
24
+ * Make sure you have a [GitHub account](https://github.com/signup/free)
25
+ * Submit a [Github issue](./issues) by:
26
+ * Clearly describing the issue
27
+ * Provide a descriptive summary
28
+ * Explain the expected behavior
29
+ * Explain the actual behavior
30
+ * Provide steps to reproduce the actual behavior
31
+
32
+ ### Making Changes
33
+
34
+ * Fork the repository on GitHub
35
+ * Create a topic branch from where you want to base your work.
36
+ * This is usually the master branch.
37
+ * To quickly create a topic branch based on master; `git branch fix/master/my_contribution master`
38
+ * Then checkout the new branch with `git checkout fix/master/my_contribution`.
39
+ * Please avoid working directly on the `master` branch.
40
+ * You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
41
+ * Make commits of logical units.
42
+ * Your commit should include a high level description of your work in HISTORY.textile
43
+ * Check for unnecessary whitespace with `git diff --check` before committing.
44
+ * Make sure your commit messages are [well formed](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
45
+ * If you created an issue, you can close it by including "Closes #issue" in your commit message. See [Github's blog post for more details](https://github.com/blog/1386-closing-issues-via-commit-messages)
46
+
47
+ ```
48
+ Present tense short summary (50 characters or less)
49
+
50
+ More detailed description, if necessary. It should be wrapped to 72
51
+ characters. Try to be as descriptive as you can, even if you think that
52
+ the commit content is obvious, it may not be obvious to others. You
53
+ should add such description also if it's already present in bug tracker,
54
+ it should not be necessary to visit a webpage to check the history.
55
+
56
+ Include Closes #<issue-number> when relavent.
57
+
58
+ Description can have multiple paragraphs and you can use code examples
59
+ inside, just indent it with 4 spaces:
60
+
61
+ class PostsController
62
+ def index
63
+ respond_with Post.limit(10)
64
+ end
65
+ end
66
+
67
+ You can also add bullet points:
68
+
69
+ - you can use dashes or asterisks
70
+
71
+ - also, try to indent next line of a point for readability, if it's too
72
+ long to fit in 72 characters
73
+ ```
74
+
75
+ * Make sure you have added the necessary tests for your changes.
76
+ * Run _all_ the tests to assure nothing else was accidentally broken.
77
+ * When you are ready to submit a pull request
78
+
79
+ ### Submitting Changes
80
+
81
+ [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
82
+
83
+ * Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
84
+ * Make sure your branch is up to date with its parent branch (i.e. master)
85
+ * `git checkout master`
86
+ * `git pull --rebase`
87
+ * `git checkout <your-branch>`
88
+ * `git rebase master`
89
+ * It is likely a good idea to run your tests again.
90
+ * Squash the commits for your branch into one commit
91
+ * `git rebase --interactive HEAD~<number-of-commits>` ([See Github help](https://help.github.com/articles/interactive-rebase))
92
+ * To determine the number of commits on your branch: `git log master..<your-branch> --oneline | wc -l`
93
+ * Squashing your branch's changes into one commit is "good form" and helps the person merging your request to see everything that is going on.
94
+ * Push your changes to a topic branch in your fork of the repository.
95
+ * Submit a pull request from your fork to the project.
96
+
97
+ ### Merging Changes
98
+
99
+ * It is considered "poor from" to merge your own request.
100
+ * Please take the time to review the changes and get a sense of what is being changed. Things to consider:
101
+ * Does the commit message explain what is going on?
102
+ * Does the code changes have tests? _Not all changes need new tests, some changes are refactorings_
103
+ * Does the commit contain more than it should? Are two separate concerns being addressed in one commit?
104
+ * Did the Travis tests complete successfully?
105
+ * If you are uncertain, bring other contributors into the conversation by creating a comment that includes their @username.
106
+ * If you like the pull request, but want others to chime in, create a +1 comment and tag a user.
107
+
108
+ # Additional Resources
109
+
110
+ * [General GitHub documentation](http://help.github.com/)
111
+ * [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
112
+ * [Pro Git](http://git-scm.com/book) is both a free and excellent book about Git.
113
+ * [A Git Config for Contributing](http://ndlib.github.io/practices/my-typical-per-project-git-config/)
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ source 'https://rubygems.org'
3
+
4
+ gemspec
5
+ gem 'pry-byebug' unless ENV['CI']
data/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ # Copyright 2017, The Trustees of Indiana University and Northwestern
2
+ # University. Licensed under the Apache License, Version 2.0 (the "License");
3
+ # you may not use this file except in compliance with the License.
4
+ #
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software distributed
10
+ # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11
+ # CONDITIONS OF ANY KIND, either express or implied. See the License for the
12
+ # specific language governing permissions and limitations under the License.
@@ -0,0 +1,100 @@
1
+ Code: [![Version](https://badge.fury.io/rb/speedy_af.png)](http://badge.fury.io/rb/speedy_af)
2
+ [![Build Status](https://travis-ci.org/samvera-labs/speedy_af.png?branch=master)](https://travis-ci.org/samvera-labs/speedy_af)
3
+ [![Coverage Status](https://coveralls.io/repos/github/samvera-labs/speedy_af/badge.svg?branch=master)](https://coveralls.io/github/samvera-labs/speedy_af?branch=master)
4
+ [![Code Climate](https://codeclimate.com/github/samvera-labs/speedy_af/badges/gpa.svg)](https://codeclimate.com/github/samvera-labs/speedy_af)
5
+ [![Dependency Status](https://gemnasium.com/samvera-labs/speedy_af.png)](https://gemnasium.com/samvera-labs/speedy_af)
6
+
7
+ Docs: [![Documentation Status](https://inch-ci.org/github/samvera-labs/speedy_af.svg?branch=master)](https://inch-ci.org/github/samvera-labs/speedy_af)
8
+ [![API Docs](http://img.shields.io/badge/API-docs-blue.svg)](http://rubydoc.info/gems/speedy_af)
9
+ [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
10
+ [![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)
11
+
12
+ # SpeedyAF
13
+
14
+ This gem provides two mixins and a presenter designed to speed up ActiveFedora-based discovery and
15
+ display operations.
16
+
17
+ **This gem depends only upon ActiveFedora, not on Hydra or HydraHead**
18
+
19
+ # Table of Contents
20
+
21
+ * [Classes and Mixins](#classes-and-mixins)
22
+ * [Installation](#installation)
23
+ * [Help](#help)
24
+ * [Known Issues](#known-issues)
25
+ * [Acknowledgments](#acknowledgments)
26
+
27
+ ## Classes and Mixins
28
+
29
+ ### OrderedAggregationIndex
30
+
31
+ This mixin adds an `indexed_ordered_aggregation(name)` class method that, in turn, adds two methods
32
+ to the including class.
33
+
34
+ ```ruby
35
+ class Container < ActiveFedora::Base
36
+ include ActiveFedora::Associations
37
+ include SpeedyAF::OrderedAggregationIndex
38
+
39
+ ordered_aggregation :items, class_name: 'Item', through: :list_source
40
+ indexed_ordered_aggregation :items
41
+ end
42
+ ```
43
+
44
+ In the example above, those two methods are `indexed_ordered_items` and `indexed_ordered_item_ids`. They
45
+ return the same data as the standard `ordered_items` and `ordered_item_ids`, respectively, but rely more
46
+ on Solr and less on the Fedora repository. The `_items` variant returns a lazy enumerator that yields
47
+ target objects instead of an `ActiveFedora::Orders::TargetProxy`, but the effect is similar.
48
+
49
+ ### IndexedContent
50
+
51
+ When mixed into an `ActiveFedora::File` descendant, it will index the resource's full content to Solr
52
+ on save. This allows the [`Base`](#Base) to load it up without hitting Fedora.
53
+
54
+ ### Base
55
+
56
+ `SpeedyAF::Base` is designed to load everything it can about an ActiveFedora object from Solr,
57
+ transparently lazy-loading and delegating calls to the underlying Fedora object only when necessary.
58
+ It casts indexed attributes to their correct types, loads both indexed and unindexed subresources
59
+ (See [`IndexedContent`](#indexedcontent)), and responds to most reflection accessors with another
60
+ `Base` instance containing proxies for the desired objects.
61
+
62
+ A presenter (or array of presenters) can be instantiated by calling:
63
+
64
+ `SpeedyAF::Base.find(item_pid)`
65
+ or
66
+ `SpeedyAF::Base.where(solr_query)`
67
+
68
+ See the spec tests for details.
69
+
70
+ # Installation
71
+
72
+ Add this line to your application's Gemfile:
73
+
74
+ gem 'speedy_af'
75
+
76
+ And then execute:
77
+
78
+ $ bundle install
79
+
80
+ Or install it yourself via:
81
+
82
+ $ gem install speedy_af
83
+
84
+ # Help
85
+
86
+ If you have questions or need help, please email [the Hydra community tech list](mailto:hydra-tech@googlegroups.com) or stop by the #dev channel in [the Hydra community Slack team](https://wiki.duraspace.org/pages/viewpage.action?pageId=43910187#Getintouch!-Slack): [![Slack Status](http://slack.projecthydra.org/badge.svg)](http://slack.projecthydra.org/)
87
+
88
+ # Known Issues
89
+
90
+ * `Base` currently tries to grab all relevant rows from Solr at once. Future releases will
91
+ be more mindful of both local resources and Solr request limits.
92
+ * `Base` may not play nicely with language-tagged RDF literals, as ActiveFedora does not
93
+ currently index/encode the language tag into Solr.
94
+
95
+ # Acknowledgments
96
+
97
+ This software has been developed by and is brought to you by the Hydra community. Learn more at the
98
+ [Project Hydra website](http://projecthydra.org/).
99
+
100
+ ![Project Hydra Logo](http://sufia.io/assets/images/hydra_logo.png)