Skip to content

Commit

Permalink
Add fancy docs generator
Browse files Browse the repository at this point in the history
  • Loading branch information
droptheplot committed Nov 7, 2017
1 parent 0b2096f commit dcb34f0
Show file tree
Hide file tree
Showing 11 changed files with 443 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# The directory Mix will write compiled artifacts to.
/_build

# If you run "mix test --cover", coverage assets end up here.
/cover

# The directory Mix downloads your dependencies sources to.
/deps

# Where 3rd-party dependencies like ExDoc output generated docs.
/doc

# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump

# Also ignore archive artifacts (built via "mix archive.build").
*.ez

/awesome-phoenix
30 changes: 30 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config

# This configuration is loaded before any dependency and is restricted
# to this project. If another project depends on this project, this
# file won't be loaded nor affect the parent project. For this reason,
# if you want to provide default values for your application for
# 3rd-party users, it should be done in your "mix.exs" file.

# You can configure for your application as:
#
# config :awesome_phoenix, key: :value
#
# And access this configuration in your application as:
#
# Application.get_env(:awesome_phoenix, :key)
#
# Or configure a 3rd-party app:
#
# config :logger, level: :info
#

# It is also possible to import configuration files, relative to this
# directory. For example, you can emulate configuration per environment
# by uncommenting the line below and defining dev.exs, test.exs and such.
# Configuration from the imported file will override the ones defined
# here (which is why it is important to import them last).
#
# import_config "#{Mix.env}.exs"
234 changes: 234 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
## [sergiotapia/magnetissimo](https://github.com/sergiotapia/magnetissimo)

Web application that indexes all popular torrent sites, and saves it to the local database.

⭐ 2014 👁 74 🍴 129 🕐 22-7-2016

## [bigardone/phoenix-trello](https://github.com/bigardone/phoenix-trello)

