hydra-head 4.0.0.rc5 → 4.0.0.rc6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY.textile +1 -1
- data/HOW_TO_GET_STARTED.textile +2 -2
- data/INSTALL_PREREQ.textile +1 -20
- data/README.textile +12 -16
- data/app/assets/stylesheets/hydra/html_refactor.css +1 -5
- data/app/assets/stylesheets/hydra/hydrangea.css +0 -4
- data/app/assets/stylesheets/hydra/styles.css +12 -595
- data/app/controllers/downloads_controller.rb +2 -1
- data/app/controllers/hydra/permissions_controller.rb +2 -6
- data/app/models/ability.rb +1 -98
- data/app/models/hydra/ability.rb +128 -0
- data/app/views/_flash_msg.html.erb +1 -1
- data/app/views/catalog/_home.html.erb +2 -2
- data/app/views/catalog/_home_text.html.erb +2 -8
- data/app/views/catalog/_show_partials/_default.html.erb +0 -4
- data/app/views/generic_images/_edit.html.erb +0 -2
- data/app/views/layouts/hydra-head.html.erb +22 -35
- data/lib/hydra-head/version.rb +1 -1
- data/lib/hydra/mods_article.rb +22 -2
- data/lib/railties/hydra-fixtures.rake +17 -24
- data/tasks/hydra-head-fixtures.rake +32 -28
- data/tasks/hydra-head.rake +39 -57
- data/{lib/railties → tasks}/hyhead_rspec.rake +7 -26
- data/test_support/features/file_upload.feature +3 -3
- data/test_support/features/step_definitions/edit_metadata_steps.rb +1 -1
- data/test_support/features/step_definitions/user_steps.rb +7 -4
- data/test_support/spec/models/ability_spec.rb +3 -9
- metadata +36 -51
- data/DEVELOP_PLUGIN.textile +0 -90
- data/GIT_WORKFLOW.textile +0 -106
- data/HOW_TO_DEFINE_A_HYDRA_CONTROLLER.textile +0 -21
- data/HOW_TO_DEFINE_A_HYDRA_MODEL.textile +0 -64
- data/HYDRA_ACCESS_CONTROLS.textile +0 -27
- data/INITIAL_APP_MODS.textile +0 -223
- data/README_RAILS3_CHANGES.textile +0 -67
- data/README_RAKE_TASKS.textile +0 -107
- data/README_SUBTREE.textile +0 -87
- data/README_TERSE.textile +0 -92
- data/RELEASE_NOTES.textile +0 -8
- data/TESTING.textile +0 -85
- data/TESTING_PLUGIN.textile +0 -133
- data/app/views/layouts/application.html.erb +0 -49
- data/lib/railties/all_tests.rake +0 -23
- data/lib/railties/hyhead_cucumber.rake +0 -126
data/TESTING_PLUGIN.textile
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
h1. Testing the hydra-head Plugin
|
2
|
-
|
3
|
-
h2. I. Install the Testing Rails Application
|
4
|
-
|
5
|
-
In order to run the tests, you need to have a properly configured rails app installed in the hydra-plugin_test_host directory. See "DEVELOP_PLUGIN":https://github.com/projecthydra/hydra-head/blob/master/DEVELOP_PLUGIN.textile for instructions on setting this up.
|
6
|
-
|
7
|
-
h2. II. Running the full Continuous Integration build
|
8
|
-
|
9
|
-
_Stop any copies of jetty (or anything else using port 8983) before running this command._
|
10
|
-
|
11
|
-
This will spin up jetty pre-configured with Fedora and Solr on port 8983, import your fixtures into it, run the tests, and stop jetty.
|
12
|
-
|
13
|
-
<pre>
|
14
|
-
rake hyhead:ci RAILS_ENV=test
|
15
|
-
</pre>
|
16
|
-
|
17
|
-
h2. III. Running the Tests Manually
|
18
|
-
|
19
|
-
h4. (1) Start Jetty, preloaded with Fedora and Solr applications
|
20
|
-
|
21
|
-
See below to reset jetty when re-running tests, or when running a simultaneous development instance.
|
22
|
-
|
23
|
-
_Stop any copies of jetty (or anything else using port 8983) before running this command._
|
24
|
-
|
25
|
-
You must do this at the root of the <b><i>hydra-head plugin</i> directory</b>, not within the tmp/test_app_ directory.
|
26
|
-
|
27
|
-
Note that java 1.6 must be invoked by the "java" command or Fedora won't work.
|
28
|
-
|
29
|
-
<pre>
|
30
|
-
rake hydra:jetty:load RAILS_ENV=test
|
31
|
-
</pre>
|
32
|
-
|
33
|
-
This will start up jetty on port 8983.
|
34
|
-
|
35
|
-
h4. (2) Load test fixtures into Fedora/Solr.
|
36
|
-
|
37
|
-
You must do this at the root of the <b><i>hydra-head plugin</i> directory</b>, not within the tmp/test_app directory.
|
38
|
-
|
39
|
-
NOTE: to ensure that the tests do not rely on non-test data, do this first:
|
40
|
-
|
41
|
-
<pre>
|
42
|
-
rake hydra:default_fixtures:delete
|
43
|
-
</pre>
|
44
|
-
|
45
|
-
<pre>
|
46
|
-
rake hydra:default_fixtures:refresh environment=test
|
47
|
-
</pre>
|
48
|
-
|
49
|
-
(TO DO: get rid of irrelevant fixtures; get rid of non-generic fixtures.)
|
50
|
-
|
51
|
-
h4. (3) Run specs.
|
52
|
-
|
53
|
-
<pre>
|
54
|
-
rake hyhead:spec
|
55
|
-
</pre>
|
56
|
-
|
57
|
-
OR
|
58
|
-
|
59
|
-
<pre>
|
60
|
-
rake hyhead:setup_test_app
|
61
|
-
rake hyhead:spec
|
62
|
-
</pre>
|
63
|
-
|
64
|
-
|
65
|
-
h2. If you need to Re-run the tests:
|
66
|
-
|
67
|
-
h4. Clean out and reload the databases:
|
68
|
-
|
69
|
-
<pre>
|
70
|
-
cd hydra-plugin_test_host
|
71
|
-
rake db:drop RAILS_ENV=test
|
72
|
-
or
|
73
|
-
rake db:drop:all (to ensure that the tests do not rely on non-test data)
|
74
|
-
rake db:migrate RAILS_ENV=test
|
75
|
-
cd ..
|
76
|
-
</pre>
|
77
|
-
|
78
|
-
|
79
|
-
h2. Don't forget to stop Jetty!
|
80
|
-
|
81
|
-
It's easy to forget a running jetty, start another jetty process,
|
82
|
-
and then get confusing behavior because you have two jetty instances on the
|
83
|
-
same port.
|
84
|
-
|
85
|
-
To stop jetty:
|
86
|
-
From the rails application directory (my-hydra-head-test-app)
|
87
|
-
|
88
|
-
<pre>
|
89
|
-
rake jetty:stop
|
90
|
-
</pre>
|
91
|
-
|
92
|
-
Use ps to ensure the java process has stopped. If not, kill it manually.
|
93
|
-
|
94
|
-
h4. Clean out and reload the fixtures:
|
95
|
-
|
96
|
-
1. Stop jetty
|
97
|
-
|
98
|
-
<pre>
|
99
|
-
rake jetty:stop
|
100
|
-
</pre>
|
101
|
-
|
102
|
-
Use ps to ensure the java process has stopped. If not, kill it manually.
|
103
|
-
|
104
|
-
2. Clean out Solr and Fedora on Jetty
|
105
|
-
|
106
|
-
(Note: this will also wipe out the development data until we use the single solr instance of hydra-jetty)
|
107
|
-
|
108
|
-
TODO: can this be a single rake task?
|
109
|
-
|
110
|
-
<pre>
|
111
|
-
cd jetty
|
112
|
-
git clean -df
|
113
|
-
git checkout .
|
114
|
-
git status should show nothing to commit
|
115
|
-
cd .. (back to root of the _plugin_)
|
116
|
-
</pre>
|
117
|
-
|
118
|
-
3. Re-initialize and start Jetty:
|
119
|
-
|
120
|
-
<pre>
|
121
|
-
rake hydra:jetty:load RAILS_ENV=test
|
122
|
-
</pre>
|
123
|
-
|
124
|
-
4. Reload the pristine fixtures.
|
125
|
-
NOTE: to ensure that the tests do not rely on non-test data, do this first:
|
126
|
-
|
127
|
-
<pre>
|
128
|
-
rake hydra:default_fixtures:delete
|
129
|
-
</pre>
|
130
|
-
|
131
|
-
<pre>
|
132
|
-
rake hydra:default_fixtures:refresh environment=test
|
133
|
-
</pre>
|
@@ -1,49 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
|
4
|
-
<!--[if IE 7 ]> <html class="ie7"> <![endif]-->
|
5
|
-
<!--[if IE 8 ]> <html class="ie8"> <![endif]-->
|
6
|
-
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
|
7
|
-
<!--[if gt IE 9]> <html> <![endif]-->
|
8
|
-
<!--[if !IE]><!--> <html> <!--<![endif]-->
|
9
|
-
|
10
|
-
<head>
|
11
|
-
<meta charset="utf-8" />
|
12
|
-
|
13
|
-
<title><%= h(@page_title || application_name) %></title>
|
14
|
-
<link href="<%= url_for :controller=>'catalog',:action => 'opensearch', :format => 'xml', :only_path => false %>" title="<%= application_name%>" type="application/opensearchdescription+xml" rel="search"/>
|
15
|
-
|
16
|
-
<%= render_head_content %>
|
17
|
-
|
18
|
-
<!--[if IE]>
|
19
|
-
<%= stylesheet_link_tag('hydra/ie-styles', {:plugin=>"hydra-head", :media=>'all'}) %>
|
20
|
-
<%= stylesheet_link_tag('progressBox-ie6.css', {:plugin=>"hydra-head", :media=>'all'}) %>
|
21
|
-
<![endif]-->
|
22
|
-
</head>
|
23
|
-
|
24
|
-
<body class="<%= render_body_class %>">
|
25
|
-
|
26
|
-
<div id="doc4" class="yui-t2">
|
27
|
-
|
28
|
-
<div id="hd">
|
29
|
-
<%= render :partial => '/user_util_links' %>
|
30
|
-
<%= (params[:controller] == "catalog" and !params[:id]) ? "<span id='results_text'>Search Results</span>".html_safe : "" %>
|
31
|
-
</div>
|
32
|
-
|
33
|
-
<div id="bd">
|
34
|
-
<div id="yui-main">
|
35
|
-
<%= render :partial=>'/flash_msg' %>
|
36
|
-
<%= yield %>
|
37
|
-
</div>
|
38
|
-
<div class="yui-b sidebar"><%= sidebar_items.join('') %></div>
|
39
|
-
</div>
|
40
|
-
|
41
|
-
|
42
|
-
<div id="footer">
|
43
|
-
<div id="hydra_logo"><%= image_tag('hydra/powered_by_hydra.png', :plugin=>"hydra-head", :width => 80, :height => 50, :alt => "Hydra logo") %></div>
|
44
|
-
</div>
|
45
|
-
|
46
|
-
</div>
|
47
|
-
</body>
|
48
|
-
|
49
|
-
</html>
|
data/lib/railties/all_tests.rake
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
namespace :hyhead do
|
2
|
-
begin
|
3
|
-
require 'cucumber/rake/task'
|
4
|
-
require 'rspec/core'
|
5
|
-
require 'rspec/core/rake_task'
|
6
|
-
|
7
|
-
desc "Run HydraHead cucumber and rspec, with test solr"
|
8
|
-
task :all_tests => ['hyhead:spec:with_solr', 'hyhead:cucumber:with_solr']
|
9
|
-
|
10
|
-
namespace :all_tests do
|
11
|
-
desc "Run HydraHead rspec and cucumber tests with rcov"
|
12
|
-
rm "hyhead-coverage.data" if File.exist?("hyhead-coverage.data")
|
13
|
-
task :rcov => ['hyhead:spec:rcov', 'hyhead:cucumber:rcov']
|
14
|
-
end
|
15
|
-
|
16
|
-
rescue LoadError
|
17
|
-
desc "Not available! (cucumber and rspec not avail)"
|
18
|
-
task :all_tests do
|
19
|
-
abort 'Not available. Both cucumber and rspec need to be installed to run hyhead:all_tests'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
@@ -1,126 +0,0 @@
|
|
1
|
-
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
-
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
-
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
|
-
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
|
-
# files.
|
6
|
-
|
7
|
-
# Blacklight customization, trick Cucumber into looking in our current
|
8
|
-
# location for Rails.root, even though we're going to give it features
|
9
|
-
# from elsewhere.
|
10
|
-
ENV['RAILS_ROOT'] = Rails.root.to_s
|
11
|
-
|
12
|
-
# hyhead_features, where to find features inside hyhead source?
|
13
|
-
hyhead_features = File.expand_path("./test_support/features",HydraHead.root)
|
14
|
-
|
15
|
-
unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
|
16
|
-
|
17
|
-
vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
|
18
|
-
$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
|
19
|
-
|
20
|
-
begin
|
21
|
-
require 'cucumber/rake/task'
|
22
|
-
|
23
|
-
namespace :hyhead do
|
24
|
-
desc 'Alias for hyhead:cucumber:ok'
|
25
|
-
task :cucumber => 'hyhead:cucumber:ok'
|
26
|
-
|
27
|
-
namespace :cucumber do
|
28
|
-
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
|
29
|
-
# Blacklight customization, call features from external location, pass
|
30
|
-
# in feature location wtih cucumber_opts, yeah it's weird but that's how.
|
31
|
-
t.cucumber_opts = hyhead_features
|
32
|
-
|
33
|
-
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
|
34
|
-
t.fork = true # You may get faster startup if you set this to false
|
35
|
-
t.profile = 'default'
|
36
|
-
end
|
37
|
-
|
38
|
-
Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
|
39
|
-
# Blacklight customization, call features from external location, pass
|
40
|
-
# in feature location wtih cucumber_opts, yeah it's weird but that's how.
|
41
|
-
t.cucumber_opts = hyhead_features
|
42
|
-
|
43
|
-
|
44
|
-
t.binary = vendored_cucumber_bin
|
45
|
-
t.fork = true # You may get faster startup if you set this to false
|
46
|
-
t.profile = 'wip'
|
47
|
-
end
|
48
|
-
|
49
|
-
Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
|
50
|
-
# Blacklight customization, call features from external location, pass
|
51
|
-
# in feature location wtih cucumber_opts, yeah it's weird but that's how.
|
52
|
-
t.cucumber_opts = hyhead_features
|
53
|
-
|
54
|
-
t.binary = vendored_cucumber_bin
|
55
|
-
t.fork = true # You may get faster startup if you set this to false
|
56
|
-
t.profile = 'rerun'
|
57
|
-
end
|
58
|
-
|
59
|
-
if (RUBY_VERSION.to_f < 1.9) then
|
60
|
-
Cucumber::Rake::Task.new({:rcov => 'db:test:prepare'}, 'Run features with rcov') do |t|
|
61
|
-
# Blacklight customization, call features from external location, pass
|
62
|
-
# in feature location wtih cucumber_opts, yeah it's weird but that's how.
|
63
|
-
t.cucumber_opts = hyhead_features
|
64
|
-
|
65
|
-
|
66
|
-
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
|
67
|
-
t.fork = true # You may get faster startup if you set this to false
|
68
|
-
t.profile = 'default'
|
69
|
-
t.rcov = true
|
70
|
-
t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/,features\/ --aggregate hyhead-coverage.data}
|
71
|
-
t.rcov_opts << %[-o "#{HydraHead.root}/coverage"]
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
desc 'Run all features'
|
76
|
-
task :all => [:ok, :wip]
|
77
|
-
|
78
|
-
|
79
|
-
# Solr wrapper. for now just for hyhead:cucumber, plan to
|
80
|
-
# provide it for all variants eventually.
|
81
|
-
# if you would like to see solr startup messages on STDERR
|
82
|
-
# when starting solr test server during functional tests use:
|
83
|
-
#
|
84
|
-
# rake SOLR_CONSOLE=true
|
85
|
-
require File.expand_path('../jetty_solr_server.rb', __FILE__)
|
86
|
-
desc "hyhead:cucumber with jetty/solr launch"
|
87
|
-
task :with_solr do
|
88
|
-
# wrap tests with a test-specific Solr server
|
89
|
-
# Need to look up where the test jetty is located
|
90
|
-
# from solr.yml, we don't hardcode it anymore.
|
91
|
-
|
92
|
-
solr_yml_path = locate_path("config", "solr.yml")
|
93
|
-
jetty_path = if ( File.exists?( solr_yml_path ))
|
94
|
-
solr_config = YAML::load(File.open(solr_yml_path))
|
95
|
-
solr_config["test"]["jetty_path"] if solr_config["test"]
|
96
|
-
end
|
97
|
-
raise Exception.new("Can't find jetty path to start test jetty. Expect a jetty_path key in config/solr.yml for test environment.") unless jetty_path
|
98
|
-
|
99
|
-
JettySolrServer.new(
|
100
|
-
:jetty_home => File.expand_path(jetty_path, Rails.root),
|
101
|
-
:sleep_after_start => 2).wrap do
|
102
|
-
Rake::Task["hyhead:cucumber"].invoke
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
task :features => :cucumber do
|
113
|
-
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
|
114
|
-
end
|
115
|
-
|
116
|
-
# In case we don't have ActiveRecord, append a no-op task that we can depend upon.
|
117
|
-
task 'db:test:prepare' do
|
118
|
-
end
|
119
|
-
rescue LoadError
|
120
|
-
desc 'cucumber rake task not available (cucumber not installed)'
|
121
|
-
task :cucumber do
|
122
|
-
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
end
|