Git Product home page Git Product logo

forgery's Introduction

Forgery

A Problem: It's harder than absolutely easy to make meaningful, simple, data for testing and development.

A Solution: A fake data generator that provides not only a host of basics and a rememberable syntax, but a customizable library to boot.

Welcome to Forgery, an excellent solution to a problem so hard you didn't know it was there.

Using

You'll want to read individual Forgery categories for more information, but these are the basics:

Forgery(:basic).password
  #=> "b6qZTQEH"

Forgery(:internet).email_address
  #=> "[email protected]"

Forgery(:monetary).money
  #=> "1.58"

Forgery(:lorem_ipsum).words(10)
  #=> "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam egestas."

Forgery(:monetary).formatted_money :min => 100, :max => 1000
  #=> "$923.36"

And many many more!

Alternatively you can write it like this:

Forgery::Basic.hex_color
Forgery::Name.full_name
Forgery::Personal.shirt_size

In addition, you can always write your own dictionaries and formats, overriding the ones in the gem. Fully explained here.

Installing

Like any gem, you can install Forgery two ways depending on it's use.

For normal Ruby development, you need simply use:

$ gem install forgery

This will add it to your gem library, just like any normal gem. You can then use it like any normal gem library. See examples for more.

Rails 3.x

If you're using Rails 3.x you need to do a few extra things (that are probably rote). First step is to add it to your Rails.root/Gemfile, we also suggest specifying the latest version (found on rubygems):

gem 'forgery', '0.3.12'

Then you'll need to run bundle install to install and lock in your new gem. Next you'll want to run the special Rails 3 generator:

$ [bundle exec] rails generate forgery

Rails 2.x

For Rails 2.x you'll need to do something a little different, by first editing your Rails.root/config/environment.rb and adding this to the configuration block:

config.gem 'forgery'

Then you'll need to run this in your command line:

$ script/generate forgery

Generators

This Rails generators will make these directories in your Rails.root directory:

- Rails.root/lib/forgery
- Rails.root/lib/forgery/dictionaries
- Rails.root/lib/forgery/extensions
- Rails.root/lib/forgery/forgeries
- Rails.root/lib/forgery/formats

You can then use these directories to write your own dictionaries, class extensions, forgeries, and formats.

Contributing

This is a work in progress and an open source project, so feel free to contribute. We'll take pull requests via git or suggestions via the issues tab. Any work done on Forgery will get you into the credits list and in our hearts.

Credits

Thanks to the authors and contributors:

  • Nate Sutton (nate aka fowlduck)
  • Brandon Arbini (brandonarbini)
  • Josh Nichols (technicalpickles)
  • Jeremy Stephens (viking aka crookshanks)
  • Darcy Laycock (Sutto)
  • Lukas Westermann (lwe)
  • Mike Dungan
  • Andrew Selder (aselder)
  • Thomas Sinclair (anathematic)
  • Stafford Brunk (wingrunr21)
  • SixArm (SixArm)
  • Akira Matsuda (amatsuda)

Licensing

Copyright (c) 2007 Sevenwire LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

On that note, have fun!

forgery's People

Contributors

amatsuda avatar anathematic avatar charlietanksley avatar denro avatar fallwith avatar graywh avatar joelparkerhenderson avatar lwe avatar maxim avatar metavida avatar mhickman84 avatar rtlechow avatar sj26 avatar sutto avatar technicalpickles avatar unnu avatar wingrunr21 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.