mannequin 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +47 -0
- data/Rakefile +9 -0
- data/lib/mannequin/person.rb +28 -0
- data/lib/mannequin/version.rb +3 -0
- data/lib/mannequin.rb +6 -0
- data/mannequin.gemspec +19 -0
- data/test/lib/mannequin/person_test.rb +17 -0
- data/test/lib/mannequin/version_test.rb +6 -0
- data/test/test_helper.rb +3 -0
- metadata +61 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Andy Macdonald
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Mannequin
|
2
|
+
|
3
|
+
Mannequin is a simple test data generator. It was initially designed to abstract code from progLipsum (http://proglipsum.com) for use in other projects.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'mannequin'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install mannequin
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Mannequin can be used to generate many different types of data. However, the basic format is the same for all data types. For example, to generate a new person:
|
22
|
+
|
23
|
+
@person = Mannequin::Person.new
|
24
|
+
|
25
|
+
You can then utilize the attributes of that person:
|
26
|
+
|
27
|
+
@person.first_name
|
28
|
+
=> "Andy"
|
29
|
+
|
30
|
+
@person.last_name
|
31
|
+
=> "Macdonald"
|
32
|
+
|
33
|
+
Currently the following test data classes and attributes have been implemented:
|
34
|
+
|
35
|
+
* Mannequin::Person
|
36
|
+
|
37
|
+
* first_name
|
38
|
+
* last_name
|
39
|
+
* middle_name
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
1. Fork it
|
44
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
45
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
46
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
47
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module Mannequin
|
2
|
+
class Person
|
3
|
+
attr_reader :first_name, :last_name, :middle_name
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@first_name = generated_first_name
|
7
|
+
@last_name = generated_last_name
|
8
|
+
@middle_name = generated_middle_name
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def generated_first_name
|
14
|
+
array_of_first_names = ["John", "David", "Michael", "Chris", "Mike", "Mark", "Paul", "Daniel", "James", "Maria", "Sarah", "Laura", "Robert", "Lisa", "Jennifer", "Andrea", "Steve", "Peter", "Kevin", "Jason", "Jessica", "Michelle", "Karen", "Joe", "Brian", "Alex", "Richard", "Linda", "Julie", "Anna", "Andrew", "Mary", "Eric", "Sandra", "Tom", "Stephanie", "Thomas", "Sara", "Martin", "Scott", "Jean", "Susan", "Matt", "Jim", "Amanda", "Marie", "Ali", "Tony", "Melissa", "Carlos", "Jeff", "Marco", "Amy", "Ryan", "Bob", "Dave", "Angela", "Kim", "Kelly", "Patricia", "Jose", "Anthony", "Nicole", "Tim", "Barbara", "Adam", "Dan", "Christine", "Sam", "Patrick", "Anne", "Steven", "Bill", "Jonathan", "George", "Nick", "Matthew", "Ben", "Andy", "William", "Sharon", "Ashley", "Elizabeth", "Nancy", "Antonio", "Rachel", "Ahmed", "Mohamed", "Stephen", "Gary", "Juan", "Jack", "Debbie", "Claudia", "Monica", "Heather", "Christian", "Luis", "Carol", "Cindy"]
|
15
|
+
return array_of_first_names.sample
|
16
|
+
end
|
17
|
+
|
18
|
+
def generated_last_name
|
19
|
+
array_of_last_names = ["Smith", "Jones", "Johnson", "Lee", "Brown", "Williams", "Rodriguez", "Garcia", "Gonzalez", "Lopez", "Martinez", "Martin", "Perez", "Miller", "Taylor", "Thomas", "Wilson", "Davis", "Khan", "Ali", "Singh", "Sanchez", "Anderson", "Hernandez", "Chan", "Ahmed", "White", "Wong", "Thompson", "Jackson", "Kumar", "Moore", "Gomez", "King", "Diaz", "Fernandez", "Walker", "Harris", "James", "Green", "Lewis", "Torres", "Robinson", "Clark", "Roberts", "Ramirez", "Young", "Scott", "Tan", "Chen", "Hall", "Wright", "Evans", "Adams", "Allen", "Hill", "Sharma", "Patel", "Baker", "Wang", "Rossi", "Li", "Campbell", "Rivera", "Edwards", "Murphy", "Parker", "Kelly", "Kim", "Turner", "Mitchell", "Mohamed", "Carter", "Phillips", "Collins", "Alvarez", "Morris", "Morgan", "Kaya", "Wood", "Nelson", "Cooper", "Cruz", "Stewart", "Morales", "Flores", "Ng", "Hansen", "Demir", "Gutierrez", "Lim", "Bell", "Reyes", "Can", "Nguyen", "Silva", "Hughes", "Ruiz", "Shah", "Davies", "Macdonald"]
|
20
|
+
return array_of_last_names.sample
|
21
|
+
end
|
22
|
+
|
23
|
+
def generated_middle_name
|
24
|
+
array_of_middle_names = ["John", "David", "Michael", "Chris", "Mike", "Mark", "Paul", "Daniel", "James", "Maria", "Sarah", "Laura", "Robert", "Lisa", "Jennifer", "Andrea", "Steve", "Peter", "Kevin", "Jason", "Jessica", "Michelle", "Karen", "Joe", "Brian", "Alex", "Richard", "Linda", "Julie", "Anna", "Andrew", "Mary", "Eric", "Sandra", "Tom", "Stephanie", "Thomas", "Sara", "Martin", "Scott", "Jean", "Susan", "Matt", "Jim", "Amanda", "Marie", "Ali", "Tony", "Melissa", "Carlos", "Jeff", "Marco", "Amy", "Ryan", "Bob", "Dave", "Angela", "Kim", "Kelly", "Patricia", "Jose", "Anthony", "Nicole", "Tim", "Barbara", "Adam", "Dan", "Christine", "Sam", "Patrick", "Anne", "Steven", "Bill", "Jonathan", "George", "Nick", "Matthew", "Ben", "Andy", "William", "Sharon", "Ashley", "Elizabeth", "Nancy", "Antonio", "Rachel", "Ahmed", "Mohamed", "Stephen", "Gary", "Juan", "Jack", "Debbie", "Claudia", "Monica", "Heather", "Christian", "Luis", "Carol", "Cindy", "Smith", "Jones", "Johnson", "Lee", "Brown", "Williams", "Rodriguez", "Garcia", "Gonzalez", "Lopez", "Martinez", "Martin", "Perez", "Miller", "Taylor", "Thomas", "Wilson", "Davis", "Khan", "Ali", "Singh", "Sanchez", "Anderson", "Hernandez", "Chan", "Ahmed", "White", "Wong", "Thompson", "Jackson", "Kumar", "Moore", "Gomez", "King", "Diaz", "Fernandez", "Walker", "Harris", "James", "Green", "Lewis", "Torres", "Robinson", "Clark", "Roberts", "Ramirez", "Young", "Scott", "Tan", "Chen", "Hall", "Wright", "Evans", "Adams", "Allen", "Hill", "Sharma", "Patel", "Baker", "Wang", "Rossi", "Li", "Campbell", "Rivera", "Edwards", "Murphy", "Parker", "Kelly", "Kim", "Turner", "Mitchell", "Mohamed", "Carter", "Phillips", "Collins", "Alvarez", "Morris", "Morgan", "Kaya", "Wood", "Nelson", "Cooper", "Cruz", "Stewart", "Morales", "Flores", "Ng", "Hansen", "Demir", "Gutierrez", "Lim", "Bell", "Reyes", "Can", "Nguyen", "Silva", "Hughes", "Ruiz", "Shah", "Davies", "Macdonald"]
|
25
|
+
return array_of_middle_names.sample
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/mannequin.rb
ADDED
data/mannequin.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mannequin/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "mannequin"
|
8
|
+
gem.version = Mannequin::VERSION
|
9
|
+
gem.authors = ["Andy Macdonald"]
|
10
|
+
gem.email = ["andy@theandym.com"]
|
11
|
+
gem.description = "A simple test data generator"
|
12
|
+
gem.summary = "A simple test data generator"
|
13
|
+
gem.homepage = "http://github.com/theandym/mannequin"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative '../../test_helper'
|
2
|
+
describe Mannequin::Person.new do
|
3
|
+
subject { Mannequin::Person.new }
|
4
|
+
describe "creating a person" do
|
5
|
+
it "must have a first name" do
|
6
|
+
subject.must_respond_to(:first_name)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "must have a last name" do
|
10
|
+
subject.must_respond_to(:last_name)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "must have a middle name" do
|
14
|
+
subject.must_respond_to(:middle_name)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mannequin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Andy Macdonald
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-13 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: A simple test data generator
|
15
|
+
email:
|
16
|
+
- andy@theandym.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- lib/mannequin.rb
|
27
|
+
- lib/mannequin/person.rb
|
28
|
+
- lib/mannequin/version.rb
|
29
|
+
- mannequin.gemspec
|
30
|
+
- test/lib/mannequin/person_test.rb
|
31
|
+
- test/lib/mannequin/version_test.rb
|
32
|
+
- test/test_helper.rb
|
33
|
+
homepage: http://github.com/theandym/mannequin
|
34
|
+
licenses: []
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
requirements: []
|
52
|
+
rubyforge_project:
|
53
|
+
rubygems_version: 1.8.24
|
54
|
+
signing_key:
|
55
|
+
specification_version: 3
|
56
|
+
summary: A simple test data generator
|
57
|
+
test_files:
|
58
|
+
- test/lib/mannequin/person_test.rb
|
59
|
+
- test/lib/mannequin/version_test.rb
|
60
|
+
- test/test_helper.rb
|
61
|
+
has_rdoc:
|