pottery 0.1.0 → 0.1.1
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 +6 -4
- data/Rakefile +25 -0
- data/lib/pottery.rb +3 -3
- data/pottery.gemspec +24 -41
- data/spec/pottery_spec.rb +4 -4
- metadata +19 -6
data/README
CHANGED
@@ -11,8 +11,8 @@ Here's example code showing Pottery playing with Hpricot:
|
|
11
11
|
|
12
12
|
> irb
|
13
13
|
|
14
|
-
require '
|
15
|
-
require 'hpricot'; require 'open-uri'
|
14
|
+
require 'rubygems'
|
15
|
+
require 'pottery'; require 'hpricot'; require 'open-uri'
|
16
16
|
|
17
17
|
class Hubbit
|
18
18
|
include Pottery
|
@@ -39,7 +39,9 @@ The model emerges from the data. Let's start by looking up 'why':
|
|
39
39
|
|
40
40
|
What new methods do we have?
|
41
41
|
|
42
|
-
Hubbit.morph_methods # => ["email", "email=", "
|
42
|
+
Hubbit.morph_methods # => ["email", "email=", "followers", "followers=",
|
43
|
+
"id_name", "id_name=", "member_since", "member_since=", "name", "name=",
|
44
|
+
"public_repos", "public_repos="]
|
43
45
|
|
44
46
|
Ah-ha, so we have a name attribute now:
|
45
47
|
|
@@ -53,7 +55,7 @@ Let's save why for later
|
|
53
55
|
|
54
56
|
Ok, now it's later, let's restore why from the database
|
55
57
|
|
56
|
-
why = Hubbit.restore('why') #=> <Hubbit @id_name="why", @name="why the lucky stiff"
|
58
|
+
why = Hubbit.restore('why') #=> <Hubbit @id_name="why", @name="why the lucky stiff" ...>
|
57
59
|
|
58
60
|
|
59
61
|
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'spec'
|
3
|
+
require 'lib/pottery'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'echoe'
|
7
|
+
|
8
|
+
Echoe.new("pottery", Pottery::VERSION) do |m|
|
9
|
+
m.author = ["Rob McKinnon"]
|
10
|
+
m.email = ["rob ~@nospam@~ rubyforge.org"]
|
11
|
+
m.description = File.readlines("README").first
|
12
|
+
m.rubyforge_name = "pottery"
|
13
|
+
m.rdoc_options << '--inline-source'
|
14
|
+
m.rdoc_pattern = ["README", "CHANGELOG", "LICENSE"]
|
15
|
+
m.dependencies = ["soup >=0.2.1", "morph >=0.1.5"]
|
16
|
+
end
|
17
|
+
|
18
|
+
rescue LoadError
|
19
|
+
puts "You need to install the echoe gem to perform meta operations on this gem"
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Open an irb session preloaded with this library"
|
23
|
+
task :console do
|
24
|
+
sh "irb -rubygems -r ./lib/pottery.rb"
|
25
|
+
end
|
data/lib/pottery.rb
CHANGED
@@ -2,7 +2,7 @@ require 'morph'
|
|
2
2
|
require 'soup'
|
3
3
|
|
4
4
|
module Pottery
|
5
|
-
VERSION = "0.1.
|
5
|
+
VERSION = "0.1.1"
|
6
6
|
|
7
7
|
def self.included(base)
|
8
8
|
Soup.prepare
|
@@ -18,8 +18,8 @@ module Pottery
|
|
18
18
|
|
19
19
|
module ClassMethods
|
20
20
|
def restore name
|
21
|
-
snip =
|
22
|
-
if snip
|
21
|
+
snip = Soup[name]
|
22
|
+
if snip && snip != []
|
23
23
|
instance = self.new
|
24
24
|
attributes = snip.attributes
|
25
25
|
unless attributes.empty?
|
data/pottery.gemspec
CHANGED
@@ -1,57 +1,40 @@
|
|
1
|
-
|
2
|
-
# Gem::Specification for Pottery-0.1.0
|
3
|
-
# Originally generated by Echoe
|
1
|
+
# -*- encoding: utf-8 -*-
|
4
2
|
|
5
3
|
Gem::Specification.new do |s|
|
6
4
|
s.name = %q{pottery}
|
7
|
-
s.version = "0.1.
|
8
|
-
|
9
|
-
s.specification_version = 2 if s.respond_to? :specification_version=
|
5
|
+
s.version = "0.1.1"
|
10
6
|
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">=
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
12
8
|
s.authors = ["Rob McKinnon"]
|
13
|
-
s.date = %q{
|
9
|
+
s.date = %q{2009-01-01}
|
14
10
|
s.description = %q{Pottery allows you to emerge class definitions via calling assignment methods and}
|
15
11
|
s.email = ["rob ~@nospam@~ rubyforge.org"]
|
16
12
|
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README"]
|
17
|
-
s.files = ["CHANGELOG", "lib/pottery.rb", "LICENSE", "README", "spec/pottery_spec.rb", "spec/pottery_spec_helper.rb", "spec/spec.opts", "Manifest", "pottery.gemspec"]
|
13
|
+
s.files = ["CHANGELOG", "lib/pottery.rb", "LICENSE", "README", "spec/pottery_spec.rb", "spec/pottery_spec_helper.rb", "spec/spec.opts", "Manifest", "pottery.gemspec", "Rakefile"]
|
18
14
|
s.has_rdoc = true
|
19
15
|
s.homepage = %q{}
|
20
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Pottery", "--main", "README", "--inline-source"]
|
21
17
|
s.require_paths = ["lib"]
|
22
18
|
s.rubyforge_project = %q{pottery}
|
23
|
-
s.rubygems_version = %q{1.
|
19
|
+
s.rubygems_version = %q{1.3.0}
|
24
20
|
s.summary = %q{Pottery allows you to emerge class definitions via calling assignment methods and}
|
25
21
|
|
26
|
-
s.
|
27
|
-
|
28
|
-
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
+
s.specification_version = 2
|
29
25
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
# m.rdoc_options << '--inline-source'
|
46
|
-
# m.rdoc_pattern = ["README", "CHANGELOG", "LICENSE"]
|
47
|
-
# m.dependencies = ["soup =0.1.5", "morph >=0.1.5"]
|
48
|
-
# end
|
49
|
-
#
|
50
|
-
# rescue LoadError
|
51
|
-
# puts "You need to install the echoe gem to perform meta operations on this gem"
|
52
|
-
# end
|
53
|
-
#
|
54
|
-
# desc "Open an irb session preloaded with this library"
|
55
|
-
# task :console do
|
56
|
-
# sh "irb -rubygems -r ./lib/pottery.rb"
|
57
|
-
# end
|
26
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
|
+
s.add_runtime_dependency(%q<soup>, [">= 0.2.1"])
|
28
|
+
s.add_runtime_dependency(%q<morph>, [">= 0.1.5"])
|
29
|
+
s.add_development_dependency(%q<echoe>, [">= 0"])
|
30
|
+
else
|
31
|
+
s.add_dependency(%q<soup>, [">= 0.2.1"])
|
32
|
+
s.add_dependency(%q<morph>, [">= 0.1.5"])
|
33
|
+
s.add_dependency(%q<echoe>, [">= 0"])
|
34
|
+
end
|
35
|
+
else
|
36
|
+
s.add_dependency(%q<soup>, [">= 0.2.1"])
|
37
|
+
s.add_dependency(%q<morph>, [">= 0.1.5"])
|
38
|
+
s.add_dependency(%q<echoe>, [">= 0"])
|
39
|
+
end
|
40
|
+
end
|
data/spec/pottery_spec.rb
CHANGED
@@ -111,12 +111,12 @@ describe Pottery, "when restore method is called with name on class" do
|
|
111
111
|
initialize_pottery_and_snip
|
112
112
|
@snip = mock(Pottery::PotterySnip)
|
113
113
|
@snip.stub!(:attributes).and_return({})
|
114
|
-
|
114
|
+
Soup.stub!('[]'.to_sym).and_return @snip
|
115
115
|
end
|
116
116
|
|
117
117
|
it 'should call Snip [] load method with given name' do
|
118
118
|
name = 'red'
|
119
|
-
|
119
|
+
Soup.should_receive('[]'.to_sym).with(name).and_return []
|
120
120
|
@potted_class.restore(name)
|
121
121
|
end
|
122
122
|
|
@@ -125,7 +125,7 @@ describe Pottery, "when restore method is called with name on class" do
|
|
125
125
|
end
|
126
126
|
|
127
127
|
it 'should return nil if Snip [] returns nil' do
|
128
|
-
|
128
|
+
Soup.stub!('[]'.to_sym).and_return []
|
129
129
|
@potted_class.restore('red').should be_nil
|
130
130
|
end
|
131
131
|
|
@@ -133,7 +133,7 @@ describe Pottery, "when restore method is called with name on class" do
|
|
133
133
|
attributes = {:name => 'red', :state => 'blue'}
|
134
134
|
|
135
135
|
@snip.stub!(:attributes).and_return(attributes)
|
136
|
-
|
136
|
+
Soup.stub!('[]'.to_sym).and_return @snip
|
137
137
|
instance = mock(@potted_class)
|
138
138
|
@potted_class.stub!(:new).and_return instance
|
139
139
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pottery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob McKinnon
|
@@ -9,20 +9,22 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-01-01 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: soup
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
20
|
-
- - "
|
21
|
+
- - ">="
|
21
22
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.1
|
23
|
+
version: 0.2.1
|
23
24
|
version:
|
24
25
|
- !ruby/object:Gem::Dependency
|
25
26
|
name: morph
|
27
|
+
type: :runtime
|
26
28
|
version_requirement:
|
27
29
|
version_requirements: !ruby/object:Gem::Requirement
|
28
30
|
requirements:
|
@@ -30,6 +32,16 @@ dependencies:
|
|
30
32
|
- !ruby/object:Gem::Version
|
31
33
|
version: 0.1.5
|
32
34
|
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: echoe
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
33
45
|
description: Pottery allows you to emerge class definitions via calling assignment methods and
|
34
46
|
email:
|
35
47
|
- rob ~@nospam@~ rubyforge.org
|
@@ -51,6 +63,7 @@ files:
|
|
51
63
|
- spec/spec.opts
|
52
64
|
- Manifest
|
53
65
|
- pottery.gemspec
|
66
|
+
- Rakefile
|
54
67
|
has_rdoc: true
|
55
68
|
homepage: ""
|
56
69
|
post_install_message:
|
@@ -74,12 +87,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
87
|
requirements:
|
75
88
|
- - ">="
|
76
89
|
- !ruby/object:Gem::Version
|
77
|
-
version: "
|
90
|
+
version: "1.2"
|
78
91
|
version:
|
79
92
|
requirements: []
|
80
93
|
|
81
94
|
rubyforge_project: pottery
|
82
|
-
rubygems_version: 1.
|
95
|
+
rubygems_version: 1.3.0
|
83
96
|
signing_key:
|
84
97
|
specification_version: 2
|
85
98
|
summary: Pottery allows you to emerge class definitions via calling assignment methods and
|