Chapter 10. Building, Compiling, and Testing with Elixir

In this chapter, the following topics will be covered:

  • Installing Node.js, Gulp, and Elixir
  • Running Elixir
  • Combining CSS and JavaScript files using Elixir
  • Setting up notifications
  • Running tests with Elixir
  • Extending Elixir

Automating Laravel

Throughout the book, many parts of an example application have been built. We discussed the steps involved in creating an application. However, there is more information available about tools to help with scaffolding, boilerplate templates, and building up a RESTful API for a CRUD application. Until recently, not much was written about automating some parts of the development process and deployment process.

A newer area that has emerged in the last few years in the PHP field is the concept of continuous integration and build tools. The popularity of continuous integration and continuous delivery enables teams of developers to constantly release many small improvements to their application many times a day. In this chapter, you will learn how Laravel has a new toolset to empower teams to rapidly and effortlessly deploy versions of their software and build, and combine many of the software's components automatically.

Continuous integration and continuous delivery has caused quite an evolution in the development process, which has drastically changed the way in which software is built. It was not too long ago, however, when the standard deployment process involved simply placing the code on the server. A majority of the early adopters of PHP were simply web designers with a need to add functionality such as a forum or contact us form. Since most of them were not programmers, most of the practices used in web design and graphic design in general made their way into PHP deployment as well. These practices often involved using an application such as FileZilla to drag-and-drop files from the left-hand side panel (the user's computer) to the right (the server's directories). For the more experienced, performing what was then cryptic UNIX commands using a terminal emulator such as PuTTY.

The insecure file transfer port 21 was used, and everything was sent uncompressed and simply copied to the server. Usually, all of the files were overwritten and often the deployment took almost an hour for a large site with many images and files.

Eventually, source code control systems became pervasive. In the most recent years, SVN and Git have become the industry standard for most software projects. These tools allowed for deployment directly from a code repository.

Most recently, the arrival of composer has created an easy way to simply include entire software packages to add functionality to software applications. The ease with which a developer simply needs to add a single line to the configuration file is exhilarating!

Automating both the development and deployment processes may involve many steps, some of which are listed next.

Deployment

Here are some of the functions of the deployment process:

  • Copying certain configuration settings that are relevant to the production environment
  • Processing or compiling any cascading style sheets (CSS) or JavaScript files that were written using a shortcut syntax or preprocessor
  • Copying the various assets (source code or images) to mirrors, cluster servers, or content delivery networks
  • Modifying the read/write/execute permissions and/or ownership of certain files or directories
  • Combining several files into one to reduce the overhead required to perform multiple HTTP calls
  • Reducing useless white space and comments (minifying and/or uglifying) in files to reduce their size
  • Comparing existing files on the server with the files from our local environment to determine whether or not to overwrite them
  • Tagging and/or versioning the source code to allow for possible code rollbacks

Development or deployment

Here are some of the functions of the development or deployment process:

  • Verifying that code passed all of the unit, functional, and acceptance tests written to guarantee its quality
  • Running scripts that perform various operations
  • Performing any migrations, seeding, or other modifications to the database tables
  • Obtaining source code control from a hosted source code control system such as GitHub

It is clear that modern development is very complex. An even more difficult aspect of software development is continually recreating the production or final environment while developing.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset