hydra-batch-edit 1.1.1 → 2.0.2

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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +21 -0
  4. data/.rubocop_todo.yml +278 -0
  5. data/.travis.yml +1 -5
  6. data/Gemfile +35 -0
  7. data/README.textile +8 -18
  8. data/Rakefile +17 -48
  9. data/app/assets/javascripts/{batch_edit.js.coffee → batch_edit/batch_edit.js.coffee} +0 -0
  10. data/app/assets/stylesheets/{batch_edit.css.scss → batch_edit/batch_edit.scss} +0 -0
  11. data/app/controllers/concerns/hydra/batch_edit_behavior.rb +2 -2
  12. data/hydra-batch-edit.gemspec +8 -5
  13. data/lib/generators/hydra_batch_edit/install_generator.rb +17 -0
  14. data/lib/generators/hydra_batch_edit/templates/batch_edit.js +1 -0
  15. data/lib/generators/hydra_batch_edit/templates/batch_edit.scss +1 -0
  16. data/lib/hydra-batch-edit.rb +1 -1
  17. data/lib/hydra/batch_edit.rb +0 -1
  18. data/lib/hydra/batch_edit/version.rb +1 -1
  19. data/spec/controllers/batch_edits_controller_spec.rb +43 -43
  20. data/spec/helpers/batch_edit_helper_spec.rb +3 -3
  21. data/spec/routing/batch_edit_routes_spec.rb +10 -10
  22. data/spec/spec_helper.rb +7 -4
  23. data/spec/support/config/initializers/hydra_config.rb +0 -28
  24. data/spec/{support → test_app_templates}/app/models/sample.rb +0 -0
  25. data/spec/{support → test_app_templates}/app/models/solr_document.rb +0 -0
  26. data/spec/{support → test_app_templates}/db/migrate/20111101221803_create_searches.rb +0 -0
  27. data/spec/test_app_templates/lib/generators/test_app_generator.rb +24 -0
  28. metadata +81 -38
  29. data/gemfiles/rails3.gemfile +0 -6
  30. data/gemfiles/rails4.gemfile +0 -6
  31. data/lib/hydra/batch_edit/search_service.rb +0 -62
  32. data/spec/lib/search_service_spec.rb +0 -41
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79fb47a9472e45137f813ca99cc4b0d1ab5cd42e
4
- data.tar.gz: ab0608ea60d01e4dbe0e2f1b3b3dd9957979c95d
3
+ metadata.gz: 69ea091b00ff503bd8818b9a8aee327d4e830b63
4
+ data.tar.gz: dd061b36c841a8143150dac1ea9da388e491b0e5
5
5
  SHA512:
6
- metadata.gz: 530d8a2f8ba67235d59270901a683bec9dcaee20e1734a57b9d19844e81e7d26a01df776e882fd985014538965c3d7d658094a2368196a74a7f465b15357be8e
7
- data.tar.gz: f7abaf0bdd6f51966014287156d25ab7ca9d2a257fdcdd43e997b1f7cbf671159d23bb788fc3b957e183b3c7fe94a92de46c1b967f44659392d8d971a677cdc7
6
+ metadata.gz: bd47ffb0ad55b19d8b8bfc66dd5593f88e679c2283082a8967d01f84c5776e3fb29f569610c76d8096f4a1eec265a175f7c2ec2ca0c710c12c81aa27b75a8c74
7
+ data.tar.gz: 4e0251902312a7ed1808b4c638861762612ea1f8662f524920b0b045e58d1090a599c10192dd03f80d986ef266644d19ec20434a0f9f1c25c50b31c0a652cbcc
data/.gitignore CHANGED
@@ -25,3 +25,5 @@ doc/
25
25
 
26
26
  *.swp
27
27
  *.swo
28
+
29
+ .internal_test_app
@@ -0,0 +1,21 @@
1
+ require: rubocop-rspec
2
+ inherit_from: .rubocop_todo.yml
3
+
4
+ AllCops:
5
+ DisplayCopNames: true
6
+ Include:
7
+ - '**/Rakefile'
8
+ - '**/config.ru'
9
+ Exclude:
10
+ - 'script/**/*'
11
+ - 'spec/test_app_templates/**/*'
12
+ - 'vendor/**/*'
13
+
14
+ Metrics/AbcSize:
15
+ Max: 16
16
+
17
+ Metrics/LineLength:
18
+ Max: 220
19
+
20
+ RSpec/InstanceVariable:
21
+ Enabled: false
@@ -0,0 +1,278 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2016-04-20 07:34:46 -0700 using RuboCop version 0.39.0.
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: 1
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
12
+ # SupportedStyles: start_of_line, def
13
+ Lint/DefEndAlignment:
14
+ Enabled: false
15
+
16
+ # Offense count: 1
17
+ # Cop supports --auto-correct.
18
+ # Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
19
+ # SupportedStyles: keyword, variable, start_of_line
20
+ Lint/EndAlignment:
21
+ Enabled: false
22
+
23
+ # Offense count: 1
24
+ # Cop supports --auto-correct.
25
+ Lint/StringConversionInInterpolation:
26
+ Exclude:
27
+ - 'spec/support/app/models/sample.rb'
28
+
29
+ # Offense count: 2
30
+ # Cop supports --auto-correct.
31
+ # Configuration parameters: IgnoreEmptyBlocks.
32
+ Lint/UnusedBlockArgument:
33
+ Exclude:
34
+ - 'app/controllers/concerns/hydra/batch_edit_behavior.rb'
35
+ - 'lib/hydra/batch_edit/routes.rb'
36
+
37
+ # Offense count: 2
38
+ # Cop supports --auto-correct.
39
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
40
+ Lint/UnusedMethodArgument:
41
+ Exclude:
42
+ - 'lib/hydra/batch_edit/search_service.rb'
43
+ - 'spec/support/app/models/sample.rb'
44
+
45
+ # Offense count: 4
46
+ Lint/Void:
47
+ Exclude:
48
+ - 'spec/controllers/batch_edits_controller_spec.rb'
49
+ - 'spec/support/lib/generators/test_app_generator.rb'
50
+
51
+ # Offense count: 2
52
+ # Configuration parameters: CountComments.
53
+ Metrics/MethodLength:
54
+ Max: 17
55
+
56
+ # Offense count: 1
57
+ RSpec/AnyInstance:
58
+ Exclude:
59
+ - 'spec/controllers/batch_edits_controller_spec.rb'
60
+
61
+ # Offense count: 1
62
+ RSpec/DescribeClass:
63
+ Exclude:
64
+ - 'spec/routing/batch_edit_routes_spec.rb'
65
+
66
+ # Offense count: 2
67
+ RSpec/DescribedClass:
68
+ Exclude:
69
+ - 'spec/lib/search_service_spec.rb'
70
+
71
+ # Offense count: 26
72
+ # Configuration parameters: CustomTransform, IgnoredWords.
73
+ RSpec/ExampleWording:
74
+ Exclude:
75
+ - 'spec/controllers/batch_edits_controller_spec.rb'
76
+ - 'spec/helpers/batch_edit_helper_spec.rb'
77
+ - 'spec/lib/search_service_spec.rb'
78
+ - 'spec/routing/batch_edit_routes_spec.rb'
79
+
80
+ # Offense count: 1
81
+ # Configuration parameters: CustomTransform.
82
+ RSpec/FilePath:
83
+ Exclude:
84
+ - 'spec/lib/search_service_spec.rb'
85
+
86
+ # Offense count: 1
87
+ # Cop supports --auto-correct.
88
+ Style/DefWithParentheses:
89
+ Exclude:
90
+ - 'spec/support/app/models/sample.rb'
91
+
92
+ # Offense count: 6
93
+ Style/Documentation:
94
+ Exclude:
95
+ - 'spec/**/*'
96
+ - 'test/**/*'
97
+ - 'app/controllers/batch_edits_controller.rb'
98
+ - 'app/controllers/concerns/hydra/batch_edit_behavior.rb'
99
+ - 'lib/hydra/batch_edit.rb'
100
+ - 'lib/hydra/batch_edit/routes.rb'
101
+ - 'lib/hydra/batch_edit/search_service.rb'
102
+
103
+ # Offense count: 3
104
+ # Cop supports --auto-correct.
105
+ Style/EmptyLines:
106
+ Exclude:
107
+ - 'spec/controllers/batch_edits_controller_spec.rb'
108
+ - 'spec/routing/batch_edit_routes_spec.rb'
109
+ - 'spec/spec_helper.rb'
110
+
111
+ # Offense count: 2
112
+ # Cop supports --auto-correct.
113
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
114
+ # SupportedStyles: empty_lines, no_empty_lines
115
+ Style/EmptyLinesAroundBlockBody:
116
+ Exclude:
117
+ - 'spec/controllers/batch_edits_controller_spec.rb'
118
+ - 'spec/routing/batch_edit_routes_spec.rb'
119
+
120
+ # Offense count: 2
121
+ # Cop supports --auto-correct.
122
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
123
+ # SupportedStyles: empty_lines, no_empty_lines
124
+ Style/EmptyLinesAroundClassBody:
125
+ Exclude:
126
+ - 'lib/hydra/batch_edit/routes.rb'
127
+ - 'spec/support/app/models/solr_document.rb'
128
+
129
+ # Offense count: 1
130
+ # Cop supports --auto-correct.
131
+ # Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
132
+ Style/ExtraSpacing:
133
+ Exclude:
134
+ - 'spec/support/db/migrate/20111101221803_create_searches.rb'
135
+
136
+ # Offense count: 1
137
+ # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts.
138
+ Style/FileName:
139
+ Exclude:
140
+ - 'lib/hydra-batch-edit.rb'
141
+
142
+ # Offense count: 1
143
+ # Configuration parameters: MinBodyLength.
144
+ Style/GuardClause:
145
+ Exclude:
146
+ - 'app/controllers/concerns/hydra/batch_edit_behavior.rb'
147
+
148
+ # Offense count: 61
149
+ # Cop supports --auto-correct.
150
+ # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
151
+ # SupportedStyles: ruby19, ruby19_no_mixed_keys, hash_rockets
152
+ Style/HashSyntax:
153
+ Enabled: false
154
+
155
+ # Offense count: 4
156
+ # Cop supports --auto-correct.
157
+ # Configuration parameters: Width.
158
+ Style/IndentationWidth:
159
+ Exclude:
160
+ - 'app/controllers/concerns/hydra/batch_edit_behavior.rb'
161
+ - 'lib/hydra/batch_edit.rb'
162
+
163
+ # Offense count: 3
164
+ # Cop supports --auto-correct.
165
+ Style/LeadingCommentSpace:
166
+ Exclude:
167
+ - 'app/controllers/concerns/hydra/batch_edit_behavior.rb'
168
+
169
+ # Offense count: 1
170
+ # Cop supports --auto-correct.
171
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
172
+ # SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
173
+ Style/MethodDefParentheses:
174
+ Enabled: false
175
+
176
+ # Offense count: 1
177
+ # Cop supports --auto-correct.
178
+ Style/MutableConstant:
179
+ Exclude:
180
+ - 'lib/hydra/batch_edit/version.rb'
181
+
182
+ # Offense count: 1
183
+ # Cop supports --auto-correct.
184
+ # Configuration parameters: AllowMultipleReturnValues.
185
+ Style/RedundantReturn:
186
+ Exclude:
187
+ - 'app/helpers/batch_edit_helper.rb'
188
+
189
+ # Offense count: 1
190
+ # Cop supports --auto-correct.
191
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
192
+ # SupportedStyles: space, no_space
193
+ Style/SpaceAroundEqualsInParameterDefault:
194
+ Enabled: false
195
+
196
+ # Offense count: 36
197
+ # Cop supports --auto-correct.
198
+ # Configuration parameters: AllowForAlignment.
199
+ Style/SpaceAroundOperators:
200
+ Exclude:
201
+ - 'app/controllers/concerns/hydra/batch_edit_behavior.rb'
202
+ - 'app/helpers/batch_edit_helper.rb'
203
+ - 'lib/hydra/batch_edit/routes.rb'
204
+ - 'lib/hydra/batch_edit/search_service.rb'
205
+ - 'spec/controllers/batch_edits_controller_spec.rb'
206
+ - 'spec/lib/search_service_spec.rb'
207
+ - 'spec/routing/batch_edit_routes_spec.rb'
208
+
209
+ # Offense count: 1
210
+ # Cop supports --auto-correct.
211
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
212
+ # SupportedStyles: space, no_space
213
+ Style/SpaceBeforeBlockBraces:
214
+ Enabled: false
215
+
216
+ # Offense count: 1
217
+ # Cop supports --auto-correct.
218
+ # Configuration parameters: AllowForAlignment.
219
+ Style/SpaceBeforeFirstArg:
220
+ Exclude:
221
+ - 'spec/support/db/migrate/20111101221803_create_searches.rb'
222
+
223
+ # Offense count: 2
224
+ # Cop supports --auto-correct.
225
+ # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
226
+ # SupportedStyles: space, no_space
227
+ Style/SpaceInsideBlockBraces:
228
+ Enabled: false
229
+
230
+ # Offense count: 18
231
+ # Cop supports --auto-correct.
232
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
233
+ # SupportedStyles: space, no_space
234
+ Style/SpaceInsideHashLiteralBraces:
235
+ Enabled: false
236
+
237
+ # Offense count: 11
238
+ # Cop supports --auto-correct.
239
+ Style/SpaceInsideParens:
240
+ Exclude:
241
+ - 'spec/controllers/batch_edits_controller_spec.rb'
242
+ - 'spec/routing/batch_edit_routes_spec.rb'
243
+
244
+ # Offense count: 90
245
+ # Cop supports --auto-correct.
246
+ # Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
247
+ # SupportedStyles: single_quotes, double_quotes
248
+ Style/StringLiterals:
249
+ Enabled: false
250
+
251
+ # Offense count: 3
252
+ # Cop supports --auto-correct.
253
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
254
+ # SupportedStyles: final_newline, final_blank_line
255
+ Style/TrailingBlankLines:
256
+ Exclude:
257
+ - 'app/controllers/batch_edits_controller.rb'
258
+ - 'lib/hydra/batch_edit/routes.rb'
259
+ - 'lib/hydra/batch_edit/search_service.rb'
260
+
261
+ # Offense count: 37
262
+ # Cop supports --auto-correct.
263
+ Style/TrailingWhitespace:
264
+ Exclude:
265
+ - 'app/controllers/concerns/hydra/batch_edit_behavior.rb'
266
+ - 'app/helpers/batch_edit_helper.rb'
267
+ - 'spec/controllers/batch_edits_controller_spec.rb'
268
+ - 'spec/routing/batch_edit_routes_spec.rb'
269
+ - 'spec/support/app/models/sample.rb'
270
+ - 'spec/support/app/models/solr_document.rb'
271
+
272
+ # Offense count: 1
273
+ # Cop supports --auto-correct.
274
+ # Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, Whitelist.
275
+ # Whitelist: to_ary, to_a, to_c, to_enum, to_h, to_hash, to_i, to_int, to_io, to_open, to_path, to_proc, to_r, to_regexp, to_str, to_s, to_sym
276
+ Style/TrivialAccessors:
277
+ Exclude:
278
+ - 'spec/support/app/models/sample.rb'
@@ -1,9 +1,5 @@
1
1
  rvm:
2
- - 2.0.0
3
-
4
- gemfile:
5
- - gemfiles/rails3.gemfile
6
- - gemfiles/rails4.gemfile
2
+ - 2.2.4
7
3
 
8
4
  notifications:
9
5
  irc: "irc.freenode.org#projecthydra"
data/Gemfile CHANGED
@@ -2,3 +2,38 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in hydra-batch-edit.gemspec
4
4
  gemspec
5
+
6
+ # BEGIN ENGINE_CART BLOCK
7
+ # engine_cart: 0.8.2
8
+ # engine_cart stanza: 0.8.0
9
+ # the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
10
+ file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path(".internal_test_app", File.dirname(__FILE__)))
11
+ if File.exist?(file)
12
+ begin
13
+ eval_gemfile file
14
+ rescue Bundler::GemfileError => e
15
+ Bundler.ui.warn '[EngineCart] Skipping Rails application dependencies:'
16
+ Bundler.ui.warn e.message
17
+ end
18
+ else
19
+ Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"
20
+
21
+ if ENV['RAILS_VERSION']
22
+ if ENV['RAILS_VERSION'] == 'edge'
23
+ gem 'rails', github: 'rails/rails'
24
+ ENV['ENGINE_CART_RAILS_OPTIONS']= "--edge --skip-turbolinks"
25
+ else
26
+ gem 'rails', ENV['RAILS_VERSION']
27
+ end
28
+ end
29
+
30
+ if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] =~ /^4.2/
31
+ gem 'responders', "~> 2.0"
32
+ gem 'sass-rails', ">= 5.0"
33
+ elsif ENV['RAILS_VERSION'] =~ /^5.0/ || ENV['RAILS_VERSION'] == 'edge'
34
+ # nop
35
+ else
36
+ gem 'sass-rails', "< 5.0"
37
+ end
38
+ end
39
+ # END ENGINE_CART BLOCK
@@ -1,6 +1,6 @@
1
1
  h1. hydra-batch-edit
2
2
 
3
- !https://travis-ci.org/projecthydra/hydra-batch-edit.png!:https://travis-ci.org/projecthydra/hydra-batch-edit !https://badge.fury.io/rb/hydra-batch-edit.png!:http://badge.fury.io/rb/hydra-batch-edit
3
+ !https://travis-ci.org/projecthydra-labs/hydra-batch-edit.png!:https://travis-ci.org/projecthydra-labs/hydra-batch-edit !https://badge.fury.io/rb/hydra-batch-edit.png!:http://badge.fury.io/rb/hydra-batch-edit
4
4
 
5
5
  Batch Editing Functionality for Hydra Heads
6
6
 
@@ -33,31 +33,21 @@ In your Gemfile, add
33
33
 
34
34
  <pre>gem 'hydra-batch-edit'</pre>
35
35
 
36
- # Call batch_edit_tools view helper in your search result page template. We recommend putting it in catalog/_sort_and_per_page.html.erb
37
- # Call batch_edit_continue in the search result page template. We put it in catalog/index.html
38
- # Call batch_edit_select(document) [passing in the solr document] on the index partial that's rendered for each search result
39
- # Add routes to config/routes.rb
40
- <pre>
41
- Hydra::BatchEdit.add_routes(self)
42
- </pre>
43
- # Add javascript to app/assets/javascripts/application.js
44
- <pre>
45
- //= require batch_edit
46
- </pre>
47
- # Add css to app/assets/stylesheets/application.css
36
+ # Run the install generator
48
37
  <pre>
