ldp 0.6.4 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,36 @@
1
+ The Samvera community is dedicated to providing a welcoming and
2
+ positive experience for all its members, whether they are at a formal
3
+ gathering, in a social setting, or taking part in activities online.
4
+ The Samvera community welcomes participation from people all over the
5
+ world and these members bring with them a wide variety of
6
+ professional, personal and social backgrounds; whatever these may be,
7
+ we treat colleagues with dignity and respect.
8
+
9
+ Community members communicate primarily in English, though for many of
10
+ them this is not their native language. We therefore strive to express
11
+ ourselves simply and clearly remembering that unnecessary use of
12
+ jargon and slang will be a barrier to understanding for many of our
13
+ colleagues. We are sensitive to the fact that the international
14
+ nature of the community means that we span many different social norms
15
+ around language and behaviour and we strive to conduct ourselves,
16
+ online and in person, in ways that are unlikely to cause offence.
17
+
18
+ Samvera conversations are often information-rich and intended to
19
+ generate discussion and debate. We discuss ideas from a standpoint of
20
+ mutual respect and reasoned argument.
21
+
22
+ Community members work together to promote a respectful and safe
23
+ community. In the event that someone’s conduct is causing offence or
24
+ distress, Samvera has a detailed
25
+ [Anti-Harassment Policy and Protocol](https://wiki.duraspace.org/display/samvera/Anti-Harassment+Policy)
26
+ which can be applied to address the problem. The first step in dealing
27
+ with any serious misconduct is to contact a local meeting organizer,
28
+ the
29
+ [Samvera community helpers](https://wiki.duraspace.org/display/samvera/Samvera+Community+Helpers)
30
+ ([email](mailto:helpers@samvera.org)), a community member you
31
+ trust, or the
32
+ [Samvera Steering Group](https://wiki.duraspace.org/display/samvera/Samvera+Steering+Group+membership)
33
+ immediately; at Samvera events, these people can be identified by
34
+ distinctive name badges. The
35
+ [Policy and Protocol](https://wiki.duraspace.org/display/samvera/Anti-Harassment+Policy)
36
+ should be consulted for fuller details.
@@ -1,21 +1,24 @@
1
1
  # How to Contribute
2
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.
3
+ We want your help to make the Samvera community great. There are a few guidelines
4
+ that we need contributors to follow so that we can have a chance of
5
+ keeping on top of things.
5
6
 
6
7
  ## Code of Conduct
7
8
 
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.
9
+ The Samvera Community is dedicated to providing a welcoming and positive
10
+ experience for all its members, whether they are at a formal gathering, in
11
+ a social setting, or taking part in activities online. Please see our
12
+ [Code of Conduct](CODE_OF_CONDUCT.md) for more information.
12
13
 
13
- ## Hydra Project Intellectual Property Licensing and Ownership
14
+ ## Samvera Community Intellectual Property Licensing and Ownership
14
15
 
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.
16
+ All code contributors must have an Individual Contributor License Agreement
17
+ (iCLA) on file with the Samvera Steering Group. If the contributor works for
18
+ an institution, the institution must have a Corporate Contributor License
19
+ Agreement (cCLA) on file.
17
20
 
18
- https://wiki.duraspace.org/display/hydra/Hydra+Project+Intellectual+Property+Licensing+and+Ownership
21
+ https://wiki.duraspace.org/display/samvera/Samvera+Community+Intellectual+Property+Licensing+and+Ownership
19
22
 
20
23
  You should also add yourself to the `CONTRIBUTORS.md` file in the root of the project.
21
24
 
@@ -31,7 +34,7 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
31
34
  ### Reporting Issues
32
35
 
33
36
  * Make sure you have a [GitHub account](https://github.com/signup/free)
34
- * Submit a [Github issue](./issues) by:
37
+ * Submit a [Github issue](https://github.com/samvera/ldp/issues) by:
35
38
  * Clearly describing the issue
36
39
  * Provide a descriptive summary
37
40
  * Explain the expected behavior
@@ -48,7 +51,7 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
48
51
  * Please avoid working directly on the `master` branch.
49
52
  * You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
50
53
  * Make sure you have added sufficient tests and documentation for your changes.
51
- * Test functionality with RSpec; est features / UI with Capybara.
54
+ * Test functionality with RSpec; Test features / UI with Capybara.
52
55
  * Run _all_ the tests to assure nothing else was accidentally broken.
53
56
 
54
57
  ### Documenting Code
@@ -60,15 +63,11 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
60
63
  * 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
64
  * This work greatly increases the usability of the code base and supports the on-ramping of new committers.
62
65
  * 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
66
  * [Getting started with YARD](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
67
67
 
68
68
  ### Committing changes
69
69
 
70
70
  * Make commits of logical units.
71
- * Your commit should include a high level description of your work in HISTORY.textile
72
71
  * Check for unnecessary whitespace with `git diff --check` before committing.
73
72
  * Make sure your commit messages are [well formed](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
74
73
  * 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)
@@ -103,6 +102,10 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
103
102
  long to fit in 72 characters
104
103
  ```
105
104
 
105
+ * Make sure you have added the necessary tests for your changes.
106
+ * Run _all_ the tests to assure nothing else was accidentally broken.
107
+ * When you are ready to submit a pull request
108
+
106
109
  ### Submitting Changes
107
110
 
108
111
  * Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
@@ -125,9 +128,7 @@ We adopted [Github's Pull Request Review](https://help.github.com/articles/about
125
128
  Common checks that may occur in our repositories:
126
129
 
127
130
  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
+ 2. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
131
132
 
132
133
  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
 
@@ -144,16 +145,17 @@ First, the person contributing the code is putting themselves out there. Be mind
144
145
  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
 
146
147
  * 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
+ * Does the code changes have tests? _Not all changes need new tests, some changes are refactorings_
148
149
  * Do new or changed methods, modules, and classes have documentation?
149
150
  * Does the commit contain more than it should? Are two separate concerns being addressed in one commit?
150
151
  * Does the description of the new/changed specs match your understanding of what the spec is doing?
152
+ * Did the Travis tests complete successfully?
151
153
 
152
154
  If you are uncertain, bring other contributors into the conversation by assigning them as a reviewer.
153
155
 
154
156
  # Additional Resources
155
157
 
156
158
  * [General GitHub documentation](http://help.github.com/)
157
- * [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
159
+ * [GitHub pull request documentation](https://help.github.com/articles/about-pull-requests/)
158
160
  * [Pro Git](http://git-scm.com/book) is both a free and excellent book about Git.
159
161
  * [A Git Config for Contributing](http://ndlib.github.io/practices/my-typical-per-project-git-config/)
data/Gemfile CHANGED
@@ -3,8 +3,16 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in ldp-client.gemspec
4
4
  gemspec
5
5
 
6
- gem 'slop', '~> 3.6' if RUBY_PLATFORM == "java"
6
+ # gem 'slop', '~> 3.6' if RUBY_PLATFORM == "java"
7
7
  gem 'byebug', platforms: [:mri]
8
8
  gem 'activesupport'
9
9
  gem 'capybara_discoball', '~> 0.0.2'
10
- gem 'derby', '~> 0.1.0'
10
+ gem 'derby', '~> 1.0'
11
+
12
+ if ENV['RAILS_VERSION']
13
+ if ENV['RAILS_VERSION'] == 'edge'
14
+ gem 'rails', github: 'rails/rails'
15
+ else
16
+ gem 'rails', ENV['RAILS_VERSION']
17
+ end
18
+ end
@@ -1,4 +1,6 @@
1
- Copyright (c) 2013 Chris Beer
1
+ Copyright 2013 Chris Beer
2
+ Copyright 2014 Data Curation Experts
3
+ Additional copyright may be held by others, as reflected in the commit history.
2
4
 
3
5
  Licensed under the Apache License, Version 2.0 (the "License");
4
6
  you may not use this file except in compliance with the License.
data/README.md CHANGED
@@ -1,9 +1,34 @@
1
1
  # Ldp.rb
2
2
 
3
- [![Build Status](https://travis-ci.org/projecthydra/ldp.png?branch=master)](https://travis-ci.org/projecthydra/ldp)
3
+ Code:
4
+ [![Build Status](https://circleci.com/gh/samvera/ldp.svg?style=svg)](https://circleci.com/gh/samvera/ldp)
5
+ [![Version](https://badge.fury.io/rb/ldp.png)](http://badge.fury.io/rb/ldp)
6
+ [![Coverage Status](https://coveralls.io/repos/github/samvera/ldp/badge.svg?branch=master)](https://coveralls.io/github/samvera/ldp?branch=master)
7
+
8
+ Docs:
9
+ [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
10
+ [![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE.txt)
11
+
12
+ Jump In: [![Slack Status](http://slack.samvera.org/badge.svg)](http://slack.samvera.org/)
13
+
14
+ # What is ldp?
4
15
 
5
16
  Linked Data Platform client library for Ruby
6
17
 
18
+ ## Product Owner & Maintenance
19
+
20
+ **ldp** is a Core Component of the Samvera community. The documentation for
21
+ what this means can be found
22
+ [here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
23
+
24
+ ### Product Owner
25
+
26
+ [randalldfloyd](https://github.com/randalldfloyd)
27
+
28
+ # Help
29
+
30
+ The Samvera community is here to help. Please see our [support guide](./SUPPORT.md).
31
+
7
32
  ## Installation
8
33
 
9
34
  Add this line to your application's Gemfile:
@@ -36,22 +61,30 @@ orm.graph.insert([orm.resource.subject_uri, RDF::DC11.title, 'a new title'])
36
61
  # save changes
37
62
  orm.save
38
63
  ```
64
+ ## Testing:
65
+
66
+ - Set Rails version you want to test against. For example:
67
+
68
+ - `export RAILS_VERSION=5.1.4`
69
+
70
+ - Ensure that the correct version of Rails is installed: `bundle update`
39
71
 
40
- ### Fedora Commons notes
41
- Due to some discrepancies with alpha version of Fedora Commons, you may need to do some things differently:
42
- * [Can't load resources from Fedora 4](https://github.com/projecthydra/ldp/issues/1)
43
- * [orm.save with an rdf:type doesn't work with Fedora 4.0.0-alpha-3](https://github.com/projecthydra/ldp/issues/2)
72
+ - And run tests: `bundle exec rake rspec`
44
73
 
45
- ## Contributing
74
+ ## Releasing
46
75
 
47
- 1. Fork it
48
- 2. Create your feature branch (`git checkout -b my-new-feature`)
49
- 3. Commit your changes (`git commit -am 'Add some feature'`)
50
- 4. Push to the branch (`git push origin my-new-feature`)
51
- 5. Create new Pull Request
76
+ 1. `bundle install`
77
+ 2. Increase the version number in `lib/ldp/version.rb`
78
+ 3. Increase the same version number in `.github_changelog_generator`
79
+ 4. Update `CHANGELOG.md` by running this command:
80
+ ```
81
+ github_changelog_generator --user samvera --project ldp --token YOUR_GITHUB_TOKEN_HERE
82
+ ```
83
+ 5. Commit these changes to the master branch
84
+ 6. Run `rake release`
52
85
 
53
- # Project Hydra
54
- This software has been developed by and is brought to you by the Hydra community. Learn more at the
55
- [Project Hydra website](http://projecthydra.org)
86
+ # Acknowledgments
87
+ This software has been developed by and is brought to you by the Samvera community. Learn more at the
88
+ [Samvera website](http://samvera.org)
56
89
 
57
- ![Project Hydra Logo](https://github.com/uvalib/libra-oa/blob/a6564a9e5c13b7873dc883367f5e307bf715d6cf/public/images/powered_by_hydra.png?raw=true)
90
+ ![Samvera Logo](https://wiki.duraspace.org/download/thumbnails/87459292/samvera-fall-font2-200w.png?version=1&modificationDate=1498550535816&api=v2)
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task :default => :spec
@@ -0,0 +1,5 @@
1
+ If you would like to report an issue, first search [the list of issues](https://github.com/samvera/ldp/issues/) to see if someone else has already reported it, and then feel free to [create a new issue](https://github.com/samvera/ldp/issues/new).
2
+
3
+ If you have questions or need help, please email [the Samvera community tech list](https://groups.google.com/forum/#!forum/samvera-tech) or stop by the #dev channel in [the Samvera community Slack team](https://wiki.duraspace.org/pages/viewpage.action?pageId=87460391#Getintouch!-Slack).
4
+
5
+ You can learn more about the various Samvera communication channels on the [Get in touch!](https://wiki.duraspace.org/pages/viewpage.action?pageId=87460391) wiki page.
data/bin/ldp CHANGED
@@ -17,13 +17,11 @@ rescue Ldp::NotFound
17
17
  end
18
18
 
19
19
  do_help = lambda do |x|
20
-
21
20
  x.command 'help' do
22
21
  run do |opts, args|
23
22
  puts opts.help
24
23
  end
25
24
  end
26
-
27
25
  end
28
26
 
29
27
  Slop.parse do
@@ -34,7 +32,7 @@ Slop.parse do
34
32
  end
35
33
 
36
34
  on :host=, "Host"
37
-
35
+
38
36
  do_help.call(self)
39
37
 
40
38
  command 'get' do
@@ -92,7 +90,7 @@ Slop.parse do
92
90
  on :host=, "Host"
93
91
  do_help.call(self)
94
92
 
95
- run do |opts, (path,file)|
93
+ run do |opts, (path, file)|
96
94
  with_error_handling do
97
95
  host = opts[:host] || ENV['LDP_HOST']
98
96
  if file.nil?
@@ -112,7 +110,7 @@ Slop.parse do
112
110
  on :host=, "Host"
113
111
  do_help.call(self)
114
112
 
115
- run do |opts, (path,file)|
113
+ run do |opts, (path, file)|
116
114
  with_error_handling do
117
115
  host = opts[:host] || ENV['LDP_HOST']
118
116
  if file.nil?
@@ -28,9 +28,12 @@ Gem::Specification.new do |spec|
28
28
  spec.add_dependency "http_logger"
29
29
  spec.add_dependency "deprecation"
30
30
  spec.add_dependency "slop"
31
- spec.add_development_dependency "bundler", "~> 1.3"
31
+ spec.add_development_dependency "bundler", "~> 2.0"
32
32
  spec.add_development_dependency "rake"
33
33
  spec.add_development_dependency "rspec"
34
34
  spec.add_development_dependency "coveralls"
35
35
  spec.add_development_dependency "simplecov"
36
+ spec.add_development_dependency "rspec_junit_formatter"
37
+ spec.add_development_dependency 'bixby', '~> 3.0.0'
38
+ spec.add_development_dependency 'github_changelog_generator'
36
39
  end
@@ -2,7 +2,6 @@
2
2
  # LDP client for presenting an ORM on top of an LDP resource
3
3
  module Ldp
4
4
  class Client
5
-
6
5
  require 'ldp/client/methods'
7
6
  require 'ldp/client/prefer_headers'
8
7
  include Ldp::Client::Methods
@@ -11,14 +10,14 @@ module Ldp
11
10
 
12
11
  def initialize(*args)
13
12
  http_client, options = if args.length == 2
14
- args
15
- elsif args.length == 1 && args.first.is_a?(Faraday::Connection)
16
- [args.first, {}]
17
- elsif args.length == 1
18
- [nil, args.first]
19
- else
20
- raise ArgumentError
21
- end
13
+ args
14
+ elsif args.length == 1 && args.first.is_a?(Faraday::Connection)
15
+ [args.first, {}]
16
+ elsif args.length == 1
17
+ [nil, args.first]
18
+ else
19
+ raise ArgumentError
20
+ end
22
21
 
23
22
  @options = options
24
23
 
@@ -3,7 +3,6 @@ require 'faraday'
3
3
  ##
4
4
  # HTTP client methods for making requests to an LDP resource and getting a response back.
5
5
  module Ldp::Client::Methods
6
-
7
6
  attr_reader :http
8
7
  def initialize_http_client *http_client
9
8
  if http_client.length == 1 and http_client.first.is_a? Faraday::Connection
@@ -117,36 +116,37 @@ module Ldp::Client::Methods
117
116
  resp.tap do |resp|
118
117
  unless resp.status < 400
119
118
  raise case resp.status
120
- when 400
121
- if resp.env.method == :head
122
- # If the request was a HEAD request (which only retrieves HTTP headers),
123
- # re-run it as a GET in order to retrieve a message body (which is passed on as the error message)
124
- get(resp.env.url.path)
125
- else
126
- Ldp::BadRequest.new(resp.body)
127
- end
128
- when 404
129
- Ldp::NotFound.new(resp.body)
130
- when 409
131
- Ldp::Conflict.new(resp.body)
132
- when 410
133
- Ldp::Gone.new(resp.body)
134
- when 412
135
- Ldp::PreconditionFailed.new(resp.body)
136
- else
137
- Ldp::HttpError.new("STATUS: #{resp.status} #{resp.body[0, 1000]}...")
138
- end
119
+ when 400
120
+ if resp.env.method == :head
121
+ # If the request was a HEAD request (which only retrieves HTTP headers),
122
+ # re-run it as a GET in order to retrieve a message body (which is passed on as the error message)
123
+ get(resp.env.url.path)
124
+ else
125
+ Ldp::BadRequest.new(resp.body)
126
+ end
127
+ when 404
128
+ Ldp::NotFound.new(resp.body)
129
+ when 409
130
+ Ldp::Conflict.new(resp.body)
131
+ when 410
132
+ Ldp::Gone.new(resp.body)
133
+ when 412
134
+ Ldp::PreconditionFailed.new(resp.body)
135
+ else
136
+ Ldp::HttpError.new("STATUS: #{resp.status} #{resp.body[0, 1000]}...")
137
+ end
139
138
  end
140
139
  end
141
140
  end
142
141
 
143
142
  def default_headers
144
- {"Content-Type"=>"text/turtle"}
143
+ { "Content-Type" => "text/turtle" }
145
144
  end
146
145
 
147
146
  def default_patch_headers
148
- {"Content-Type"=>"application/sparql-update"}
147
+ { "Content-Type" => "application/sparql-update" }
149
148
  end
149
+
150
150
  ##
151
151
  # Some valid query paths can be mistaken for absolute URIs
152
152
  # with an alternative scheme. If the scheme isn't HTTP(S), assume
@@ -2,7 +2,7 @@ module Ldp
2
2
  class PreferHeaders
3
3
  attr_reader :headers_string
4
4
 
5
- def initialize(headers_string="")
5
+ def initialize(headers_string = "")
6
6
  @headers_string = headers_string
7
7
  end
8
8
 
@@ -54,11 +54,11 @@ module Ldp
54
54
  end
55
55
 
56
56
  def options
57
- headers_string.gsub('"',"").
58
- split(";").
59
- map{|x| x.strip.split("=")}.
60
- map{|x| { x[0] => x[1].split(" ") }}.
61
- inject({}, &:merge)
57
+ headers_string.gsub('"', "")
58
+ .split(";")
59
+ .map { |x| x.strip.split("=") }
60
+ .map { |x| { x[0] => x[1].split(" ") } }
61
+ .inject({}, &:merge)
62
62
  end
63
63
  end
64
64
  end
@@ -1,6 +1,6 @@
1
1
  module Ldp
2
2
  class Error < StandardError; end
3
-
3
+
4
4
  class HttpError < RuntimeError; end
5
5
  class BadRequest < HttpError; end # 400
6
6
  class NotFound < HttpError; end # 404