maiha-dm-ys 0.3.1 → 0.4

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.
data/README CHANGED
@@ -7,7 +7,7 @@ Example
7
7
  =======
8
8
 
9
9
  class Maintainer
10
- include DataMapper::YunkerStar
10
+ include DataMapper::YS
11
11
  uri "http://datamapper.org/doku.php?id=gem_maintainers"
12
12
  end
13
13
 
@@ -24,13 +24,28 @@ Example
24
24
  => ["Gem", "Maintainer", "Name"]
25
25
 
26
26
 
27
+ Anonymous class
28
+ ===============
29
+
30
+ [] is a syntax sugar for generating anonymous class
31
+
32
+ Wota = DataMapper::YS["http://wota.jp"]
33
+
34
+ is equivalent to
35
+
36
+ class Wota
37
+ include DataMapper::YS
38
+ uri "http://wota.jp"
39
+ end
40
+
41
+
27
42
  Pagination
28
43
  ==========
29
44
 
30
- Special syntax "uri*" means pagination mode that enables recursive retrieving.
45
+ Special syntax "URI*" means pagination mode that enables recursive retrieving.
31
46
 
32
47
  class Plugin
33
- include DataMapper::YunkerStar
48
+ include DataMapper::YS
34
49
  uri "http://merbi.st/plugins/index?page=1"
35
50
  end
36
51
 
@@ -41,7 +56,7 @@ This parses only specified uri.
41
56
  Append "*" to uri if you want pagination mode.
42
57
 
43
58
  class Plugin
44
- include DataMapper::YunkerStar
59
+ include DataMapper::YS
45
60
  uri "http://merbi.st/plugins/index?page=1*"
46
61
  end
47
62
 
@@ -49,4 +64,8 @@ Append "*" to uri if you want pagination mode.
49
64
  => 36
50
65
 
51
66
 
67
+ TODO
68
+ ====
69
+ * store link information for each columns
70
+
52
71
  Copyright (c) 2008 maiha@wota.jp, released under the MIT license
data/Rakefile CHANGED
@@ -33,7 +33,7 @@ AUTHOR = "maiha"
33
33
  EMAIL = "maiha@wota.jp"
34
34
  HOMEPAGE = "http://github.com/maiha/dm-ys"
35
35
  SUMMARY = "a DataMapper extension that uses html table as its schema and data powerfully like YunkerStar"
36
- GEM_VERSION = "0.3.1"
36
+ GEM_VERSION = "0.4"
37
37
 
38
38
  spec = Gem::Specification.new do |s|
39
39
  # s.rubyforge_project = 'merb'
@@ -10,4 +10,5 @@ require __DIR__ + '/dm-ys/cached_accessor'
10
10
  require __DIR__ + '/dm-ys/memory_repository'
11
11
  require __DIR__ + '/dm-ys/proxy'
12
12
  require __DIR__ + '/dm-ys/indexed_property'
13
+ require __DIR__ + '/dm-ys/element_property'
13
14
  require __DIR__ + '/dm-ys/scraper'
@@ -1,5 +1,5 @@
1
1
  module DataMapper
2
- module YunkerStar
2
+ module YS
3
3
  # @api public
4
4
  def self.append_inclusions(*inclusions)
5
5
  extra_inclusions.concat inclusions
@@ -12,10 +12,11 @@ module DataMapper
12
12
 
13
13
  # @api private
14
14
  def self.included(model)
15
- name = 'YunkelStar'
15
+ name = 'YS'
16
16
  model.send :include, DataMapper::Resource
17
17
  model.send :include, Proxy
18
18
  model.send :include, IndexedProperty
19
+ model.send :include, ElementProperty
19
20
  # model.send :include, MemoryRepository
20
21
  model.const_set(name, self) unless model.const_defined?(name)
21
22
  extra_inclusions.each { |inclusion| model.send(:include, inclusion) }
@@ -29,10 +30,11 @@ module DataMapper
29
30
 
30
31
  # @api public
31
32
  def self.[](uri)
32
- klass = Class.new do
33
- include DataMapper::YunkerStar
33
+ klass = Class.new
34
+ klass.class_eval do
35
+ include DataMapper::YS
36
+ self.uri uri
34
37
  end
35
- klass.uri uri
36
38
  return klass
37
39
  end
38
40
  end
@@ -1,5 +1,5 @@
1
1
  module DataMapper
2
- module YunkerStar
2
+ module YS
3
3
  ######################################################################
4
4
  ### CachedAccessor
5
5
 
@@ -1,5 +1,5 @@
1
1
  module DataMapper
2
- module YunkerStar
2
+ module YS
3
3
  class Config
4
4
  def self.default
5
5
  {:max_pages=>100, :uniq=>true}
@@ -1,10 +1,10 @@
1
1
  module DataMapper
2
- module YunkerStar
2
+ module YS
3
3
 
4
4
  # ==== Example
5
5
  #
6
6
  # Class Foo
7
- # include DataMapper::YunkerStar
7
+ # include DataMapper::YS
8
8
  # property :id, Serial
9
9
  #
10
10
  # foo = Foo.new
@@ -13,18 +13,26 @@ module DataMapper
13
13
  class InvalidIndex < RuntimeError; end
14
14
 
15
15
  module IndexedProperty
16
- def [](key)
16
+ def normalized_property_for(key)
17
17
  case key
18
18
  when Integer
19
- self[properties.map(&:name)[key]]
19
+ properties.map(&:name)[key]
20
20
  when String
21
- attributes[key.intern]
21
+ key.intern
22
22
  when Symbol
23
- attributes[key]
23
+ key
24
24
  else
25
25
  raise InvalidIndex, "expected Integer/String/Symbol, but got #{key.class}"
26
26
  end
27
27
  end
28
+
29
+ def [](key)
30
+ attributes[normalized_property_for(key)]
31
+ end
32
+
33
+ def <=>(other)
34
+ id<=>other.id
35
+ end
28
36
  end
29
37
 
30
38
  end
@@ -1,5 +1,5 @@
1
1
  module DataMapper
2
- module YunkerStar
2
+ module YS
3
3
  ######################################################################
4
4
  ### MemoryRepository
5
5
 
@@ -1,10 +1,10 @@
1
1
  module DataMapper
2
- module YunkerStar
2
+ module YS
3
3
 
4
4
  # ==== Example
5
5
  #
6
6
  # Class Foo
7
- # include DataMapper::YunkerStar
7
+ # include DataMapper::YS
8
8
  #
9
9
  # uri "http://ds.gkwiki2.com/47.html"
10
10
  # thead "table.style_table thead tr"
@@ -18,7 +18,7 @@ module DataMapper
18
18
  dsl_accessor :table
19
19
  dsl_accessor :tbody
20
20
  dsl_accessor :thead
21
- dsl_accessor :ys, :default=>proc{|*a| DataMapper::YunkerStar::Config.new}
21
+ dsl_accessor :ys, :default=>proc{|*a| DataMapper::YS::Config.new}
22
22
  property :id, DataMapper::Types::Serial
23
23
  end
24
24
  end
@@ -38,20 +38,16 @@ module DataMapper
38
38
  proxy.labels
39
39
  end
40
40
 
41
- def entries
42
- proxy.entries
41
+ def records
42
+ @records ||= (proxy.records.each_with_index{|r,i| r.id = i+1}; proxy.records)
43
43
  end
44
44
 
45
45
  def count
46
- entries.size
46
+ records.size
47
47
  end
48
48
 
49
49
  def all
50
- count = 0
51
- @all ||= entries.map{|array|
52
- count += 1
53
- new(Hash[*names.zip(array).flatten].merge(:id=>count))
54
- }
50
+ records
55
51
  end
56
52
 
57
53
  def first
@@ -1,5 +1,5 @@
1
1
  module DataMapper
2
- module YunkerStar
2
+ module YS
3
3
 
4
4
  ######################################################################
5
5
  ### Scrape html
@@ -56,12 +56,12 @@ module DataMapper
56
56
  raise ArgumentError, "missing uri" unless model.uri
57
57
  @model = model
58
58
  end
59
- [:names, :labels, :entries].each do |method|
59
+ [:names, :labels, :records].each do |method|
60
60
  define_method(method) {raise NotImplementedError, method.to_s}
61
61
  end
62
62
 
63
63
  def count
64
- entries.size
64
+ records.size
65
65
  end
66
66
 
67
67
  def uri
@@ -104,24 +104,31 @@ module DataMapper
104
104
  attrs = [
105
105
  [ :html, "#{html.size}bytes" ],
106
106
  [ :names, names ],
107
- [ :entries, count ],
107
+ [ :records, count ],
108
108
  ]
109
109
  "#<#{self.class.name} #{attrs.map { |(k,v)| "@#{k}=#{v.inspect}" } * ' '}>"
110
110
  end
111
111
 
112
112
  def page_hash
113
- body = entries.flatten.join("\t")
114
- Digest::SHA1.hexdigest(body)
113
+ Digest::SHA1.hexdigest(tbody.inspect)
115
114
  end
116
115
 
117
116
  cached_accessor do
118
- doc {Hpricot(@html)}
119
- table {specified(:table) or guess_table}
120
- thead {specified(:thead) or table.search("> thead").first or table}
121
- tbody {specified(:tbody) or table.search("> tbody").first or table}
122
- names {labels.map{|i| label2name(i)}}
123
- labels {thead.search("> tr").first.search("> td|th").map{|i|strip_tags(i.inner_html)}}
124
- entries {tbody.search("> tr").map{|tr| tr.search("> td").map{|i|strip_tags(i.inner_html)}}.delete_if{|i|i.blank?}}
117
+ doc {Hpricot(@html)}
118
+ table {specified(:table) or guess_table}
119
+ thead {specified(:thead) or table.search("> thead").first or table}
120
+ tbody {specified(:tbody) or table.search("> tbody").first or table}
121
+ names {labels.map{|i| label2name(i)}}
122
+ labels {thead.search("> tr").first.search("> td|th").map{|i|strip_tags(i.inner_html)}}
123
+ records {
124
+ tbody.search("> tr").map do |tr|
125
+ elems = tr.search("> td")
126
+ values = elems.map{|i|strip_tags(i.inner_html)}
127
+ record = @model.new(Hash[*names.zip(values).flatten])
128
+ record.elements = Hash[*names.zip(elems).flatten]
129
+ record
130
+ end
131
+ }
125
132
  end
126
133
 
127
134
  private
@@ -195,13 +202,13 @@ module DataMapper
195
202
  pages.first.labels
196
203
  end
197
204
 
198
- def entries
205
+ def records
199
206
  records = []
200
207
  digests = Set.new
201
208
  pages.each do |page|
202
- page.entries.each do |entry|
209
+ page.records.each do |entry|
203
210
  if config.uniq_entry?
204
- sha1 = Digest::SHA1.hexdigest(entry.join("\t"))
211
+ sha1 = entry.attributes.merge(:id=>nil).inspect
205
212
  next if digests.include?(sha1)
206
213
  digests << sha1
207
214
  end
@@ -1,22 +1,32 @@
1
1
  require File.join( File.dirname(__FILE__), "spec_helper" )
2
2
 
3
- describe DataMapper::YunkerStar do
3
+ describe DataMapper::YS do
4
4
  it "should provide []" do
5
- DataMapper::YunkerStar.should respond_to(:[])
5
+ DataMapper::YS.should respond_to(:[])
6
6
  end
7
7
 
8
8
  describe "[]" do
9
9
  before(:each) do
10
10
  @uri = "http://merbi.st/plugins/index?page=1"
11
- @ys = DataMapper::YunkerStar[@uri]
11
+ @ys = DataMapper::YS[@uri]
12
12
  end
13
13
 
14
14
  it "should return a new class" do
15
15
  @ys.should be_kind_of(Class)
16
16
  end
17
17
 
18
- it "should include DataMapper::YunkerStar" do
19
- @ys.ancestors.should be_include(DataMapper::YunkerStar)
18
+ it "should include DataMapper::YS" do
19
+ @ys.ancestors.should be_include(DataMapper::YS)
20
+ end
21
+
22
+ it "should have ys option" do
23
+ @ys.should respond_to(:ys)
24
+ end
25
+
26
+ describe ".ys" do
27
+ it "should return a kind of Config" do
28
+ @ys.ys.should be_kind_of(DataMapper::YS::Config)
29
+ end
20
30
  end
21
31
 
22
32
  it "should set uri" do
@@ -1,8 +1,12 @@
1
1
  require File.join( File.dirname(__FILE__), "spec_helper" )
2
2
 
3
- describe DataMapper::YunkerStar::Scraper::Composite do
3
+ describe DataMapper::YS::Scraper::Composite do
4
4
  before(:each) do
5
- @scraper = DataMapper::YunkerStar::Scraper::Composite.new(Plugin)
5
+ @scraper = DataMapper::YS::Scraper::Composite.new(Plugin)
6
+ end
7
+
8
+ def strip_id(records)
9
+ records.map{|r| r = r.dup; r.attributes[:id] = nil; r}
6
10
  end
7
11
 
8
12
  it "should provide #uri" do
@@ -43,7 +47,7 @@ describe DataMapper::YunkerStar::Scraper::Composite do
43
47
 
44
48
  describe "#names" do
45
49
  it "should return same value as Plugin" do
46
- @scraper.names.should == DataMapper::YunkerStar::Scraper::Page.new(Plugin1).names
50
+ @scraper.names.should == DataMapper::YS::Scraper::Page.new(Plugin1).names
47
51
  end
48
52
  end
49
53
 
@@ -53,17 +57,18 @@ describe DataMapper::YunkerStar::Scraper::Composite do
53
57
 
54
58
  describe "#labels" do
55
59
  it "should return same value as Plugin" do
56
- @scraper.labels.should == DataMapper::YunkerStar::Scraper::Page.new(Plugin1).labels
60
+ @scraper.labels.should == DataMapper::YS::Scraper::Page.new(Plugin1).labels
57
61
  end
58
62
  end
59
63
 
60
- it "should provide #entries" do
61
- @scraper.should respond_to(:entries)
64
+ it "should provide #records" do
65
+ @scraper.should respond_to(:records)
62
66
  end
63
67
 
64
- describe "#entries" do
68
+ describe "#records" do
65
69
  it "should return same value as Plugin" do
66
- @scraper.entries.should == (Plugin1.entries + Plugin2.entries)
70
+ @scraper.records.map(&:Name).should ==
71
+ Plugin1.records.map(&:Name) + Plugin2.records.map(&:Name)
67
72
  end
68
73
  end
69
74
 
@@ -72,14 +77,15 @@ describe DataMapper::YunkerStar::Scraper::Composite do
72
77
  SortedPlugin.proxy.pages.size.should == 6
73
78
  end
74
79
 
75
- describe "#entries" do
76
- it "should return duplicate entries" do
77
- SortedPlugin.entries.sort.should == ((SortedPlugin1.entries + SortedPlugin2.entries)*3).sort
80
+ describe "#records" do
81
+ it "should return duplicate records" do
82
+ total = SortedPlugin1.records.map{|i|i[1]} + SortedPlugin2.records.map{|i|i[1]}
83
+ SortedPlugin.records.map{|i|i[1]}.sort.should == (total*3).sort
78
84
  end
79
85
  end
80
86
 
81
87
  describe "#count" do
82
- it "should return duplicate entries" do
88
+ it "should return duplicate records" do
83
89
  SortedPlugin.count.should == (SortedPlugin1.count + SortedPlugin2.count)*3
84
90
  end
85
91
  end
@@ -90,9 +96,10 @@ describe DataMapper::YunkerStar::Scraper::Composite do
90
96
  SortedPluginWithUniqPage.proxy.pages.size.should == 2
91
97
  end
92
98
 
93
- describe "#entries" do
99
+ describe "#records" do
94
100
  it "should return same value as Plugin" do
95
- SortedPluginWithUniqPage.entries.should == (SortedPlugin1.entries + SortedPlugin2.entries)
101
+ SortedPluginWithUniqPage.records.map{|i|i[1]}.sort.should ==
102
+ (SortedPlugin1.records.map{|i|i[1]} + SortedPlugin2.records.map{|i|i[1]}).sort
96
103
  end
97
104
  end
98
105
 
@@ -102,20 +109,4 @@ describe DataMapper::YunkerStar::Scraper::Composite do
102
109
  end
103
110
  end
104
111
  end
105
-
106
- describe "UniqPlugin" do
107
- it "should return 2 pages" do
108
- UniqPlugin.proxy.pages.size.should == 2
109
- end
110
-
111
- describe "#count" do
112
- it "should return same value as Plugin" do
113
- UniqPlugin1.count.should == 20
114
- UniqPlugin2.count.should == 4
115
- UniqPlugin .count.should == 22
116
- end
117
- end
118
- end
119
-
120
-
121
112
  end
@@ -1,8 +1,8 @@
1
1
  require File.join( File.dirname(__FILE__), "spec_helper" )
2
2
 
3
- describe DataMapper::YunkerStar::Config do
3
+ describe DataMapper::YS::Config do
4
4
  before(:each) do
5
- @config = DataMapper::YunkerStar::Config.new
5
+ @config = DataMapper::YS::Config.new
6
6
  end
7
7
 
8
8
  it "should provide []" do
@@ -25,17 +25,17 @@ describe DataMapper::YunkerStar::Config do
25
25
  end
26
26
 
27
27
  it "should return true when :uniq is set to :page" do
28
- config = DataMapper::YunkerStar::Config.new(:uniq=>:page)
28
+ config = DataMapper::YS::Config.new(:uniq=>:page)
29
29
  config.uniq_page?.should == true
30
30
  end
31
31
 
32
32
  it "should return true when :uniq is set to :entry" do
33
- config = DataMapper::YunkerStar::Config.new(:uniq=>:entry)
33
+ config = DataMapper::YS::Config.new(:uniq=>:entry)
34
34
  config.uniq_page?.should == true
35
35
  end
36
36
 
37
37
  it "should return false when :uniq is set to false" do
38
- config = DataMapper::YunkerStar::Config.new(:uniq=>false)
38
+ config = DataMapper::YS::Config.new(:uniq=>false)
39
39
  config.uniq_page?.should == false
40
40
  end
41
41
  end
@@ -50,17 +50,17 @@ describe DataMapper::YunkerStar::Config do
50
50
  end
51
51
 
52
52
  it "should return false when :uniq is set to :page" do
53
- config = DataMapper::YunkerStar::Config.new(:uniq=>:page)
53
+ config = DataMapper::YS::Config.new(:uniq=>:page)
54
54
  config.uniq_entry?.should == false
55
55
  end
56
56
 
57
57
  it "should return true when :uniq is set to :entry" do
58
- config = DataMapper::YunkerStar::Config.new(:uniq=>:entry)
58
+ config = DataMapper::YS::Config.new(:uniq=>:entry)
59
59
  config.uniq_entry?.should == true
60
60
  end
61
61
 
62
62
  it "should return false when :uniq is set to :page" do
63
- config = DataMapper::YunkerStar::Config.new(:uniq=>false)
63
+ config = DataMapper::YS::Config.new(:uniq=>false)
64
64
  config.uniq_entry?.should == false
65
65
  end
66
66
 
@@ -75,144 +75,6 @@
75
75
  <td>
76
76
  </td>
77
77
  </tr>
78
- <tr class="">
79
- <td><a href="/plugins/33">merb-slices-search-path-fix-0.0.1</a></td>
80
- <td>&dagger;</td>
81
- <td><a href="/users/1">genki</a></td>
82
- <td>A merb plugin that fixes </td>
83
- <td>
84
- </td>
85
- </tr>
86
- <tr class="even">
87
- <td><a href="/plugins/32">rubyforge-1.0.2</a></td>
88
- <td>&dagger;</td>
89
- <td><a href="/users/1">genki</a></td>
90
- <td>A script which automates a limited set of rubyforge operations.
91
- </td>
92
- <td>
93
- </td>
94
- </tr>
95
- <tr class="">
96
- <td><a href="/plugins/31">ruby-git</a></td>
97
- <td>&dagger;</td>
98
- <td><a href="/users/1">genki</a></td>
99
- <td>Ruby/Git is a Ruby library that can be used to create, read and manipulate Git repositories by wrapping system calls to the git binary.</td>
100
- <td>
101
- </td>
102
- </tr>
103
- <tr class="even">
104
- <td><a href="/plugins/30">fastthread-1.0.1</a></td>
105
- <td>&dagger;</td>
106
- <td><a href="/users/1">genki</a></td>
107
- <td>fastthread that is compatible to ruby191</td>
108
- <td>
109
- </td>
110
- </tr>
111
- <tr class="">
112
- <td><a href="/plugins/29">mime-types-1.15.1</a></td>
113
- <td>&dagger;</td>
114
- <td><a href="/users/1">genki</a></td>
115
- <td>This library allows for the identification of a file’s likely MIME content type.</td>
116
- <td>
117
- </td>
118
- </tr>
119
- <tr class="even">
120
- <td><a href="/plugins/28">memcached-0.14</a></td>
121
- <td>&dagger;</td>
122
- <td><a href="/users/1">genki</a></td>
123
- <td>A Ruby interface to the libmemcached C client</td>
124
- <td>
125
- </td>
126
- </tr>
127
- <tr class="">
128
- <td><a href="/plugins/27">gem_plugin-0.2.3</a></td>
129
- <td>&dagger;</td>
130
- <td><a href="/users/1">genki</a></td>
131
- <td>Gem Based Plugin System</td>
132
- <td>
133
- </td>
134
- </tr>
135
- <tr class="even">
136
- <td><a href="/plugins/26">cgi_multipart_eof_fix-2.5.0</a></td>
137
- <td>&dagger;</td>
138
- <td><a href="/users/1">genki</a></td>
139
- <td>cgi_multipart_eof_fix on github</td>
140
- <td>
141
- </td>
142
- </tr>
143
- <tr class="">
144
- <td><a href="/plugins/25">mongrel-1.1.2</a></td>
145
- <td>&dagger;</td>
146
- <td><a href="/users/1">genki</a></td>
147
- <td>Mongrel</td>
148
- <td>
149
- </td>
150
- </tr>
151
- <tr class="even">
152
- <td><a href="/plugins/24">hpricot-0.6.207</a></td>
153
- <td>&dagger;</td>
154
- <td><a href="/users/1">genki</a></td>
155
- <td>A swift, liberal HTML parser with a fantastic library</td>
156
- <td>
157
- </td>
158
- </tr>
159
- <tr class="">
160
- <td><a href="/plugins/23">methopara-0.3.0</a></td>
161
- <td>&dagger;</td>
162
- <td><a href="/users/1">genki</a></td>
163
- <td>Method#parameters for ruby-1.9.1</td>
164
- <td>
165
- </td>
166
- </tr>
167
- <tr class="even">
168
- <td><a href="/plugins/22">irb_rocket-0.1.3</a></td>
169
- <td>&dagger;</td>
170
- <td><a href="/users/1">genki</a></td>
171
- <td>irb plugin that makes irb #=&gt; rocket</td>
172
- <td>
173
- </td>
174
- </tr>
175
- <tr class="">
176
- <td><a href="/plugins/21">ruby-terminfo-0.1.1</a></td>
177
- <td>&dagger;</td>
178
- <td><a href="/users/1">genki</a></td>
179
- <td>ruby-terminfo is a terminfo binding for Ruby</td>
180
- <td>
181
- </td>
182
- </tr>
183
- <tr class="even">
184
- <td><a href="/plugins/20">extlib-present-0.0.2</a></td>
185
- <td>&dagger;</td>
186
- <td><a href="/users/1">genki</a></td>
187
- <td>A plugin that provides Object#present?</td>
188
- <td>
189
- </td>
190
- </tr>
191
- <tr class="">
192
- <td><a href="/plugins/19">merb_render_filter-0.0.2</a></td>
193
- <td>&dagger;</td>
194
- <td><a href="/users/1">genki</a></td>
195
- <td>A plugin that provides {before|after}_render filters for Controller.</td>
196
- <td>
197
- </td>
198
- </tr>
199
- <tr class="even">
200
- <td><a href="/plugins/18">bcrypt-ruby-2.0.3</a></td>
201
- <td>&dagger;</td>
202
- <td><a href="/users/1">genki</a></td>
203
- <td>bcrypt-ruby is a Ruby binding for the OpenBSD bcrypt() password hashing algorithm, allowing you to easily store a secure hash of your users' passwords.
204
- </td>
205
- <td>
206
- </td>
207
- </tr>
208
- <tr class="">
209
- <td><a href="/plugins/17">json-1.1.4.1</a></td>
210
- <td>&dagger;</td>
211
- <td><a href="/users/1">genki</a></td>
212
- <td>This library can parse JSON texts and generate them from ruby data structures. Install the extension variant (in C) with &quot;gem install json&quot; or install the pure Ruby variant with &quot;gem install json_pure&quot;.</td>
213
- <td>
214
- </td>
215
- </tr>
216
78
  </tbody>
217
79
  </table>
218
80
 
@@ -75,110 +75,6 @@
75
75
  <td>
76
76
  </td>
77
77
  </tr>
78
- <tr class="">
79
- <td><a href="/plugins/13">merb_full_url-0.0.2</a></td>
80
- <td>&dagger;</td>
81
- <td><a href="/users/1">genki</a></td>
82
- <td>A plugin for merb framework that provides full_url/full_resource method.</td>
83
- <td>
84
- </td>
85
- </tr>
86
- <tr class="even">
87
- <td><a href="/plugins/12">merb_timezone_select-0.0.2</a></td>
88
- <td>&dagger;</td>
89
- <td><a href="/users/1">genki</a></td>
90
- <td>A plugin for the Merb framework that provides timezone selector</td>
91
- <td>
92
- </td>
93
- </tr>
94
- <tr class="">
95
- <td><a href="/plugins/11">merb_slice-gen-0.0.2</a></td>
96
- <td>&dagger;</td>
97
- <td><a href="/users/1">genki</a></td>
98
- <td>generator for slices</td>
99
- <td>
100
- </td>
101
- </tr>
102
- <tr class="even">
103
- <td><a href="/plugins/10">merb_recognize_path-0.0.2</a></td>
104
- <td>&dagger;</td>
105
- <td><a href="/users/1">genki</a></td>
106
- <td>A merb plugin for the Merb framework that provides recognize_path method. </td>
107
- <td>
108
- </td>
109
- </tr>
110
- <tr class="">
111
- <td><a href="/plugins/9">merb_component-0.2.3</a></td>
112
- <td>&dagger;</td>
113
- <td><a href="/users/1">genki</a></td>
114
- <td>Merb plugin that provides composition of controllers.</td>
115
- <td>
116
- </td>
117
- </tr>
118
- <tr class="even">
119
- <td><a href="/plugins/8">dm-pagination-0.1.2.1</a></td>
120
- <td>&dagger;</td>
121
- <td><a href="/users/1">genki</a></td>
122
- <td>A pagination plugin for DataMapper.</td>
123
- <td>
124
- </td>
125
- </tr>
126
- <tr class="">
127
- <td><a href="/plugins/7">pagination_scope-0.0.8</a></td>
128
- <td>&dagger;</td>
129
- <td><a href="/users/1">genki</a></td>
130
- <td>This is a rails plugin module for mixing in pagination function.</td>
131
- <td>
132
- </td>
133
- </tr>
134
- <tr class="even">
135
- <td><a href="/plugins/6">rttool-1.0.2</a></td>
136
- <td>&dagger;</td>
137
- <td><a href="/users/1">genki</a></td>
138
- <td>Simple table generator</td>
139
- <td>
140
- </td>
141
- </tr>
142
- <tr class="">
143
- <td><a href="/plugins/5">dm-has-versions-0.1.1</a></td>
144
- <td>&dagger;</td>
145
- <td><a href="/users/1">genki</a></td>
146
- <td>A plugin that adds version control to DataMapper models.</td>
147
- <td>
148
- </td>
149
- </tr>
150
- <tr class="even">
151
- <td><a href="/plugins/4">merb_babel-0.1.2.2</a></td>
152
- <td>&dagger;</td>
153
- <td><a href="/users/1">genki</a></td>
154
- <td>Merb用I18n/L10nライブラリ</td>
155
- <td>
156
- </td>
157
- </tr>
158
- <tr class="">
159
- <td><a href="/plugins/3">dm-is-paginated</a></td>
160
- <td></td>
161
- <td><a href="/users/1">genki</a></td>
162
- <td>dm-is-paginated is a simple pagination plugin for DataMapper.</td>
163
- <td>
164
- </td>
165
- </tr>
166
- <tr class="even">
167
- <td><a href="/plugins/2">merb-pagination</a></td>
168
- <td></td>
169
- <td><a href="/users/1">genki</a></td>
170
- <td>A pagination helper for merb. Useful with dm-is-paginated or with Sequel’s built in pagination.</td>
171
- <td>
172
- </td>
173
- </tr>
174
- <tr class="">
175
- <td><a href="/plugins/1">merb-auth-slice-activation</a></td>
176
- <td></td>
177
- <td><a href="/users/1">genki</a></td>
178
- <td>This slice provides a check to make sure that a user is active on login. It also provides activation on the “user” object via an activation action (slice_url :activate).</td>
179
- <td>
180
- </td>
181
- </tr>
182
78
  </tbody>
183
79
  </table>
184
80
 
@@ -51,7 +51,7 @@
51
51
  <td><a href="/plugins/36">eventmachine-0.12.5</a></td>
52
52
  <td>&dagger;</td>
53
53
  <td><a href="/users/1">genki</a></td>
54
- <td>EventMachine: fast, simple event-processing library for Ruby programs</td>
54
+ <td>EventMachine</td>
55
55
  <td>
56
56
  </td>
57
57
  </tr>
@@ -59,153 +59,7 @@
59
59
  <td><a href="/plugins/35">dm-last-0.0.1</a></td>
60
60
  <td>&dagger;</td>
61
61
  <td><a href="/users/1">genki</a></td>
62
- <td>A DataMapper plugin that offers a short-hand for Model.all.last as Model.last</td>
63
- <td>
64
- </td>
65
- </tr>
66
- <tr class="even">
67
- <td><a href="/plugins/34">sweet_merb_fixtures-0.0.4</a></td>
68
- <td>&dagger;</td>
69
- <td><a href="/users/1">genki</a></td>
70
- <td>The way to store records from YAML file.</td>
71
- <td>
72
- </td>
73
- </tr>
74
- <tr class="">
75
- <td><a href="/plugins/33">merb-slices-search-path-fix-0.0.1</a></td>
76
- <td>&dagger;</td>
77
- <td><a href="/users/1">genki</a></td>
78
- <td>A merb plugin that fixes </td>
79
- <td>
80
- </td>
81
- </tr>
82
- <tr class="even">
83
- <td><a href="/plugins/32">rubyforge-1.0.2</a></td>
84
- <td>&dagger;</td>
85
- <td><a href="/users/1">genki</a></td>
86
- <td>A script which automates a limited set of rubyforge operations.
87
- </td>
88
- <td>
89
- </td>
90
- </tr>
91
- <tr class="">
92
- <td><a href="/plugins/31">ruby-git</a></td>
93
- <td>&dagger;</td>
94
- <td><a href="/users/1">genki</a></td>
95
- <td>Ruby/Git is a Ruby library that can be used to create, read and manipulate Git repositories by wrapping system calls to the git binary.</td>
96
- <td>
97
- </td>
98
- </tr>
99
- <tr class="even">
100
- <td><a href="/plugins/30">fastthread-1.0.1</a></td>
101
- <td>&dagger;</td>
102
- <td><a href="/users/1">genki</a></td>
103
- <td>fastthread that is compatible to ruby191</td>
104
- <td>
105
- </td>
106
- </tr>
107
- <tr class="">
108
- <td><a href="/plugins/29">mime-types-1.15.1</a></td>
109
- <td>&dagger;</td>
110
- <td><a href="/users/1">genki</a></td>
111
- <td>This library allows for the identification of a file’s likely MIME content type.</td>
112
- <td>
113
- </td>
114
- </tr>
115
- <tr class="even">
116
- <td><a href="/plugins/28">memcached-0.14</a></td>
117
- <td>&dagger;</td>
118
- <td><a href="/users/1">genki</a></td>
119
- <td>A Ruby interface to the libmemcached C client</td>
120
- <td>
121
- </td>
122
- </tr>
123
- <tr class="">
124
- <td><a href="/plugins/27">gem_plugin-0.2.3</a></td>
125
- <td>&dagger;</td>
126
- <td><a href="/users/1">genki</a></td>
127
- <td>Gem Based Plugin System</td>
128
- <td>
129
- </td>
130
- </tr>
131
- <tr class="even">
132
- <td><a href="/plugins/26">cgi_multipart_eof_fix-2.5.0</a></td>
133
- <td>&dagger;</td>
134
- <td><a href="/users/1">genki</a></td>
135
- <td>cgi_multipart_eof_fix on github</td>
136
- <td>
137
- </td>
138
- </tr>
139
- <tr class="">
140
- <td><a href="/plugins/25">mongrel-1.1.2</a></td>
141
- <td>&dagger;</td>
142
- <td><a href="/users/1">genki</a></td>
143
- <td>Mongrel</td>
144
- <td>
145
- </td>
146
- </tr>
147
- <tr class="even">
148
- <td><a href="/plugins/24">hpricot-0.6.207</a></td>
149
- <td>&dagger;</td>
150
- <td><a href="/users/1">genki</a></td>
151
- <td>A swift, liberal HTML parser with a fantastic library</td>
152
- <td>
153
- </td>
154
- </tr>
155
- <tr class="">
156
- <td><a href="/plugins/23">methopara-0.3.0</a></td>
157
- <td>&dagger;</td>
158
- <td><a href="/users/1">genki</a></td>
159
- <td>Method#parameters for ruby-1.9.1</td>
160
- <td>
161
- </td>
162
- </tr>
163
- <tr class="even">
164
- <td><a href="/plugins/22">irb_rocket-0.1.3</a></td>
165
- <td>&dagger;</td>
166
- <td><a href="/users/1">genki</a></td>
167
- <td>irb plugin that makes irb #=&gt; rocket</td>
168
- <td>
169
- </td>
170
- </tr>
171
- <tr class="">
172
- <td><a href="/plugins/21">ruby-terminfo-0.1.1</a></td>
173
- <td>&dagger;</td>
174
- <td><a href="/users/1">genki</a></td>
175
- <td>ruby-terminfo is a terminfo binding for Ruby</td>
176
- <td>
177
- </td>
178
- </tr>
179
- <tr class="even">
180
- <td><a href="/plugins/20">extlib-present-0.0.2</a></td>
181
- <td>&dagger;</td>
182
- <td><a href="/users/1">genki</a></td>
183
- <td>A plugin that provides Object#present?</td>
184
- <td>
185
- </td>
186
- </tr>
187
- <tr class="">
188
- <td><a href="/plugins/19">merb_render_filter-0.0.2</a></td>
189
- <td>&dagger;</td>
190
- <td><a href="/users/1">genki</a></td>
191
- <td>A plugin that provides {before|after}_render filters for Controller.</td>
192
- <td>
193
- </td>
194
- </tr>
195
- <tr class="even">
196
- <td><a href="/plugins/18">bcrypt-ruby-2.0.3</a></td>
197
- <td>&dagger;</td>
198
- <td><a href="/users/1">genki</a></td>
199
- <td>bcrypt-ruby is a Ruby binding for the OpenBSD bcrypt() password hashing algorithm, allowing you to easily store a secure hash of your users' passwords.
200
- </td>
201
- <td>
202
- </td>
203
- </tr>
204
- <tr class="">
205
- <td><a href="/plugins/17">json-1.1.4.1</a></td>
206
- <td>&dagger;</td>
207
- <td><a href="/users/1">genki</a></td>
208
- <td>This library can parse JSON texts and generate them from ruby data structures. Install the extension variant (in C) with &quot;gem install json&quot; or install the pure Ruby variant with &quot;gem install json_pure&quot;.</td>
62
+ <td>Model.last</td>
209
63
  <td>
210
64
  </td>
211
65
  </tr>
@@ -47,27 +47,11 @@
47
47
  </tr>
48
48
  </thead>
49
49
  <tbody>
50
- <tr class="even">
51
- <td><a href="/plugins/16">templater-0.5.0</a></td>
52
- <td>&dagger;</td>
53
- <td><a href="/users/1">genki</a></td>
54
- <td>RubiGen alternative Generator thingy</td>
55
- <td>
56
- </td>
57
- </tr>
58
50
  <tr class="">
59
51
  <td><a href="/plugins/15">hosts_access-0.3</a></td>
60
52
  <td>&dagger;</td>
61
53
  <td><a href="/users/1">genki</a></td>
62
- <td>Rails/Merb plugin that controls host access like hosts.allow</td>
63
- <td>
64
- </td>
65
- </tr>
66
- <tr class="even">
67
- <td><a href="/plugins/36">eventmachine-0.12.5</a></td>
68
- <td>&dagger;</td>
69
- <td><a href="/users/1">genki</a></td>
70
- <td>EventMachine: fast, simple event-processing library for Ruby programs</td>
54
+ <td>hosts.allow</td>
71
55
  <td>
72
56
  </td>
73
57
  </tr>
@@ -75,7 +59,7 @@
75
59
  <td><a href="/plugins/35">dm-last-0.0.1</a></td>
76
60
  <td>&dagger;</td>
77
61
  <td><a href="/users/1">genki</a></td>
78
- <td>A DataMapper plugin that offers a short-hand for Model.all.last as Model.last</td>
62
+ <td>Model.last</td>
79
63
  <td>
80
64
  </td>
81
65
  </tr>
@@ -1,6 +1,6 @@
1
1
  require File.join( File.dirname(__FILE__), "spec_helper" )
2
2
 
3
- describe DataMapper::YunkerStar do
3
+ describe DataMapper::YS do
4
4
  before(:each) do
5
5
  @plugin = Plugin1.first
6
6
  end
@@ -25,7 +25,7 @@ describe DataMapper::YunkerStar do
25
25
  it "should raise InvalidIndex for unknown key" do
26
26
  lambda {
27
27
  @plugin[Object]
28
- }.should raise_error(DataMapper::YunkerStar::InvalidIndex)
28
+ }.should raise_error(DataMapper::YS::InvalidIndex)
29
29
  end
30
30
  end
31
31
 
@@ -1,4 +1,4 @@
1
1
  class ::GemMaintainer
2
- include DataMapper::YunkerStar
2
+ include DataMapper::YS
3
3
  uri spec_data_path("gem_maintainers.html")
4
4
  end
@@ -1,53 +1,49 @@
1
1
  class Plugin
2
- include DataMapper::YunkerStar
2
+ include DataMapper::YS
3
3
  uri "http://merbi.st/plugins/index?page=1*"
4
4
  end
5
5
 
6
6
  class Plugin1
7
- include DataMapper::YunkerStar
7
+ include DataMapper::YS
8
8
  uri "http://merbi.st/plugins/index?page=1"
9
9
  end
10
10
 
11
11
  class Plugin2
12
- include DataMapper::YunkerStar
12
+ include DataMapper::YS
13
13
  uri "http://merbi.st/plugins/index?page=2"
14
14
  end
15
15
 
16
16
  class SortedPlugin
17
- include DataMapper::YunkerStar
17
+ include DataMapper::YS
18
18
  uri "http://merbi.st/plugins/sorted?page=1*"
19
19
  ys[:uniq] = false
20
20
  end
21
21
 
22
- class SortedPlugin1
23
- include DataMapper::YunkerStar
22
+ class SortedPlugin1 < SortedPlugin
24
23
  uri "http://merbi.st/plugins/sorted?page=1"
25
- ys[:uniq] = false
26
24
  end
27
25
 
28
- class SortedPlugin2
29
- include DataMapper::YunkerStar
26
+ class SortedPlugin2 < SortedPlugin
30
27
  uri "http://merbi.st/plugins/sorted?page=2"
