Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the ffaker sample data dependency #2140

Closed

Conversation

cbrunsdon
Copy link
Contributor

Continues the idea of #2082, this removes the dependency of ffaker but
also yanks it out of the sample requirement. I generated a small data
set with 15.times.map { FFaker::Name.first_name } etc.

It should be noted that there isn't any reasonable way to export development dependencies to people, and anyone trying to include our factories will get ffaker missing errors. I personally think thats pretty reasonable in exchange for removing ffaker as a useless runtime dependency in prod.

state: new_york,
zipcode: 16_804,
country: united_states,
phone: FFaker::PhoneNumber.phone_number)
phone: phone_numbers.sample)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.

state: new_york,
zipcode: 16_804,
country: united_states,
phone: FFaker::PhoneNumber.phone_number)
phone: phone_numbers.sample)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.

@@ -1,26 +1,35 @@
united_states = Spree::Country.find_by!(iso: "US")
new_york = Spree::State.find_by!(name: "New York")

require 'pry'
binding.pry

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove debugger entry point binding.pry.

state: new_york,
zipcode: 16_804,
country: united_states,
phone: FFaker::PhoneNumber.phone_number)
phone: phone_numbers.sample)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.

state: new_york,
zipcode: 16_804,
country: united_states,
phone: FFaker::PhoneNumber.phone_number)
phone: phone_numbers.sample)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.

@@ -1,26 +1,35 @@
united_states = Spree::Country.find_by!(iso: "US")
new_york = Spree::State.find_by!(name: "New York")

require 'pry'
binding.pry

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove debugger entry point binding.pry.

@cbrunsdon cbrunsdon force-pushed the remove_ffaker_dependency branch from 7c3117f to 8a02a5c Compare August 9, 2017 01:24
state: new_york,
zipcode: 16_804,
country: united_states,
phone: FFaker::PhoneNumber.phone_number)
phone: phone_numbers.sample)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.

state: new_york,
zipcode: 16_804,
country: united_states,
phone: FFaker::PhoneNumber.phone_number)
phone: phone_numbers.sample)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.

Continues the idea of solidusio#2082, this removes the dependency of ffaker but
also yanks it out of the sample requirement. I generated a small data
set with 15.times.map { FFaker::Name.first_name } etc.
@cbrunsdon cbrunsdon force-pushed the remove_ffaker_dependency branch from 8a02a5c to 433ef54 Compare August 9, 2017 01:27
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👏

... thats pretty reasonable in exchange for removing ffaker as a useless runtime dependency in prod.

We only require ffaker in one place.

Why not add a guard around the require 'ffaker' line in core/lib/spree/testing_support/sequences.rb?

begin
  require 'ffaker'
rescue LoadError
  abort "Solidus factories require FFaker. Please add `ffaker` to your `Gemfile`"
end

@@ -35,6 +35,7 @@
gem 'with_model'
gem 'rspec_junit_formatter'
gem 'rails-controller-testing'
gem 'ffaker'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add require: false here? We don't need to require ffaker every time we boot the dummy apps.

zipcode: 16_804,
country: united_states,
phone: FFaker::PhoneNumber.phone_number)
first_names = ["Sterling", "Jennette", "Salome", "Lyla", "Lola", "Cheree", "Hettie", "Barbie", "Amelia", "Marceline", "Keeley", "Mi", "Karon", "Jessika", "Emmy"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I prefer the %w(Sterling Jennette) syntax for arrays of strings. Also having a new line for each word is far better readable, but this should not block this PR.

@tvdeyen
Copy link
Member

tvdeyen commented Aug 9, 2017

We probably want to add a changelog entry

@tvdeyen
Copy link
Member

tvdeyen commented Aug 17, 2017

Closed in favor of #2163

@tvdeyen tvdeyen closed this Aug 17, 2017
AlessioRocco added a commit to nebulab/solidus_page_objects that referenced this pull request Sep 22, 2017
See this PR solidusio/solidus#2140 for
reference. This change also works with previous versions of solidus.
AlessioRocco added a commit to nebulab/solidus_page_objects that referenced this pull request Sep 22, 2017
See this PR solidusio/solidus#2140 for
reference. This change also works with previous versions of solidus.
acreilly pushed a commit to acreilly/solidus_auth_devise that referenced this pull request Jan 4, 2019
ffaker was removed as a runtime dependency of Solidus.

polyglot (which is a dependency of deface) is raising a LoadError when
it tries to require ffaker, which is not defined.

PR removing ffaker from Solidus:
solidusio/solidus#2140
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants