concept project in category elixir

appears as: project, project, project, The project, Projects
Phoenix in Action

This is an excerpt from Manning's book Phoenix in Action.

Over the years, some high-profile companies have embraced Phoenix and Elixir. They have done so in varying degrees—some started with just API servers, some used them for internal tooling, and some have gone all-in and moved everything over. Companies such as Pinterest, Slack, Discord, Lonely Planet, Bleacher Report, Undead Labs (the company behind the hit video game State of Decay), and Opendoor are on this ever-growing list. The ability to dip a toe into the world of Phoenix or fully dive in is one of the great things about Elixir and Phoenix. They can handle any size of project you throw at them, and do so very cost-effectively.

Listing 5.2. Using mix help new to learn about creating a new Elixir project
> mix help new

                                    mix new

Creates a new Elixir project. It expects the path of the project as argument.

    mix new PATH [--sup] [--module MODULE] [--app APP] [--umbrella]      #1

A project at the given PATH will be created. The application name and module
name will be retrieved from the path, unless --module or --app is given.

A --sup option can be given to generate an OTP application skeleton including a
supervision tree. Normally an app is generated without a supervisor and without
the app callback.

An --umbrella option can be given to generate an umbrella project.

An --app option can be given in order to name the OTP application for the
project.

A --module option can be given in order to name the modules in the generated
code skeleton.

## Examples

    mix new hello_world                                                  #2

Is equivalent to:

    mix new hello_world --module HelloWorld

To generate an app with a supervision tree and an application callback:

    mix new hello_world --sup

To generate an umbrella application with sub applications:

    mix new hello_world --umbrella
    cd hello_world/apps
    mix new child_app
The project function

The project function defines the top-level details of your Elixir application:

The following listing shows the project function.

Listing 5.7. The project function
def project do
  [
    app: :auction,
    version: "0.1.0",

    build_path: "../../_build",                #1
    config_path: "../../config/config.exs",    #1
    deps_path: "../../deps",                   #1
    lockfile: "../../mix.lock",                #1
    elixir: "~> 1.7",
    start_permanent: Mix.env() == :prod,
    deps: deps()
  ]
end
The Little Elixir & OTP Guidebook

This is an excerpt from Manning's book The Little Elixir & OTP Guidebook.

mix is a build tool used for creating, compiling, and testing Elixir projects. It’s also used to manage dependencies, among other things. Think of it like rake in Ruby and lein in Clojure. (Some of the first contributors to mix also wrote lein.) Projects such as the Phoenix web framework have used mix to great effect for things like building generators that reduce the need to write boilerplate.

Listing 11.1. Setting up a project to use QuickCheck
defmodule QuickcheckPlayground.Mixfile do
  use Mix.Project
  def project do
    [app: :quickcheck_playground,
     version: "0.0.1",
     elixir: "~> 1.2-rc",
     build_embedded: Mix.env == :prod,
     start_permanent: Mix.env == :prod,
     test_pattern: "*_{test,eqc}.exs",                   #1
     deps: deps]
  end
  def application do
    [applications: [:logger]]
  end
  defp deps do
    [{:eqc_ex, "~> 1.2.4"}]                              #2
  end
end