diff --git a/.formatter.exs b/.formatter.exs index 76d930a..3ebaf3c 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,5 +1,5 @@ # Used by "mix format" [ - inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"], - line_length: 120 + line_length: 120, + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] ] diff --git a/.gitignore b/.gitignore index 4f87084..7835cee 100644 --- a/.gitignore +++ b/.gitignore @@ -7,9 +7,8 @@ # The directory Mix downloads your dependencies sources to. /deps/ -# Where 3rd-party dependencies like ExDoc output generated docs. +# Where third-party dependencies like ExDoc output generated docs. /doc/ -/docs/ # Ignore .fetch files in case you like to edit your project deps locally. /.fetch @@ -19,3 +18,9 @@ erl_crash.dump # Also ignore archive artifacts (built via "mix archive.build"). *.ez + +# Ignore package tarball (built via "mix hex.build"). +cocktail-*.tar + +# Temporary files, for example, from tests. +/tmp/ diff --git a/LICENSE.md b/LICENSE.md index b4a26a4..39992a9 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # MIT License -Copyright © 2020 Peek Travel, Inc. +Copyright (c) 2020 Peek Travel, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index afe11be..c0f9b00 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ -# Cocktail ![Cocktail](./logo_with_border.png) +# Cocktail ![Cocktail](./assets/logo_with_border.png) -[![CI -Status](https://github.com/peek-travel/cocktail/workflows/CI/badge.svg)](https://github.com/peek-travel/cocktail/actions) +[![CI Status](https://github.com/peek-travel/cocktail/workflows/CI/badge.svg)](https://github.com/peek-travel/cocktail/actions) [![codecov](https://codecov.io/gh/peek-travel/cocktail/branch/main/graph/badge.svg)](https://codecov.io/gh/peek-travel/cocktail) -[![Hex.pm Version](https://img.shields.io/hexpm/v/cocktail.svg?style=flat)](https://hex.pm/packages/cocktail) -[![License](https://img.shields.io/hexpm/l/cocktail.svg)](LICENSE.md) +[![Module Version](https://img.shields.io/hexpm/v/cocktail.svg)](https://hex.pm/packages/cocktail) +[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/cocktail/) +[![Total Download](https://img.shields.io/hexpm/dt/cocktail.svg)](https://hex.pm/packages/cocktail) +[![License](https://img.shields.io/hexpm/l/cocktail.svg)](https://github.com/peek-travel/cocktail/blob/master/LICENSE.md) +[![Last Updated](https://img.shields.io/github/last-commit/peek-travel/cocktail.svg)](https://github.com/peek-travel/cocktail/commits/master) Cocktail is an Elixir date recurrence library based on [iCalendar events](https://tools.ietf.org/html/rfc5545#section-3.6.1). Its primary use case currently is to expand schedules with recurrence rules into streams of occurrences. For example: say you wanted to represent a repeating schedule of events that occurred every other week, on Mondays, Wednesdays and Fridays, at 10am and 4pm. @@ -27,8 +29,7 @@ Then to get a list of the first 10 occurrences of this schedule, you would do: ## Installation -Cocktail is [available in Hex](https://hex.pm/packages/cocktail) and can be installed -by adding `cocktail` to your list of dependencies in `mix.exs`: +Cocktail is [available in Hex](https://hex.pm/packages/cocktail) and can be installed by adding `:cocktail` to your list of dependencies in `mix.exs`: ```elixir def deps do @@ -98,7 +99,7 @@ iex> occurrences = Cocktail.Schedule.occurrences(schedule) [~N[2017-01-01 00:00:00], ~N[2017-01-02 00:00:00], ~N[2017-01-03 00:00:00]] ``` -The type of each occurrence depends on what start time type you used, and wether or not you supplied a duration when creating the schedule. +The type of each occurrence depends on what start time type you used, and whether or not you supplied a duration when creating the schedule. ### Duration @@ -155,6 +156,9 @@ iex> i_calendar = Cocktail.Schedule.to_i_calendar(schedule) Cocktail is heavily inspired by and based on a very similar Ruby library, [ice_cube](https://github.com/seejohnrun/ice_cube). -## License +## Copyright and License -[MIT](LICENSE.md) +Copyright (c) + +This work is free. You can redistribute it and/or modify it under the +terms of the MIT License. See the [LICENSE.md](./LICENSE.md) file for more details. diff --git a/logo.png b/assets/logo.png similarity index 100% rename from logo.png rename to assets/logo.png diff --git a/logo_with_border.png b/assets/logo_with_border.png similarity index 100% rename from logo_with_border.png rename to assets/logo_with_border.png diff --git a/mix.exs b/mix.exs index 82408df..e916171 100644 --- a/mix.exs +++ b/mix.exs @@ -1,17 +1,16 @@ defmodule Cocktail.Mixfile do use Mix.Project + @source_url "https://github.com/peek-travel/cocktail" @version "0.10.0" def project do [ app: :cocktail, name: "Cocktail", - source_url: "https://github.com/peek-travel/cocktail", version: @version, elixir: "~> 1.7", elixirc_paths: elixirc_paths(Mix.env()), - description: description(), package: package(), deps: deps(), docs: docs(), @@ -29,33 +28,36 @@ defmodule Cocktail.Mixfile do [extra_applications: [:logger]] end - defp description do - """ - Cocktail is a date/time recurrence library for Elixir based on iCalendar events. - It can generate a stream of dates/times based on a set of repeat rules. - """ - end - defp package do [ - files: ["lib", "mix.exs", "README.md", "LICENSE.md"], + description: + "Cocktail is a date/time recurrence library for Elixir " <> + "based on iCalendar events. It can generate a stream of dates/times " <> + "based on a set of repeat rules.", + files: ["lib", "mix.exs", "README.md", "LICENSE.md", "CHANGELOG.md"], maintainers: ["Chris Dosé"], licenses: ["MIT"], links: %{ - "GitHub" => "https://github.com/peek-travel/cocktail", - "Readme" => "https://github.com/peek-travel/cocktail/blob/#{@version}/README.md", - "Changelog" => "https://github.com/peek-travel/cocktail/blob/#{@version}/CHANGELOG.md" + "GitHub" => @source_url, + "Readme" => "#{@source_url}/blob/#{@version}/README.md", + "Changelog" => "#{@source_url}/blob/#{@version}/CHANGELOG.md" } ] end defp docs do [ - main: "Cocktail.Schedule", - logo: "logo.png", + extras: [ + "CHANGELOG.md": [], + "LICENSE.md": [title: "License"], + "README.md": [title: "Overview"] + ], + main: "readme", + assets: "assets", + logo: "assets/logo.png", + source_url: @source_url, source_ref: @version, - source_url: "https://github.com/peek-travel/cocktail", - extras: ["README.md", "LICENSE.md"] + formatters: ["html"] ] end @@ -79,7 +81,7 @@ defmodule Cocktail.Mixfile do [ {:credo, "~> 1.5", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false}, - {:ex_doc, "~> 0.23", only: :dev, runtime: false}, + {:ex_doc, ">= 0.0.0", only: :dev, runtime: false}, {:excoveralls, "~> 0.10", only: :test}, {:timex, "~> 3.6"} ]