Giter Club home page Giter Club logo

faker-bot's Introduction

faker-bot

CI Gem Version Open Source Helpers Maintainability Test Coverage

Quickly look up Faker methods without leaving your terminal!

faker-bot-demo

πŸ“– Code Documentation

Installation

$ gem install faker-bot

Usage

1.) Run a quick lookup

$ faker search name
# Faker::SwordArtOnline
# └── real_name
# └── game_name
# Faker::Superhero
# └── name
# ....

2.) List methods

$ faker list
# Faker::BackToTheFuture
# β”œβ”€β”€ quote
# β”œβ”€β”€ date
# └── character
# Faker::Finance
# └── credit_card
# ....

faker also includes an option to display sample output via the --verbose or -v flag. πŸ˜‰

3.)

$ faker list -v
# Faker::Appliance
# β”œβ”€β”€ brand=> Whirlpool
# └── equipment=> Sump pump
# Faker::UmphreysMcgee
# └── song=> Headphones & Snowcones
$ faker search name -v
# Faker::App
# └── name=> Subin
# Faker::Address
# └── street_name=> Percy Landing
# ....

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/faker-ruby/faker-bot. See CONTRIBUTING.md. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Credits

Terminal awesomeness made easy by the TTY Toolkit. 🍺

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the faker-bot project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

faker-bot's People

Contributors

akabiru avatar amrrbakry avatar bpleslie avatar dependabot-preview[bot] avatar kfpo avatar piotrmurach avatar shtakai avatar vbrazo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

faker-bot's Issues

Handle Deprecation Warnings

Lookups that include methods with deprecation warnings are currently not handled gracefully.

We should find a way of showing this nicely as it's still valuable info.

Steps to reproduce bug

$ fakerbot list -v

screen shot 2018-08-16 at 10 38 44

After pager exit 😭

screen shot 2018-08-16 at 10 38 35

Fakerbot not searching namespace

Example1:

C:\Users\richard.bulger>faker search beer -v

Sorry, we couldn't find a match 😒


C:\Users\richard.bulger>faker search yeast -v
Faker
└── yeast=> 5526 - Brettanomyces lambicus
Faker
β”œβ”€β”€ as_you_like_it=> I like this place and willingly could waste my time in it.
└── as_you_like_it_quote=> Can one desire too much of a good thing?.

Note that the first result for beer returns nothing. But the second for yeast, which is a method of beer does. (Also note that the namespace name isn't shown in the result tree, which I've raised in #1565 )

Also, in the second result, you can see it also returns irrelevant results from the Shakespeare namespace. Not sure why.

Example2:

C:\Users\richard.bulger>faker search simpsons -v
Faker
└── i_groups=> Two Two

Doesn't return any simpons namespace stuff, but returns a Kpop one...

From: faker-ruby/faker#1566

CI Builds Stuck

#94 #93 Have been stuckfor quite some time now. It's also not possible to view the builds o travis afaics.

Maybe a good time to try out GitHub actions? WDYT @bpleslie @vbrazo ?

Only show public class methods

Description

When listing, $ fakerbot list -v you'll notice that things such as Faker::Bitcoin will list protected methods.

Faker::Bitcoin.singleton_methods(false)
#=> [:address, :address_for, :testnet_address, :base58]

This should list only "address" and "testnet_address" Ref stympy/faker

Improve Search

It's worrying that search cannot match "first_name" to "firstname" - maybe look into a different approach that's more "fuzzy like"

screen shot 2018-10-05 at 15 53 34

Faker-bot list -v fails at first time execution

Issue summary

Following faker-bot documentation while executing faker list -v I got the following error:

/hidden/path/faker-2.19.0/lib/faker.rb:188:in `method_missing': super: no superclass method `species' for Faker::Games::DnD:Class (NoMethodError)

Expected behavior

As per described in Usage section it should retrieve a method list with sample output included.

Actual behavior

Instead I got the following error:

`DnD.species` is deprecated. Use `DnD.race` instead.
/hidden/path/gems/faker-2.19.0/lib/faker.rb:188:in `method_missing': super: no superclass method `species' for Faker::Games::DnD:Class (NoMethodError)
Β  from /hidden/path/gems/faker-2.19.0/lib/faker/games/dnd.rb:131:in `species'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:172:in `public_send'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:172:in `faker_method'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:158:in `verbose_output'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:137:in `block in leaf_args'
Β  from :90:in `tap'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:136:in `leaf_args'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:132:in `block in leaf'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:132:in `map'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:132:in `leaf'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:121:in `node'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:107:in `block in build_tree'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:106:in `each'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:106:in `reduce'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:106:in `build_tree'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:74:in `tree'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:94:in `gt_screen_height?'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:84:in `paginable?'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:50:in `call'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/renderer.rb:22:in `call'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/command.rb:47:in `render'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/commands/list.rb:40:in `render'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot/commands/list.rb:22:in `execute'
Β  from /hidden/path/gems/faker-bot-0.5.3/lib/faker/bot.rb:32:in `list'
Β  from /hidden/path/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
Β  from /hidden/path/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
Β  from /hidden/path/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
Β  from /hidden/path/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
Β  from /hidden/path/gems/faker-bot-0.5.3/bin/faker:14:in `'
Β  from /hidden/path/bin/faker:25:in `load'
Β  from /hidden/path/bin/faker:25:in `'
Β  from /hidden/path/bin/ruby_executable_hooks:22:in `eval'
Β  from /hidden/path/bin/ruby_executable_hooks:22:in `'

Steps to reproduce the problem

  1. gem install faker-bot
  2. faker list -v

Specifications

App type: CLI
Operating System: macOS 12.1
Shell: zsh 5.8 (x86_64-apple-darwin21.0)
Ruby version: 3.0.3

Additional considerations

Not sure if this could be related but when install asked for overwrite the executable I answered yes:

Overwrite the executable? [yN]  y
Successfully installed faker-bot-0.5.3
13 gems installed

Add flag to show sample faker output

Description

When listing faker namespace it would be nice to include a flag in the command that triggers sample output from the methods.

E.g.

$ fakerbot list --verbose --with-samples
# Output
Faker::Currency
└── name#=> Tala
└── code#=> MUR
└── symbol#=> PhP
Faker::BackToTheFuture
└── quote#=> I noticed your band is on the roster for the dance auditions after school today. Why even bother, McFly? You don't have a chance. You're too much like your old man. No McFly ever amounted to anything in the history of Hill Valley!
└── date#=> October 26, 1985
└── character#=> Goldie Wilson
Faker::Artist
└── name#=> Seurat

This feature could also be extended to other commands such as search

Let `faker list` accept arguments

Description

At the moment running faker list will list out all Faker constants and the methods they respond to. This is cool and all but what if I just want to list Faker::Internet?

I should be able to run sth like faker list internet and this should list out the Faker::Internet class

The command should also support the verbose option and any other sensible options e.g. data type.

Screenshot πŸ“·

screenshot 2019-01-18 at 10 50 08

Namespace missing in fakerbot

image

Gem built from latest master. Windows 10, ruby 2.4.4p296 (2018-03-28 revision 63013) and ruby 2.5.3p105 (2018-10-18 revision 65156)

Expecting to see full namespace at top of tree, ie Faker::PhoneNumber (as shown in #1507 )

From: faker-ruby/faker#1565

Should search include namespaces in addition to methods?

Description

At the moment executing fakerbot search star does not include results like Faker::StarWars i.e. "everything matching star".
This is because the fakerbot reflector only searches through the class method names and doesn't include the class names.

Task

Find a sensible way of implementing a "full" search i.e. one that includes the class and it's method names.

Faker issue: Byebug reporting error at require "faker"

Still very new to Rails and am trying to use Faker to -- of course -- seed my userdata db with realistic-looking data. When I execute the code below via rails db:seed, I don't get any response from the CLI, rather just a returned line with no output, messaging, etc.

Seeds.rb:

require "faker"

10.times do
    data = Userdatum.new(
        adds1: Faker::Address.street_address,
        adds2: '-',
        addcity: Faker::Address.city,
        addstate: Faker::Address.state,
        addzip: Faker::Address.zip,
        phone: Faker::PhoneNumber.cell_phone,
        taxpref: Faker::Boolean.boolean,
        mtgepref: Faker::Boolean.boolean,
        inspref: Faker::Boolean.boolean,
        created_at: '123456',
        updated_at: '123456',
        user_id: 10000,
        fName: Faker::Name.first_name,
        lName: Faker::Name.last_name,
        email: Faker::Internet.email
    )
    data.save
end

Byebug error message:

[4, 13] in /Users/robertmaxwell/RUBY/GULF/GULF/db/seeds.rb
    4: # Examples:
    5: #
    6: #   movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
    7: #   Character.create(name: 'Luke', movie: movies.first)
    8: 
=>  9: require "faker"
   10: 
   11: 10.times do
   12:     data = Userdatum.new(
   13:         adds1: Faker::Address.street_address,

Schema.db

ActiveRecord::Schema.define(version: 2021_07_26_050246) do

create_table "userdata", force: :cascade do |t|
   t.string "adds1"
   t.string "adds2"
   t.string "addcity"
   t.string "addstate"
   t.string "addzip"
   t.string "phone"
   t.boolean "taxpref"
   t.boolean "mtgepref"
   t.boolean "inspref"
   t.datetime "created_at", precision: 6, null: false
   t.datetime "updated_at", precision: 6, null: false
   t.integer "user_id"
   t.string "fName"
   t.string "lName"
   t.string "email"
   t.index ["user_id"], name: "index_userdata_on_user_id"
 end

Please, please, please and thank you in advance for any assistance here!

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.