hydramata-work 0.0.1.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0fcc0738988470157183521706aecb2f57b0c1b0
4
+ data.tar.gz: 96f1fd8eee6cc2197f7dff5c2ab065758bd1f4e8
5
+ SHA512:
6
+ metadata.gz: 0842a0403ac0df1850fd8f010312fdab55d2ab679d2e81f785775c8c0aec09f81f613656a2ef39ba2180eeed0180dd099b6f5ab1185b14d43682f31fff17ae36
7
+ data.tar.gz: f667803f1c33a3ea377bc58a67f84778d9d79e07e4e3ca1462191b325d60ca0b8a68de51a7bcea94a5b70c0463ca5c5bb03b77fd6628326503887e3f14a8cba9
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+
5
+ Gemfile.lock
6
+ spec/internal
7
+ ./spec/internal
8
+ coverage
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.travis.yml ADDED
@@ -0,0 +1,14 @@
1
+ language: ruby
2
+ rvm:
3
+ - "2.0.0"
4
+
5
+ env:
6
+ global:
7
+ - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
8
+
9
+ script: 'COVERAGE=true rake spec:travis'
10
+
11
+ bundler_args: --without headless debug
12
+
13
+ before_install:
14
+ - gem install bundler
data/Gemfile ADDED
@@ -0,0 +1,26 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in hydramata-work.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use debugger
14
+ # gem 'debugger'
15
+
16
+ gem "rake"
17
+ gem 'coveralls', require: false
18
+ gem 'simplecov', require: false
19
+
20
+ file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path("../spec/internal", __FILE__))
21
+ if File.exists?(file)
22
+ puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
23
+ instance_eval File.read(file)
24
+ end
25
+
26
+ gem 'sprockets', '2.11.0'
data/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ##########################################################################
2
+ # Copyright 2014 University of Notre Dame
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
data/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # Hydramata::Work
2
+
3
+ [![Version](https://badge.fury.io/rb/hydramata-work.png)](http://badge.fury.io/rb/hydramata-work)
4
+ [![Build Status](https://travis-ci.org/jeremyf/hydramata-work.png?branch=master)](https://travis-ci.org/jeremyf/hydramata-work)
5
+ [![Code Climate](https://codeclimate.com/github/jeremyf/hydramata-work.png)](https://codeclimate.com/github/jeremyf/hydramata-work)
6
+ [![Coverage Status](https://img.shields.io/coveralls/jeremyf/hydramata-work.svg)](https://coveralls.io/r/jeremyf/hydramata-work)
7
+ [![API Docs](http://img.shields.io/badge/API-docs-blue.svg)](http://rubydoc.info/gems/hydramata-work/0.8.0/frames)
8
+ [![APACHE 2 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)
data/Rakefile ADDED
@@ -0,0 +1,43 @@
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
+ Bundler::GemHelper.install_tasks
8
+
9
+ begin
10
+ APP_RAKEFILE = File.expand_path('../spec/internal/Rakefile', __FILE__)
11
+ load 'rails/tasks/engine.rake'
12
+ rescue LoadError
13
+ puts "Unable to load all app tasks for #{APP_RAKEFILE}"
14
+ end
15
+
16
+ require 'engine_cart/rake_task'
17
+ require 'rspec/core/rake_task'
18
+
19
+ namespace :spec do
20
+ RSpec::Core::RakeTask.new(:all) do
21
+ ENV['COVERAGE'] = 'true'
22
+ end
23
+
24
+ desc 'Run the Travis CI specs'
25
+ task :travis do
26
+ ENV['RAILS_ENV'] = 'test'
27
+ ENV['SPEC_OPTS'] = '--profile 20'
28
+ Rake::Task['engine_cart:clean'].invoke
29
+ Rake::Task['engine_cart:generate'].invoke
30
+ Rake::Task['spec:all'].invoke
31
+ end
32
+ end
33
+
34
+ begin
35
+ Rake::Task['default'].clear
36
+ rescue RuntimeError
37
+ # This isn't a big deal if we don't have a default
38
+ end
39
+
40
+ Rake::Task['spec'].clear
41
+
42
+ task spec: 'spec:all'
43
+ task default: 'spec:travis'
@@ -0,0 +1,12 @@
1
+ module Hydramata
2
+ module Work
3
+ class Entity
4
+ def entity_type
5
+ end
6
+
7
+ def properties
8
+ @properties ||= []
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ module Hydramata
2
+ module Work
3
+ class PresentationStructure
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,12 @@
1
+ module Hydramata
2
+ module Work
3
+ class Renderer
4
+ def initialize(options = {})
5
+ end
6
+
7
+ def call
8
+ ''
9
+ end
10
+ end
11
+ end
12
+ end
data/fs ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ script/fast_specs
@@ -0,0 +1,35 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+
3
+ # Maintain your gem's version:
4
+ require 'hydramata/work/version'
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |s|
8
+ s.name = 'hydramata-work'
9
+ s.version = Hydramata::Work::VERSION
10
+ s.authors = [
11
+ 'Jeremy Friesen'
12
+ ]
13
+ s.email = [
14
+ 'jeremy.n.friesen@gmail.com'
15
+ ]
16
+ s.homepage = 'https://github.com/jeremyf/hydramata-work'
17
+ s.summary = 'A Thought Experiement on Modeling Hydramata::Work'
18
+ s.description = 'A Thought Experiement on Modeling Hydramata::Work'
19
+
20
+ s.license = 'APACHE2'
21
+
22
+ s.files = `git ls-files -z`.split("\x0")
23
+ s.executables = s.files.grep(%r{^bin/}) do |f|
24
+ f == 'bin/rails' ? nil : File.basename(f)
25
+ end.compact
26
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
27
+ s.require_paths = ['lib']
28
+
29
+ s.add_dependency 'rails', '~> 4.0.3'
30
+
31
+ s.add_development_dependency 'engine_cart'
32
+ s.add_development_dependency 'rspec-given'
33
+ s.add_development_dependency 'rspec-html-matchers'
34
+ s.add_development_dependency 'sqlite3'
35
+ end
@@ -0,0 +1,5 @@
1
+ require 'hydramata/work/engine' if defined?(Rails)
2
+ module Hydramata
3
+ module Work
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ module Hydramata
2
+ module Work
3
+ class Engine < ::Rails::Engine
4
+ engine_name 'hydramata_work'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Hydramata
2
+ module Work
3
+ VERSION = '0.0.1.pre'
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ # A convenience/courtesy file for adopters of this gem.
2
+ require 'hydramata-work'
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :hydramata/work do
3
+ # # Task goes here
4
+ # end
data/script/fast_specs ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby -w
2
+
3
+ require 'rake'
4
+
5
+ # A helper function for answering: Does this spec run fast?
6
+ module Fast
7
+ module_function
8
+ def spec?(fn)
9
+ open(fn) { |f| f.gets =~ /fast_helper/ }
10
+ end
11
+ end
12
+
13
+ fast_specs = FileList['spec/**/*_spec.rb'].select do |fn|
14
+ Fast.spec?(fn)
15
+ end
16
+
17
+ if fast_specs.any?
18
+ system "rspec #{fast_specs}"
19
+ else
20
+ puts 'Unable to find any fast specs'
21
+ exit(-1)
22
+ end
@@ -0,0 +1,11 @@
1
+ require 'rspec/given'
2
+ Dir[File.expand_path("../../app/*", __FILE__)].each do |dir|
3
+ $LOAD_PATH << dir
4
+ end
5
+ $LOAD_PATH << File.expand_path("../../lib", __FILE__)
6
+
7
+ unless defined?(require_dependency)
8
+ def require_dependency(*files)
9
+ require *files
10
+ end
11
+ end
@@ -0,0 +1 @@
1
+ require 'spec_helper'
@@ -0,0 +1,51 @@
1
+ require 'feature_helper'
2
+
3
+ describe 'An entity and presentation structure' do
4
+ let(:entity) do
5
+ Hydramata::Work::Entity.new do |entity|
6
+ entity.properties << { predicate: :title, value: 'Hello' }
7
+ entity.properties << { predicate: :title, value: 'World' }
8
+ entity.properties << { predicate: :title, value: 'Bang!' }
9
+ entity.properties << { predicate: :abstract, value: 'Long Text' }
10
+ entity.properties << { predicate: :abstract, value: 'Longer Text' }
11
+ entity.properties << { predicate: :keyword, value: 'Programming' }
12
+ end
13
+ end
14
+
15
+ let(:presentation_structure) do
16
+ Hydramata::Work::PresentationStructure.new do |struct|
17
+ struct.fieldset(:required) do |fieldset|
18
+ fieldset.push predicate: :title
19
+ end
20
+ struct.fieldset(:optional) do |fieldset|
21
+ fieldset.push predicate: :abstract
22
+ fieldset.push predicate: :keyword
23
+ end
24
+ end
25
+ end
26
+
27
+ let(:renderer) do
28
+ Hydramata::Work::Renderer.new(
29
+ context: :show,
30
+ content_type: :html,
31
+ entity: entity,
32
+ presentation_structure: presentation_structure
33
+ )
34
+ end
35
+
36
+ xit 'renders as a well-structured HTML document' do
37
+ rendered_output = renderer.call
38
+
39
+ expect(rendered_output).to have_tag('.work') do
40
+ with_tag('.required .title .label', text: 'Title')
41
+ with_tag('.required .title .value', text: 'Hello')
42
+ with_tag('.required .title .value', text: 'World')
43
+ with_tag('.required .title .value', text: 'Bang!')
44
+ with_tag('.optional .abstract .label', text: 'Abstract')
45
+ with_tag('.optional .abstract .value', text: 'Long Text')
46
+ with_tag('.optional .abstract .value', text: 'Longer Text')
47
+ with_tag('.optional .keyword .label', text: 'Keyword')
48
+ with_tag('.optional .keyword .value', text: 'Programming')
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,20 @@
1
+ require 'fast_helper'
2
+ require 'hydramata/work/entity'
3
+
4
+ module Hydramata
5
+ module Work
6
+ describe Entity do
7
+ subject { described_class.new }
8
+ it { expect(subject).to respond_to(:entity_type) }
9
+
10
+ context '#properties' do
11
+ let(:property) { { predicate: :title, value: 'Hello' } }
12
+ it 'can be appended' do
13
+ expect {
14
+ subject.properties << property
15
+ }.to change { subject.properties.count }.by(1)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
File without changes
@@ -0,0 +1,34 @@
1
+ ENV["RAILS_ENV"] ||= 'test'
2
+ if ENV['COVERAGE']
3
+ require 'simplecov'
4
+ SimpleCov.start 'rails'
5
+ SimpleCov.command_name "spec"
6
+ end
7
+
8
+ if ENV['TRAVIS']
9
+ require 'coveralls'
10
+ Coveralls.wear!('rails')
11
+ end
12
+
13
+ require 'engine_cart'
14
+ require File.expand_path("../internal/config/environment.rb", __FILE__)
15
+
16
+ EngineCart.load_application!
17
+
18
+ # This file was generated by the `rspec --init` command. Conventionally, all
19
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
20
+ # Require this file using `require "spec_helper"` to ensure that it is only
21
+ # loaded once.
22
+ #
23
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
24
+ RSpec.configure do |config|
25
+ config.treat_symbols_as_metadata_keys_with_true_values = true
26
+ config.run_all_when_everything_filtered = true
27
+ config.filter_run :focus
28
+
29
+ # Run specs in random order to surface order dependencies. If you find an
30
+ # order dependency and want to debug it, you can fix the order by providing
31
+ # the seed, which is printed after each run.
32
+ # --seed 1234
33
+ config.order = 'random'
34
+ end
@@ -0,0 +1,14 @@
1
+ require 'rails/generators'
2
+
3
+ class TestAppGenerator < Rails::Generators::Base
4
+ source_root "./spec/test_app_templates"
5
+
6
+ # if you need to generate any additional configuration
7
+ # into the test app, this generator will be run immediately
8
+ # after setting up the application
9
+
10
+ def install_engine
11
+ generate 'hydramata-work:install'
12
+ end
13
+ end
14
+
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hydramata-work
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.pre
5
+ platform: ruby
6
+ authors:
7
+ - Jeremy Friesen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-29 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.0.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: engine_cart
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
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: rspec-given
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
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: rspec-html-matchers
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: sqlite3
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: A Thought Experiement on Modeling Hydramata::Work
84
+ email:
85
+ - jeremy.n.friesen@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - .gitignore
91
+ - .rspec
92
+ - .travis.yml
93
+ - Gemfile
94
+ - LICENSE
95
+ - README.md
96
+ - Rakefile
97
+ - app/models/hydramata/work/entity.rb
98
+ - app/models/hydramata/work/presentation_structure.rb
99
+ - app/models/hydramata/work/renderer.rb
100
+ - fs
101
+ - hydramata-work.gemspec
102
+ - lib/hydramata-work.rb
103
+ - lib/hydramata/work/engine.rb
104
+ - lib/hydramata/work/version.rb
105
+ - lib/hydramata_work.rb
106
+ - lib/tasks/hydramata_work_tasks.rake
107
+ - script/fast_specs
108
+ - spec/fast_helper.rb
109
+ - spec/feature_helper.rb
110
+ - spec/features/entity_rendering_spec.rb
111
+ - spec/models/hydramata/work/entity_spec.rb
112
+ - spec/models/hydramata/work/property_set_spec.rb
113
+ - spec/spec_helper.rb
114
+ - spec/test_app_templates/lib/generators/test_app_generator.rb
115
+ homepage: https://github.com/jeremyf/hydramata-work
116
+ licenses:
117
+ - APACHE2
118
+ metadata: {}
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - '>'
131
+ - !ruby/object:Gem::Version
132
+ version: 1.3.1
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 2.0.14
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: A Thought Experiement on Modeling Hydramata::Work
139
+ test_files:
140
+ - spec/fast_helper.rb
141
+ - spec/feature_helper.rb
142
+ - spec/features/entity_rendering_spec.rb
143
+ - spec/models/hydramata/work/entity_spec.rb
144
+ - spec/models/hydramata/work/property_set_spec.rb
145
+ - spec/spec_helper.rb
146
+ - spec/test_app_templates/lib/generators/test_app_generator.rb