ruby-fedora 0.1.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/COPYING.LESSER.txt +165 -0
  2. data/COPYING.txt +674 -0
  3. data/Manifest.txt +19 -20
  4. data/README.txt +6 -1
  5. data/Rakefile +4 -0
  6. data/config/hoe.rb +2 -2
  7. data/config/requirements.rb +9 -2
  8. data/lib/active_fedora.rb +41 -0
  9. data/lib/active_fedora/base.rb +278 -8
  10. data/lib/active_fedora/content_model.rb +22 -0
  11. data/lib/active_fedora/datastream.rb +95 -0
  12. data/lib/active_fedora/fedora_object.rb +84 -0
  13. data/lib/active_fedora/metadata_datastream.rb +97 -0
  14. data/lib/active_fedora/model.rb +94 -0
  15. data/lib/active_fedora/property.rb +15 -0
  16. data/lib/active_fedora/qualified_dublin_core_datastream.rb +72 -0
  17. data/lib/active_fedora/relationship.rb +43 -0
  18. data/lib/active_fedora/rels_ext_datastream.rb +43 -0
  19. data/lib/active_fedora/semantic_node.rb +221 -0
  20. data/lib/active_fedora/solr_service.rb +20 -0
  21. data/lib/fedora/base.rb +2 -1
  22. data/lib/fedora/connection.rb +104 -134
  23. data/lib/fedora/datastream.rb +10 -1
  24. data/lib/fedora/fedora_object.rb +28 -24
  25. data/lib/fedora/generic_search.rb +71 -0
  26. data/lib/fedora/repository.rb +47 -3
  27. data/lib/ruby-fedora.rb +9 -8
  28. data/lib/util/class_level_inheritable_attributes.rb +23 -0
  29. data/solr/config/schema.xml +229 -0
  30. metadata +37 -24
  31. data/lib/active-fedora.rb +0 -1
  32. data/lib/ambition/adapters/active_fedora.rb +0 -10
  33. data/lib/ambition/adapters/active_fedora/base.rb +0 -14
  34. data/lib/ambition/adapters/active_fedora/query.rb +0 -48
  35. data/lib/ambition/adapters/active_fedora/select.rb +0 -104
  36. data/lib/ambition/adapters/active_fedora/slice.rb +0 -19
  37. data/lib/ambition/adapters/active_fedora/sort.rb +0 -43
  38. data/script/destroy +0 -14
  39. data/script/generate +0 -14
  40. data/script/txt2html +0 -74
  41. data/tasks/deployment.rake +0 -34
  42. data/tasks/environment.rake +0 -7
  43. data/tasks/website.rake +0 -17
  44. data/website/index.html +0 -93
  45. data/website/index.txt +0 -39
  46. data/website/javascripts/rounded_corners_lite.inc.js +0 -285
  47. data/website/stylesheets/screen.css +0 -138
  48. data/website/template.rhtml +0 -48
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-fedora
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt
@@ -9,11 +9,12 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-19 00:00:00 -05:00
12
+ date: 2009-01-19 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: facets
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
@@ -23,6 +24,7 @@ dependencies:
23
24
  version:
24
25
  - !ruby/object:Gem::Dependency
25
26
  name: xml-simple
27
+ type: :runtime
26
28
  version_requirement:
27
29
  version_requirements: !ruby/object:Gem::Requirement
28
30
  requirements:
@@ -32,6 +34,7 @@ dependencies:
32
34
  version:
33
35
  - !ruby/object:Gem::Dependency
34
36
  name: mime-types
37
+ type: :runtime
35
38
  version_requirement:
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
@@ -39,6 +42,16 @@ dependencies:
39
42
  - !ruby/object:Gem::Version
40
43
  version: "1.15"
41
44
  version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: hoe
47
+ type: :development
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 1.8.2
54
+ version:
42
55
  description: Ruby API for Fedora
43
56
  email:
44
57
  - matt.zumwalt@yourmediashelf.com>
@@ -47,12 +60,15 @@ executables: []
47
60
  extensions: []
48
61
 
49
62
  extra_rdoc_files:
63
+ - COPYING.LESSER.txt
64
+ - COPYING.txt
50
65
  - History.txt
51
66
  - License.txt
52
67
  - Manifest.txt
53
68
  - README.txt
54
- - website/index.txt
55
69
  files:
70
+ - COPYING.LESSER.txt
71
+ - COPYING.txt
56
72
  - History.txt
57
73
  - License.txt
58
74
  - Manifest.txt
@@ -60,33 +76,30 @@ files:
60
76
  - Rakefile
61
77
  - config/hoe.rb
62
78
  - config/requirements.rb
63
- - lib/ruby-fedora.rb
79
+ - lib/active_fedora.rb
80
+ - lib/active_fedora/base.rb
81
+ - lib/active_fedora/content_model.rb
82
+ - lib/active_fedora/datastream.rb
83
+ - lib/active_fedora/fedora_object.rb
84
+ - lib/active_fedora/metadata_datastream.rb
85
+ - lib/active_fedora/model.rb
86
+ - lib/active_fedora/property.rb
87
+ - lib/active_fedora/qualified_dublin_core_datastream.rb
88
+ - lib/active_fedora/relationship.rb
89
+ - lib/active_fedora/rels_ext_datastream.rb
90
+ - lib/active_fedora/semantic_node.rb
91
+ - lib/active_fedora/solr_service.rb
64
92
  - lib/fedora/base.rb
65
93
  - lib/fedora/connection.rb
66
94
  - lib/fedora/datastream.rb
67
95
  - lib/fedora/fedora_object.rb
68
96
  - lib/fedora/formats.rb
97
+ - lib/fedora/generic_search.rb
69
98
  - lib/fedora/repository.rb
70
- - lib/active-fedora.rb
71
- - lib/active_fedora/base.rb
72
- - lib/ambition/adapters/active_fedora.rb
73
- - lib/ambition/adapters/active_fedora/base.rb
74
- - lib/ambition/adapters/active_fedora/query.rb
75
- - lib/ambition/adapters/active_fedora/select.rb
76
- - lib/ambition/adapters/active_fedora/slice.rb
77
- - lib/ambition/adapters/active_fedora/sort.rb
78
- - script/destroy
79
- - script/generate
80
- - script/txt2html
99
+ - lib/ruby-fedora.rb
100
+ - lib/util/class_level_inheritable_attributes.rb
81
101
  - setup.rb
82
- - tasks/deployment.rake
83
- - tasks/environment.rake
84
- - tasks/website.rake
85
- - website/index.html
86
- - website/index.txt
87
- - website/javascripts/rounded_corners_lite.inc.js
88
- - website/stylesheets/screen.css
89
- - website/template.rhtml
102
+ - solr/config/schema.xml
90
103
  has_rdoc: true
91
104
  homepage: http://rubyfedora.rubyforge.org
92
105
  post_install_message:
@@ -110,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
123
  requirements: []
111
124
 
112
125
  rubyforge_project: rubyfedora
113
- rubygems_version: 1.1.1
126
+ rubygems_version: 1.3.1
114
127
  signing_key:
115
128
  specification_version: 2
116
129
  summary: Ruby API for Fedora
