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

Proposal: user-specific after.sh files #932

Merged
merged 4 commits into from Sep 2, 2018
Merged

Proposal: user-specific after.sh files #932

merged 4 commits into from Sep 2, 2018

Conversation

stevegrunwell
Copy link
Contributor

I'm a huge fan of the after.sh convention, which really lets me streamline the setup of an application (I tend to use per-project Homestead installations); picking up one of my Laravel apps usually looks like:

  1. Clone the git repo
  2. Install Composer dependencies
  3. $ vendor/bin/homestead make
  4. $ vagrant up (with after.sh handling migrations, seeding, etc.)
  5. $ vagrant ssh

β€” then start building awesome stuff!

The after.sh script is great to ensure that new VMs automatically get system requirements and let me save developers a step in running migrations/seeders. Of course, developers are an opinionated bunch, so I find myself running this anytime I rebuild the VM:

# Replace nano with a much better editor πŸ’₯
$ sudo update-alternatives --set editor /usr/bin/vim.basic

For developers more dependent on their own, more-unique aliases, it's nice to have a way to set user-specific settings automatically in a script that's not tracked under version control.

This PR introduces just that, in the form of an after.local.sh file: when present, the after.local.sh file will be executed immediately following the after.sh file (though the two are not tied to one another). Nothing is generated automatically, but developers who want to be able to fully customize the VM without losing their work with each rebuild, after.local.sh is πŸ‘Œ

Alternate approach

If the maintainers/community find that this doesn't add enough value, I'll also leave the less-canonical implementation for teams that would benefit from this concept:

# after.sh

# Load developer-specific after.sh commands.
if [ -e after.local.sh ]; then
    ./after.local.sh
fi

Copy link
Contributor

@svpernova09 svpernova09 left a comment

Choose a reason for hiding this comment

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

Not a fan of "after local" but it does drive what you're wanting out of this. What do you think about calling it "user-customizations.sh` or similar? I think that would be a bit better description of what we're trying to accomplish here.

@@ -38,6 +39,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
end

if File.exist? afterLocalScriptPath then
config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be path: afterLocalScriptPath

…r* `after.sh`, help assign more meaning to it with the name `user-customizations.sh`
@stevegrunwell
Copy link
Contributor Author

Phew, I wasn't particularly attached to after.local.sh, but was having trouble coming up with a better name; user-customizations.sh gives it a much clearer meaning πŸ‘

PR has been updated to use the new name and address the missed copy/paste error in resources/localized/Vagrantfile.

@svpernova09
Copy link
Contributor

svpernova09 commented Sep 2, 2018 via email

@svpernova09 svpernova09 merged commit c123d98 into laravel:master Sep 2, 2018
@svpernova09
Copy link
Contributor

Thanks for the PR and changes. Looking forward to implementing this in my own projects.

@stevegrunwell stevegrunwell deleted the feature/after-local-script branch September 4, 2018 14:17
njbarrett pushed a commit to JuiceboxCreative/localbox that referenced this pull request Oct 22, 2018
* upstream/master:
  Add Load Balancer (laravel#957)
  add header support (laravel#955)
  πŸ’Ž πŸ”– Tagging v7.18.0
  Increase the configuration of the thinkphp framework (laravel#952)
  Fix error message for missing Homestead settings (laravel#950)
  hyperv : use linked_clone instead of deprecated differencing_disk option (laravel#946)
  Backup mysql functions and procedures (laravel#945)
  🚧 WIP work on Rails support. Current issue is nginx compatibility (laravel#944)
  ✨ Add support for 'aspdotnetcore' site type (laravel#941)
  πŸ’Ž πŸ”– Tagging version 7.17.0
  Apache HTTP/HTTPS php version fix (laravel#940)
  Create minio buckets via config (laravel#939)
  πŸ’Ž πŸ”– Tagging 7.16.1
  πŸš‘ Fix typo breaking older versions of Vagrant < 2.1.0 (laravel#935)
  Proposal: user-specific after.sh files (laravel#932)
  Install the latest version of neo4j rather than a specific version. (laravel#933)
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.

None yet

2 participants