browse-everything 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 518594f6029b1a5f8a1d568f4ac1c6eae872a81f
4
- data.tar.gz: bb13d82ebbf15df963ee0a582ddc48fe639b9371
3
+ metadata.gz: d1321ca84320f83f10929d0559cb09f897f30f24
4
+ data.tar.gz: 1dca717478b686eebded6fb96b4822f636bdc8c3
5
5
  SHA512:
6
- metadata.gz: 19e62abcce0d050182c46752638587829bc26ab0457d14f2e76391cb34dfed2d36671fde45bf60575a16e0701eee41b4401f42916cbecb3bb371320dd01d8e55
7
- data.tar.gz: 0ff8b484d4c68adad2cbff83ae1cf7097bd259f21a6e261ae3c6379c7aa544014704837797952894046142d82f1766eb8ebef9b273e9dbf4b78fc81e604e80e6
6
+ metadata.gz: 2cbc9788fa805c061a81278640f3cca1f736f63a0df3e618d5761773a511c534cc3b4598f81989d3eeef0997ceb58ee26272bda85e57c9c495a68f8eda72493e
7
+ data.tar.gz: eddf4834ffde69d653627116e60178015152238258fbb2e56f3ce3257dc8ae082b3daf5e0da47b11c21227289e827e329d0bfcc0d19afd8e5b6e1e2bf0414987
@@ -1,16 +1,28 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
+ TargetRubyVersion: 2.1
5
+ DisplayCopNames: true
6
+ Include:
7
+ - '**/Rakefile'
4
8
  Exclude:
5
- - db/migrate/**
6
- - db/schema.rb
9
+ - 'vendor/**/*'
7
10
 
8
11
  Rails:
9
12
  Enabled: true
10
13
 
11
14
  # Configuration parameters: AllowURI, URISchemes.
12
15
  Metrics/LineLength:
13
- Max: 180
16
+ Max: 400
17
+
18
+ RSpec/NestedGroups:
19
+ Enabled: false
20
+
21
+ RSpec/FilePath:
22
+ Enabled: false
23
+
24
+ RSpec/LeadingSubject:
25
+ Enabled: false
14
26
 
15
27
  Style/NumericLiterals:
16
28
  MinDigits: 7
@@ -1,6 +1,8 @@
1
+ require: rubocop-rspec
2
+
1
3
  # This configuration was generated by
2
4
  # `rubocop --auto-gen-config`
3
- # on 2016-09-28 11:47:17 -0700 using RuboCop version 0.42.0.
5
+ # on 2017-02-28 11:01:25 -0500 using RuboCop version 0.42.0.
4
6
  # The point is for the user to remove these configuration records
5
7
  # one by one as the offenses are removed from the code base.
6
8
  # Note that changes in the inspected code, or installation of new
@@ -11,14 +13,9 @@ Lint/Loop:
11
13
  Exclude:
12
14
  - 'lib/browse_everything/driver/google_drive.rb'
13
15
 
14
- # Offense count: 10
16
+ # Offense count: 11
15
17
  Metrics/AbcSize:
16
- Max: 32
17
-
18
- # Offense count: 1
19
- # Configuration parameters: CountComments.
20
- Metrics/ClassLength:
21
- Max: 101
18
+ Max: 43
22
19
 
23
20
  # Offense count: 3
24
21
  Metrics/CyclomaticComplexity:
@@ -38,6 +35,28 @@ Metrics/ParameterLists:
38
35
  Metrics/PerceivedComplexity:
39
36
  Max: 9
40
37
 
38
+ # Offense count: 1
39
+ RSpec/DescribeClass:
40
+ Exclude:
41
+ - 'spec/javascripts/jasmine_spec.rb'
42
+
43
+ # Offense count: 2
44
+ # Configuration parameters: Max.
45
+ RSpec/ExampleLength:
46
+ Exclude:
47
+ - 'spec/features/select_files_spec.rb'
48
+ - 'spec/javascripts/jasmine_spec.rb'
49
+
50
+ # Offense count: 2
51
+ RSpec/MultipleExpectations:
52
+ Max: 2
53
+
54
+ # Offense count: 1
55
+ # Configuration parameters: IgnoreSymbolicNames.
56
+ RSpec/VerifiedDoubles:
57
+ Exclude:
58
+ - 'spec/views/browse_everything/_file.html.erb_spec.rb'
59
+
41
60
  # Offense count: 1
42
61
  Rails/OutputSafety:
43
62
  Exclude:
@@ -68,7 +87,7 @@ Style/ClassAndModuleChildren:
68
87
  - 'lib/generators/browse_everything/config_generator.rb'
69
88
  - 'lib/generators/browse_everything/install_generator.rb'
70
89
 
