ratom 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,7 @@
1
+ == 0.2.2 2008-02-10
2
+
3
+ * Removed dependency on ActiveSupport.
4
+
1
5
  == 0.2.1 2008-03-03
2
6
 
3
7
  * Initial release to the public.
data/README.txt CHANGED
@@ -14,7 +14,6 @@ and can be used to access Atom feeds or to script publishing entries to a blog s
14
14
 
15
15
  == Prerequisites
16
16
 
17
- * ActiveSupport, >= 2.0.1
18
17
  * libxml-ruby, = 0.5.2.0
19
18
  * rspec (Only required for tests)
20
19
 
@@ -105,6 +104,9 @@ You can also delete an entry using the <tt>destroy!</tt> method, but we won't do
105
104
  * Support batching of protocol operations.
106
105
  * Examples of editing existing entries.
107
106
  * All my tests have been against internal systems, I'd really like feedback from those who have tried rAtom using existing blog software that supports APP.
107
+ * Handle all base uri tests.
108
+ * What to do with extension elements?
109
+ * Add slug support.
108
110
 
109
111
  == Source Code
110
112
 
@@ -60,7 +60,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
60
60
  # == Optional
61
61
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
62
62
  # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
63
- p.extra_deps = [['activesupport', '>= 2.0.1'], ['libxml-ruby', '= 0.5.2.0']]
63
+ p.extra_deps = [['libxml-ruby', '= 0.5.2.0']]
64
64
 
65
65
  #p.spec_extras = {} # A hash of extra values to set in the gemspec.
66
66
 
@@ -4,9 +4,9 @@
4
4
  #
5
5
 
6
6
  require 'forwardable'
7
+ require 'delegate'
7
8
  require 'rubygems'
8
9
  require 'xml/libxml'
9
- require 'activesupport'
10
10
  require 'atom/xml/parser.rb'
11
11
 
12
12
  module Atom # :nodoc:
@@ -89,7 +89,6 @@ module Atom # :nodoc:
89
89
  # http://www.atomenabled.org/developers/syndication/atom-format-spec.php#element.content
90
90
  class Base < DelegateClass(String)
91
91
  include Xml::Parseable
92
- attribute :type, :'xml:lang'
93
92
 
94
93
  def initialize(c)
95
94
  __setobj__(c)
@@ -112,7 +111,8 @@ module Atom # :nodoc:
112
111
  end
113
112
 
114
113
  # Text content within an Atom document.
115
- class Text < Base
114
+ class Text < Base
115
+ attribute :type, :'xml:lang'
116
116
  def initialize(xml)
117
117
  super(xml.read_string)
118
118
  parse(xml, :once => true)
@@ -120,8 +120,8 @@ module Atom # :nodoc:
120
120
  end
121
121
 
122
122
  # Html content within an Atom document.
123
- class Html < Base
124
-
123
+ class Html < Base
124
+ attribute :type, :'xml:lang'
125
125
  # Creates a new Content::Html.
126
126
  #
127
127
  # +o+:: An XML::Reader or a HTML string.
@@ -148,7 +148,8 @@ module Atom # :nodoc:
148
148
 
149
149
  # XHTML content within an Atom document.
150
150
  class Xhtml < Base
151
- XHTML = 'http://www.w3.org/1999/xhtml'
151
+ XHTML = 'http://www.w3.org/1999/xhtml'
152
+ attribute :type, :'xml:lang'
152
153
 
153
154
  def initialize(xml)
154
155
  parse(xml, :once => true)
@@ -2,7 +2,7 @@ module Atom #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -7,6 +7,27 @@
7
7
 
8
8
  require 'net/http'
9
9
 
