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
Initalize git repo when creatin new rails app #27632
Conversation
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @sgrif (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review. Please see the contribution instructions for more information. |
There's a large difference between creating a single, small file, and initializing an empty git repository automatically. Also, where is the source indicating that 90% of rails applications use git? That aside.. If this does get approved then I would highly recommend that we flip the |
ee74c82
to
5b7a646
Compare
@zachweed thanks for the comment :) That being said, I like your idea about using Also, I feel that using |
@dixpac I completely agree. I personally don't agree with the |
“Assume nothing“ isn’t really Rails’s modus operandi. |
Thank you for the pull request but doing this by default means that users now need to have git installed to generated a rails application otherwise it will fail. Can we check if git is present in the machine before running the command? |
@rafaelfranca we can check if git is present, but not sure do we have to because |
@dixpac it may be a good idea to return a message indicating we intended to create an empty git repo but were unable to due to it not being installed. |
@@ -205,6 +211,7 @@ def create_root_files | |||
build(:configru) | |||
build(:gitignore) unless options[:skip_git] | |||
build(:gemfile) unless options[:skip_gemfile] | |||
build(:version_control) |
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.
Why not check the options[:skip_git]
flag here like how its been done for :gitignore
?
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.
Since other developers can create custom AppBuilder templates by overriding rails AppBuilder methods, adding options[:skip_git]
here would add more complexity if someone wants to use other version_control
system in their templates :)
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.
Could you add a CHANGELOG entry?
5b7a646
to
d65680c
Compare
@rafaelfranca sure I added CHANGELOG and rebased from master :) |
* If `--skip-git` is not specified initalize git repo when creating new rails app
d65680c
to
8989a50
Compare
@rafaelfranca I'm not sure why tests are red after I rebased from master :( |
@dixpac restarted the randomly failing build, all green now |
I actually like this idea. At first I was thinking "wow, that assumes a lot about the developer's intentions" but then I realized... Yes, and that's probably a good thing in the context of Rails development. Rails is opinionated. Most developers use version control and most developers using version control use Git for it. So I think it is logical to implicitly create a new Git repo during the creation of a new Rails app. |
Initalize git repo when creatin new rails app
Since Rails is already generating
.gitignore
, and in 90% of cases when creating new rails app user initialise git repo. Now Rails automatically initialises new git repo onrails new
command If--skip-git
is not specified.I've added this as new "step" in generator called
version_control
in case someone wants to override this when creating custom app builder (maybe not using git as version_control but something else)