connie 0.0.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.
@@ -0,0 +1,100 @@
1
+ James
2
+ John
3
+ Robert
4
+ Michael
5
+ William
6
+ David
7
+ Richard
8
+ Charles
9
+ Joseph
10
+ Thomas
11
+ Christopher
12
+ Daniel
13
+ Paul
14
+ Mark
15
+ Donald
16
+ George
17
+ Kenneth
18
+ Steven
19
+ Edward
20
+ Brian
21
+ Ronald
22
+ Anthony
23
+ Kevin
24
+ Jason
25
+ Matthew
26
+ Gary
27
+ Timothy
28
+ Jose
29
+ Larry
30
+ Jeffrey
31
+ Frank
32
+ Scott
33
+ Eric
34
+ Stephen
35
+ Andrew
36
+ Raymond
37
+ Gregory
38
+ Joshua
39
+ Jerry
40
+ Dennis
41
+ Walter
42
+ Patrick
43
+ Peter
44
+ Harold
45
+ Douglas
46
+ Henry
47
+ Carl
48
+ Arthur
49
+ Ryan
50
+ Roger
51
+ Joe
52
+ Juan
53
+ Jack
54
+ Albert
55
+ Jonathan
56
+ Justin
57
+ Terry
58
+ Gerald
59
+ Keith
60
+ Samuel
61
+ Willie
62
+ Ralph
63
+ Lawrence
64
+ Nicholas
65
+ Roy
66
+ Benjamin
67
+ Bruce
68
+ Brandon
69
+ Adam
70
+ Harry
71
+ Fred
72
+ Wayne
73
+ Billy
74
+ Steve
75
+ Louis
76
+ Jeremy
77
+ Aaron
78
+ Randy
79
+ Howard
80
+ Eugene
81
+ Carlos
82
+ Russell
83
+ Bobby
84
+ Victor
85
+ Martin
86
+ Ernest
87
+ Phillip
88
+ Todd
89
+ Jesse
90
+ Craig
91
+ Alan
92
+ Shawn
93
+ Clarence
94
+ Sean
95
+ Philip
96
+ Chris
97
+ Johnny
98
+ Earl
99
+ Jimmy
100
+ Antonio
@@ -0,0 +1,5 @@
1
+ Jr
2
+ Sr
3
+ II
4
+ III
5
+ IV
@@ -0,0 +1,6 @@
1
+ Mr
2
+ Ms
3
+ Mrs
4
+ Dr
5
+ Rev
6
+ Honorable
@@ -0,0 +1,16 @@
1
+ module Connie
2
+ module Names
3
+
4
+ # Returns either a male or a female first name
5
+ def first
6
+ Connie [true, false] ? male : female
7
+ end
8
+
9
+ def gender
10
+ Connie [true ,false] ? 'male' : 'female'
11
+ end
12
+
13
+ # TODO: create a gender sensitive title
14
+
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ biz
2
+ com
3
+ info
4
+ name
5
+ net
6
+ org
7
+ gov
8
+ edu
9
+ mil
@@ -0,0 +1,7 @@
1
+ XS
2
+ S
3
+ M
4
+ L
5
+ XL
6
+ 2XL
7
+ 3XL
@@ -0,0 +1,99 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe Connie, 'api' do
4
+
5
+ before(:each) do
6
+ Connie.reload_dictionaries
7
+ end
8
+
9
+ it "returns elements off a dictionary" do
10
+ Connie(:'names.male').should eql('Mark')
11
+ end
12
+
13
+ it "returns a dictionary using the shorthand" do
14
+ Connie(:names).male.should eql('Mark')
15
+ end
16
+
17
+ it "returns a dictionary using []" do
18
+ raise Connie[:names].inspect
19
+ Connie[:names].male.should eql('Mark')
20
+ end
21
+
22
+ it "parses a string passed" do
23
+ Connie(':names.male :names.last').should match %r{Mark [A-Z][a-z]*}
24
+ end
25
+
26
+ it "scopes dictionaries" do
27
+ Connie::Parser.process ':title :male :last', Connie[:names]
28
+ end
29
+
30
+ it "has a nifty regex-like syntax" do
31
+ Connie(':w{3,10}').should match(%r{[a-z]{3,10}})
32
+ end
33
+
34
+ it "returns access to a family of dictionaries" do
35
+ Connie[:names].class.should eql(Connie::Dictionary)
36
+ end
37
+
38
+ it "has a couple of core functions" do
39
+ Connie.letter.should match(%r{[a-z]})
40
+ Connie.digit.to_s.should match(%r{[0-9]})
41
+ end
42
+
43
+ it "supports overriding generators" do
44
+ module Connie
45
+ module Names
46
+ def misspelled_name
47
+ name = male
48
+ name[rand(name.size)] += 1
49
+ name
50
+ end
51
+ end
52
+ end
53
+
54
+ Connie[:names].misspelled_name.should match(%r{[MN][ab][rs][kl]})
55
+ end
56
+
57
+ it "supports recursive calls to generators" do
58
+ module Connie
59
+ module Geo
60
+ def where
61
+ interpolate ":city, :state_short"
62
+ end
63
+ end
64
+
65
+ module Address
66
+ def name_and_where
67
+ interpolate ":names.first :geo.where"
68
+ end
69
+ end
70
+ end
71
+
72
+ Connie[:address].name_and_where.should match(%r{Mark [A-Za-z]+, [A-Z]{2,2}})
73
+ end
74
+
75
+ it "can store possible formats in a dictionary" do
76
+ #Connie.compose[:story] == Connie(Connie[:story]) # the story dictionary is in connie syntax
77
+ pending
78
+ end
79
+
80
+ end
81
+
82
+
83
+ describe Connie, 'dictionaries' do
84
+
85
+ it "picks name form a dictionary" do
86
+ Connie[:names].should_receive(:male)
87
+
88
+ Connie(:names).male
89
+ end
90
+
91
+ it "supports hierarchical sources" do
92
+ source = {:italian => %w(pasta pizza polenta), :spanish => %w(tortilla gazpacho chorizo)}
93
+ pending
94
+ end
95
+
96
+ it "should warn in case of double dictionary" do
97
+ pending
98
+ end
99
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'rspec'
4
+ # optionally add autorun support
5
+ require 'rspec/autorun'
6
+
7
+ require 'connie'
8
+
9
+ Connie.dictionaries_paths << File.expand_path('test_dictionaries', File.dirname(__FILE__))
10
+ Rspec.configure do |c|
11
+ c.mock_with :rspec
12
+ end
@@ -0,0 +1 @@
1
+ Mark
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: connie
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Leandro Pedroni
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-09-04 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 13
30
+ segments:
31
+ - 1
32
+ - 2
33
+ - 9
34
+ version: 1.2.9
35
+ type: :development
36
+ version_requirements: *id001
37
+ description: Heavily based on Forgery it uses the same word sources. It's built to be a bit more customisable and allows you to define new strategies and styles both using ruby modules or big text lists.
38
+ email: ilpoldo@gmail.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - LICENSE
45
+ - README.rdoc
46
+ files:
47
+ - .gitignore
48
+ - Gemfile
49
+ - LICENSE
50
+ - README.rdoc
51
+ - Rakefile
52
+ - VERSION
53
+ - lib/connie.rb
54
+ - lib/connie/connie.rb
55
+ - lib/connie/dictionary.rb
56
+ - lib/connie/generators.rb
57
+ - lib/connie/generators/dictionary.rb
58
+ - lib/connie/parser.rb
59
+ - lib/dictionaries/creative.color
60
+ - lib/dictionaries/creative.lorem_ipsum
61
+ - lib/dictionaries/geo/city
62
+ - lib/dictionaries/geo/country
63
+ - lib/dictionaries/geo/language
64
+ - lib/dictionaries/geo/province
65
+ - lib/dictionaries/geo/province_short
66
+ - lib/dictionaries/geo/race
67
+ - lib/dictionaries/geo/state
68
+ - lib/dictionaries/geo/state_short
69
+ - lib/dictionaries/geo/street
70
+ - lib/dictionaries/geo/street_suffix
71
+ - lib/dictionaries/language/frequency
72
+ - lib/dictionaries/names.rb
73
+ - lib/dictionaries/names/company
74
+ - lib/dictionaries/names/female
75
+ - lib/dictionaries/names/last
76
+ - lib/dictionaries/names/male
77
+ - lib/dictionaries/names/suffix
78
+ - lib/dictionaries/names/title
79
+ - lib/dictionaries/net/top_level_domain
80
+ - lib/dictionaries/shopping.shirt_size
81
+ - spec/connie_spec.rb
82
+ - spec/spec_helper.rb
83
+ - spec/test_dictionaries/names/male
84
+ has_rdoc: true
85
+ homepage: http://github.com/ilpoldo@gmail.com/connie
86
+ licenses: []
87
+
88
+ post_install_message:
89
+ rdoc_options:
90
+ - --charset=UTF-8
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ hash: 3
99
+ segments:
100
+ - 0
101
+ version: "0"
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ hash: 3
108
+ segments:
109
+ - 0
110
+ version: "0"
111
+ requirements: []
112
+
113
+ rubyforge_project:
114
+ rubygems_version: 1.3.7
115
+ signing_key:
116
+ specification_version: 3
117
+ summary: Little compact library to synthesise data that does not load big files in memory
118
+ test_files:
119
+ - spec/connie_spec.rb
120
+ - spec/spec_helper.rb