ldp 0.6.3 → 0.6.4

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: 6944a02432f0cdfd06b90e0649c3b3c36ad6f9df
4
- data.tar.gz: '0563854ee106d1bf2fb3076ecc43e031391cb862'
3
+ metadata.gz: 6c9572b864b81901aa96938e005067a143a02304
4
+ data.tar.gz: c445078867b6a3e1a7443a97f92664c6fd281398
5
5
  SHA512:
6
- metadata.gz: eac6a1ee8964d876f10bbab233dc387bffd974fd1ffb4b185b00be0c8b9768ae74d935b9e1aba08a039b82df2d4274b252099ec18d3386d4ebca3c01ca25464b
7
- data.tar.gz: 8190d1af09bd221e49a0f472df8dbeefe5a49a4c6bd2a151fcd68addd6f063a586b8201310df4d6f6fd5c8943162b1e21134a9a8bf01bb7b2cd7934cf309ceab
6
+ metadata.gz: 7ed4e30b6127803dca0e85348894e896082636bbb4441b83636fd83100267af5c01718f71782a34f5edde0a42b6ecb5c6b3efbaa39f384402c835dbc58d41abc
7
+ data.tar.gz: d541f160218cb123eab2a9ca7b236d6f0d6d4c72dc4c6931bbe6d7e50eb5bd520cb66423782b1cdb4b8755534ae4f49a19456f62846f2977d8a436232af546ea
@@ -0,0 +1,159 @@
1
+ # How to Contribute
2
+
3
+ We want your help to make Project Hydra great.
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
+
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
+
13
+ ## Hydra Project Intellectual Property Licensing and Ownership
14
+
15
+ All code contributors must have an Individual Contributor License Agreement (iCLA) on file with the Hydra Project Steering Group.
16
+ If the contributor works for an institution, the institution must have a Corporate Contributor License Agreement (cCLA) on file.
17
+
18
+ https://wiki.duraspace.org/display/hydra/Hydra+Project+Intellectual+Property+Licensing+and+Ownership
19
+
20
+ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the project.
21
+
22
+ ## Contribution Tasks
23
+
24
+ * Reporting Issues
25
+ * Making Changes
26
+ * Documenting Code
27
+ * Committing Changes
28
+ * Submitting Changes
29
+ * Reviewing and Merging Changes
30
+
31
+ ### Reporting Issues
32
+
33
+ * Make sure you have a [GitHub account](https://github.com/signup/free)
34
+ * Submit a [Github issue](./issues) by:
35
+ * Clearly describing the issue
36
+ * Provide a descriptive summary
37
+ * Explain the expected behavior
38
+ * Explain the actual behavior
39
+ * Provide steps to reproduce the actual behavior
40
+
41
+ ### Making Changes
42
+
43
+ * Fork the repository on GitHub
44
+ * Create a topic branch from where you want to base your work.
45
+ * This is usually the master branch.
46
+ * To quickly create a topic branch based on master; `git branch fix/master/my_contribution master`
47
+ * Then checkout the new branch with `git checkout fix/master/my_contribution`.
48
+ * Please avoid working directly on the `master` branch.
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
+
70
+ * Make commits of logical units.
71
+ * Your commit should include a high level description of your work in HISTORY.textile
72
+ * Check for unnecessary whitespace with `git diff --check` before committing.
73
+ * Make sure your commit messages are [well formed](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
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)
75
+
76
+ ```
77
+ Present tense short summary (50 characters or less)
78
+
79
+ More detailed description, if necessary. It should be wrapped to 72
80
+ characters. Try to be as descriptive as you can, even if you think that
81
+ the commit content is obvious, it may not be obvious to others. You
82
+ should add such description also if it's already present in bug tracker,
83
+ it should not be necessary to visit a webpage to check the history.
84
+
85
+ Include Closes #<issue-number> when relavent.
86
+
87
+ Description can have multiple paragraphs and you can use code examples
88
+ inside, just indent it with 4 spaces:
89
+
90
+ class PostsController
91
+ def index
92
+ respond_to do |wants|
93
+ wants.html { render 'index' }
94
+ end
95
+ end
96
+ end
97
+
98
+ You can also add bullet points:
99
+
100
+ - you can use dashes or asterisks
101
+
102
+ - also, try to indent next line of a point for readability, if it's too
103
+ long to fit in 72 characters
104
+ ```
105
+
106
+ ### Submitting Changes
107
+
108
+ * Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
109
+ * Make sure your branch is up to date with its parent branch (i.e. master)
110
+ * `git checkout master`
111
+ * `git pull --rebase`
112
+ * `git checkout <your-branch>`
113
+ * `git rebase master`
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))
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.
119
+ * Push your changes to a topic branch in your fork of the repository.
120
+ * Submit a pull request from your fork to the project.
121
+
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:
145
+
146
+ * Does the commit message explain what is going on?
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?
149
+ * Does the commit contain more than it should? Are two separate concerns being addressed in one commit?
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.
153
+
154
+ # Additional Resources
155
+
156
+ * [General GitHub documentation](http://help.github.com/)
157
+ * [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
158
+ * [Pro Git](http://git-scm.com/book) is both a free and excellent book about Git.
159
+ * [A Git Config for Contributing](http://ndlib.github.io/practices/my-typical-per-project-git-config/)
@@ -77,8 +77,9 @@ module Ldp
77
77
  ##
78
78
  # Create a new resource at the URI
79
79
  # @return [RdfSource] the new representation
80
+ # @raise [Ldp::Conflict] if you attempt to call create on an existing resource
80
81
  def create &block
81
- raise Ldp::Error, "Can't call create on an existing resource" unless new?
82
+ raise Ldp::Conflict, "Can't call create on an existing resource" unless new?
82
83
  verb = subject.nil? ? :post : :put
83
84
  resp = client.send(verb, (subject || @base_path), content) do |req|
84
85
  req.headers["Link"] = "<#{interaction_model}>;rel=\"type\"" if interaction_model
@@ -1,3 +1,3 @@
1
1
  module Ldp
2
- VERSION = "0.6.3"
2
+ VERSION = "0.6.4"
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require 'stringio'
2
2
  require 'spec_helper'
3
+ require 'rdf/vocab/dc'
3
4
 
4
5
  describe Ldp::Resource::RdfSource do
5
6
  let(:simple_graph) do
@@ -34,7 +35,18 @@ describe Ldp::Resource::RdfSource do
34
35
 
35
36
 
36
37
  describe "#create" do
37
- subject { Ldp::Resource::RdfSource.new mock_client, nil }
38
+ subject { rdf_source }
39
+ let(:rdf_source) { Ldp::Resource::RdfSource.new mock_client, nil }
40
+
41
+ context "if the resource already exists" do
42
+ subject { rdf_source.create }
43
+ before do
44
+ allow(rdf_source).to receive(:new?).and_return(false)
45
+ end
46
+ it "raises an error" do
47
+ expect { subject }.to raise_error Ldp::Conflict
48
+ end
49
+ end
38
50
 
39
51
  it "should return a new resource" do
40
52
  created_resource = subject.create
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ldp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-13 00:00:00.000000000 Z
11
+ date: 2017-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -216,6 +216,7 @@ extra_rdoc_files: []
216
216
  files:
217
217
  - ".gitignore"
218
218
  - ".travis.yml"
219
+ - CONTRIBUTING.md
219
220
  - Gemfile
220
221
  - LICENSE.txt
221
222
  - README.md