hydra 7.0.0.rc1 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/RELEASE-POLICY.md +2 -2
- data/doc/Dive-into-Hydra.md +3 -8
- data/doc/Lesson:-Define-Relationships-Between-Objects.md +10 -6
- data/doc/Lesson:-Generate-Rails-Scaffolding-for-Creating-and-Editing-Books.md +15 -19
- data/doc/Lesson:-add-the-Hydra-dependencies.md +51 -9
- data/doc/Lesson:-adding-content-datastreams.md +1 -4
- data/doc/Lesson:-build-a-book-model.md +11 -8
- data/doc/Lesson:-generate-a-rails-application.md +56 -15
- data/doc/Lesson:-install-hydra-jetty.md +96 -11
- data/doc/Lesson:-make-blacklight-return-search-results.md +30 -8
- data/doc/Lesson:-start-the-application-&-search-for-results.md +1 -15
- data/hydra.gemspec +1 -1
- data/lib/generators/hydra/install_generator.rb +1 -1
- data/lib/hydra/version.rb +1 -1
- data/script/grant_revoke_gem_authority.rb +1 -0
- metadata +6 -10
- data/doc/Lesson:-create-a-git-repository.md +0 -32
- data/doc/Lesson:-run-the-Hydra-generator.md +0 -39
- data/doc/Lesson:-start-jetty.md +0 -85
- data/doc/Lesson:-turn-off-access-controls.md +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57ba23f57ce7053f1ba3ba3b46c306ffb2cc12ad
|
4
|
+
data.tar.gz: 2e133722302297e19f5fbebd4a2780721395e7c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2c93c5b5b2e8ac5a8328aceace75d5fc112bbde2cc1b532d3b36bc8eaf94f7c312c40c1f2095769684ec9ada0f4b882c83c82e1596bc147478f745fd6971cc4
|
7
|
+
data.tar.gz: 3ca2915c65fd0f0cab91ad9fe5534f6ec618ce5c926c5912dcb5fcccb7760d7c567e63e3cdf0bffff5d5c76357ca1057344381f10fd0fb08c845745605f8b035
|
data/RELEASE-POLICY.md
CHANGED
@@ -43,7 +43,7 @@ repositories, so you can treat them like any other.
|
|
43
43
|
git pull
|
44
44
|
```
|
45
45
|
|
46
|
-
1. Copy the wiki pages to `
|
46
|
+
1. Copy the wiki pages to `doc/` directory of `hydra` repository.
|
47
47
|
|
48
48
|
```
|
49
49
|
cp -a path/to/hydra.wiki/* path/to/hydra/doc/
|
@@ -60,4 +60,4 @@ repositories, so you can treat them like any other.
|
|
60
60
|
This commit should then be included as part of the pull request for the new
|
61
61
|
release. See ["Making Changes"](/CONTRIBUTING.md#making-changes) and
|
62
62
|
["Submitting Changes"](/CONTRIBUTING.md#submitting-changes) on the preferred
|
63
|
-
way to submit pull requests.
|
63
|
+
way to submit pull requests.
|
data/doc/Dive-into-Hydra.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
This tutorial is
|
1
|
+
This tutorial is tested to work with [hydra](http://rubygems.org/gems/hydra) release version 7.0.0.
|
2
2
|
_Please update this wiki to reflect any other versions that have been tested._
|
3
3
|
|
4
4
|
# Prerequisites
|
@@ -11,8 +11,8 @@ The tutorial also mentions using [Ruby Version Manager](http://rvm.io), a.k.a RV
|
|
11
11
|
|
12
12
|
# System Requirements
|
13
13
|
Your system should have the following installed before beginning the walkthrough
|
14
|
-
+ [ruby](http://www.ruby-lang.org/en/) 1.
|
15
|
-
+ [rails](http://rubyonrails.org/) ~>3.2.
|
14
|
+
+ [ruby](http://www.ruby-lang.org/en/) 2.1.1 (also works with 2.0.0)
|
15
|
+
+ [rails](http://rubyonrails.org/) ~>4.1.0 (also works with 3.2.x & 4.0.x)
|
16
16
|
+ [git](http://git-scm.com/)
|
17
17
|
+ [java](http://www.java.com/en/) runtime >= 6.0
|
18
18
|
|
@@ -29,14 +29,10 @@ Your system should have the following installed before beginning the walkthrough
|
|
29
29
|
|
30
30
|
# Steps/Lessons
|
31
31
|
1. [[Lesson: Generate a Rails Application]]
|
32
|
-
1. [[Lesson: Create a git Repository]]
|
33
32
|
1. [[Lesson: Add the Hydra Dependencies]]
|
34
|
-
1. [[Lesson: Run the Hydra generator]]
|
35
33
|
1. [[Lesson: Install hydra-jetty]]
|
36
|
-
1. [[Lesson: Start Jetty]]
|
37
34
|
1. [[Lesson: Start the Application & Search for Results]]
|
38
35
|
1. [[Lesson: Build a Book Model]]
|
39
|
-
1. [[Lesson: Turn Off Access Controls]]
|
40
36
|
1. [[Lesson: Make Blacklight Return Search Results]]
|
41
37
|
|
42
38
|
## Bonus
|
@@ -45,7 +41,6 @@ You've completed the main tutorial, the following lessons can be completed in an
|
|
45
41
|
1. [[Lesson: Define Relationships Between Objects]]
|
46
42
|
1. [[Lesson: Adding Content Datastreams]]
|
47
43
|
1. [[Lesson: Generate Rails Scaffolding for Creating and Editing Books]]
|
48
|
-
1. [[Lesson: Set up your Rails Application to use RSpec]]
|
49
44
|
|
50
45
|
# Next Steps
|
51
46
|
You've finished the initial Hydra tutorial and learned about setting up the basic hydra framework, building basic data models, establishing relationships between models, and modifying the basic user interface provided in a default hydra install. There is still lots more to learn. At this point, you can explore the ideas in this tutorial further by spending some time building out your models to support more complex metadata, further customizing your application views, and/or adding tests to make your applications more robust and easy to maintain.
|
@@ -1,6 +1,3 @@
|
|
1
|
-
This lesson is known to work with hydra version 6.2.0.
|
2
|
-
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
-
|
4
1
|
# Goals
|
5
2
|
* Set up Models to represent relationships between different types of objects
|
6
3
|
* Create and modify relationships between objects
|
@@ -28,6 +25,11 @@ class Datastreams::PageMetadata < ActiveFedora::OmDatastream
|
|
28
25
|
def self.xml_template
|
29
26
|
Nokogiri::XML.parse("<fields/>")
|
30
27
|
end
|
28
|
+
|
29
|
+
def prefix
|
30
|
+
'' # add a prefix for solr index terms if you need to namespace identical terms in multiple data streams
|
31
|
+
end
|
32
|
+
|
31
33
|
end
|
32
34
|
|
33
35
|
```
|
@@ -52,7 +54,7 @@ This is very similar to how our Book class looks, with the exception of the line
|
|
52
54
|
|
53
55
|
### Step 3: Make Books aware of their Pages
|
54
56
|
|
55
|
-
Let's edit the Book class and add the other half of the relationship:
|
57
|
+
Let's edit the Book class in ```app/models/book.rb``` and add the other half of the relationship:
|
56
58
|
|
57
59
|
```ruby
|
58
60
|
# within app/models/book.rb
|
@@ -72,6 +74,8 @@ p.book = b
|
|
72
74
|
=> #<Book pid:"changeme:1", title:"Anna Karenina", author:"Tolstoy, Leo">
|
73
75
|
p.save
|
74
76
|
=> true
|
77
|
+
b.reload
|
78
|
+
=> #<Book pid:"changeme:1", title:"Anna Karenina", author:"Tolstoy, Leo">
|
75
79
|
b.pages
|
76
80
|
=> [#<Page pid:"changeme:2", number:1, text:"Happy families are all alike; every unhappy family is unhappy in its own way.">]
|
77
81
|
```
|
@@ -89,7 +93,7 @@ Alternatively, look at the datastream in your browser at [http://localhost:8983/
|
|
89
93
|
|
90
94
|
Either way, you should see RDF that looks like this:
|
91
95
|
|
92
|
-
```
|
96
|
+
```text
|
93
97
|
<?xml version="1.0" encoding="UTF-8"?>
|
94
98
|
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns0="info:fedora/fedora-system:def/model#" xmlns:ns1="info:fedora/fedora-system:def/relations-external#">
|
95
99
|
<rdf:Description rdf:about="info:fedora/changeme:2">
|
@@ -123,5 +127,5 @@ $> git commit -m "Created a book page model with relationship to the book model"
|
|
123
127
|
```
|
124
128
|
|
125
129
|
# Next Step
|
126
|
-
Go on to [[Lesson: Adding Content Datastreams]] or
|
130
|
+
Go on to **BONUS** [[Lesson: Adding Content Datastreams]] or
|
127
131
|
explore other [Dive into Hydra](Dive into Hydra#Bonus) tutorial bonus lessons.
|
@@ -1,6 +1,3 @@
|
|
1
|
-
This Tutorial is known to work with hydra version 6.1.0, 6.2.0.
|
2
|
-
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
-
|
4
1
|
# Goals
|
5
2
|
|
6
3
|
- Understand the difference between unique (single-value) and multi-valued metadata fields
|
@@ -44,22 +41,21 @@ Removing test/unit/helpers/
|
|
44
41
|
|
45
42
|
Run the `rails server` and visit [[http://localhost:3000/books]]
|
46
43
|
|
47
|
-
|
48
|
-
|
49
|
-
Replace the first line BookMetadata with Datastreams::BookMetadata:
|
50
|
-
|
51
|
-
```ruby
|
52
|
-
class Datastreams::BookMetadata < ActiveFedora::OmDatastream
|
53
|
-
```
|
54
|
-
|
55
|
-
You will also need to edit `app/models/book.rb`
|
56
|
-
|
57
|
-
Again, replace BookMetadata with Datastreams::BookMetadata:
|
44
|
+
Explore the pages for creating, editing and showing Books.
|
58
45
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
46
|
+
> ####Rails 3-troubleshooting:
|
47
|
+
> If you see 'uninitialized constant Book::BookMetadata' you'll need to edit two files.
|
48
|
+
> Open `app/models/datastreams/book_metadata.rb` and replace `BookMetadata` in the class definition with `Datastreams::BookMetadata` i.e.
|
49
|
+
>
|
50
|
+
> ```ruby
|
51
|
+
> class Datastreams::BookMetadata < ActiveFedora::OmDatastream
|
52
|
+
> ```
|
53
|
+
>
|
54
|
+
> You will also need to edit `app/models/book.rb` and replace `BookMetadata` with `Datastreams::BookMetadata`:
|
55
|
+
>
|
56
|
+
> ```ruby
|
57
|
+
> has_metadata 'descMetadata', type: Datastreams::BookMetadata
|
58
|
+
> ```
|
63
59
|
|
64
60
|
### Step 3: Commit your work
|
65
61
|
|
@@ -179,4 +175,4 @@ git commit -m "Handling multivalued author fields"
|
|
179
175
|
Based on the concepts in steps 1-7, determine whether you want 'Title' to display as a single or multi-valued field and make appropriate edits to the 'show' view and '_form' partial on your own.
|
180
176
|
|
181
177
|
# Next Step
|
182
|
-
Proceed to [
|
178
|
+
Proceed to additional hydra tutorials including [Tame Your XML With OM](https://github.com/projecthydra/om/wiki/Tame-your-XML-with-OM) and [Access Controls with Hydra](https://github.com/projecthydra/hydra-head/wiki/Access-Controls-with-Hydra) or go back to explore other [Dive into Hydra](Dive into Hydra#Bonus) tutorial bonus lessons.
|
@@ -1,28 +1,70 @@
|
|
1
|
-
This lesson is known to work with hydra (gem) version 6.1.0, 6.2.0.
|
2
|
-
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
-
|
4
1
|
# Goals
|
5
2
|
* Add the Hydra software to your application's list of dependencies
|
6
|
-
*
|
3
|
+
* Add Hydra (Hydra, Blacklight, and Devise) functionality to your Rails Application
|
7
4
|
|
8
5
|
# Explanation
|
9
6
|
|
10
7
|
In order to take advantage of the Hydra code and features in your application, you need to tell the application where to find that code and which versions of that code to use. Rails uses a tool called [bundler](http://bundler.io/) to track dependencies. Bundler looks in the file called `Gemfile` to know what you want installed.
|
11
8
|
|
9
|
+
Hydra builds on and extends the features provided by Blacklight, the hydra generator integrates core hydra and blacklight functionality into your application. To do this, we run the custom [Rails generator](http://guides.rubyonrails.org/generators.html) provided by the hydra gem. The generator creates a number of files in your application that will allow you to build a Hydra application and use and modify Blacklight's features in your application. The default generator also installs [devise](https://github.com/plataformatec/devise) to provide simple user authentication and management.
|
10
|
+
|
12
11
|
# Steps
|
13
12
|
|
14
|
-
|
13
|
+
### Step 1: Add the *hydra* gem to your Gemfile
|
14
|
+
|
15
|
+
Open up `Gemfile` in your editor. We're going to add the following lines after the `source` line:
|
15
16
|
|
16
17
|
```ruby
|
17
18
|
gem 'hydra'
|
18
19
|
```
|
19
20
|
|
20
|
-
This
|
21
|
+
This includes the hydra-gem in our application. Bundler will then ensure that the hydra-head, blacklight, active-fedora and other gems required by hydra get included (required) correctly. This includes a dependency for the jettywrapper gem (installed automatically). The jettywrapper gem is used to install and configure a preconfigured instance of jetty that loads and runs local development instances of Fedora and Solr for you to run and test your application against.
|
22
|
+
|
23
|
+
Now save the change and install the dependencies by running bundler:
|
24
|
+
```text
|
25
|
+
bundle install
|
26
|
+
```
|
27
|
+
|
28
|
+
Check which files have been changed:
|
29
|
+
```text
|
30
|
+
git status
|
31
|
+
```
|
32
|
+
|
33
|
+
You should see changes to your `Gemfile` and `Gemfile.lock`. Now, go ahead and commit the modified files to your local git repo:
|
34
|
+
```text
|
35
|
+
git add .
|
36
|
+
git commit -m "Add hydra dependency to Gemfile"
|
37
|
+
```
|
38
|
+
|
39
|
+
### Step 2: Run the code generator provided by the *hydra* gem.
|
40
|
+
|
41
|
+
>
|
42
|
+
**Tip:** If you want to see clearly what changes that the generator makes, make sure that all of your current changes have been checked into git before running the generator. I.E. make sure that `git status` reports that there are no changes ("nothing to commit"). Then, after you run the generator, you can list all of the newly created and modified field by running `git status`.
|
43
|
+
>
|
44
|
+
|
45
|
+
Run the hydra generator
|
46
|
+
|
47
|
+
```text
|
48
|
+
rails generate hydra:install
|
49
|
+
```
|
50
|
+
|
51
|
+
The hydra generator invokes both the blacklight generator and the hydra-head generator. Additionally, the blacklight generator installed the devise gem and the bootstrap gem. It's created an important file in our application `app/controllers/catalog_controller.rb`. This is the primary place where you configure the blacklight search.
|
52
|
+
|
53
|
+
When they are done, the generators have created a few database migrations that support saving user data, searches and bookmarks. Normally you would have to run `rake db:migrate` to update your database tables, but the hydra installer does this for you as one of its last steps.
|
54
|
+
|
55
|
+
### Step 3: Review and commit your changes
|
56
|
+
|
57
|
+
See what the hydra generator has done
|
58
|
+
```text
|
59
|
+
git status
|
60
|
+
```
|
61
|
+
|
62
|
+
After you've viewed which files have been modified, commit the changes:
|
21
63
|
|
22
|
-
Now we save the file and install the dependencies by running bundler:
|
23
64
|
```text
|
24
|
-
|
65
|
+
git add .
|
66
|
+
git commit -m "Ran hydra generator"
|
25
67
|
```
|
26
68
|
|
27
69
|
# Next Step
|
28
|
-
Go on to [[Lesson:
|
70
|
+
Go on to [[Lesson: Install hydra-jetty]] or return to the [[Dive into Hydra]] page.
|
@@ -1,6 +1,3 @@
|
|
1
|
-
This lesson is known to work with hydra version 6.1.0, 6.2.0.
|
2
|
-
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
-
|
4
1
|
# Goals
|
5
2
|
* Add "file-bearing" Datastreams to models and objects
|
6
3
|
* See where files are stored in Fedora objects and how to retrieve them
|
@@ -57,4 +54,4 @@ $> git commit -m "Created a content datastream"
|
|
57
54
|
```
|
58
55
|
|
59
56
|
# Next Step
|
60
|
-
Proceed to [[Lesson: Generate Rails Scaffolding for Creating and Editing Books]] or explore other [Dive into Hydra](Dive into Hydra#bonus) tutorial bonus lessons.
|
57
|
+
Proceed to **BONUS** [[Lesson: Generate Rails Scaffolding for Creating and Editing Books]] or explore other [Dive into Hydra](Dive into Hydra#bonus) tutorial bonus lessons.
|
@@ -1,6 +1,3 @@
|
|
1
|
-
This lesson is known to work with hydra release version 6.1.0, 6.2.0.
|
2
|
-
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
-
|
4
1
|
# Goals
|
5
2
|
* Define a simple OM (Opinionated Metadata) Terminology for Book Metadata that we will track as XML Datastreams
|
6
3
|
* Start the Rails console and run code interactively in the console
|
@@ -44,6 +41,12 @@ class BookMetadata < ActiveFedora::OmDatastream
|
|
44
41
|
def self.xml_template
|
45
42
|
Nokogiri::XML.parse("<fields/>")
|
46
43
|
end
|
44
|
+
|
45
|
+
def prefix
|
46
|
+
# set a datastream prefix if you need to namespace terms that might occur in multiple data streams
|
47
|
+
""
|
48
|
+
end
|
49
|
+
|
47
50
|
end
|
48
51
|
```
|
49
52
|
|
@@ -216,7 +219,7 @@ Check and see that to_solr includes the title and author fields.
|
|
216
219
|
|
217
220
|
```text
|
218
221
|
b.descMetadata.to_solr
|
219
|
-
=> {"title_tesim"=>["Anna Karenina"], "author_tesim"=>["Tolstoy, Leo"]}
|
222
|
+
=> {"title_tesim"=>["Anna Karenina"], "author_tesim"=>["Tolstoy, Leo"]}
|
220
223
|
```
|
221
224
|
Now when you call `.to_solr` on a BookMetadata datastream it returns a solr document with fields named `title_tesim` and `author_tesim` that contain your title and author values. Those are the field names that we will add to Blacklight's queries in [[Lesson: Make Blacklight Return Search Results]].
|
222
225
|
|
@@ -234,14 +237,14 @@ If you refresh the document result from solr ([[http://localhost:8983/solr/selec
|
|
234
237
|
|
235
238
|
```xml
|
236
239
|
<arr name="title_tesim">
|
237
|
-
|
240
|
+
<str>Anna Karenina</str>
|
238
241
|
</arr>
|
239
242
|
<arr name="author_tesim">
|
240
|
-
|
243
|
+
<str>Tolstoy, Leo</str>
|
241
244
|
</arr>
|
242
245
|
```
|
243
246
|
|
244
|
-
**Aside:** The strange suffixes on the field names are provided by [solrizer](http://github.com/projecthydra/solrizer). You can read about them in the solrizer documentaton. In short, the **_tesim** suffix tells Solr to treat the values as _**t**ext_ in the _**e**nglish_ language that should be _**s**tored_, _**i**ndexed_ and allowed to be _**m**ultivalued_. This _tesim suffix is a useful catch-all that gets your searches working predictably with minimal fuss. As you encounter cases where you need to index your content in more nuanced ways, there are ways to change these suffixes in order to achieve different results in Solr.
|
247
|
+
**Aside:** The strange suffixes on the field names are provided by [solrizer](http://github.com/projecthydra/solrizer). You can read about them in the [solrizer documentaton](https://github.com/projecthydra/hydra-head/wiki/Solr-Schema). In short, the **_tesim** suffix tells Solr to treat the values as _**t**ext_ in the _**e**nglish_ language that should be _**s**tored_, _**i**ndexed_ and allowed to be _**m**ultivalued_. This _tesim suffix is a useful catch-all that gets your searches working predictably with minimal fuss. As you encounter cases where you need to index your content in more nuanced ways, there are ways to change these suffixes in order to achieve different results in Solr.
|
245
248
|
|
246
249
|
#### Why doesn't the Book show up in Blacklight?
|
247
250
|
|
@@ -257,6 +260,6 @@ $> git commit -m "Created a book model and a datastream"
|
|
257
260
|
```
|
258
261
|
|
259
262
|
# Next Step
|
260
|
-
Go on to [[Lesson:
|
263
|
+
Go on to [[Lesson: Make Blacklight Return Search Results]] or return to the [[Dive into Hydra]] page.
|
261
264
|
|
262
265
|
If you want to learn about OM Terminologies and how they work, visit the [Tame your XML with OM](https://github.com/projecthydra/om/wiki/Tame-your-XML-with-OM) Tutorial.
|
@@ -1,50 +1,91 @@
|
|
1
1
|
# Goals
|
2
2
|
* Create your new Ruby on Rails Application
|
3
|
+
* Initialize the local git repository for your project
|
3
4
|
|
4
5
|
# Explanation
|
5
6
|
|
6
|
-
**Note:** This lesson is
|
7
|
+
**Note:** This lesson is roughly covers the [Getting Started](http://curriculum.railsbridge.org/curriculum/getting_started) and [Create A New Git Repo](http://curriculum.railsbridge.org/curriculum/create_a_new_git_repo) steps in the RailsBridge Curriculum.
|
7
8
|
|
8
|
-
This lesson assumes you are using a **3.2 or 4.
|
9
|
+
This lesson assumes you are using a **3.2, 4.0, or 4.1 version of rails**. To avoid confusion, it's better to have a clean gemset with only one version of rails installed. Most people use either [RVM](http://rvm.io) or [rbenv](https://github.com/sstephenson/rbenv) to handle gemsets and ruby versions.
|
9
10
|
|
10
11
|
The first step to creating a Hydra Head, or any other type of Rails Application, is to generate the basic skeleton of the application code.
|
11
12
|
|
13
|
+
We'll also initialize our Git repository in this lesson so we can track incremental changes to our code. In order to track the changes you make to your code, to share your changes with others, and to pull other people's changes into your code, you need some form of Version Control. The Hydra community uses Git for version control and to share work on Github.
|
14
|
+
|
12
15
|
# Steps
|
13
16
|
|
14
17
|
### Step 1: Create a new rails application
|
15
18
|
|
16
|
-
Once you have installed a suitable rails gem (any 3.2 or 4.
|
19
|
+
Once you have installed a suitable rails gem (any 3.2, 4.0, or 4.1 release), begin by using it to generate a new rails application. You can choose any name for your application. In this tutorial we are calling it hydra-demo
|
17
20
|
|
18
|
-
```
|
19
|
-
|
21
|
+
```text
|
22
|
+
rails new hydra-demo
|
20
23
|
```
|
21
24
|
|
22
25
|
This generates the file structure for an empty rails application. And it runs 'bundler' which loads in all of the external dependencies for rails.
|
23
26
|
|
24
|
-
Enter the directory for the new rails app:
|
27
|
+
Enter the directory for the new rails app:
|
28
|
+
|
29
|
+
```text
|
30
|
+
cd hydra-demo
|
31
|
+
```
|
32
|
+
|
33
|
+
When you type `ls` at the command prompt, you should see a file structure like this:
|
25
34
|
|
26
|
-
|
27
|
-
|
35
|
+
>
|
36
|
+
```text
|
28
37
|
Gemfile Rakefile config.ru lib script vendor
|
29
38
|
Gemfile.lock app db log test
|
30
39
|
README.rdoc config doc public tmp
|
31
40
|
```
|
41
|
+
>
|
42
|
+
|
43
|
+
### Step 1a: *(Linux only)* Enable javascript runtime
|
44
|
+
|
45
|
+
Find the line in your Gemfile that has ```# gem 'therubyracer', :platforms => :ruby``` and uncomment that line. This allows your system to identify the appropriate javascript runtime.
|
46
|
+
|
47
|
+
Now save the Gemfile and run ```bundle install```. This tells bundler to update your dependencies to reflect the change in your Gemfile.
|
48
|
+
|
49
|
+
### Step 1b: *(Rails 3 only)* Remove the default rails 3 homepage
|
50
|
+
|
51
|
+
Rails 3 generates a placeholder homepage at `public/index.html`. You will need to remove this file in order for the blacklight generated homepage to be used:
|
52
|
+
|
53
|
+
```text
|
54
|
+
rm public/index.html
|
55
|
+
```
|
32
56
|
|
33
57
|
### Step 2: Set your Ruby version for this project
|
34
58
|
|
35
|
-
|
59
|
+
A file called ```.ruby-version``` in your project directory (hydra-demo) identifies which version of ruby your application is built with. Put your Ruby's version inside that file. For example, if you're using ruby-2.1.1, you can create the file by entering this at the command prompt:
|
60
|
+
|
61
|
+
```text
|
62
|
+
echo 'ruby-2.1.1' > .ruby-version
|
63
|
+
```
|
64
|
+
|
65
|
+
If you're using a Ruby environment manager such as RVM or rbenv, this will cause your system to automatically load the correct version of Ruby when you enter this directory.
|
66
|
+
|
67
|
+
### Step 3: Initialize your git repository
|
68
|
+
|
69
|
+
Now, let's turn the application directory into a git repository. Type the following:
|
36
70
|
|
37
71
|
```text
|
38
|
-
|
72
|
+
git init .
|
39
73
|
```
|
40
74
|
|
41
|
-
|
75
|
+
Then you should see something like this:
|
42
76
|
|
43
|
-
> ### Linux only step: Enable javascript runtime
|
44
77
|
>
|
45
|
-
|
78
|
+
```text
|
79
|
+
Initialized empty Git repository in /Users/camper/hydra-demo/.git/
|
80
|
+
```
|
46
81
|
>
|
47
|
-
|
82
|
+
|
83
|
+
Next, we'll add all the files rails created into the repository. This way we can jump back to this state later if the need arises.
|
84
|
+
|
85
|
+
```text
|
86
|
+
git add .
|
87
|
+
git commit -m "Initial rails application"
|
88
|
+
```
|
48
89
|
|
49
90
|
# Next Step
|
50
|
-
Go on to [[Lesson:
|
91
|
+
Go on to [[Lesson: Add the Hydra Dependencies]] or return to the [[Dive into Hydra]] page.
|
@@ -1,27 +1,34 @@
|
|
1
|
-
This lesson is known to work with hydra release version 6.1.0, 6.2.0.
|
2
|
-
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
-
|
4
1
|
# Goals
|
5
2
|
* Install a copy of hydra-jetty, which includes pre-configured copies of Fedora and Solr
|
3
|
+
* Learn to start and stop hydra-jetty (which contains Fedora and Solr)
|
6
4
|
|
7
5
|
# Explanation
|
8
|
-
In order to use blacklight and hydra-head, you need an installation of Solr.
|
6
|
+
In order to use blacklight and hydra-head, you need an installation of Solr. In addition, hydra-head requires a copy of Fedora. Fedora and Solr are both Java web applications that need to run in a servlet container like Tomcat or Jetty.
|
9
7
|
|
10
|
-
|
8
|
+
For developer environments, we have created a package called hydra-jetty which provides both services pre-installed within a Jetty Java application server. Whenever you need Fedora and Solr running in your development environment, just start or stop that copy of hydra-jetty.
|
9
|
+
|
10
|
+
>
|
11
|
+
**TIP** *DO NOT* use hydra-jetty for production installations. The hydra-jetty passwords are well-known and the installation has not been secured for non-local use.
|
12
|
+
>
|
11
13
|
|
14
|
+
# Steps
|
12
15
|
|
13
16
|
### Step 1: Install the hydra-jetty package
|
14
17
|
|
15
18
|
Use the hydra:jetty generator to install the hydra-jetty package by running:
|
16
19
|
|
17
|
-
|
18
|
-
|
20
|
+
>
|
21
|
+
**TIP** hydra-jetty is a very large download. If you are completing this lesson as part of a workshop, the facilitator may have a copy of hydra-jetty that you can load from a flash-drive rather than downloading over the internet. The workshop facilitator will provide alternate instructions for this step.
|
22
|
+
>
|
23
|
+
|
24
|
+
```text
|
25
|
+
rails g hydra:jetty
|
19
26
|
```
|
20
27
|
|
21
28
|
This generator is provided by the jettywrapper gem.
|
22
29
|
|
23
30
|
|
24
|
-
This can be very slow (over 100Mb of download). When it's done you'll see the directory named
|
31
|
+
This can be very slow (over 100Mb of download). When it's done you'll see the directory named `jetty` has been created. If you run `git status` you will see
|
25
32
|
|
26
33
|
```text
|
27
34
|
# On branch master
|
@@ -37,7 +44,7 @@ This can be very slow (over 100Mb of download). When it's done you'll see the d
|
|
37
44
|
|
38
45
|
We want git to ignore the jetty directory for the same reasons that we don't check our development databases into git -- because it's big and bulky and you don't actually need other developers to have exact copies of your jetty as long as they have all the other code.
|
39
46
|
|
40
|
-
We do that by editing
|
47
|
+
We do that by editing `.gitignore` and adding the something like this:
|
41
48
|
|
42
49
|
```text
|
43
50
|
# Ignore jetty directory (from hydra-jetty)
|
@@ -47,11 +54,89 @@ We do that by editing ```.gitignore``` and adding the something like this:
|
|
47
54
|
|
48
55
|
Now commit this change
|
49
56
|
|
50
|
-
```
|
57
|
+
```text
|
51
58
|
git add .gitignore
|
52
59
|
git commit -m "Adds /jetty to .gitignore"
|
53
60
|
```
|
54
61
|
|
62
|
+
### Step 3: Start Jetty
|
63
|
+
At the project root, type
|
64
|
+
|
65
|
+
```text
|
66
|
+
rake jetty:start
|
67
|
+
```
|
68
|
+
|
69
|
+
You should see output like this:
|
70
|
+
|
71
|
+
>
|
72
|
+
```text
|
73
|
+
Starting jetty with these values:
|
74
|
+
jetty_home: /Users/justin/hydra-demo/jetty
|
75
|
+
jetty_command: java -Djetty.port=8983 -Dsolr.solr.home=/Users/justin/hydra-demo/jetty/solr -Xmx256m -XX:MaxPermSize=128m -jar start.jar
|
76
|
+
Logging jettywrapper stdout to /Users/justin/hydra-demo/jetty/jettywrapper.log
|
77
|
+
Wrote pid file to /Users/justin/hydra-demo/tmp/pids/_Users_justin_hydra-demo_jetty.pid with value 8315
|
78
|
+
Waited 5 seconds for jetty to start, but it is not yet listening on port 8983. Continuing anyway.
|
79
|
+
Started jetty (5575.9ms)
|
80
|
+
```
|
81
|
+
>
|
82
|
+
|
83
|
+
hydra-jetty has a fair amount of stuff in it, so it may take up to a minute to start. You can check to see if it's started by going to [[http://localhost:8983/solr]]
|
84
|
+
|
85
|
+
If Fedora, Solr, or jetty itself are not starting, you'll want to look at the jettywrapper log to diagnose.
|
86
|
+
|
87
|
+
**Windows Tip:** This rake task is not currently working on Windows (see [jettywrapper issue #13](https://github.com/projecthydra/jettywrapper/issues/13) for status). In the meantime, start jetty manually
|
88
|
+
|
89
|
+
```text
|
90
|
+
cd jetty
|
91
|
+
java -Djetty.port=8983 -Dsolr.solr.home=/Users/justin/hydra-demo/jetty/solr -Xmx256m -XX:MaxPermSize=128m -jar start.jar
|
92
|
+
```
|
93
|
+
|
94
|
+
### Step 4: Look at the jettywrapper log
|
95
|
+
|
96
|
+
The jetty:start rake task runs jetty as a background job, so jetty's logs won't appear in your terminal. Instead they're written to the file `jetty/jettywrapper.log`. If you look at the output from running the jetty:start task, you'll see that one line gives you the full path to the file, for example:
|
97
|
+
|
98
|
+
```text
|
99
|
+
Logging jettywrapper stdout to /Users/justin/hydra-demo/jetty/jettywrapper.log
|
100
|
+
```
|
101
|
+
|
102
|
+
You can open this log file with any text editor or log reader.
|
103
|
+
|
104
|
+
```text
|
105
|
+
vi jetty/jettywrapper.log
|
106
|
+
```
|
107
|
+
|
108
|
+
### Step 5: Monitor the jettywrapper log
|
109
|
+
|
110
|
+
>
|
111
|
+
**Tip:** if jetty is taking a long time to start, you can watch its output using the tail command with the path to your jettywrapper.log. For example:
|
112
|
+
|
113
|
+
```text
|
114
|
+
tail -f jetty/jettywrapper.log
|
115
|
+
```
|
116
|
+
>
|
117
|
+
|
118
|
+
As Jetty, Fedora, and Solr start you will see more info being written to the log file. After a few moments you will be able to open jetty at [[http://localhost:8983]] or [[http://0.0.0.0:8983]] (**note:** The root page will give a 404 error, but should have three links to the applications running in Jetty: /solr, /fedora and /fedora-test)
|
119
|
+
|
120
|
+
### Step 6: Stop Jetty
|
121
|
+
You might have guessed this one. In order to stop jetty, at the project root, type
|
122
|
+
|
123
|
+
```text
|
124
|
+
rake jetty:stop
|
125
|
+
```
|
126
|
+
|
127
|
+
### Step 7: Start Jetty again
|
128
|
+
Before proceeding to the next lesson, make sure jetty is running. If you're not sure whether it's running, go to http://localhost:8983. If jetty is running a page will load. If jetty is not running no page will load.
|
129
|
+
|
130
|
+
If it's not running, just use the jetty:start rake task again.
|
131
|
+
|
132
|
+
```text
|
133
|
+
rake jetty:start
|
134
|
+
```
|
135
|
+
|
136
|
+
|
137
|
+
>
|
138
|
+
**Tip:** Sometimes people are confused about whether they need to restart jetty when they restart their Rails application. In most cases it is fine to leave jetty running when you start, stop, and restart the Rails application. The only exception is when you make changes to Solr's configuration or Fedora's configuration -- these would be changes to files inside of your copy of hydra-jetty (ie. jetty/solr/config), not changes to files in your Rails application's Ruby code. In those cases, where you have made changes to Solr or Fedora's configuration, you need to restart Jetty in order for those changes to take effect. The most common change that requires restarting jetty is when you modify the solrconfig.xml or schema.xml in your solr config directory.
|
139
|
+
>
|
55
140
|
|
56
141
|
# Next Step
|
57
|
-
Go on to [[Lesson: Start
|
142
|
+
Go on to [[Lesson: Start the Application & Search for Results]] or return to the [[Dive into Hydra]] page.
|
@@ -1,7 +1,5 @@
|
|
1
|
-
This lesson is known to work with hydra version 6.1.0, 6.2.0.
|
2
|
-
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
-
|
4
1
|
# Goals
|
2
|
+
* *(for now)* Turn off access controls for Blacklight-based searches and "show" views
|
5
3
|
* Tell Blacklight which fields to use in searches
|
6
4
|
* Run a search in Blacklight and see results rendered
|
7
5
|
|
@@ -9,13 +7,37 @@ _Please update this wiki to reflect any other versions that have been tested._
|
|
9
7
|
|
10
8
|
In [[Lesson: Build a Book Model]] you made a Book object, saved it, and saw that the Book's metadata was indexed in Solr. Now we will make that Book appear in your Blacklight searches.
|
11
9
|
|
10
|
+
One of the main features that Hydra adds to Blacklight is the ability to control who has access to which information in search results. That topic gets a little bit complicated. For the purpose of this Tutorial we want to stay focused on showing you how to set up an app, define models and create objects based on those models, so in order to keep things simple we will make this Hydra Head behave like an open access repository where everyone can see everything. Once you've completed this tutorial, you can check out [Access Controls with Hydra](https://github.com/projecthydra/hydra-head/wiki/Access-Controls-with-Hydra) to learn how to assert access controls on objects and enforce those access controls in a Hydra Head.
|
11
|
+
|
12
|
+
Once you've turned off access controls in step #1, we show you how to tell blacklight which fields you want to use for default searches in the remaining steps.
|
13
|
+
|
12
14
|
# Steps
|
13
15
|
|
14
|
-
### Step 1:
|
16
|
+
### Step 1: Comment out the lines that enforce access controls in Blacklight's CatalogController
|
17
|
+
|
18
|
+
If you open ```app/controllers/catalog_controller.rb``` and look at the code near lines 8-12 you should see this:
|
19
|
+
```ruby
|
20
|
+
# These before_filters apply the hydra access controls
|
21
|
+
before_filter :enforce_show_permissions, :only=>:show
|
22
|
+
# This applies appropriate access controls to all solr queries
|
23
|
+
CatalogController.solr_search_params_logic += [:add_access_controls_to_solr_params]
|
24
|
+
```
|
25
|
+
|
26
|
+
This code tells blacklight to enforce access controls on the search and result view pages. For the time being we will turn this off by commenting out two lines so that it looks like this:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
# These before_filters apply the hydra access controls
|
30
|
+
#before_filter :enforce_show_permissions, :only=>:show
|
31
|
+
# This applies appropriate access controls to all solr queries
|
32
|
+
#CatalogController.solr_search_params_logic += [:add_access_controls_to_solr_params]
|
33
|
+
```
|
34
|
+
Then, save the file.
|
35
|
+
|
36
|
+
### Step 2: Run a search in the CatalogController
|
15
37
|
|
16
38
|
Visit or reload the page at [[http://localhost:3000/]]. You should see the Blacklight search interface with a search box. If you search for 'Anna' you don't see any results even though we created a Book called "Anna Karenina" and indexed it in Solr in the last lesson.
|
17
39
|
|
18
|
-
### Step
|
40
|
+
### Step 3: Tell Blacklight which fields to use in Queries
|
19
41
|
|
20
42
|
The reason why we're not getting any hits is because we haven't told Blacklight which fields to search in. Let's fix that by setting the default 'qf' solr parameter. Open `app/controllers/catalog_controller.rb` and set the `default_solr_params` section (around line 18) to this:
|
21
43
|
|
@@ -27,13 +49,13 @@ The reason why we're not getting any hits is because we haven't told Blacklight
|
|
27
49
|
}
|
28
50
|
```
|
29
51
|
|
30
|
-
### Step
|
52
|
+
### Step 4: Re-run your search
|
31
53
|
|
32
54
|
Save the file, and refresh your web browser. You should now see a result for "Anna Karenina" when you search for "Anna"
|
33
55
|
|
34
56
|
**Tip:** When you make changes like this, you *don't* need to restart the Rails server. This is because in development mode (which is the default environment for the Rails server), the Rails server reloads any files in app/models, app/controllers, app/views, etc. for every request it receives from a browser. This makes the server slower, but it makes life much smoother when you're actively developing and making changes.
|
35
57
|
|
36
|
-
### Step
|
58
|
+
### Step 5: Commit your changes
|
37
59
|
|
38
60
|
Now that we've updated our search functionality, it's a great time to commit to git:
|
39
61
|
|
@@ -43,5 +65,5 @@ $> git commit -m "Disabled access controls and set default search fields"
|
|
43
65
|
```
|
44
66
|
|
45
67
|
# Next Step
|
46
|
-
Go on to [[Lesson: Define Relationships Between Objects]] or
|
68
|
+
Go on to **BONUS** [[Lesson: Define Relationships Between Objects]] or
|
47
69
|
explore other [Dive into Hydra](Dive into Hydra#Bonus) tutorial bonus lessons.
|
@@ -1,6 +1,3 @@
|
|
1
|
-
This lesson is known to work with hydra release version 6.1.0.
|
2
|
-
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
-
|
4
1
|
# Goals
|
5
2
|
* Start and Stop a local "development" copy of the application
|
6
3
|
* Remove the default Welcome page provided by Rails
|
@@ -21,18 +18,7 @@ Leave that terminal window open. It will print info whenever the server does an
|
|
21
18
|
### Step 2: Look at the application in your Browser
|
22
19
|
|
23
20
|
Now you can visit your local copy of the application with a web browser when you point the browser at [[http://localhost:3000/]]
|
24
|
-
|
25
|
-
> ####Rails 3-only step: Remove the Rails default "Welcome" page
|
26
|
-
>
|
27
|
-
> If it worked you should see a page with the text: "Welcome aboard. You’re riding Ruby on Rails!". This is the default page, but now that we know it works, we can delete it. In Rails 4 you will **NOT** see the default rails welcome page and you can proceed to the 'Run a Search' step.
|
28
|
-
>
|
29
|
-
> Open a new terminal (so we can keep the server running) and type:
|
30
|
-
>
|
31
|
-
> ```bash
|
32
|
-
> $> rm public/index.html
|
33
|
-
> ```
|
34
|
-
> Then reload the page at [[http://localhost:3000/]].
|
35
|
-
|
21
|
+
|
36
22
|
### Step 3: Run a Search
|
37
23
|
|
38
24
|
Now that you've removed the default "Welcome" page and reloaded the page in your browser, you should see something that looks like a default Blacklight install. If you enter a search query you don't see any results because we haven't created any objects yet -- your Solr index is empty.
|
data/hydra.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |gem|
|
|
30
30
|
gem.add_dependency 'om', '~> 3.0.4'
|
31
31
|
gem.add_dependency 'solrizer', '~> 3.1.1'
|
32
32
|
gem.add_dependency 'rsolr', '~> 1.0.10'
|
33
|
-
gem.add_dependency 'blacklight', '~> 5.
|
33
|
+
gem.add_dependency 'blacklight', '~> 5.4.0'
|
34
34
|
gem.add_dependency 'nokogiri', '~> 1.6.0'
|
35
35
|
gem.add_dependency 'rubydora', '~> 1.7.4'
|
36
36
|
gem.add_dependency 'nom-xml', '~> 0.5.1'
|
data/lib/hydra/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.0
|
4
|
+
version: 7.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Friesen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hydra-head
|
@@ -121,14 +121,14 @@ dependencies:
|
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 5.
|
124
|
+
version: 5.4.0
|
125
125
|
type: :runtime
|
126
126
|
prerelease: false
|
127
127
|
version_requirements: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 5.
|
131
|
+
version: 5.4.0
|
132
132
|
- !ruby/object:Gem::Dependency
|
133
133
|
name: nokogiri
|
134
134
|
requirement: !ruby/object:Gem::Requirement
|
@@ -217,15 +217,11 @@ files:
|
|
217
217
|
- doc/Lesson:-add-the-Hydra-dependencies.md
|
218
218
|
- doc/Lesson:-adding-content-datastreams.md
|
219
219
|
- doc/Lesson:-build-a-book-model.md
|
220
|
-
- doc/Lesson:-create-a-git-repository.md
|
221
220
|
- doc/Lesson:-generate-a-rails-application.md
|
222
221
|
- doc/Lesson:-install-hydra-jetty.md
|
223
222
|
- doc/Lesson:-make-blacklight-return-search-results.md
|
224
|
-
- doc/Lesson:-run-the-Hydra-generator.md
|
225
223
|
- doc/Lesson:-set-up-your-Rails-Application-to-use-rspec.md
|
226
|
-
- doc/Lesson:-start-jetty.md
|
227
224
|
- doc/Lesson:-start-the-application-&-search-for-results.md
|
228
|
-
- doc/Lesson:-turn-off-access-controls.md
|
229
225
|
- doc/Migrating-to-Hydra-6.2.md
|
230
226
|
- doc/Migration-Notes.md
|
231
227
|
- doc/Models---Defining-a-Custom-Hydra-Model.textile
|
@@ -260,9 +256,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
260
256
|
version: '0'
|
261
257
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
262
258
|
requirements:
|
263
|
-
- - "
|
259
|
+
- - ">="
|
264
260
|
- !ruby/object:Gem::Version
|
265
|
-
version:
|
261
|
+
version: '0'
|
266
262
|
requirements: []
|
267
263
|
rubyforge_project:
|
268
264
|
rubygems_version: 2.2.2
|
@@ -1,32 +0,0 @@
|
|
1
|
-
Note: This lesson is basically equivalent to the [Create A New Git Repo](http://curriculum.railsbridge.org/curriculum/create_a_new_git_repo) step in the RailsBridge Curriculum.
|
2
|
-
|
3
|
-
# Goals
|
4
|
-
* Create a local git repository that will track all changes to this application's code
|
5
|
-
|
6
|
-
# Explanation
|
7
|
-
|
8
|
-
In order to track the changes you make to your code, to share your changes with others, and to pull other people's changes into your code, you need some form of Version Control. All of the Hydra projects use Git for version control and share their work on Github.
|
9
|
-
|
10
|
-
# Steps
|
11
|
-
|
12
|
-
Now, let's turn this directory into a git repository. Type the following:
|
13
|
-
|
14
|
-
```bash
|
15
|
-
$> git init .
|
16
|
-
```
|
17
|
-
|
18
|
-
Then you should see something like this:
|
19
|
-
|
20
|
-
```
|
21
|
-
Initialized empty Git repository in /Users/justin/hydra-demo/.git/
|
22
|
-
```
|
23
|
-
|
24
|
-
Next, we'll add all the files rails created into the repository. This way we can jump back to this state later if the need arises.
|
25
|
-
|
26
|
-
```bash
|
27
|
-
$> git add .
|
28
|
-
$> git commit -m "Initial rails application"
|
29
|
-
```
|
30
|
-
|
31
|
-
# Next Step
|
32
|
-
Go on to [[Lesson: Add the Hydra Dependencies]] or return to the [[Dive into Hydra]] page.
|
@@ -1,39 +0,0 @@
|
|
1
|
-
This lesson is known to work with hydra version 6.1.0, 6.2.0.
|
2
|
-
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
-
|
4
|
-
# Goals
|
5
|
-
* Add Hydra (Hydra, Blacklight, and Devise) functionality to your Rails Application
|
6
|
-
|
7
|
-
# Explanation
|
8
|
-
|
9
|
-
Hydra builds on and extends the features provided by Blacklight, the generator integrates core hydra and blacklight functionality into your application. To do this, we run the custom [Rails generator](http://guides.rubyonrails.org/generators.html) provided by the hydra gem. The generator creates a number of files in your application that will allow you to build a Hydra application and use and modify Blacklight's features in your application. The default generator also installs [devise](https://github.com/plataformatec/devise) to provide simple user authentication and management.
|
10
|
-
|
11
|
-
**Tip:** If you want to see clearly what changes that the generator has made, make sure that before you run the generator all of your current changes have been checked into git -- so before running the generator running 'git status' should report that there are no changes ("nothing to commit"). Then when you run the generator you will be able to see all of the changes it's made by runing 'git status'.
|
12
|
-
|
13
|
-
# Steps
|
14
|
-
|
15
|
-
**Note:** You must have completed the steps in [[Lesson: Add the Hydra Dependencies]] in order for the following steps to work.
|
16
|
-
|
17
|
-
|
18
|
-
### Step 1: Run the code generator provided by the Hydra gem.
|
19
|
-
|
20
|
-
We do this by typing
|
21
|
-
|
22
|
-
```bash
|
23
|
-
$> rails generate hydra:install
|
24
|
-
```
|
25
|
-
|
26
|
-
The hydra generator invokes both the blacklight generator and the hydra-head generator. Additionally, the blacklight generator installed the devise gem and the bootstrap gem. It's created an important file in our application `app/controllers/catalog_controller.rb`. This is the primary place where you configure the blacklight search.
|
27
|
-
|
28
|
-
When they are done, the generators have created a few database migrations that support saving user data, searches and bookmarks. Normally you would have to run `rake db:migrate` to update your database tables, but the hydra installer does this for you as one of its last steps.
|
29
|
-
|
30
|
-
### Step 2: Commit your changes
|
31
|
-
At this point it's a good idea to commit the changes:
|
32
|
-
|
33
|
-
```bash
|
34
|
-
$> git add .
|
35
|
-
$> git commit -m "Ran hydra generator"
|
36
|
-
```
|
37
|
-
|
38
|
-
# Next Step
|
39
|
-
Go on to [[Lesson: Install hydra-jetty]] or return to the [[Dive into Hydra]] page.
|
data/doc/Lesson:-start-jetty.md
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
This lesson is known to work with hydra release version 6.1.0, 6.2.0.
|
2
|
-
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
-
|
4
|
-
# Goals
|
5
|
-
* Start and Stop Jetty (which contains Fedora and Solr)
|
6
|
-
|
7
|
-
# Explanation
|
8
|
-
Fedora and Solr are both Java web applications that need to run in a servlet container like Tomcat or Jetty. We installed hydra-jetty in the [[Lesson: Install hydra-jetty]]. Now whenever you need Fedora and Solr running, just start or stop that copy of hydra-jetty.
|
9
|
-
|
10
|
-
**Tip:** Sometimes people are confused about whether they need to restart jetty when they restart their Rails application. In most cases it is fine to leave jetty running when you start, stop, and restart the Rails application. The only exception is when you make changes to Solr's configuration or Fedora's configuration -- these would be changes to files inside of your copy of hydra-jetty (ie. jetty/solr/config), not changes to files in your Rails application's Ruby code. In those cases, where you have made changes to Solr or Fedora's configuration, you need to restart Jetty in order for those changes to take effect. The most common change that requires restarting jetty is when you modify the solrconfig.xml or schema.xml in your solr config directory.
|
11
|
-
|
12
|
-
# Steps
|
13
|
-
|
14
|
-
### Step 1: Start Jetty
|
15
|
-
At the project root, type
|
16
|
-
|
17
|
-
```bash
|
18
|
-
$> rake jetty:start
|
19
|
-
```
|
20
|
-
|
21
|
-
You should see output like this:
|
22
|
-
|
23
|
-
```text
|
24
|
-
Starting jetty with these values:
|
25
|
-
jetty_home: /Users/justin/hydra-demo/jetty
|
26
|
-
jetty_command: java -Djetty.port=8983 -Dsolr.solr.home=/Users/justin/hydra-demo/jetty/solr -Xmx256m -XX:MaxPermSize=128m -jar start.jar
|
27
|
-
Logging jettywrapper stdout to /Users/justin/hydra-demo/jetty/jettywrapper.log
|
28
|
-
Wrote pid file to /Users/justin/hydra-demo/tmp/pids/_Users_justin_hydra-demo_jetty.pid with value 8315
|
29
|
-
Waited 5 seconds for jetty to start, but it is not yet listening on port 8983. Continuing anyway.
|
30
|
-
Started jetty (5575.9ms)
|
31
|
-
```
|
32
|
-
|
33
|
-
hydra-jetty has a fair amount of stuff in it, so it may take up to a minute to start. You can check to see if it's started by going to [[http://localhost:8983/solr]]
|
34
|
-
|
35
|
-
If Fedora, Solr, or jetty itself are not starting, you'll want to look at the jettywrapper log to diagnose.
|
36
|
-
|
37
|
-
**Windows Tip:** This rake task is not currently working on Windows (see [jettywrapper issue #13](https://github.com/projecthydra/jettywrapper/issues/13) for status). In the meantime, start jetty manually
|
38
|
-
```
|
39
|
-
cd jetty
|
40
|
-
java -Djetty.port=8983 -Dsolr.solr.home=/Users/justin/hydra-demo/jetty/solr -Xmx256m -XX:MaxPermSize=128m -jar start.jar
|
41
|
-
```
|
42
|
-
|
43
|
-
### Step 2: Look at the jettywrapper log
|
44
|
-
|
45
|
-
The jetty:start rake task runs jetty as a background job, so jetty's logs won't appear in your terminal. Instead they're written to the file ```jetty/jettywrapper.log```. If you look at the output from running the jetty:start task, you'll see that one line gives you the full path to the file, for example:
|
46
|
-
|
47
|
-
```text
|
48
|
-
Logging jettywrapper stdout to /Users/justin/hydra-demo/jetty/jettywrapper.log
|
49
|
-
```
|
50
|
-
|
51
|
-
You can open this log file with any text editor or log reader.
|
52
|
-
|
53
|
-
```bash
|
54
|
-
$> vi jetty/jettywrapper.log
|
55
|
-
```
|
56
|
-
|
57
|
-
### Step 3: Monitor the jettywrapper log
|
58
|
-
|
59
|
-
|
60
|
-
**Tip:** if jetty is taking a long time to start, you can watch its output using the tail command with the path to your jettywrapper.log. For example:
|
61
|
-
|
62
|
-
```bash
|
63
|
-
$> tail -f jetty/jettywrapper.log
|
64
|
-
```
|
65
|
-
|
66
|
-
As Jetty, Fedora, and Solr start you will see more info being written to the log file. After a few moments you will be able to open jetty at [[http://localhost:8983]] or [[http://0.0.0.0:8983]] (**note:** The root page will give a 404 error, but should have three links to the applications running in Jetty: /solr, /fedora and /fedora-test)
|
67
|
-
|
68
|
-
### Step 4: Stop Jetty
|
69
|
-
You might have guessed this one. In order to stop jetty, at the project root, type
|
70
|
-
|
71
|
-
```bash
|
72
|
-
$> rake jetty:stop
|
73
|
-
```
|
74
|
-
|
75
|
-
### Step 5: Start Jetty again
|
76
|
-
Before proceeding to the next step, make sure jetty is running. If you're not sure whether it's running, go to http://localhost:8983. If jetty is running a page will load. If jetty is not running no page will load.
|
77
|
-
|
78
|
-
If it's not running, just use the jetty:start rake task again.
|
79
|
-
|
80
|
-
```bash
|
81
|
-
$> rake jetty:start
|
82
|
-
```
|
83
|
-
|
84
|
-
# Next Step
|
85
|
-
Go on to [[Lesson: Start the Application & Search for Results]] or return to the [[Dive into Hydra]] page.
|
@@ -1,37 +0,0 @@
|
|
1
|
-
This lesson is known to work with hydra version 6.1.0, 6.2.0.
|
2
|
-
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
-
|
4
|
-
# Goals
|
5
|
-
* *(for now)* Turn off access controls for Blacklight-based searches and "show" views
|
6
|
-
|
7
|
-
# Explanation
|
8
|
-
One of the main features that Hydra adds to Blacklight is the ability to control who has access to which information in search results. That topic gets a little bit complicated. For the purpose of this Tutorial we want to stay focused on showing you how to set up an app, define models and create objects based on those models, so in order to keep things simple we will make this Hydra Head behave like an open access repository where everyone can see everything. Once you've completed this tutorial, you can check out [Access Controls with Hydra](https://github.com/projecthydra/hydra-head/wiki/Access-Controls-with-Hydra) to learn how to assert access controls on objects and enforce those access controls in a Hydra Head.
|
9
|
-
|
10
|
-
# Steps
|
11
|
-
|
12
|
-
### Step 1: Comment out the lines that enforce access controls in Blacklight's CatalogController
|
13
|
-
|
14
|
-
If you open ```app/controllers/catalog_controller.rb``` and look at the code near lines 8-12 you should see this:
|
15
|
-
```ruby
|
16
|
-
# These before_filters apply the hydra access controls
|
17
|
-
before_filter :enforce_show_permissions, :only=>:show
|
18
|
-
# This applies appropriate access controls to all solr queries
|
19
|
-
CatalogController.solr_search_params_logic += [:add_access_controls_to_solr_params]
|
20
|
-
```
|
21
|
-
|
22
|
-
This code tells blacklight to enforce access controls on the search and result view pages. For the time being we will turn this off by commenting out two lines so that it looks like this:
|
23
|
-
|
24
|
-
```ruby
|
25
|
-
# These before_filters apply the hydra access controls
|
26
|
-
#before_filter :enforce_show_permissions, :only=>:show
|
27
|
-
# This applies appropriate access controls to all solr queries
|
28
|
-
#CatalogController.solr_search_params_logic += [:add_access_controls_to_solr_params]
|
29
|
-
```
|
30
|
-
|
31
|
-
### Step 2: Save the file
|
32
|
-
|
33
|
-
Then, save the file.
|
34
|
-
|
35
|
-
|
36
|
-
# Next Step
|
37
|
-
Go on to [[Lesson: Make Blacklight Return Search Results]] or return to the [[Dive into Hydra]] page.
|