31
- ys[:uniq] = false
32
28
  end
33
29
 
34
30
  class SortedPluginWithUniqPage
35
- include DataMapper::YunkerStar
31
+ include DataMapper::YS
36
32
  uri "http://merbi.st/plugins/sorted?page=1*"
37
33
  ys[:uniq] = :page
38
34
  end
39
35
 
40
36
  class UniqPlugin
41
- include DataMapper::YunkerStar
37
+ include DataMapper::YS
42
38
  uri "http://merbi.st/plugins/uniq?page=1*"
43
39
  end
44
40
 
45
41
  class UniqPlugin1
46
- include DataMapper::YunkerStar
42
+ include DataMapper::YS
47
43
  uri "http://merbi.st/plugins/uniq?page=1"
48
44
  end
49
45
 
50
46
  class UniqPlugin2
51
- include DataMapper::YunkerStar
47
+ include DataMapper::YS
52
48
  uri "http://merbi.st/plugins/uniq?page=2"
53
49
  end
@@ -1,6 +1,6 @@
1
1
  require File.join( File.dirname(__FILE__), "spec_helper" )
2
2
 
3
- describe DataMapper::YunkerStar do
3
+ describe DataMapper::YS do
4
4
  it "should provide proxy" do
5
5
  Plugin1.count.should == 20
6
6
  end
@@ -1,13 +1,13 @@
1
1
  require File.join( File.dirname(__FILE__), "spec_helper" )
2
2
 
3
- describe DataMapper::YunkerStar do
3
+ describe DataMapper::YS do
4
4
  class ::BlankHtml
5
- include DataMapper::YunkerStar
5
+ include DataMapper::YS
6
6
  uri spec_data_path("blank.html")
7
7
  end
8
8
 
9
9
  class ::BlankStyle
10
- include DataMapper::YunkerStar
10
+ include DataMapper::YS
11
11
  uri spec_data_path("plugins1.html")
12
12
  end
13
13
 
@@ -30,12 +30,12 @@ describe DataMapper::YunkerStar do
30
30
 
31
31
  describe ".ys" do
32
32
  it "should return a ys config" do
33
- Plugin.ys.should be_kind_of(DataMapper::YunkerStar::Config)
33
+ Plugin.ys.should be_kind_of(DataMapper::YS::Config)
34
34
  end
35
35
 
36
36
  describe "[:max_pages]" do
37
37
  class NetworkUnreachable
38
- include DataMapper::YunkerStar
38
+ include DataMapper::YS
39
39
  uri "http://merbi.st/plugins/index?page=1*"
40
40
  ys[:max_pages] = 0
41
41
  end
@@ -47,7 +47,7 @@ describe DataMapper::YunkerStar do
47
47
  it "should raise MaxPagesOverflow when count of visited sites exceeds :max_pages value" do
48
48
  lambda {
49
49
  NetworkUnreachable.count
50
- }.should raise_error(DataMapper::YunkerStar::Proxy::MaxPagesOverflow)
50
+ }.should raise_error(DataMapper::YS::Proxy::MaxPagesOverflow)
51
51
  end
52
52
  end
53
53
  end
@@ -76,7 +76,7 @@ describe DataMapper::YunkerStar do
76
76
  it "should raise when the html contains no tables" do
77
77
  lambda {
78
78
  BlankHtml.proxy.guess_table
79
- }.should raise_error(DataMapper::YunkerStar::Scraper::TableNotFound)
79
+ }.should raise_error(DataMapper::YS::Scraper::TableNotFound)
80
80
  end
81
81
  end
82
82
 
@@ -87,7 +87,7 @@ describe DataMapper::YunkerStar do
87
87
  it "should raise when the html contains no tables" do
88
88
  lambda {
89
89
  BlankHtml.proxy.table
90
- }.should raise_error(DataMapper::YunkerStar::Scraper::TableNotFound)
90
+ }.should raise_error(DataMapper::YS::Scraper::TableNotFound)
91
91
  end
92
92
 
93
93
  it "should return specified table" do
@@ -106,7 +106,7 @@ describe DataMapper::YunkerStar do
106
106
  it "should raise when the html contains no tables" do
107
107
  lambda {
108
108
  BlankHtml.proxy.thead
109
- }.should raise_error(DataMapper::YunkerStar::Scraper::TableNotFound)
109
+ }.should raise_error(DataMapper::YS::Scraper::TableNotFound)
110
110
  end
111
111
  end
112
112
 
@@ -1,8 +1,8 @@
1
1
  require File.join( File.dirname(__FILE__), "spec_helper" )
2
2
 
3
- describe DataMapper::YunkerStar::Proxy do
3
+ describe DataMapper::YS::Proxy do
4
4
  before(:each) do
5
- @scraper = DataMapper::YunkerStar::Scraper::Page.new(Plugin1)
5
+ @scraper = DataMapper::YS::Scraper::Page.new(Plugin1)
6
6
  end
7
7
 
8
8
  it "should provide #uri" do
@@ -1,10 +1,10 @@
1
1
  require File.join( File.dirname(__FILE__), "spec_helper" )
2
2
 
3
- describe DataMapper::YunkerStar::Scraper::Utils do
4
- include DataMapper::YunkerStar::Scraper::Utils
3
+ describe DataMapper::YS::Scraper::Utils do
4
+ include DataMapper::YS::Scraper::Utils
5
5
 
6
6
  it "should provide .constantize" do
7
- DataMapper::YunkerStar::Scraper::Utils.should respond_to(:constantize)
7
+ DataMapper::YS::Scraper::Utils.should respond_to(:constantize)
8
8
  end
9
9
 
10
10
  describe ".constantize" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maiha-dm-ys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: "0.4"
5
5
  platform: ruby
6
6
  authors:
7
7
  - maiha