71
- # Offense count: 18
90
+ # Offense count: 19
72
91
  Style/Documentation:
73
92
  Enabled: false
74
93
 
@@ -139,11 +158,3 @@ Style/RegexpLiteral:
139
158
  Style/RescueModifier:
140
159
  Exclude:
141
160
  - 'lib/browse_everything/driver/file_system.rb'
142
-
143
- # Offense count: 1
144
- # Cop supports --auto-correct.
145
- # Configuration parameters: EnforcedStyle, SupportedStyles.
146
- # SupportedStyles: use_perl_names, use_english_names
147
- Style/SpecialGlobalVars:
148
- Exclude:
149
- - 'browse-everything.gemspec'
@@ -3,6 +3,13 @@
3
3
  We want your help to make Project Hydra great.
4
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
5
 
6
+ ## Code of Conduct
7
+
8
+ The Hydra community is dedicated to providing a welcoming and positive experience for all its
9
+ members, whether they are at a formal gathering, in a social setting, or taking part in activities
10
+ online. Please see our [Code of Conduct](https://wiki.duraspace.org/display/hydra/Code+of+Conduct)
11
+ for more information.
12
+
6
13
  ## Hydra Project Intellectual Property Licensing and Ownership
7
14
 
8
15
  All code contributors must have an Individual Contributor License Agreement (iCLA) on file with the Hydra Project Steering Group.
@@ -16,8 +23,10 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
16
23
 
17
24
  * Reporting Issues
18
25
  * Making Changes
26
+ * Documenting Code
27
+ * Committing Changes
19
28
  * Submitting Changes
20
- * Merging Changes
29
+ * Reviewing and Merging Changes
21
30
 
22
31
  ### Reporting Issues
23
32
 
@@ -38,8 +47,28 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
38
47
  * Then checkout the new branch with `git checkout fix/master/my_contribution`.
39
48
  * Please avoid working directly on the `master` branch.
40
49
  * You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
50
+ * Make sure you have added sufficient tests and documentation for your changes.
51
+ * Test functionality with RSpec; est features / UI with Capybara.
52
+ * Run _all_ the tests to assure nothing else was accidentally broken.
53
+
54
+ ### Documenting Code
55
+
56
+ * All new public methods, modules, and classes should include inline documentation in [YARD](http://yardoc.org/).
57
+ * Documentation should seek to answer the question "why does this code exist?"
58
+ * Document private / protected methods as desired.
59
+ * If you are working in a file with no prior documentation, do try to document as you gain understanding of the code.
60
+ * If you don't know exactly what a bit of code does, it is extra likely that it needs to be documented. Take a stab at it and ask for feedback in your pull request. You can use the 'blame' button on GitHub to identify the original developer of the code and @mention them in your comment.
61
+ * This work greatly increases the usability of the code base and supports the on-ramping of new committers.
62
+ * We will all be understanding of one another's time constraints in this area.
63
+ * YARD examples:
64
+ * [Hydra::Works::RemoveGenericFile](https://github.com/projecthydra-labs/hydra-works/blob/master/lib/hydra/works/services/generic_work/remove_generic_file.rb)
65
+ * [ActiveTriples::LocalName::Minter](https://github.com/ActiveTriples/active_triples-local_name/blob/master/lib/active_triples/local_name/minter.rb)
66
+ * [Getting started with YARD](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
67
+
68
+ ### Committing changes
69
+
41
70
  * Make commits of logical units.
42
- * Your commit should include a high level description of your work in HISTORY.textile
71
+ * Your commit should include a high level description of your work in HISTORY.textile
43
72
  * Check for unnecessary whitespace with `git diff --check` before committing.
44
73
  * Make sure your commit messages are [well formed](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
45
74
  * 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)
@@ -60,7 +89,9 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
60
89
 
61
90
  class PostsController
62
91
  def index
63
- respond_with Post.limit(10)
92
+ respond_to do |wants|
93
+ wants.html { render 'index' }
94
+ end
64
95
  end
65
96
  end
66
97
 
@@ -72,38 +103,53 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
72
103
  long to fit in 72 characters
73
104
  ```
74
105
 
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
106
  ### Submitting Changes
80
107
 
81
- [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
82
-
83
108
  * Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
84
109
  * Make sure your branch is up to date with its parent branch (i.e. master)
85
110
  * `git checkout master`
86
111
  * `git pull --rebase`
87
112
  * `git checkout <your-branch>`
88
113
  * `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`
114
+ * It is a good idea to run your tests again.
115
+ * If you've made more than one commit take a moment to consider whether squashing commits together would help improve their logical grouping.
116
+ * [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
117
+ * `git rebase --interactive master` ([See Github help](https://help.github.com/articles/interactive-rebase))
93
118
  * 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
119
  * Push your changes to a topic branch in your fork of the repository.
95
120
  * Submit a pull request from your fork to the project.
96
121
 
97
- ### Merging Changes
122
+ ### Reviewing and Merging Changes
123
+
124
+ We adopted [Github's Pull Request Review](https://help.github.com/articles/about-pull-request-reviews/) for our repositories.
125
+ Common checks that may occur in our repositories:
126
+
127
+ 1. Travis CI - where our automated tests are running
128
+ 2. Hound CI - where we check for style violations
129
+ 3. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
130
+ 4. CodeClimate - is our code remaining healthy (at least according to static code analysis)
131
+
132
+ If one or more of the required checks failed (or are incomplete), the code should not be merged (and the UI will not allow it). If all of the checks have passed, then anyone on the project (including the pull request submitter) may merge the code.
133
+
134
+ *Example: Carolyn submits a pull request, Justin reviews the pull request and approves. However, Justin is still waiting on other checks (Travis CI is usually the culprit), so he does not merge the pull request. Eventually, all of the checks pass. At this point, Carolyn or anyone else may merge the pull request.*
135
+
136
+ #### Things to Consider When Reviewing
137
+
138
+ First, the person contributing the code is putting themselves out there. Be mindful of what you say in a review.
139
+
140
+ * Ask clarifying questions
141
+ * State your understanding and expectations
142
+ * Provide example code or alternate solutions, and explain why
143
+
144
+ This is your chance for a mentoring moment of another developer. Take time to give an honest and thorough review of what has changed. Things to consider:
98
145
 
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
146
  * 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_
147
+ * Does the code changes have tests? _Not all changes need new tests, some changes are refactors_
148
+ * Do new or changed methods, modules, and classes have documentation?
103
149
  * 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.
150
+ * Does the description of the new/changed specs match your understanding of what the spec is doing?
151
+
152
+ If you are uncertain, bring other contributors into the conversation by assigning them as a reviewer.
107
153
 
108
154
  # Additional Resources
109
155
 
@@ -7,7 +7,7 @@ $ ->
7
7
 
8
8
  dialog.modal
9
9
  backdrop: 'static'
10
- show: false
10
+ show: false
11
11
  ctx =
12
12
  opts: $.extend(true, {}, options)
13
13
  callbacks:
@@ -15,7 +15,7 @@ $ ->
15
15
  done: $.Callbacks()
16
16
  cancel: $.Callbacks()
17
17
  fail: $.Callbacks()
18
- ctx.callback_proxy =
18
+ ctx.callback_proxy =
19
19
  show: (func) -> ctx.callbacks.show.add(func) ; return this
20
20
  done: (func) -> ctx.callbacks.done.add(func) ; return this
21
21
  cancel: (func) -> ctx.callbacks.cancel.add(func) ; return this
@@ -42,7 +42,7 @@ $ ->
42
42
  $('input.ev-url').each () ->
43
43
  if this.value == $(row).data('ev-location')
44
44
  result = true
45
- return result
45
+ return result
46
46
 
47
47
  toggleFileSelect = (row) ->
48
48
  row.toggleClass('ev-selected')
@@ -57,11 +57,15 @@ $ ->
57
57
  file_location = row.data('ev-location')
58
58
  hidden_input = $("<input type='hidden' class='ev-url' name='selected_files[]'/>").val(file_location)
59
59
  target_form.append(hidden_input)
60
+ unless $(row).find('.ev-select-file').prop('checked')
61
+ $(row).find('.ev-select-file').prop('checked', true)
60
62
 
61
63
  unselectFile = (row) ->
62
64
  target_form = $('form.ev-submit-form')
63
65
  file_location = row.data('ev-location')
64
66
  $("form.ev-submit-form input[value='#{file_location}']").remove()
67
+ if $(row).find('.ev-select-file').prop('checked')
68
+ $(row).find('.ev-select-file').prop('checked', false)
65
69
 
66
70
  updateFileCount = () ->
67
71
  count = $('input.ev-url').length
@@ -144,6 +148,7 @@ $ ->
144
148
  set_size = (selector, pct) ->
145
149
  $(selector, table).width(full_width * pct).css('width',full_width * pct).css('max-width',full_width * pct)
146
150
  set_size '.ev-file', 0.4
151
+ set_size '.ev-container', 0.4
147
152
  set_size '.ev-size', 0.1
148
153
  set_size '.ev-kind', 0.3
149
154
  set_size '.ev-date', 0.2
@@ -178,7 +183,7 @@ $ ->
178
183
 
179
184
  refreshFiles = ->
180
185
  $('.ev-providers select').change()
181
-
186
+
182
187
  $(window).on('resize', -> sizeColumns($('table#file-list')))
183
188
 
184
189
  $.fn.browseEverything = (options) ->
@@ -188,29 +193,29 @@ $ ->
188
193
  ctx = initialize(this[0], options)
189
194
  $(this).click () ->
190
195
  dialog.data('ev-state',ctx)
191
- dialog.load ctx.opts.route, () ->
196
+ dialog.load ctx.opts.route, () ->
192
197
  setTimeout refreshFiles, 500
193
198
  ctx.callbacks.show.fire()
194
199
  dialog.modal('show')
195
200
 
196
201
  if ctx
197
202
  ctx.callback_proxy
198
- else
199
- {
203
+ else
204
+ {
200
205
  show: -> this
201
206
  done: -> this
202
207
  cancel: -> this
203
- fail: -> this
208
+ fail: -> this
204
209
  }
205
210
 
206
211
  $.fn.browseEverything.toggleCheckbox = (box) ->
207
212
  if box.value == "0"
208
213
  $(box).prop('value', "1")
209
214
  else
210
- $(box).prop('value', "0")
215
+ $(box).prop('value', "0")
211
216
 
212
217
  $(document).on 'ev.refresh', (event) -> refreshFiles()
213
-
218
+
214
219
  $(document).on 'click', 'button.ev-cancel', (event) ->
215
220
  event.preventDefault()
216
221
  dialog.data('ev-state').callbacks.cancel.fire()
@@ -239,7 +244,7 @@ $ ->
239
244
  $('body').css('cursor','default')
240
245
  $('.ev-browser').modal('hide')
241
246
  $('#browse-btn').focus()
242
-
247
+
243
248
  $(document).on 'click', '.ev-files .ev-container a.ev-link', (event) ->
244
249
  event.stopPropagation()
245
250
  event.preventDefault()
@@ -251,7 +256,7 @@ $ ->
251
256
  $(document).on 'change', '.ev-providers select', (event) ->
252
257
  event.preventDefault()
253
258
  $('body').css('cursor','wait')
254
- $.ajax
259
+ $.ajax
255
260
  url: $(this).val(),
256
261
  data:
257
262
  accept: dialog.data('ev-state').opts.accept
@@ -300,10 +305,15 @@ $ ->
300
305
  else
301
306
  selectChildRows(row, action)
302
307
 
308
+ $(document).on 'change', 'input.ev-select-file', (event) ->
309
+ event.stopPropagation()
310
+ event.preventDefault()
311
+ toggleFileSelect($(this).closest('tr'))
312
+
303
313
 
304
314
  auto_toggle = ->
305
315
  triggers = $('*[data-toggle=browse-everything]')
306
- triggers.each () ->
316
+ triggers.each () ->
307
317
  ctx = $(this).data('ev-state')
308
318
  $(this).browseEverything($(this).data()) unless ctx?
309
319
 
@@ -16,17 +16,17 @@
16
16
  margin: 0 0 0 -37.5%;
17
17
  left: 50%;
18
18
  top: 10%;
19
- background-color: initial;
19
+ background-color: initial;
20
20
  width: 75%;
21
21
 
22
22
  div {
23
23
  background-color: white;
24
24
  }
25
-
25
+
26
26
  .modal-header {
27
27
  padding: 8px;
28
28
  }
29
-
29
+
30
30
  .modal-body {
31
31
  overflow: hidden;
32
32
  }
@@ -38,17 +38,16 @@
38
38
  .row {
39
39
  margin: inherit;
40
40
  }
41
-
41
+
42
42
  .ev-files {
43
43
  position: relative;
44
44
  overflow-x: auto;
45
45
  overflow-y: auto;
46
46
 
47
- li {
47
+ li {
48
48
  overflow: hidden;
49
49
  text-overflow: ellipsis;
50
50
  .ev-file-name {
51
- // padding: 0px 6px;
52
51
  white-space: nowrap;
53
52
  }
54
53
  border-top: none;
@@ -105,14 +104,14 @@
105
104
  }
106
105
  }
107
106
  }
108
-
107
+
109
108
  .ev-files {
110
109
  height: 50vh;
111
110
  li { @include ev-link; }
112
111
  }
113
-
112
+
114
113
  .ev-providers {
115
114
  select { width: 30% }
116
115
  }
117
116
 
118
- }
117
+ }
@@ -4,6 +4,8 @@ class BrowseEverythingController < ActionController::Base
4
4
  layout 'browse_everything'
5
5
  helper BrowseEverythingHelper
6
6
 
7
+ protect_from_forgery with: :exception
8
+
7
9
  after_action { session["#{provider_name}_token"] = provider.token unless provider.nil? }
8
10
 
9
11
  def index