bash: vagrant
If you’re a web developer, possibly one of your most boring and repetitive tasks is the configuration of the basic setup for every new project. Configuring your my-project.dev domain, creating the database, installing WordPress (or any other CMS/Framework) for the thousandth time: you already know how to do it. What if you could automate all of that?
如果您是Web开发人员,那么最无聊和重复性的任务之一可能就是为每个新项目配置基本设置。 配置您的my-project.dev域,创建数据库,千分之一次安装WordPress(或任何其他CMS / Framework):您已经知道该怎么做。 如果可以自动化所有这些怎么办?
Well, actually, you can.
好吧,实际上,您可以。
Please is a simple bash script that helps to automate the installations of many CMSs and Frameworks by configuring them automatically into your Vagrant box, adding a development domain name into your host file, and even a database if needed.
Please是一个简单的bash脚本,可通过将其自动配置到“ Vagrant”框中,将开发域名添加到主机文件中,甚至在需要时添加数据库,来帮助自动执行许多CMS和Framework的安装。
Let’s take a look.
让我们来看看。
Since Please is still in beta version (0.3), I suggest that you not use it immediately in your production, but to test it first — to make sure everything works as you require. There’s no risk about losing data and so on — the worst thing that could happen is that it’s not working — but it’s always better to be safe.
由于Please仍处于测试版(0.3)中,因此建议您不要在生产中立即使用它,而要先对其进行测试-确保一切正常。 丢失数据等没有任何风险-可能发生的最糟糕的事情是它无法正常工作-但是安全总是更好。
So, first, you need to setup a Vagrant box.
因此,首先,您需要设置一个Vagrant框。
If you’re new to Vagrant, I suggest you read this nice introduction to understand the whole thing and get started the right way.
如果您是Vagrant的新手,建议您阅读此入门指南,以了解整个内容并以正确的方式开始。
A small Vagrant box (a fork of box.scotch.io) has been created for this project, and it’s named Please Box.
为此项目创建了一个小的Vagrant框( box.scotch.io的分支 ),并将其命名为Please Box 。
Here are all the steps for installation via the command line:
以下是通过命令行进行安装的所有步骤:
git clone https://github.com/jehanf/please-box.git please-box cd please-box vagrant upPlease also requires the Vagrant HostsUpdater plugin to get everything to work. The installation is quite simple; here’s the command to save you some time:
还请需要流浪HostsUpdater插件得到的一切工作。 安装非常简单; 这是节省您时间的命令:
vagrant plugin install vagrant-hostsupdaterThat’s it, you’re all set to start using Please!
就是这样,您都可以开始使用Please !
There are very few steps needed to install Please, as written in the official documentation:
按照官方文档中的说明,只需很少的步骤即可安装Please :
git clone https://github.com/jehanf/please.git sudo chmod +x please/please sudo mv please/please /usr/local/bin/please && sudo rm -R pleaseThe && sudo rm -R please part is only to keep your computer clean; since the git clone part clones the full folder of the repo, including the README file, you may not want to keep these on your computer.
&& sudo rm -R please部分只是为了保持计算机的清洁; 由于git clone部分会克隆回购的完整文件夹,包括README文件,因此您可能不希望将它们保留在计算机上。
The basic command to create a new project is:
创建新项目的基本命令是:
please createYou can also type please create <name of cms/framework>, as written in the documentation.
您也可以键入please create <name of cms/framework>按照文档中的说明please create <name of cms/framework> 。
please create will trigger a select screen, as in the following screenshot:
please create将触发一个选择屏幕,如以下屏幕截图所示:
As you can see, for now, the only options available are:
如您所见,目前,唯一可用的选项是:
a simple custom dev domain (+ optional database) 一个简单的自定义开发域(+可选数据库) WordPress WordPress的 Symfony Symfony Angular2 角度2 Laravel Laravel Pagekit 页面套件 ReactJS. ReactJS。Let’s take a look at a simple example of project creation. I’ve chosen WordPress, since it’s the most used/complete one.
让我们看一个简单的项目创建示例。 我选择了WordPress,因为它是最常用/最完整的一个。
Please will ask a few questions to setup your new environment, and then ask you a simple confirmation, as you can see below:
请将要求设置新环境的一些问题,然后问你一个简单的确认,你可以看到如下:
Since Please uses WP-CLI to perform the install, you can choose to update it before it begins. And if it’s not installed (on your Vagrant), it will be installed automatically (even if you said no), because it needs to.
由于Please请使用WP-CLI执行安装,因此您可以选择在开始之前对其进行更新。 如果尚未安装(在您的Vagrant上),则会自动安装(即使您说不),因为需要这样做。
All you need to do now is type Y or simply hit the Enter button, and go grab a coffee.
现在您需要做的就是输入Y或直接按Enter键,然后去喝杯咖啡。
Meanwhile, Please will now do the following:
同时, 请现在执行以下操作:
make a folder (named by the site name you defined earlier, demoforsitepoint.dev here)
制作一个文件夹(以您之前定义的站点名称命名,此处为demoforsitepoint.dev )
set up a Virtual Host on your machine (same as the folder : demoforsitepoint.dev!)
在您的机器上设置一个虚拟主机(与文件夹: demoforsitepoint.dev相同)。
download the latest version of WordPress 下载最新版本的WordPresscreate your WP database (also named demoforsitepoint.dev)
创建您的WP数据库(也称为demoforsitepoint.dev )
generate the wp-config.php and do the WordPress install
生成wp-config.php并进行WordPress安装
restart your Vagrant box. 重新启动“ Vagrant”框。You can now visit to your site (still demoforsitepoint.dev here), and start working.
现在,您可以访问您的站点(此处仍为demoforsitepoint.dev ),然后开始工作。
Now that this creation tutorial is almost over, maybe you want to delete this demoforsitepoint.dev?
现在,本教程已快结束,也许您想删除此demoforsitepoint.dev吗?
A simple command:
一个简单的命令:
please deleteThere will be a small bunch of questions (including a confirmation), and Please will delete everything, and then reboot your Vagrant box.
将出现一小部分问题(包括确认信息), 请删除所有内容,然后重新启动Vagrant框。
Warning: since the project is deleted on the Vagrant side, there’s no revert possible!
警告 :由于项目已在Vagrant端删除,因此无法还原!
As you can see, Please doesn’t have the power (yet!) of a Yeoman when it comes to creating a starter project, but it could be enough for some situations. Some of the automations are, like Please itself, still in beta (like Angular2), but it’s enough to do some tests.
如您所见,在创建启动项目时, 请 (还没有)Yeoman的功能,但是在某些情况下这可能就足够了。 某些自动化程序(例如Please本身)仍处于beta版本(如Angular2 ),但是足以进行一些测试。
Please is currently in 0.3, and it’s evolving quickly. I’d love it if you would check it out and let me know what you think in the comments. Of course, because it’s on GitHub, you’re welcome to suggest improvements too.
Please目前处于0.3,并且发展Swift。 如果您可以检查一下并在评论中告诉我您的想法,我将非常乐意。 当然,由于它在GitHub上,因此也欢迎您提出改进建议。
翻译自: https://www.sitepoint.com/please-automated-cms-and-framework-installs-in-vagrant/
bash: vagrant
相关资源:jdk-8u281-windows-x64.exe