[https://phoenix-trello.herokuapp.com](https://phoenix-trello.herokuapp.com)

Trello tribute done in Elixir, Phoenix Framework, React and Redux.

⭐ 2014 👁 86 🍴 333 🕐 4-1-2016

## [thechangelog/changelog.com](https://github.com/thechangelog/changelog.com)

[https://changelog.com/posts/changelog-is-open-source](https://changelog.com/posts/changelog-is-open-source)

Hacker to the 💚

⭐ 1190 👁 44 🍴 108 🕐 28-12-2015

## [operable/cog](https://github.com/operable/cog)

Bringing the power of the command line to chat

⭐ 785 👁 29 🍴 58 🕐 8-1-2016

## [dailydrip/firestorm](https://github.com/dailydrip/firestorm)

[http://www.firestormforum.org](http://www.firestormforum.org)

An open-source forum engine, with an Elixir+Phoenix backend and an Elm frontend.

⭐ 643 👁 94 🍴 56 🕐 24-12-2016

## [wojtekmach/acme_bank](https://github.com/wojtekmach/acme_bank)

An example ☂ project

⭐ 439 👁 32 🍴 58 🕐 28-5-2016

## [hexpm/hexpm](https://github.com/hexpm/hexpm)

[https://hex.pm](https://hex.pm)

API server and website for Hex

⭐ 373 👁 33 🍴 152 🕐 28-1-2014

## [thoughtbot/constable](https://github.com/thoughtbot/constable)

[constable-demo.herokuapp.com](constable-demo.herokuapp.com)

Better company announcements

⭐ 311 👁 33 🍴 30 🕐 4-2-2015

## [evercam/evercam-server](https://github.com/evercam/evercam-server)

[https://media.evercam.io/](https://media.evercam.io/)

Cloud CCTV Server (Phoenix)

⭐ 299 👁 29 🍴 39 🕐 18-3-2015

## [vinsol/nectarcommerce](https://github.com/vinsol/nectarcommerce)

Quest for customizable E-commerce - the Elixir way

⭐ 236 👁 34 🍴 41 🕐 1-2-2016

## [tony612/exchat](https://github.com/tony612/exchat)

[https://exchat-example.herokuapp.com/](https://exchat-example.herokuapp.com/)

A Slack-like app by Elixir, Phoenix & React(redux)

⭐ 180 👁 10 🍴 21 🕐 29-8-2015

## [code-corps/code-corps-api](https://github.com/code-corps/code-corps-api)

[https://www.codecorps.org](https://www.codecorps.org)

Elixir/Phoenix API for Code Corps.

⭐ 179 👁 30 🍴 74 🕐 16-7-2016

## [Angarsk8/Loopa-News](https://github.com/Angarsk8/Loopa-News)

[https://loopa-news.herokuapp.com](https://loopa-news.herokuapp.com)

Realtime social news app developed from scratch with Elixir, Phoenix, Vue and Vuex

⭐ 177 👁 9 🍴 13 🕐 14-12-2016

## [rrrene/elixirstatus-web](https://github.com/rrrene/elixirstatus-web)

[http://elixirstatus.com](http://elixirstatus.com)

Community site for Elixir project/blog post/version updates

⭐ 176 👁 17 🍴 36 🕐 21-6-2015

## [authentic-pixels/ex-shop](https://github.com/authentic-pixels/ex-shop)

[https://www.authenticpixels.com](https://www.authenticpixels.com)

Digital goods shop & blog created using Elixir (Phoenix framework)

⭐ 162 👁 9 🍴 22 🕐 21-9-2016

## [vutuv/vutuv](https://github.com/vutuv/vutuv)

vutuv is a social network service to host and share information about humans and organizations.

⭐ 148 👁 17 🍴 18 🕐 27-4-2016

## [elpassion/sprint-poker](https://github.com/elpassion/sprint-poker)

[http://sprintpoker.io](http://sprintpoker.io)

Online estimation tool for Agile teams.

⭐ 148 👁 29 🍴 23 🕐 31-7-2015

## [mustafaturan/shield](https://github.com/mustafaturan/shield)

Shield is an OAuth2 Provider hex package and also a standalone microservice build top of the Phoenix Framework and 'authable' package. (with Heroku Deploy Button)

⭐ 140 👁 14 🍴 20 🕐 28-6-2016

## [cerclecrm/cercle](https://github.com/cerclecrm/cercle)

[http://get.cercle.co](http://get.cercle.co)

Cercle is the ultimate CRM+Project Manager for your organization - Phoenix Framework & Vuejs

⭐ 107 👁 10 🍴 15 🕐 6-2-2017

## [hashrocket/tilex](https://github.com/hashrocket/tilex)

[https://til.hashrocket.com](https://til.hashrocket.com)

Today I Learned in Elixir

⭐ 98 👁 15 🍴 28 🕐 18-11-2016

## [stride-nyc/remote_retro](https://github.com/stride-nyc/remote_retro)

[https://remoteretro.org/](https://remoteretro.org/)

A real-time application for conducting Agile retrospectives

⭐ 84 👁 10 🍴 16 🕐 11-12-2016

## [rizafahmi/elixirjobs](https://github.com/rizafahmi/elixirjobs)

[http://jobs.elixirdose.com/](http://jobs.elixirdose.com/)

Job portal for Alchemist

⭐ 83 👁 10 🍴 33 🕐 7-6-2015

## [gaynetdinov/ex_money](https://github.com/gaynetdinov/ex_money)

A [work-in-progress] self-hosted personal finance app

⭐ 67 👁 10 🍴 5 🕐 19-11-2015

## [zabirauf/ephemeral_share](https://github.com/zabirauf/ephemeral_share)

A file sharing web app using RTC, React and Phoenix

⭐ 61 👁 4 🍴 10 🕐 13-7-2015

## [stevedomin/ex_playground](https://github.com/stevedomin/ex_playground)

Run Elixir code in your browser - http://play.elixirbyexample.com/

⭐ 38 👁 3 🍴 3 🕐 15-6-2015

## [tsurupin/job_search](https://github.com/tsurupin/job_search)

[http://demo.job-search.tsurupin.com/](http://demo.job-search.tsurupin.com/)

An app to search startup jobs scraped from websites written in Elixir, Phoenix, React and styled-components.

⭐ 37 👁 5 🍴 6 🕐 30-12-2016

## [healthlocker/healthlocker](https://github.com/healthlocker/healthlocker)

[https://www.healthlocker.uk](https://www.healthlocker.uk)

Inspire and motivate people to stay well.

⭐ 30 👁 16 🍴 4 🕐 21-1-2017

## [GBH/loaded.bike](https://github.com/GBH/loaded.bike)

[http://loaded.bike](http://loaded.bike)

Phoenix/Elixir web app for exploring and sharing bicycle touring routes

⭐ 29 👁 2 🍴 3 🕐 19-2-2017

## [workshops-de/classlab](https://github.com/workshops-de/classlab)

A virtual classroom for workshops.

⭐ 25 👁 6 🍴 4 🕐 11-10-2016

## [ember-weekend/ember-weekend-api](https://github.com/ember-weekend/ember-weekend-api)

[https://emberweekend.com/](https://emberweekend.com/)

Ember Weekend API

⭐ 15 👁 2 🍴 1 🕐 22-2-2016

## [code3-coop/carbon](https://github.com/code3-coop/carbon)

Hackable white label CRM

⭐ 15 👁 10 🍴 0 🕐 16-7-2016

## [nicksergeant/leather](https://github.com/nicksergeant/leather)

[https://www.leatherapp.com/](https://www.leatherapp.com/)

💰 A modern money management app.

⭐ 6 👁 3 🍴 1 🕐 25-7-2017

1 change: 1 addition & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
title: Awesome Phoenix
35 changes: 35 additions & 0 deletions lib/awesome_phoenix.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
defmodule AwesomePhoenix do
@input "README.md"
@output "docs/README.md"
@regex ~r/https:\/\/github.com\/([a-zA-Z0-9\-\_\.]+)\/([a-zA-Z0-9\-\_\.]+)/

alias AwesomePhoenix.Repo
alias AwesomePhoenix.Template

def main([]) do
IO.puts "GitHub personal access token is missing."
end

def main(args) do
token = Enum.at(args, 0)

HTTPoison.start

client = Tentacat.Client.new(%{access_token: token})

{:ok, file} = File.open(@output, [:write])
{:ok, data} = File.read(@input)

try do
data
|> String.split("\n")
|> Enum.filter(&String.starts_with?(&1, "*"))
|> Enum.map(&Regex.run(@regex, &1))
|> Enum.map(&Repo.parse(client, Enum.at(&1, 1), Enum.at(&1, 2)))
|> Enum.sort_by(&Map.get(&1, :stargazers_count), &>=/2)
|> Enum.each(&IO.binwrite(file, Template.render_repo(&1)))
after
File.close(file)
end
end
end
27 changes: 27 additions & 0 deletions lib/awesome_phoenix/repo.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
defmodule AwesomePhoenix.Repo do
@enforce_keys [:owner, :name]
defstruct [:owner, :name, :description, :created_at, :homepage, :html_url, topics: [],
stargazers_count: 0, watchers_count: 0, forks_count: 0]

def parse(client, owner, name) do
case Tentacat.Repositories.repo_get(owner, name, client) do
{403, _} -> nil
data -> new(data)
end
end

def new(data) do
%__MODULE__{
owner: get_in(data, ["owner", "login"]),
name: Map.get(data, "name"),
description: Map.get(data, "description"),
created_at: Map.get(data, "created_at"),
homepage: Map.get(data, "homepage"),
html_url: Map.get(data, "html_url"),
topics: Map.get(data, "topics"),
stargazers_count: Map.get(data, "stargazers_count"),
watchers_count: Map.get(data, "subscribers_count"),
forks_count: Map.get(data, "forks_count"),
}
end
end
38 changes: 38 additions & 0 deletions lib/awesome_phoenix/template.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
defmodule AwesomePhoenix.Template do
alias AwesomePhoenix.Repo

def render_repo(%Repo{} = repo) do
"""
## [#{repo.owner}/#{repo.name}](#{repo.html_url})
#{render_homepage(repo)}
#{repo.description}
#{render_stargazers(repo)} #{render_watchers(repo)} #{render_forks(repo)} #{render_date(repo)}
"""
end

def render_homepage(%Repo{homepage: nil}), do: ""
def render_homepage(%Repo{homepage: ""}), do: ""
def render_homepage(%Repo{} = repo) do
"\n[#{repo.homepage}](#{repo.homepage})\n"
end

defp render_stargazers(%Repo{} = repo) do
"⭐ #{repo.stargazers_count}"
end

defp render_watchers(%Repo{} = repo) do
"👁 #{repo.watchers_count}"
end

defp render_forks(%Repo{} = repo) do
"🍴 #{repo.forks_count}"
end

defp render_date(%Repo{} = repo) do
{:ok, dt, 0} = DateTime.from_iso8601(repo.created_at)

"🕐 #{dt.day}-#{dt.month}-#{dt.year}"
end
end
Loading

0 comments on commit dcb34f0

Please sign in to comment.