This is the most basic word to ask people for their help. Why shouldn't this be applied to machines?
Starting with this simple idea combined with the power of Vagrant, Please is a simple bash script that helps you automate the installations of many CMS/Frameworks by configuring them automatically, setting up a development domain name, and even a database if needed.
Less repetitions, more results (and politely at that).
The first obvious thing to have is a vagrant box.
If you don't have one, or want a clean start, a small Vagrant Box (a fork of box.scotch.io) has been created for this project, here are all the steps to install it:
$ git clone https://github.com/jehanf/please-box.git my-folder $ cd my-folder $ vagrant up
Please (haha) note that you will need to install Vagrant HostsUpdater to get all the functions included in Please to work.
The installation is quite simple, here is the command to save you some time:
$ vagrant plugin install vagrant-hostsupdater
How to install Please?
The installation process is quite simple:
$ git clone https://github.com/jehanf/please.git $ sudo chmod +x please/please $ sudo mv please/please /usr/local/bin/please && sudo rm -R please
chmod +x please/please makes the script executable, and
mv please/please /usr/local/bin/please && sudo rm -R please moves the bash script into /usr/local/bin/ folder for easy use. It also removes the folder downloaded via git (now only containing the readme file you are currently reading).
It's almost a copy/paste of the official doc, easy right?
How do I use Please?
You can be guided from the start with a simple:
$ please create
It will trigger a small selection example like this (I'm on OSX) :
As you can see, for now, the only options (there are more to come) are:
- A simple custom dev domain (+ optionnal database)
From then, all you need to do is type the number associated with the type of project you want to create, and you'll have to answer a few questions, depending on your choice. Let's see what it would look like for a WordPress example:
The script will ask you first a site name, I choose demoforscotch.dev here.
Then, you'll have to enter a username (Jehan in my case), a password (not 123456 for me), and an email (email@example.com here): this will be the WordPress admin account.
You may have noticed that you can also update the WP-CLI. Note that if it is not installed on your Vagrant, it will install it for you (even if you said no), because it needs to.
It was up-to-date on my config, so I chose not to do it.
All you need to do now is type
Y or simply hit en Enter button, and let the magic begin.
Please will automatically:
- Create a folder for your project (named by the site name you defined earlier, demoforscotch.dev in my case)
- Setup a Virtual Host on your machine (guess what is it for me? demoforscotch.dev! Yeah, hard to guess!)
- Get the latest version of WordPress
- Create your WP database (it will also be named using the site name you defined)
- Generate the wp-config.php and finish the WordPress install
- Restart your Vagrant Box
You could go a grab a coffee during this time, except if you are like me and you forget to start your vagrant before doing a tutorial. In this case it won't work. But I guess/hope you are smarter than me, so it will not happen to you :)
If everything went well (it should), you'll see a confirmation message :
You can now go to your site (still demoforscotch.dev in my case, but you already knew, right?), and start doing your stuff. Or stop because you only wanted to follow this tutorial.
And if you want to stop, maybe you want to delete the demo website you just created? You see me coming now, isn't this an awesome transition?
Delete a project
Nothing hard here, you can launch Europe's The Final Countdown in your headset and do a simple command:
$ please delete
You will have to answer a few questions. Following my example, it would do something like this:
I saved you all the gibberish stuff about things being removed and Vagrant restarting, but this is more than enough for now.
The project folder will be deleted (warning: no possible revert), the database removed (but only if you confirm the deletion), and the virtual host deleted.
As you can see, Please was built with the purpose of saving time by avoiding the redundant tasks, and performing them while you take a few seconds to grab your coffee/tea/croissant.
And even if some of the included automations are still in beta (hello Angular2), this small script -31.5 KB!- could also be used to test new frameworks very quickly.
Please is actually in version 0.1, some improvements are to be made (self-update, to name the obvious one), and other automations will be added in the near future.
I hope this tutorial was helpful.