data/lib/active-fedora.rb DELETED
@@ -1 +0,0 @@
1
- require 'active_fedora/base'
@@ -1,10 +0,0 @@
1
- require 'ambition'
2
- require 'active-fedora'
3
- require 'ambition/adapters/active_fedora/base'
4
- require 'ambition/adapters/active_fedora/query'
5
- require 'ambition/adapters/active_fedora/select'
6
- require 'ambition/adapters/active_fedora/slice'
7
- require 'ambition/adapters/active_fedora/sort'
8
-
9
- ActiveFedora::Base.extend Ambition::API
10
- ActiveFedora::Base.ambition_adapter = Ambition::Adapters::ActiveFedora
@@ -1,14 +0,0 @@
1
- module Ambition
2
- module Adapters
3
- module ActiveFedora
4
- class Base
5
- def encode(value)
6
- case value
7
- when String then value.include?(' ') ? %Q('#{value}') : value
8
- else value.to_s
9
- end
10
- end
11
- end
12
- end
13
- end
14
- end
@@ -1,48 +0,0 @@
1
- =begin
2
-
3
- These methods are king:
4
-
5
- - owner
6
- - clauses
7
- - stash
8
-
9
- +owner+ is the class from which the request was generated.
10
-
11
- User.select { |u| u.name == 'Pork' }
12
- # => owner == User
13
-
14
- +clauses+ is the hash of translated arrays, keyed by processors
15
-
16
- User.select { |u| u.name == 'Pork' }
17
- # => clauses == { :select => [ "users.name = 'Pork'" ] }
18
-
19
- +stash+ is your personal private stash. A hash you can use for
20
- keeping stuff around.
21
-
22
- User.select { |u| u.profile.name == 'Pork' }
23
- # => stash == { :include => [ :profile ] }
24
-
25
- The above is totally arbitrary. It's basically a way for your
26
- translators to talk to each other and, more importantly, to the Query
27
- object.
28
-
29
- =end
30
- module Ambition
31
- module Adapters
32
- module ActiveFedora
33
- class Query < Base
34
- def kick
35
- owner.find_objects(to_s)
36
- end
37
-
38
- def size
39
- raise "Not Implemented"
40
- end
41
-
42
- def to_s
43
- clauses[:select].to_s
44
- end
45
- end
46
- end
47
- end
48
- end
@@ -1,104 +0,0 @@
1
- ##
2
- # The format of the documentation herein is:
3
- #
4
- # >> method with block
5
- # => methods on this class called by Ambition (with arguments)
6
- #
7
- module Ambition
8
- module Adapters
9
- module ActiveFedora
10
- class Select < Base
11
- # >> select { |u| u.name == 'chris' }
12
- # => #call(:name)
13
- def call(method)
14
- method
15
- end
16
-
17
- # >> select { |u| u.name.downcase == 'chris' }
18
- # => #call(:name, :downcase)
19
- def chained_call(*methods)
20
- # An idiom here is to call the chained method and pass it
21
- # the first method.
22
- #
23
- # if respond_to? methods[1]
24
- # send(methods[1], methods[0])
25
- # end
26
- #
27
- # In the above example, this translates to calling:
28
- #
29
- # #downcase(:name)
30
- #
31
- if respond_to? methods[1]
32
- send(methods[1], methods[0])
33
- else
34
- raise "I don't understand: #{methods.inspect}"
35
- end
36
- end
37
-
38
- # &&
39
- # >> select { |u| u.name == 'chris' && u.age == 22 }
40
- # => #both( processed left side, processed right side )
41
- def both(left, right)
42
- "#{left} #{right}"
43
- end
44
-
45
- # ||
46
- # >> select { |u| u.name == 'chris' || u.age == 22 }
47
- # => #either( processed left side, processed right side )
48
- def either(left, right)
49
- raise "Not implemented."
50
- end
51
-
52
- # >> select { |u| u.name == 'chris' }
53
- # => #==( call(:name), 'chris' )
54
- def ==(left, right)
55
- "#{left}=#{encode(right)}"
56
- end
57
-
58
- # !=
59
- # >> select { |u| u.name != 'chris' }
60
- # => #not_equal( call(:name), 'chris' )
61
- def not_equal(left, right)
62
- "#{left}!=#{encode(right)}"
63
- end
64
-
65
- # >> select { |u| u.name =~ 'chris' }
66
- # => #=~( call(:name), 'chris' )
67
- def =~(left, right)
68
- "#{left}~#{encode(right)}"
69
- end
70
-
71
- # !~
72
- # >> select { |u| u.name !~ 'chris' }
73
- # => #not_regexp( call(:name), 'chris' )
74
- def not_regexp(left, right)
75
- raise "Not implemented."
76
- end
77
-
78
- ##
79
- # Etc.
80
- def <(left, right)
81
- "#{left}<#{encode(right)}"
82
- end
83
-
84
- def >(left, right)
85
- "#{left}>#{encode(right)}"
86
- end
87
-
88
- def >=(left, right)
89
- "#{left}>=#{encode(right)}"
90
- end
91
-
92
- def <=(left, right)
93
- "#{left}<=#{encode(right)}"
94
- end
95
-
96
- # >> select { |u| [1, 2, 3].include? u.id }
97
- # => #include?( [1, 2, 3], call(:id) )
98
- def include?(left, right)
99
- raise "Not implemented."
100
- end
101
- end
102
- end
103
- end
104
- end
@@ -1,19 +0,0 @@
1
- module Ambition
2
- module Adapters
3
- module ActiveFedora
4
- class Slice < Base
5
- # >> User.first(5)
6
- # => #slice(0, 5)
7
- #
8
- # >> User.first
9
- # => #slice(0, 1)
10
- #
11
- # >> User[10, 20]
12
- # => #slice(10, 20)
13
- def slice(start, length)
14
- raise "Not implemented."
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,43 +0,0 @@
1
- module Ambition
2
- module Adapters
3
- module ActiveFedora
4
- class Sort < Base
5
- # >> sort_by { |u| u.age }
6
- # => #sort_by(:age)
7
- def sort_by(method)
8
- raise "Not implemented."
9
- end
10
-
11
- # >> sort_by { |u| -u.age }
12
- # => #reverse_sort_by(:age)
13
- def reverse_sort_by(method)
14
- raise "Not implemented."
15
- end
16
-
17
- # >> sort_by { |u| u.profile.name }
18
- # => #chained_sort_by(:profile, :name)
19
- def chained_sort_by(receiver, method)
20
- raise "Not implemented."
21
- end
22
-
23
- # >> sort_by { |u| -u.profile.name }
24
- # => #chained_reverse_sort_by(:profile, :name)
25
- def chained_reverse_sort_by(receiver, method)
26
- raise "Not implemented."
27
- end
28
-
29
- # >> sort_by(&:name)
30
- # => #to_proc(:name)
31
- def to_proc(symbol)
32
- raise "Not implemented."
33
- end
34
-
35
- # >> sort_by { rand }
36
- # => #rand
37
- def rand
38
- raise "Not implemented."
39
- end
40
- end
41
- end
42
- end
43
- end
data/script/destroy DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Generate.new.run(ARGV)
data/script/txt2html DELETED
@@ -1,74 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- begin
5
- require 'newgem'
6
- rescue LoadError
7
- puts "\n\nGenerating the website requires the newgem RubyGem"
8
- puts "Install: gem install newgem\n\n"
9
- exit(1)
10
- end
11
- require 'redcloth'
12
- require 'syntax/convertors/html'
13
- require 'erb'
14
- require File.dirname(__FILE__) + '/../lib/ruby-fedora.rb'
15
-
16
- version = RubyFedora::VERSION::STRING
17
- download = 'http://rubyforge.org/projects/RubyFedora'
18
-
19
- class Fixnum
20
- def ordinal
21
- # teens
22
- return 'th' if (10..19).include?(self % 100)
23
- # others
24
- case self % 10
25
- when 1: return 'st'
26
- when 2: return 'nd'
27
- when 3: return 'rd'
28
- else return 'th'
29
- end
30
- end
31
- end
32
-
33
- class Time
34
- def pretty
35
- return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
36
- end
37
- end
38
-
39
- def convert_syntax(syntax, source)
40
- return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
41
- end
42
-
43
- if ARGV.length >= 1
44
- src, template = ARGV
45
- template ||= File.join(File.dirname(__FILE__), '/../website/template.rhtml')
46
-
47
- else
48
- puts("Usage: #{File.split($0).last} source.txt [template.rhtml] > output.html")
49
- exit!
50
- end
51
-
52
- template = ERB.new(File.open(template).read)
53
-
54
- title = nil
55
- body = nil
56
- File.open(src) do |fsrc|
57
- title_text = fsrc.readline
58
- body_text = fsrc.read
59
- syntax_items = []
60
- body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
61
- ident = syntax_items.length
62
- element, syntax, source = $1, $2, $3
63
- syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
64
- "syntax-temp-#{ident}"
65
- }
66
- title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
67
- body = RedCloth.new(body_text).to_html
68
- body.gsub!(%r!(?:<pre><code>)?syntax-temp-(\d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
69
- end
70
- stat = File.stat(src)
71
- created = stat.ctime
72
- modified = stat.mtime
73
-
74
- $stdout << template.result(binding)