Skip to content

Commit

Permalink
Finish 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Aug 4, 2022
2 parents a41a72a + fb9374b commit 1c1dd59
Show file tree
Hide file tree
Showing 81 changed files with 5,732 additions and 55 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This workflow runs continuous CI across different versions of ruby on all branches and pull requests to develop.

name: CI
on:
push:
branches: [ '**' ]
pull_request:
branches: [ develop ]
workflow_dispatch:

jobs:
tests:
name: Ruby ${{ matrix.ruby }}
if: "contains(github.event.commits[0].message, '[ci skip]') == false"
runs-on: ubuntu-latest
env:
CI: true
ALLOW_FAILURES: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'jruby' }}
strategy:
fail-fast: false
matrix:
ruby:
- 2.6
- 2.7
- "3.0"
- 3.1
- ruby-head
- jruby
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Install dependencies
run: bundle install --jobs 4 --retry 3
- name: Run tests
run: ruby --version; bundle exec rspec spec || $ALLOW_FAILURES
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v1.1.2
if: "matrix.ruby == '3.0'"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
wintests:
name: Win64 Ruby ${{ matrix.ruby }}
if: "contains(github.event.commits[0].message, '[ci skip]') == false"
runs-on: windows-latest
env:
CI: true
ALLOW_FAILURES: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'jruby' }}
strategy:
fail-fast: false
matrix:
ruby:
- 3.1
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Install dependencies
run: bundle install --jobs 4 --retry 3
- name: Run tests
run: ruby --version; bundle exec rspec spec || $ALLOW_FAILURES
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v1.1.2
if: "matrix.ruby == '3.0'"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build & deploy documentation
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Update gh-pages with docs
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
- name: Install required gem dependencies
run: gem install yard --no-document
- name: Build YARD Ruby Documentation
run: yardoc
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc/yard
publish_branch: gh-pages
62 changes: 9 additions & 53 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,56 +1,12 @@
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/

# Used by dotenv library to load environment variables.
# .env

# Ignore Byebug command history file.
.byebug_history

## Specific to RubyMotion:
.dat*
.repl_history
build/
*.bridgesupport
build-iPhoneOS/
build-iPhoneSimulator/

## Specific to RubyMotion (use of CocoaPods):
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# vendor/Pods/

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/

## Environment normalization:
/coverage/
/*.gem
/coverage/
/spec.html
/spec.pdf
/pkg/
/.rbx/
/.bundle/
/vendor/bundle
/lib/bundler/man/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# Used by RuboCop. Remote config files pulled in from inherit_from directive.
# .rubocop-https?--*
Gemfile.lock
/.byebug_history
11 changes: 11 additions & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--title "JSON-LD reader/writer for RDF.rb."
--output-dir doc/yard
--protected
--no-private
--hide-void-return
--markup markdown
--readme README.md
-
AUTHORS
VERSION
UNLICENSE
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Gregg Kellogg <gregg@greggkellogg.net>
38 changes: 38 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# How to contribute

Community contributions are essential for keeping Ruby RDF great. We want to keep it as easy as possible to contribute changes that get things working in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.

## Development

This repository uses [Git Flow](https://github.com/nvie/gitflow) to mange development and release activity. All submissions _must_ be on a feature branch based on the _develop_ branch to ease staging and integration.

* create or respond to an issue on the [Github Repository](https://github.com/ruby-rdf/json-ld/issues)
* Fork and clone the repo:
`git clone git@github.com:your-username/json-ld.git`
* Install bundle:
`bundle install`
* Create tests in RSpec and make sure you achieve at least 90% code coverage for the feature your adding or behavior being modified.
* Push to your fork and [submit a pull request][pr].

## Do's and Dont's
* Do your best to adhere to the existing coding conventions and idioms.
* Don't use hard tabs, and don't leave trailing whitespace on any line.
Before committing, run `git diff --check` to make sure of this.
* Do document every method you add using [YARD][] annotations. Read the
[tutorial][YARD-GS] or just look at the existing code for examples.
* Don't touch the `.gemspec` or `VERSION` files. If you need to change them,
do so on your private branch only.
* Do feel free to add yourself to the `CREDITS` file and the
corresponding list in the the `README`. Alphabetical order applies.
* Don't touch the `AUTHORS` file. If your contributions are significant
enough, be assured we will eventually add you in there.
* Do note that in order for us to merge any non-trivial changes (as a rule
of thumb, additions larger than about 15 lines of code), we need an
explicit [public domain dedication][PDD] on record from you,
which you will be asked to agree to on the first commit to a repo within the organization.
Note that the agreement applies to all repos in the [Ruby RDF](https://github.com/ruby-rdf/) organization.

[YARD]: https://yardoc.org/
[YARD-GS]: https://rubydoc.info/docs/yard/file/docs/GettingStarted.md
[PDD]: https://unlicense.org/#unlicensing-contributions
[pr]: https://github.com/ruby-rdf/rdf/compare/
24 changes: 24 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
source "https://rubygems.org"

gemspec
gem 'rdf', git: "https://github.com/ruby-rdf/rdf", branch: "develop"
gem 'json-ld', git: "https://github.com/ruby-rdf/json-ld", branch: "develop"

group :development do
gem 'rdf-isomorphic', git: "https://github.com/ruby-rdf/rdf-isomorphic", branch: "develop"
gem 'rdf-spec', git: "https://github.com/ruby-rdf/rdf-spec", branch: "develop"
gem 'rdf-vocab', git: "https://github.com/ruby-rdf/rdf-vocab", branch: "develop"
gem 'rdf-xsd', git: "https://github.com/ruby-rdf/rdf-xsd", branch: "develop"
gem 'earl-report'
gem 'ruby-prof', platforms: :mri
end

group :development, :test do
gem 'simplecov', '~> 0.21', platforms: :mri
gem 'simplecov-lcov', '~> 0.8', platforms: :mri
gem 'rake'
end

group :debug do
gem "byebug", platforms: :mri
end
152 changes: 150 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,150 @@
# yaml-ld
Ruby YAML-LD reader/writer for RDF.rb
# YAML-LD reader/writer

Ruby [YAML-LD][] reader/writer for RDF.rb

[![Gem Version](https://badge.fury.io/rb/yaml-ld.png)](https://rubygems.org/gems/yaml-ld)
[![Build Status](https://secure.travis-ci.org/ruby-rdf/yaml-ld.png?branch=develop)](https://github.com/ruby-rdf/yaml-ld/actions?query=workflow%3ACI)
[![Coverage Status](https://coveralls.io/repos/ruby-rdf/yaml-ld/badge.svg?branch=develop)](https://coveralls.io/github/ruby-rdf/yaml-ld?branch=develop)
[![Gitter chat](https://badges.gitter.im/ruby-rdf.png)](https://gitter.im/gitterHQ/gitter)

## Features

YAML_LD parses and serializes [YAML-LD][] into [RDF][].

As the specification is under development, this gem should be considered **experimental** and is subject to change at any time.

YAML-LD documents may use frames or contexts described either using [JSON-LD][] or [YAML-LD][].

* Process YAML-LD source using JSON-LD Context or Frame.
* Process JSON-LD source using YAML-LD Context or Frame.

## Examples

require 'rubygems'
require 'yaml\_ld'

### Expand a YAML-LD Document

input = StringIO.new(%(
"@context":
"@vocab": http://xmlns.com/foaf/0.1/
name: Gregg Kellogg
homepage: https://greggkellogg.net
depiction: http://www.gravatar.com/avatar/42f948adff3afaa52249d963117af7c8
))

YAML_LD::API.expand(input) # => %(
%YAML 1.2
---
- http://xmlns.com/foaf/0.1/name:
- "@value": Gregg Kellogg
http://xmlns.com/foaf/0.1/homepage:
- "@value": https://greggkellogg.net
http://xmlns.com/foaf/0.1/depiction:
- "@value": http://www.gravatar.com/avatar/42f948adff3afaa52249d963117af7c8
)

### Expand a YAML-LD Document to JSON-LD

input = StringIO.new(%(
"@context":
"@vocab": http://xmlns.com/foaf/0.1/
name: Gregg Kellogg
homepage: https://greggkellogg.net
depiction: http://www.gravatar.com/avatar/42f948adff3afaa52249d963117af7c8
))

YAML_LD::API.expand(input, serializer: JSON::LD::API.method(:serializer)) # => %(
[
{
"http://xmlns.com/foaf/0.1/name": [{ "@value": "Gregg Kellogg" }],
"http://xmlns.com/foaf/0.1/homepage": [{ "@value": "https://greggkellogg.net" }],
"http://xmlns.com/foaf/0.1/depiction": [{
"@value": "http://www.gravatar.com/avatar/42f948adff3afaa52249d963117af7c8"
}]
}
]
)

### Expand a JSON-LD Document to YAML-LD

input = StringIO.new(%(
{
"@context": {
"@vocab":"http://xmlns.com/foaf/0.1/"
},
"name": "Gregg Kellogg",
"homepage": "https://greggkellogg.net",
"depiction": "http://www.gravatar.com/avatar/42f948adff3afaa52249d963117af7c8"
}
))

YAML_LD::API.expand(input, content_type: 'application/ld+json') # => %(
%YAML 1.2
---
- http://xmlns.com/foaf/0.1/name:
- "@value": Gregg Kellogg
http://xmlns.com/foaf/0.1/homepage:
- "@value": https://greggkellogg.net
http://xmlns.com/foaf/0.1/depiction:
- "@value": http://www.gravatar.com/avatar/42f948adff3afaa52249d963117af7c8
)

## Implementation

The gem largely acts as a front-end for the [JSON-LD gem][] with differences largely in the serialization format only.

In addition to the input, both a `context` and `frame` may be specified using either JSON-LD or YAML-LD.

## Dependencies
* [Ruby](https://ruby-lang.org/) (>= 2.6)
* [JSON-LD](https://rubygems.org/gems/json-ld) (>= 3.2.2)
* [Psych](https://rubygems.org/gems/psych) (>= 4.0)
* [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.2)

## Installation
The recommended installation method is via [RubyGems](https://rubygems.org/).
To install the latest official release of the `JSON-LD` gem, do:

% [sudo] gem install yaml-ld

## Download
To get a local working copy of the development repository, do:

% git clone git://github.com/ruby-rdf/yaml-ld.git

## Mailing List
* <https://lists.w3.org/Archives/Public/public-rdf-ruby/>

## Author
* [Gregg Kellogg](https://github.com/gkellogg) - <https://greggkellogg.net/>

## Contributing
* Do your best to adhere to the existing coding conventions and idioms.
* Don't use hard tabs, and don't leave trailing whitespace on any line.
* Do document every method you add using [YARD][] annotations. Read the
[tutorial][YARD-GS] or just look at the existing code for examples.
* Don't touch the `json-ld.gemspec`, `VERSION` or `AUTHORS` files. If you need to
change them, do so on your private branch only.
* Do feel free to add yourself to the `CREDITS` file and the corresponding
list in the the `README`. Alphabetical order applies.
* Do note that in order for us to merge any non-trivial changes (as a rule
of thumb, additions larger than about 15 lines of code), we need an
explicit [public domain dedication][PDD] on record from you,
which you will be asked to agree to on the first commit to a repo within the organization.
Note that the agreement applies to all repos in the [Ruby RDF](https://github.com/ruby-rdf/) organization.

## License

This is free and unencumbered public domain software. For more information,
see <https://unlicense.org/> or the accompanying {file:UNLICENSE} file.

[Ruby]: https://ruby-lang.org/
[RDF]: https://www.w3.org/RDF/
[YARD]: https://yardoc.org/
[YARD-GS]: https://rubydoc.info/docs/yard/file/docs/GettingStarted.md
[PDD]: https://unlicense.org/#unlicensing-contributions
[RDF.rb]: https://rubygems.org/gems/rdf
[JSON-LD gem]: https://rubygems.org/gems/json-ld
[JSON-LD]: https://www.w3.org/TR/json-ld11/ "JSON-LD 1.1"
[YAML-LD]: https://json-ld.github.io/yaml-ld/spec/
Loading

0 comments on commit 1c1dd59

Please sign in to comment.