cerberus-annotations 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 07cae43a204adaf7202bdf5bbbd2b5ae7429fa3e
4
+ data.tar.gz: 8612361186f4e3be2256bc8d2ebf74a18422a1a2
5
+ SHA512:
6
+ metadata.gz: b31856248e71ecdb931386fcd228ccd3902bcca0abfad15af5c9df0ab0ea7b3007989fb029354893412bccdf6b20ddc52733330392ea17bf2160576f389cb687
7
+ data.tar.gz: e97c79581b2c32aa32c7b6211b4d9077b2a5038e79d5a6ba51a07ff3971da6f91c18136f6ab71293e69b8e5f7f64f3304db70659158ee0ca4d5029b88963b486
@@ -0,0 +1,40 @@
1
+ # Cerberus annotations
2
+
3
+ Demonstration linked data application to support the Linked Data for Libraries use cases.
4
+
5
+ ## Tests
6
+
7
+ Run tests:
8
+
9
+ ```console
10
+ $ rake
11
+ ```
12
+
13
+ ## Installation
14
+
15
+ Add this line to your gemfile
16
+
17
+ ```ruby
18
+ gem 'cerberus-annotations'
19
+ ```
20
+
21
+ Then execute:
22
+
23
+ ```console
24
+ $ bundle
25
+ ```
26
+
27
+ Then run the cerberus generator:
28
+
29
+ ```console
30
+ $ rails g cerberus:annotations:install
31
+ ```
32
+
33
+ ## Running the application in development
34
+
35
+ There is a bundled rake task for running the test app:
36
+
37
+ ```console
38
+ $ rake engine_cart:generate # (first run only)
39
+ $ rake cerberus:server
40
+ ```
@@ -0,0 +1,60 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ ZIP_URL = "https://github.com/projecthydra/hydra-jetty/archive/v8.0.0.rc2.zip"
8
+
9
+ require 'active_support/benchmarkable'
10
+ require 'jettywrapper'
11
+
12
+ require 'rdoc/task'
13
+
14
+ RDoc::Task.new(:rdoc) do |rdoc|
15
+ rdoc.rdoc_dir = 'rdoc'
16
+ rdoc.title = 'Cerberus'
17
+ rdoc.options << '--line-numbers'
18
+ rdoc.rdoc_files.include('README.rdoc')
19
+ rdoc.rdoc_files.include('lib/**/*.rb')
20
+ end
21
+
22
+ require 'engine_cart/rake_task'
23
+ task :ci => ['engine_cart:generate', 'jetty:clean'] do
24
+ # run the tests
25
+ jetty_params = Jettywrapper.load_config.merge({:jetty_home => File.expand_path(File.dirname(__FILE__) + '/jetty')})
26
+ Jettywrapper.wrap(jetty_params) do
27
+ Rake::Task['spec'].invoke
28
+ end
29
+ end
30
+
31
+ namespace :cerberus do
32
+ task :server do
33
+ jetty_params = Jettywrapper.load_config.merge({:jetty_home => File.expand_path(File.dirname(__FILE__) + '/jetty')})
34
+ Jettywrapper.wrap(jetty_params) do
35
+ within_test_app do
36
+ system "rails s"
37
+ end
38
+ end
39
+ end
40
+
41
+ task :console do
42
+ jetty_params = Jettywrapper.load_config.merge({:jetty_home => File.expand_path(File.dirname(__FILE__) + '/jetty')})
43
+ Jettywrapper.wrap(jetty_params) do
44
+ within_test_app do
45
+ system "rails c"
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+
52
+ load 'rails/tasks/statistics.rake'
53
+
54
+ require 'rspec/core/rake_task'
55
+
56
+ RSpec::Core::RakeTask.new(:spec)
57
+
58
+ task :default => :ci
59
+
60
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,30 @@
1
+ require 'shellwords'
2
+ module Cerberus::Annotations
3
+ class AnnotationsController < ApplicationController
4
+ def index
5
+ @annotations = Dir.glob(File.join(fixtures_path, '*')).map { |x| x.split("/").last.gsub('.json', '') }
6
+
7
+ respond_to do |format|
8
+ format.html
9
+ end
10
+ end
11
+
12
+ def show
13
+ load_annotation
14
+
15
+ respond_to do |format|
16
+ format.html
17
+ format.json
18
+ end
19
+ end
20
+
21
+ private
22
+ def load_annotation
23
+ @annotation = Annotation.from_json(File.read(File.join(fixtures_path, params[:id] + ".json")))
24
+ end
25
+
26
+ def fixtures_path
27
+ File.join(Cerberus::Annotations::Engine.root, 'spec', 'fixtures', 'annotations')
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,4 @@
1
+ module Cerberus::Annotations
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Cerberus::Annotations
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,17 @@
1
+ module Cerberus::Annotations
2
+ class Annotation
3
+ class <<self
4
+ def from_json json
5
+ graph = RDF::Graph.new << JSON::LD::API.toRdf(JSON.parse(json))
6
+ self.new graph
7
+ end
8
+ end
9
+
10
+ attr_reader :graph
11
+
12
+ def initialize graph
13
+ @graph = graph
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ <ul>
2
+ <% @annotations.each do |a| %>
3
+ <li><%= link_to a, annotation_path(a) %></li>
4
+ <% end %>
5
+ </ul>
@@ -0,0 +1,2 @@
1
+ <h1>Annotation</h1>
2
+ <%= @annotation.graph.dump(:ttl) %>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Cerberus</title>
5
+ <%= stylesheet_link_tag "cerberus/annotations/application", media: "all" %>
6
+ <%= javascript_include_tag "cerberus/annotations/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,5 @@
1
+ Cerberus::Annotations::Engine.routes.draw do
2
+ root to: 'annotations#index'
3
+
4
+ resources :annotations
5
+ end
@@ -0,0 +1 @@
1
+ require "cerberus/annotations"
@@ -0,0 +1,6 @@
1
+ require 'linkeddata'
2
+ module Cerberus
3
+ module Annotations
4
+ require "cerberus/annotations/engine"
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Cerberus::Annotations
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Cerberus::Annotations
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Cerberus
2
+ module Annotations
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ require 'rails/generators'
2
+
3
+ module Cerberus
4
+ module Annotations
5
+ class Install < Rails::Generators::Base
6
+ def inject_cerberus_routes
7
+ route "mount Cerberus::Annotations::Engine, at: 'annotations'"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ namespace :cerberus do
2
+ # desc "Explaining what the task does"
3
+ # task :cerberus do
4
+ # # Task goes here
5
+ # end
6
+ end
metadata ADDED
@@ -0,0 +1,188 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cerberus-annotations
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Chris Beer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.2.0.beta1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.2.0.beta1
27
+ - !ruby/object:Gem::Dependency
28
+ name: linkeddata
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: spira
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sqlite3
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: engine_cart
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.4'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.4'
111
+ - !ruby/object:Gem::Dependency
112
+ name: jettywrapper
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: capybara
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description:
140
+ email:
141
+ - cabeer@stanford.edu
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - README.md
147
+ - Rakefile
148
+ - app/assets/javascripts/cerberus/annotations/application.js
149
+ - app/assets/stylesheets/cerberus/annotations/application.css
150
+ - app/controllers/cerberus/annotations/annotations_controller.rb
151
+ - app/controllers/cerberus/annotations/application_controller.rb
152
+ - app/helpers/cerberus/annotations/application_helper.rb
153
+ - app/models/cerberus/annotations/annotation.rb
154
+ - app/views/cerberus/annotations/annotations/index.html.erb
155
+ - app/views/cerberus/annotations/annotations/show.html.erb
156
+ - app/views/layouts/cerberus/annotations/application.html.erb
157
+ - config/routes.rb
158
+ - lib/cerberus.rb
159
+ - lib/cerberus/annotations.rb
160
+ - lib/cerberus/annotations/engine.rb
161
+ - lib/cerberus/annotations/version.rb
162
+ - lib/generators/cerberus/annotations/install_generator.rb
163
+ - lib/tasks/cerberus_tasks.rake
164
+ homepage:
165
+ licenses:
166
+ - Apache 2
167
+ metadata: {}
168
+ post_install_message:
169
+ rdoc_options: []
170
+ require_paths:
171
+ - lib
172
+ required_ruby_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ required_rubygems_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ requirements: []
183
+ rubyforge_project:
184
+ rubygems_version: 2.2.2
185
+ signing_key:
186
+ specification_version: 4
187
+ summary: Open Annotation demonstrator for LD4L
188
+ test_files: []