Skip to content

Fix TypeError when no config given and warn if file unchanged#683

Merged
rafaelfranca merged 1 commit into
rails:masterfrom
enigmatt-pl:master
Oct 9, 2019
Merged

Fix TypeError when no config given and warn if file unchanged#683
rafaelfranca merged 1 commit into
rails:masterfrom
enigmatt-pl:master

Conversation

@enigmatt-pl

Copy link
Copy Markdown

closes #571
closes #665

@enigmatt-pl enigmatt-pl changed the title Add default config in insert_into_file method Raise an exception if before and after arguments are missing Oct 1, 2019
@rafaelfranca

Copy link
Copy Markdown
Member

Thank you for the pull request. I believe if none of :after or :before are set we should just append to the end of the file.

Can you change the code and tests to do that?

#665 seems to be a different problem since :after was provided. We should add a test for that case and fix it.

@enigmatt-pl enigmatt-pl changed the title Raise an exception if before and after arguments are missing Fix TypeError when no config given and wanrn if file unchanged Oct 9, 2019
@enigmatt-pl enigmatt-pl changed the title Fix TypeError when no config given and wanrn if file unchanged Fix TypeError when no config given and warn if file unchanged Oct 9, 2019
@enigmatt-pl

Copy link
Copy Markdown
Author

Ready @rafaelfranca 😃

Comment thread lib/thor/actions/inject_into_file.rb Outdated
If no :before nor :after parameter was supplied, Thor now decides
to append the data after the last piece of information within the file.

In addition, a constant Hash with warnings has been added.
If the file is unchanged because the flag value couldn't be found,
Thor now warns the users and briefly explains what happened.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants