clone_factory 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0d7ff10af1f69543d5615d9daae167bae44a3324
4
+ data.tar.gz: 2cbf80ec182966b257166d2cf60fdcabcfbad548
5
+ SHA512:
6
+ metadata.gz: c86b3086dd1bc664eaaab6977500d45c7aea2216393a37a543792f31a6de0eb2ec6f176e28eed5a802bf48aec7da29520a654c89890455340a224cd7e05487f6
7
+ data.tar.gz: 3ada05300399de9c9c13fd5ac9a0e15e76a8abfab5c7124caf97bc019433b835597e64d47b6e61932c1cd2b57f29247fa52b37eb18aae280be72a0fe2465676d
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+
5
+ # Specify your gem's dependencies in clone_factory.gemspec
6
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Nathan R
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.
@@ -0,0 +1,32 @@
1
+ # CloneFactory
2
+
3
+ This gem creates a number of fake users with real first names, last names, address, city, zip, and area code
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'clone_factory'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install clone_factory
18
+
19
+ ## Usage
20
+
21
+ $ clone_factory
22
+
23
+ This will generate users for you to use.
24
+
25
+
26
+ ## Contributing
27
+
28
+ 1. Fork it
29
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
30
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
31
+ 4. Push to the branch (`git push origin my-new-feature`)
32
+ 5. Create new Pull Request
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core/rake_task'
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'clone_factory/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "clone_factory"
8
+ spec.version = CloneFactory::VERSION
9
+ spec.authors = ["Nathan Rohm"]
10
+ spec.email = ["nathan19@hotmail.com"]
11
+ spec.description = %q{Creates unique users with names, addresses, and phone numbers}
12
+ spec.summary = %q{Create fake users for your apps}
13
+ spec.homepage = "http://rubygems.org/gems/Clone_Factory"
14
+ spec.license = "MIT"
15
+ spec.date = "2014-12-01"
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency 'rake', '~> 0'
25
+ end
@@ -0,0 +1 @@
1
+ boys_names
@@ -0,0 +1 @@
1
+ girls_names
@@ -0,0 +1 @@
1
+ last_names
@@ -0,0 +1 @@
1
+ street_names
@@ -0,0 +1 @@
1
+ zip,primary_city,state,area_codes
@@ -0,0 +1,88 @@
1
+ require "clone_factory/version"
2
+ require "read_data"
3
+
4
+ class CombineData
5
+
6
+ attr_accessor :num, :data, :boys, :girls, :last, :street, :zip_combos
7
+
8
+ #read files and out put several arrays and pull random values for each array
9
+
10
+ def initialize (num=200)
11
+ @num = num
12
+ end
13
+
14
+ def generate
15
+ get_data
16
+ number_of_boys = (@num / 2).to_i
17
+ number_of_girls = (@num - number_of_boys).to_i
18
+ return_val = []
19
+
20
+ number_of_boys.times { return_val << return_random_boy }
21
+ number_of_girls.times { return_val << return_random_girl }
22
+
23
+ return_val
24
+
25
+ File.open("Cloned_Users.txt", "w+") do |f|
26
+ return_val.each do |item|
27
+ f.write("#{item}\n")
28
+ end
29
+ end
30
+ end
31
+
32
+ def files
33
+ {
34
+ boys: '../db/boys_names.csv',
35
+ girls: '../db/girls_names.csv',
36
+ last_names: '../db/last_names.csv',
37
+ street_names: '../db/street_names.csv',
38
+ zip_combinations: '../db/zip_combinations.csv',
39
+ }
40
+ end
41
+
42
+ def get_data
43
+ return_val = {}
44
+ files.each do |k, v|
45
+ d = ReadData.new(v).read_file
46
+ return_val[k] = d
47
+ end
48
+ @data = return_val
49
+ end
50
+
51
+ def return_random_boy
52
+ return_val = return_random_last_name_and_address
53
+
54
+ return_val[:first_name] = @data[:boys].sample(1)[0]
55
+
56
+ return_val
57
+ end
58
+
59
+ def return_random_girl
60
+ return_val = return_random_last_name_and_address
61
+
62
+ return_val[:first_name] = @data[:girls].sample(1)[0]
63
+
64
+ return_val
65
+ end
66
+
67
+ #zip,primary_city,state,area_codes
68
+ def return_random_last_name_and_address
69
+ ln = @data[:last_names].sample(1)[0]
70
+ s = @data[:street_names].sample(1)[0]
71
+ zc = @data[:zip_combinations].sample
72
+ z = zc['zip']
73
+ c = zc['primary_city']
74
+ st = zc['state']
75
+ a = zc['area_code']
76
+
77
+ {
78
+ last_name: ln,
79
+ street: s,
80
+ zip: z,
81
+ city: c,
82
+ state: st,
83
+ area_code: a
84
+ }
85
+ end
86
+ end
87
+
88
+
@@ -0,0 +1,3 @@
1
+ module CloneFactory
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,21 @@
1
+ require 'csv'
2
+
3
+ class ReadData
4
+
5
+ attr_accessor :return_val
6
+
7
+ def initialize(file)
8
+ @file = file
9
+ end
10
+
11
+ def read_file()
12
+ return unless File.exists?(@file)
13
+ return_val = []
14
+
15
+ CSV.foreach(@file, headers: true, quote_char: '"', col_sep: ',') do |row|
16
+ return_val << row
17
+ end
18
+
19
+ return_val
20
+ end
21
+ end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+ require 'clone_factory'
3
+
4
+
5
+ describe CloneFactory do
6
+
7
+ context "run clone_factory and create base set of user" do
8
+
9
+
10
+ it "generates a list of users as an array" do
11
+ c = CombineData.new()
12
+ expect(c.generate).to be_kind_of(Array)
13
+ end
14
+
15
+ it "generates a list of users" do
16
+ c = CombineData.new()
17
+ expect(c.generate.size).to be > 0
18
+ end
19
+
20
+ end
21
+
22
+ context "run clone_factory with custom number of users" do
23
+
24
+ it "generates "
25
+
26
+ end
27
+
28
+
29
+ end
@@ -0,0 +1,25 @@
1
+ require 'read_data'
2
+
3
+ describe ReadData do
4
+
5
+ context '#read_file' do
6
+
7
+ before(:all) do
8
+ @content = ReadData.new("../db/boys_names.csv").read_file
9
+ end
10
+
11
+ it 'returns the array' do
12
+ expect(@content.class).to be_kind_of(Array)
13
+ end
14
+
15
+ it 'returns correct number of data' do
16
+ expect(@content.size).to eq 100
17
+ end
18
+
19
+ it 'returns correct data' do
20
+ expect(@content.first['boys_names']).to eq "Noah"
21
+ end
22
+
23
+ end
24
+
25
+ end
@@ -0,0 +1,91 @@
1
+ require 'clone_factory'
2
+
3
+ # This file was generated by the `rspec --init` command. Conventionally, all
4
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
6
+ # file to always be loaded, without a need to explicitly require it in any files.
7
+ #
8
+ # Given that it is always loaded, you are encouraged to keep this file as
9
+ # light-weight as possible. Requiring heavyweight dependencies from this file
10
+ # will add to the boot time of your test suite on EVERY test run, even for an
11
+ # individual file that may not need all of that loaded. Instead, consider making
12
+ # a separate helper file that requires the additional dependencies and performs
13
+ # the additional setup, and require it from the spec files that actually need it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ RSpec.configure do |config|
20
+ # rspec-expectations config goes here. You can use an alternate
21
+ # assertion/expectation library such as wrong or the stdlib/minitest
22
+ # assertions if you prefer.
23
+ config.expect_with :rspec do |expectations|
24
+ # This option will default to `true` in RSpec 4. It makes the `description`
25
+ # and `failure_message` of custom matchers include text for helper methods
26
+ # defined using `chain`, e.g.:
27
+ # be_bigger_than(2).and_smaller_than(4).description
28
+ # # => "be bigger than 2 and smaller than 4"
29
+ # ...rather than:
30
+ # # => "be bigger than 2"
31
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
+ end
33
+
34
+ # rspec-mocks config goes here. You can use an alternate test double
35
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
36
+ config.mock_with :rspec do |mocks|
37
+ # Prevents you from mocking or stubbing a method that does not exist on
38
+ # a real object. This is generally recommended, and will default to
39
+ # `true` in RSpec 4.
40
+ mocks.verify_partial_doubles = true
41
+ end
42
+
43
+ # The settings below are suggested to provide a good initial experience
44
+ # with RSpec, but feel free to customize to your heart's content.
45
+ =begin
46
+ # These two settings work together to allow you to limit a spec run
47
+ # to individual examples or groups you care about by tagging them with
48
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
+ # get run.
50
+ config.filter_run :focus
51
+ config.run_all_when_everything_filtered = true
52
+
53
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
54
+ # For more details, see:
55
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
56
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
57
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
58
+ config.disable_monkey_patching!
59
+
60
+ # This setting enables warnings. It's recommended, but in some cases may
61
+ # be too noisy due to issues in dependencies.
62
+ config.warnings = true
63
+
64
+ # Many RSpec users commonly either run the entire suite or an individual
65
+ # file, and it's useful to allow more verbose output when running an
66
+ # individual spec file.
67
+ if config.files_to_run.one?
68
+ # Use the documentation formatter for detailed output,
69
+ # unless a formatter has already been configured
70
+ # (e.g. via a command-line flag).
71
+ config.default_formatter = 'doc'
72
+ end
73
+
74
+ # Print the 10 slowest examples and example groups at the
75
+ # end of the spec run, to help surface which specs are running
76
+ # particularly slow.
77
+ config.profile_examples = 10
78
+
79
+ # Run specs in random order to surface order dependencies. If you find an
80
+ # order dependency and want to debug it, you can fix the order by providing
81
+ # the seed, which is printed after each run.
82
+ # --seed 1234
83
+ config.order = :random
84
+
85
+ # Seed global randomization in this process using the `--seed` CLI option.
86
+ # Setting this allows you to use `--seed` to deterministically reproduce
87
+ # test failures related to randomization by passing the same `--seed` value
88
+ # as the one that triggered the failure.
89
+ Kernel.srand config.seed
90
+ =end
91
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: clone_factory
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Nathan Rohm
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Creates unique users with names, addresses, and phone numbers
56
+ email:
57
+ - nathan19@hotmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - clone_factory.gemspec
69
+ - db/boys_names.csv
70
+ - db/girls_names.csv
71
+ - db/last_names.csv
72
+ - db/street_names.csv
73
+ - db/zip_combinations.csv
74
+ - lib/clone_factory.rb
75
+ - lib/clone_factory/version.rb
76
+ - lib/read_data.rb
77
+ - spec/clone_factory_spec.rb
78
+ - spec/read_data_spec.rb
79
+ - spec/spec_helper.rb
80
+ homepage: http://rubygems.org/gems/Clone_Factory
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project:
100
+ rubygems_version: 2.2.2
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: Create fake users for your apps
104
+ test_files:
105
+ - spec/clone_factory_spec.rb
106
+ - spec/read_data_spec.rb
107
+ - spec/spec_helper.rb