gearbox 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/.document +5 -0
  2. data/Gemfile +21 -0
  3. data/Gemfile.lock +138 -0
  4. data/Guardfile +9 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.html +89 -0
  7. data/README.md +87 -0
  8. data/Rakefile +46 -0
  9. data/VERSION +1 -0
  10. data/lib/examples/audience.rb +24 -0
  11. data/lib/examples/person.rb +29 -0
  12. data/lib/examples/reference.rb +38 -0
  13. data/lib/examples/theme.rb +8 -0
  14. data/lib/gearbox.rb +40 -0
  15. data/lib/gearbox/attribute_collection.rb +42 -0
  16. data/lib/gearbox/mixins/ad_hoc_properties.rb +41 -0
  17. data/lib/gearbox/mixins/resource.rb +17 -0
  18. data/lib/gearbox/mixins/semantic_accessors.rb +118 -0
  19. data/lib/gearbox/rdf_collection.rb +72 -0
  20. data/lib/gearbox/type.rb +85 -0
  21. data/lib/gearbox/types.rb +28 -0
  22. data/lib/gearbox/types/any.rb +24 -0
  23. data/lib/gearbox/types/boolean.rb +31 -0
  24. data/lib/gearbox/types/date.rb +27 -0
  25. data/lib/gearbox/types/decimal.rb +29 -0
  26. data/lib/gearbox/types/float.rb +28 -0
  27. data/lib/gearbox/types/integer.rb +27 -0
  28. data/lib/gearbox/types/native.rb +22 -0
  29. data/lib/gearbox/types/string.rb +27 -0
  30. data/lib/gearbox/types/uri.rb +25 -0
  31. data/spec/examples/audience_spec.rb +28 -0
  32. data/spec/examples/person_spec.rb +45 -0
  33. data/spec/examples/reference_spec.rb +43 -0
  34. data/spec/examples/theme_spec.rb +137 -0
  35. data/spec/gearbox/attribute_collection_spec.rb +33 -0
  36. data/spec/gearbox/mixins/ad_hoc_properties_spec.rb +52 -0
  37. data/spec/gearbox/mixins/resource_spec.rb +32 -0
  38. data/spec/gearbox/mixins/semantic_accessors_spec.rb +53 -0
  39. data/spec/gearbox/rdf_collection_spec.rb +52 -0
  40. data/spec/gearbox_spec.rb +13 -0
  41. data/spec/spec_helper.rb +16 -0
  42. metadata +235 -0
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,21 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'linkeddata'
4
+ gem 'rspec'
5
+ gem 'uuid'
6
+
7
+ if RUBY_PLATFORM =~ /darwin/i
8
+ gem 'autotest-fsevent'
9
+ gem 'autotest-growl'
10
+ end
11
+
12
+ group :development do
13
+ gem "minitest", ">= 0"
14
+ gem "yard", "~> 0.6.0"
15
+ gem "bundler"
16
+ gem "jeweler", "~> 1.6.4"
17
+ gem "simplecov", ">= 0"
18
+ gem 'guard-markdown'
19
+ gem "ruby-debug19"
20
+ gem 'guard-minitest', :git => 'git://github.com/aspiers/guard-minitest.git'
21
+ end
@@ -0,0 +1,138 @@
1
+ GIT
2
+ remote: git://github.com/aspiers/guard-minitest.git
3
+ revision: 4b660261d3596b7dd2a9fe135f7ee23ca0c04cc1
4
+ specs:
5
+ guard-minitest (0.4.0)
6
+ guard (~> 0.4)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ addressable (2.2.7)
12
+ archive-tar-minitar (0.5.2)
13
+ autotest-fsevent (0.2.8)
14
+ sys-uname
15
+ autotest-growl (0.2.16)
16
+ backports (2.3.0)
17
+ columnize (0.3.6)
18
+ diff-lcs (1.1.3)
19
+ ffi (1.0.11)
20
+ git (1.2.5)
21
+ guard (0.10.0)
22
+ ffi (>= 0.5.0)
23
+ thor (~> 0.14.6)
24
+ guard-markdown (0.1.4)
25
+ guard (>= 0.2.2)
26
+ kramdown (~> 0.13.3)
27
+ haml (3.1.4)
28
+ htmlentities (4.3.1)
29
+ jeweler (1.6.4)
30
+ bundler (~> 1.0)
31
+ git (>= 1.2.5)
32
+ rake
33
+ json (1.6.5)
34
+ json-ld (0.1.0)
35
+ json (>= 1.5.1)
36
+ rdf (>= 0.3.4)
37
+ json_pure (1.6.5)
38
+ kramdown (0.13.5)
39
+ linecache19 (0.5.12)
40
+ ruby_core_source (>= 0.1.4)
41
+ linkeddata (0.3.5)
42
+ json-ld (>= 0.1.0)
43
+ rdf (>= 0.3.5)
44
+ rdf-isomorphic (>= 0.3.4)
45
+ rdf-json (>= 0.3.0)
46
+ rdf-microdata (>= 0.2.3)
47
+ rdf-n3 (>= 0.3.6)
48
+ rdf-rdfa (>= 0.3.9)
49
+ rdf-rdfxml (>= 0.3.5)
50
+ rdf-trig (>= 0.1.1)
51
+ rdf-trix (>= 0.3.0)
52
+ rdf-turtle (>= 0.1.1)
53
+ macaddr (1.5.0)
54
+ systemu (>= 2.4.0)
55
+ minitest (2.11.3)
56
+ multi_json (1.1.0)
57
+ nokogiri (1.5.0)
58
+ rake (0.9.2.2)
59
+ rdf (0.3.5)
60
+ addressable (>= 2.2.6)
61
+ rdf-isomorphic (0.3.4)
62
+ rdf (>= 0.2.3)
63
+ rdf-json (0.3.0)
64
+ json_pure (>= 1.4.2)
65
+ rdf (~> 0.3.0)
66
+ rdf-microdata (0.2.3.1)
67
+ htmlentities (>= 4.3.0)
68
+ json (>= 1.6.1)
69
+ rdf (>= 0.3.4)
70
+ rdf-xsd (>= 0.3.4)
71
+ rdf-n3 (0.3.6)
72
+ rdf (>= 0.3.4)
73
+ rdf-rdfa (0.3.9)
74
+ backports
75
+ haml (>= 3.0.0)
76
+ htmlentities (>= 4.3.0)
77
+ rdf (>= 0.3.3)
78
+ rdf-xsd (>= 0.3.5)
79
+ rdf-rdfxml (0.3.5)
80
+ nokogiri (>= 1.4.4)
81
+ rdf (>= 0.3.4)
82
+ rdf-trig (0.1.1)
83
+ rdf (>= 0.3.4)
84
+ rdf-turtle (>= 0.1.1)
85
+ rdf-trix (0.3.0)
86
+ rdf (~> 0.3.0)
87
+ rdf-turtle (0.1.1)
88
+ rdf (>= 0.3.4)
89
+ rdf-xsd (0.3.5)
90
+ nokogiri (>= 1.5.0)
91
+ rdf (>= 0.3.4)
92
+ rspec (2.8.0)
93
+ rspec-core (~> 2.8.0)
94
+ rspec-expectations (~> 2.8.0)
95
+ rspec-mocks (~> 2.8.0)
96
+ rspec-core (2.8.0)
97
+ rspec-expectations (2.8.0)
98
+ diff-lcs (~> 1.1.2)
99
+ rspec-mocks (2.8.0)
100
+ ruby-debug-base19 (0.11.25)
101
+ columnize (>= 0.3.1)
102
+ linecache19 (>= 0.5.11)
103
+ ruby_core_source (>= 0.1.4)
104
+ ruby-debug19 (0.11.6)
105
+ columnize (>= 0.3.1)
106
+ linecache19 (>= 0.5.11)
107
+ ruby-debug-base19 (>= 0.11.19)
108
+ ruby_core_source (0.1.5)
109
+ archive-tar-minitar (>= 0.5.2)
110
+ simplecov (0.6.1)
111
+ multi_json (~> 1.0)
112
+ simplecov-html (~> 0.5.3)
113
+ simplecov-html (0.5.3)
114
+ sys-uname (0.9.0)
115
+ ffi (>= 1.0.0)
116
+ systemu (2.4.2)
117
+ thor (0.14.6)
118
+ uuid (2.3.5)
119
+ macaddr (~> 1.0)
120
+ yard (0.6.8)
121
+
122
+ PLATFORMS
123
+ ruby
124
+
125
+ DEPENDENCIES
126
+ autotest-fsevent
127
+ autotest-growl
128
+ bundler
129
+ guard-markdown
130
+ guard-minitest!
131
+ jeweler (~> 1.6.4)
132
+ linkeddata
133
+ minitest
134
+ rspec
135
+ ruby-debug19
136
+ simplecov
137
+ uuid
138
+ yard (~> 0.6.0)
@@ -0,0 +1,9 @@
1
+ guard 'markdown', :convert_on_start => true, :dry_run => false do
2
+ watch (/README.md/) {|m| "README.md|./README.html"}
3
+ end
4
+
5
+ guard 'minitest' do
6
+ watch(%r|^spec/(.*)_spec\.rb|)
7
+ watch(%r|^lib/(.*)\.rb|) { |m| "spec/#{m[1]}_spec.rb" }
8
+ watch(%r|^spec/spec_helper\.rb|) { "spec" }
9
+ end
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 David Richards
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,89 @@
1
+ <h1 id="gearbox">Gearbox</h1>
2
+
3
+ <p>The purpose of this project is to make it easier for me to curate semantic graphs. I&rsquo;m looking for deeper satisfaction in my personal research. I tend to fill my days researching technology, market dispositions, and my own business documents. These types of data stores, of course, could be applied in many areas.</p>
4
+
5
+ <p>To get to wherever I am now, I&rsquo;ve been playing with semantic models for a while. I started by demonstrating working code from various corners of my imagination. After a while, I thought I had enough to create a useful gem. In the past, I&rsquo;ve worked with <a href="https://github.com/bhuga/spira">Spira</a> and examples given by <a href="http://greggkellogg.net/">Gregg Kellogg</a>. These have been very useful in forming ideas.</p>
6
+
7
+ <p>As I worked on this code, I decided to go to <a href="https://github.com/bhuga/spira">Spira</a> to see how similar the two gems are. I was surprised how similar they actually are. The similarities are:</p>
8
+
9
+ <ul>
10
+ <li>both are ORMs for semantic data, written in Ruby</li>
11
+ <li>support for properties/attributes</li>
12
+ <li>concept of model associations</li>
13
+ <li>data validations</li>
14
+ <li>value types</li>
15
+ </ul>
16
+
17
+ <p>However, Gearbox is quite a bit different. It came from a different place. I&rsquo;ve been trying to embrace the nature of semantic models. This, juxtaposed against relational models or other types of models. The major differences, I imagine are:</p>
18
+
19
+ <ul>
20
+ <li>support for SPARQL-based scopes and finder methods</li>
21
+ <li>better support for working with various SPARQL end points</li>
22
+ <li>creating and maintaining full-text indices</li>
23
+ <li>object factory from triples</li>
24
+ </ul>
25
+
26
+ <h1 id="development-workflow-for-semantic-data">Development Workflow for Semantic Data</h1>
27
+
28
+ <p>For a typical domain, I test-drive some models to define the nature of the data. These are custom-built to support the user scenarios and behavior an application is built to serve. For semantic models, I&rsquo;m going for something different. The relationships between resources are much more dynamic. It&rsquo;s tough to build an application on dynamic domain models. </p>
29
+
30
+ <p>To work with this, I&rsquo;d rather optimize for different things. Instead of trying to canonize the data, concretize the interaction. Given a head/buffer/file full of data, what&rsquo;s the easiest way to save it? Which values have to be recorded? Which values can be inferred or classified offline? </p>
31
+
32
+ <p>I think that there&rsquo;s going to be an evolution of the data graph. I&rsquo;m looking to start with the mundane, and hope to be able to create a broad view from the details collected. Possibly, I will have alternative broad views, such as a full view of the topic or a chronological account of the topic as it transpires. From here, I want to look for insightful information: inferences that show the nature of our subject. </p>
33
+
34
+ <p>That&rsquo;s the goal.</p>
35
+
36
+ <p>Practically, the work changes over time. We start with defining the attributes and associations that are needed. This is the mundane. We then start to qualify the data by writing validations. Probably, there will be overlapping models to reflect the interaction. For example, browsing email might have a cursory recording of the people involved. Looking up Twitter information might have a more-specific user model. Facebook, the same. We&rsquo;re building a summary of the users, or whatever we&rsquo;re studying. From here, we might be able to use various analytical methods to classify and enhance the models, to clarify the story we are able to gather.</p>
37
+
38
+ <p>As you can see, this is a very different process than something we might do with typical relational data. I don&rsquo;t think there is much that we do with semantic data that can&rsquo;t be done with relational data, it&rsquo;s just that the technologies are optimized for different purposes.</p>
39
+
40
+ <h1 id="practical-example">Practical Example</h1>
41
+
42
+ <p>It would be good to offer a practical example. I&rsquo;ll get to these in a bit. I don&rsquo;t need to have the documentation get ahead of the released code.</p>
43
+
44
+ <h1 id="todo">TODO</h1>
45
+
46
+ <ul>
47
+ <li>bring in the association and combination code</li>
48
+ <li>implement mutability</li>
49
+ <li>implement persistence</li>
50
+ <li>implement queryable</li>
51
+ <li>implement named scopes</li>
52
+ <li>implement some sort of repository access</li>
53
+ <li>use Gearbox in the examples (were written to concretize an example in my head)</li>
54
+ </ul>
55
+
56
+ <h1 id="contributing-to-gearbox">Contributing to Gearbox</h1>
57
+
58
+ <ul>
59
+ <li>Check out the latest master to make sure the feature hasn&rsquo;t been implemented or the bug hasn&rsquo;t been fixed yet</li>
60
+ <li>Check out the issue tracker to make sure someone already hasn&rsquo;t requested it and/or contributed it</li>
61
+ <li>Fork the project</li>
62
+ <li>Start a feature/bugfix branch</li>
63
+ <li>Commit and push until you are happy with your contribution</li>
64
+ <li>Make sure to add tests for it. This is important so I don&rsquo;t break it in a future version unintentionally.</li>
65
+ <li>Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.</li>
66
+ </ul>
67
+
68
+ <h1 id="copyright">Copyright</h1>
69
+
70
+ <p>Copyright (c) 2012 David Richards</p>
71
+
72
+ <p>Permission is hereby granted, free of charge, to any person obtaining
73
+ a copy of this software and associated documentation files (the
74
+ &ldquo;Software&rdquo;), to deal in the Software without restriction, including
75
+ without limitation the rights to use, copy, modify, merge, publish,
76
+ distribute, sublicense, and/or sell copies of the Software, and to
77
+ permit persons to whom the Software is furnished to do so, subject to
78
+ the following conditions:</p>
79
+
80
+ <p>The above copyright notice and this permission notice shall be
81
+ included in all copies or substantial portions of the Software.</p>
82
+
83
+ <p>THE SOFTWARE IS PROVIDED &ldquo;AS IS&rdquo;, WITHOUT WARRANTY OF ANY KIND,
84
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
85
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
86
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
87
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
88
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
89
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
@@ -0,0 +1,87 @@
1
+ Gearbox
2
+ =======
3
+
4
+ The purpose of this project is to make it easier for me to curate semantic graphs. I'm looking for deeper satisfaction in my personal research. I tend to fill my days researching technology, market dispositions, and my own business documents. These types of data stores, of course, could be applied in many areas.
5
+
6
+ To get to wherever I am now, I've been playing with semantic models for a while. I started by demonstrating working code from various corners of my imagination. After a while, I thought I had enough to create a useful gem. In the past, I've worked with [Spira](https://github.com/bhuga/spira) and examples given by [Gregg Kellogg](http://greggkellogg.net/). These have been very useful in forming ideas.
7
+
8
+ As I worked on this code, I decided to go to [Spira](https://github.com/bhuga/spira) to see how similar the two gems are. I was surprised how similar they actually are. The similarities are:
9
+
10
+ * both are ORMs for semantic data, written in Ruby
11
+ * support for properties/attributes
12
+ * concept of model associations
13
+ * data validations
14
+ * value types
15
+
16
+ However, Gearbox is quite a bit different. It came from a different place. I've been trying to embrace the nature of semantic models. This, juxtaposed against relational models or other types of models. The major differences, I imagine are:
17
+
18
+ * support for SPARQL-based scopes and finder methods
19
+ * better support for working with various SPARQL end points
20
+ * creating and maintaining full-text indices
21
+ * object factory from triples
22
+
23
+ Development Workflow for Semantic Data
24
+ ======================================
25
+
26
+ For a typical domain, I test-drive some models to define the nature of the data. These are custom-built to support the user scenarios and behavior an application is built to serve. For semantic models, I'm going for something different. The relationships between resources are much more dynamic. It's tough to build an application on dynamic domain models.
27
+
28
+ To work with this, I'd rather optimize for different things. Instead of trying to canonize the data, concretize the interaction. Given a head/buffer/file full of data, what's the easiest way to save it? Which values have to be recorded? Which values can be inferred or classified offline?
29
+
30
+ I think that there's going to be an evolution of the data graph. I'm looking to start with the mundane, and hope to be able to create a broad view from the details collected. Possibly, I will have alternative broad views, such as a full view of the topic or a chronological account of the topic as it transpires. From here, I want to look for insightful information: inferences that show the nature of our subject.
31
+
32
+ That's the goal.
33
+
34
+ Practically, the work changes over time. We start with defining the attributes and associations that are needed. This is the mundane. We then start to qualify the data by writing validations. Probably, there will be overlapping models to reflect the interaction. For example, browsing email might have a cursory recording of the people involved. Looking up Twitter information might have a more-specific user model. Facebook, the same. We're building a summary of the users, or whatever we're studying. From here, we might be able to use various analytical methods to classify and enhance the models, to clarify the story we are able to gather.
35
+
36
+ As you can see, this is a very different process than something we might do with typical relational data. I don't think there is much that we do with semantic data that can't be done with relational data, it's just that the technologies are optimized for different purposes.
37
+
38
+ Practical Example
39
+ =================
40
+
41
+ It would be good to offer a practical example. I'll get to these in a bit. I don't need to have the documentation get ahead of the released code.
42
+
43
+ TODO
44
+ ====
45
+
46
+ * bring in the association and combination code
47
+ * implement mutability
48
+ * implement persistence
49
+ * implement queryable
50
+ * implement named scopes
51
+ * implement some sort of repository access
52
+ * use Gearbox in the examples (were written to concretize an example in my head)
53
+
54
+ Contributing to Gearbox
55
+ =======================
56
+
57
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
58
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
59
+ * Fork the project
60
+ * Start a feature/bugfix branch
61
+ * Commit and push until you are happy with your contribution
62
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
63
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
64
+
65
+ Copyright
66
+ =========
67
+
68
+ Copyright (c) 2012 David Richards
69
+
70
+ Permission is hereby granted, free of charge, to any person obtaining
71
+ a copy of this software and associated documentation files (the
72
+ "Software"), to deal in the Software without restriction, including
73
+ without limitation the rights to use, copy, modify, merge, publish,
74
+ distribute, sublicense, and/or sell copies of the Software, and to
75
+ permit persons to whom the Software is furnished to do so, subject to
76
+ the following conditions:
77
+
78
+ The above copyright notice and this permission notice shall be
79
+ included in all copies or substantial portions of the Software.
80
+
81
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
82
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
83
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
84
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
85
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
86
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
87
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,46 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "gearbox"
18
+ gem.homepage = "http://github.com/davidrichards/gearbox"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Flexible semantic models.}
21
+ gem.description = %Q{A SPARQL-driven modeling toolset for semantic models.}
22
+ gem.email = "davidlamontrichards@gmail.com"
23
+ gem.authors = ["David Richards"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ # require 'rcov/rcovtask'
36
+ # Rcov::RcovTask.new do |test|
37
+ # test.libs << 'test'
38
+ # test.pattern = 'test/**/test_*.rb'
39
+ # test.verbose = true
40
+ # test.rcov_opts << '--exclude "gems/*"'
41
+ # end
42
+
43
+ task :default => :test
44
+
45
+ require 'yard'
46
+ YARD::Rake::YardocTask.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,24 @@
1
+ module Gearbox
2
+ class Audience
3
+
4
+ attr_writer :resource_source
5
+
6
+ attr_accessor :name
7
+
8
+ def add_resource(hash={})
9
+ new_resource = resource_source.call(hash.merge(:audience => self))
10
+ resources << new_resource
11
+ new_resource
12
+ end
13
+
14
+ def resources
15
+ @resources ||= []
16
+ end
17
+
18
+ private
19
+ def resource_source
20
+ @resource_source ||= Resource.public_method(:new)
21
+ end
22
+
23
+ end
24
+ end