49
- *= require batch_edit
38
+ $ rails g hydra_batch_edit:install
50
39
  </pre>
51
-
52
-
53
40
 
41
+ # Call batch_edit_tools view helper in your search result page template. We recommend putting it in catalog/_sort_and_per_page.html.erb
42
+ # Call batch_edit_continue in the search result page template. We put it in catalog/index.html
43
+ # Call batch_edit_select(document) [passing in the solr document] on the index partial that's rendered for each search result
54
44
 
55
45
  h2. Dependencies
56
46
 
57
47
  hydra-head
58
- hydra-collections
48
+ curation_concerns
59
49
  bootstrap
60
- blacklight.js
50
+ blacklight
61
51
  coffeescript & scss
62
52
 
63
53
 
data/Rakefile CHANGED
@@ -1,58 +1,27 @@
1
1
  #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
3
- require 'rspec/core/rake_task'
4
-
5
- ENV["RAILS_ROOT"] ||= 'spec/internal'
6
-
7
- desc 'Default: run specs.'
8
- task :default => :spec
9
-
10
-
11
- task :spec => [:generate] do |t|
12
- focused_spec = ENV['SPEC'] ? " SPEC=#{File.join(GEM_ROOT, ENV['SPEC'])}" : ''
13
- within_test_app do
14
- system "rake myspec#{focused_spec}"
15
- abort "Error running hydra-batch-edit" unless $?.success?
16
- end
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
17
6
  end
18
7
 
8
+ Bundler::GemHelper.install_tasks
19
9
 
10
+ task default: [:ci]
20
11
 
21
- desc "Create the test rails app"
22
- task :generate do
23
- unless File.exists?('spec/internal/Rakefile')
24
- puts "Generating rails app"
25
- `rails new spec/internal`
26
- puts "Updating gemfile"
27
- `echo "gem 'hydra-batch-edit', :path=>'../../../hydra-batch-edit'
28
- gem 'rspec-rails'
29
- " >> spec/internal/Gemfile`
30
- puts "Copying generator"
31
- `cp -r spec/support/lib/generators spec/internal/lib`
32
-
33
- within_test_app do
34
- puts "Bundle install"
35
- puts `bundle install`
36
- puts "running generator"
37
- puts `rails generate test_app`
12
+ require 'rspec/core/rake_task'
13
+ require 'engine_cart/rake_task'
14
+ require 'rubocop/rake_task'
38
15
 
39
- puts "running migrations"
40
- puts `rake db:migrate db:test:prepare`
41
- end
42
- end
43
- puts "Running specs"
16
+ desc 'Run style checker'
17
+ RuboCop::RakeTask.new(:rubocop) do |task|
18
+ task.requires << 'rubocop-rspec'
19
+ task.fail_on_error = true
44
20
  end
45
21
 
46
- desc "Clean out the test rails app"
47
- task :clean do
48
- puts "Removing sample rails app"
49
- `rm -rf spec/internal`
50
- end
22
+ RSpec::Core::RakeTask.new(:spec)
51
23
 
52
- def within_test_app
53
- FileUtils.cd('spec/internal')
54
- Bundler.with_clean_env do
55
- yield
56
- end
57
- FileUtils.cd('../..')
24
+ desc 'Start solr, fcrepo, and run specs'
25
+ task ci: ['rubocop', 'engine_cart:generate'] do
26
+ Rake::Task['spec'].invoke
58
27
  end