faker-ruby / faker

A library for generating fake data such as names, addresses, and phone numbers.
MIT License
11.24k stars 3.18k forks source link

Cannot require 'faker' after update to 1.8.1 #975

Closed botandrose closed 7 years ago

botandrose commented 7 years ago
$ irb
r2.2.0 :001 > require 'faker'
NameError: uninitialized constant Faker::Date
    from /home/micah/.rvm/gems/ruby-2.2.0@complexity/gems/faker-1.8.1/lib/faker/time.rb:2:in `<module:Faker>'
turboladen commented 7 years ago

Having the same issue here with ruby 2.4.1 on Ubuntu 14.04.4 LTS.

rcaught commented 7 years ago

https://github.com/stympy/faker/pull/971

stympy commented 7 years ago

I have tried to reproduce this on Ubuntu 16.04 and 14.04 with ruby installed via apt, including both the Ubuntu default version (2.3.1 on 16.04) and the brightbox packages (2.4.1 on both Ubuntu versions). In every case I was able to do this:

$ gem install faker
$ irb
irb(main):001:0> require 'faker'
=> true

To aid me in getting this resolved, please let me know how you have installed Ruby and how you have installed faker (either via the gem command or by bundler).

kmats commented 7 years ago

i think, https://github.com/stympy/faker/commit/baf7f8295fdc7f140d718391a5676cadf7509ed0 does not guarantee the requiring order. so sometimes 'faker/time' is required before 'faker/date' and raise "NameError: uninitialized constant Faker::Date"

stympy commented 7 years ago

Yeah, I was thinking the same thing, I was just hoping to be able to reproduce before trying a fix. Oh well. :)

fotos commented 7 years ago

Maybe the 1.8.1 gem should be yanked?

stympy commented 7 years ago

Gem v1.8.1 has been yanked