rubydora 1.9.1 → 2.0.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: 6a3cb0f516d462a7840ff2d05e13736c0e4049a0
4
- data.tar.gz: c6dfcef98d31c52456eda1997968b0e6f3ddc771
3
+ metadata.gz: f135092fa34c604d6cb3d8f32550fa05ad6c9cf0
4
+ data.tar.gz: 410e8527aff25c3cbd0af821feddb16e2e80b577
5
5
  SHA512:
6
- metadata.gz: 6bd6f39b559d69821166fc12211cdb190e5926f27b821434608e3a6fbcd1a93bc47bfb1e6ad82429946f91d227074f02bb27f30b7b5820ee4e893ee8d25686ef
7
- data.tar.gz: 5dec0ba2cdea2b353dde866fde0d7d42b3ecda766c7df003d27afb58665e891b24780a16bec782aa1ed2e7f346631d7b400debb87d8293088a0424d4002b02f7
6
+ metadata.gz: 161d6e64dcf7ce12b490c215eb6d5c33609e526596a91dd0777f7d4c681c2a49435f2b4f04b307ff5701cfa47c0d3ee4fd385b58ef94fa12d93a302a76bc5097
7
+ data.tar.gz: b872044de36daf6c140e4b10caaa884a2408b06c2b10f9318fa0afb6ab05e8c83324268076401cac4cd012ef61ef4d8b3864eceb506a4061cc7411f3de86fd51
@@ -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
 
data/Gemfile CHANGED
@@ -4,3 +4,4 @@ gemspec
4
4
 
5
5
  gem 'jruby-openssl', :platform => :jruby
6
6
  gem 'activesupport', '< 5' if RUBY_VERSION < '2.2.2'
7
+ gem 'rake', '< 12'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.9.1
1
+ 2.0.0
@@ -336,9 +336,8 @@ module Rubydora
336
336
  file = query_options.delete(:content)
337
337
  content_type = query_options.delete(:content_type) || query_options[:mimeType] || file_content_type(file)
338
338
  run_hook :before_add_datastream, :pid => pid, :dsid => dsid, :file => file, :options => options
339
- str = file.respond_to?(:read) ? file.read : file
340
339
  file.rewind if file.respond_to?(:rewind)
341
- ProfileParser.parse_datastream_profile(client[datastream_url(pid, dsid, query_options)].post(str, :content_type => content_type.to_s, :multipart => true))
340
+ ProfileParser.parse_datastream_profile(client[datastream_url(pid, dsid, query_options)].post(file, :content_type => content_type.to_s, :multipart => true))
342
341
  rescue Exception => exception
343
342
  rescue_with_handler(exception) || raise
344
343
  end
@@ -361,9 +360,8 @@ module Rubydora
361
360
  end
362
361
 
363
362
  run_hook :before_modify_datastream, :pid => pid, :dsid => dsid, :file => file, :content_type => content_type, :options => options
364
- str = file.respond_to?(:read) ? file.read : file
365
363
  file.rewind if file.respond_to?(:rewind)
366
- ProfileParser.parse_datastream_profile(client[datastream_url(pid, dsid, query_options)].put(str, rest_client_options))
364
+ ProfileParser.parse_datastream_profile(client[datastream_url(pid, dsid, query_options)].put(file, rest_client_options))
367
365
 
368
366
  rescue Exception => exception
369
367
  rescue_with_handler(exception) || raise
@@ -240,11 +240,11 @@ describe Rubydora::RestApiClient do
240
240
  @mock_repository.add_datastream :pid => 'mypid', :dsid => 'aaa'
241
241
  end
242
242
  describe "when a file is passed" do
243
- let!(:file) { StringIO.new('test', 'r') } # StringIO is a good stand it for a real File (it has read, rewind and close)
244
- it "should rewind the file" do
243
+ let!(:file) { StringIO.new('test', 'r') } # StringIO is a good stand in for a real File (it has read, rewind and close)
244
+ it "closes the file" do
245
245
  RestClient::Request.any_instance.should_receive(:transmit) #stub transmit so that Request.execute can close the file we pass
246
246
  @mock_repository.add_datastream :pid => 'mypid', :dsid => 'aaa', :content=>file
247
- lambda {file.read}.should_not raise_error
247
+ file.should be_closed
248
248
  end
249
249
  describe "and mimeType is not provided" do
250
250
  describe "and file responds to :content_type" do
@@ -282,10 +282,10 @@ describe Rubydora::RestApiClient do
282
282
  end
283
283
  describe "when a file is passed" do
284
284
  let!(:file) { StringIO.new('test', 'r') } # StringIO is a good stand it for a real File (it has read, rewind and close)
285
- it "should rewind the file" do
285
+ it "closes the file" do
286
286
  RestClient::Request.any_instance.should_receive(:transmit) #stub transmit so that Request.execute can close the file we pass
287
287
  @mock_repository.modify_datastream :pid => 'mypid', :dsid => 'aaa', :content=>file
288
- lambda {file.read}.should_not raise_error
288
+ file.should be_closed
289
289
  end
290
290
  describe "and mimeType is not provided" do
291
291
  describe "and file responds to :content_type" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubydora
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-17 00:00:00.000000000 Z
11
+ date: 2017-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -288,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
288
  version: '0'
289
289
  requirements: []
290
290
  rubyforge_project:
291
- rubygems_version: 2.5.1
291
+ rubygems_version: 2.6.8
292
292
  signing_key:
293
293
  specification_version: 4
294
294
  summary: Fedora Commons REST API ruby library