10
+ # Just a couple methods form transforming strings
11
+ unless defined?(ActiveSupport)
12
+ class String # :nodoc:
13
+ def singularize
14
+ if self =~ /ies$/
15
+ self.sub(/ies$/, 'y')
16
+ else
17
+ self.sub(/s$/, '')
18
+ end
19
+ end
20
+
21
+ def demodulize
22
+ self.sub(/.*::/, '')
23
+ end
24
+
25
+ def constantize
26
+ Object.module_eval("::#{self}", __FILE__, __LINE__)
27
+ end
28
+ end
29
+ end
30
+
10
31
  module Atom
11
32
  module Xml # :nodoc:
12
33
  module Parseable # :nodoc:
@@ -39,9 +60,12 @@ module Atom
39
60
  end
40
61
 
41
62
  def Parseable.included(o)
42
- o.send(:cattr_accessor, :element_specs, :attributes)
43
- o.element_specs = {}
44
- o.attributes = []
63
+ o.class_eval do
64
+ def o.element_specs; @element_specs ||= {}; end
65
+ def o.attributes; @attributes ||= []; end
66
+ def element_specs; self.class.element_specs; end
67
+ def attributes; self.class.attributes; end
68
+ end
45
69
  o.send(:extend, DeclarationMethods)
46
70
  end
47
71
 
@@ -513,7 +513,7 @@ describe Atom do
513
513
  end
514
514
 
515
515
  it "should include the non-core type in the list of links" do
516
- @entry.links.map(&:href).should include('http://www.snellspace.com/public/linktests/license')
516
+ @entry.links.map{|l| l.href }.should include('http://www.snellspace.com/public/linktests/license')
517
517
  end
518
518
  end
519
519
 
@@ -531,7 +531,7 @@ describe Atom do
531
531
  end
532
532
 
533
533
  it "should include the non-core type in the list of links identified by a uri" do
534
- @entry.links.map(&:href).should include('http://www.snellspace.com/public/linktests/example')
534
+ @entry.links.map{|l| l.href }.should include('http://www.snellspace.com/public/linktests/example')
535
535
  end
536
536
  end
537
537
 
@@ -549,7 +549,7 @@ describe Atom do
549
549
  end
550
550
 
551
551
  it "should include the non-core type in the list of links" do
552
- @entry.links.map(&:href).should include('http://www.snellspace.com/public/linktests/license')
552
+ @entry.links.map{|l| l.href }.should include('http://www.snellspace.com/public/linktests/license')
553
553
  end
554
554
  end
555
555
 
@@ -567,7 +567,7 @@ describe Atom do
567
567
  end
568
568
 
569
569
  it "should include the non-core type in the list of links identified by a uri" do
570
- @entry.links.map(&:href).should include('http://www.snellspace.com/public/linktests/example')
570
+ @entry.links.map{|l| l.href }.should include('http://www.snellspace.com/public/linktests/example')
571
571
  end
572
572
  end
573
573
  end
@@ -1,9 +1,3 @@
1
- begin
2
- require 'spec'
3
- rescue LoadError
4
- require 'rubygems'
5
- require 'spec'
6
- end
7
1
  begin
8
2
  require 'spec/rake/spectask'
9
3
  rescue LoadError
@@ -13,3 +7,11 @@ To use rspec for testing you must install rspec gem:
13
7
  EOS
14
8
  exit(0)
15
9
  end
10
+
11
+ desc "Run the specs under spec/models"
12
+ Spec::Rake::SpecTask.new do |t|
13
+ t.spec_opts = ['--options', "spec/spec.opts"]
14
+ t.spec_files = FileList['spec/**/*_spec.rb']
15
+ end
16
+
17
+ task :default => :spec
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ratom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ""
6
6
  authors:
7
7
  - Peerworks
@@ -9,18 +9,9 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-03-04 00:00:00 +10:30
12
+ date: 2008-03-10 00:00:00 +10:30
13
13
  default_executable:
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: activesupport
17
- version_requirement:
18
- version_requirements: !ruby/object:Gem::Requirement
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 2.0.1
23
- version:
24
15
  - !ruby/object:Gem::Dependency
25
16
  name: libxml-ruby
26
17
  version_requirement: