-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add before
and after
options to Blueprint#insertIntoFile
#2122
Add before
and after
options to Blueprint#insertIntoFile
#2122
Conversation
before
and after
options to insertIntoFilebefore
and after
options to Blueprint#insertIntoFile
var line1 = 'line1 is here'; | ||
var line2 = 'line2 here'; | ||
var line3 = 'line3'; | ||
var originalContent = [line1, line2, line3].join('\n'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will need to switch all instances of \n
to use var EOL = os.eol;
.
Looks great! We need to swap the I would also like to see a test that confirms the behavior if multiple matches are found. From the implementation it is obvious that it doesn't matter (it will always use the first one due to the usage of |
"newGlobal", | ||
"window", | ||
"document" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
going to change this example. I've been focused on automatically adding test helpers but it's not good to encourage people to add globals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
3dc7864
to
f3983f1
Compare
f3983f1
to
61b1101
Compare
thanks! Added 2 more tests to ensure that it inserts before/after the first instance of the string only. Changed |
…rt-into-file Add `before` and `after` options to Blueprint#insertIntoFile
}); | ||
|
||
it('will insert into the file before a specified string if options.before is specified', function(){ | ||
var toInsert = 'blahzorz blammo'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inserting an EOL in the "before" statment causes formatting issues. Can we just insert "before" starting immediately before the statement? And leave it to the insertion statment to add the EOL?
Adds the ability to specify the string in a file to insert contents before or after, similar to the same method in Thor.
Example: