Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
d465760
Update README.md
johnhamelink Dec 30, 2022
9e266fe
Deps update, release, runtime port configuration
hissssst Dec 19, 2022
d01db19
Cleanup, packaging
hissssst Dec 20, 2022
9524208
Now /tmp is a dir with docs
hissssst Dec 20, 2022
60423fa
Refactoring, dead code removal
hissssst Dec 20, 2022
bfd44ef
Fixes
hissssst Dec 20, 2022
f0369ff
Nix package
hissssst Dec 20, 2022
e9c3803
License and CoC
hissssst Dec 22, 2022
42628bc
Remove phoenix compiler
hissssst Feb 8, 2023
4ce2ab8
Format files
Awea Feb 19, 2023
0fa3c70
Remove sidebar and burger button from docset
Awea Feb 19, 2023
711aa4e
Rebuild docset when missing on disk
Awea Feb 19, 2023
73b6f56
Separate exceptions, pages and protocols from modules
Awea Feb 20, 2023
79871b3
update usage instructions
andrhua Jan 12, 2023
330eeec
chore(Deps): Bump dependencies
johnhamelink Nov 5, 2024
320b340
chore(Deps): Tweak floki dependency constraints
johnhamelink Nov 5, 2024
5e3a0af
fix(Deps): Fix bad versioning
johnhamelink Nov 5, 2024
6a1899c
chore(Deps): Drop phoenix down to 1.6
johnhamelink Nov 5, 2024
d1a17cb
chore(Flake): Added a simple nix flake
johnhamelink Nov 5, 2024
01c459d
refactor(Deps): Remove esqlite override, update phoenix_view
johnhamelink Nov 5, 2024
6adc183
feat(Flake): Add gnutar, since it's a required runtime dependency
johnhamelink Nov 5, 2024
e2dd20e
feat(Flake): Add a .envrc for automatic dev-env activation
johnhamelink Nov 5, 2024
f4608bb
refactor(DocsetAPI)!: Refactor builder logic to get it working again
johnhamelink Nov 5, 2024
887d6a4
chore(Direnv): Add /.direnv to the gitignore
johnhamelink Nov 5, 2024
509316f
docs(Example): Added my version of the GenerateDocsets task
johnhamelink Nov 5, 2024
b9c593e
feat(Nix): Use a VERSION file to sync the version between Nix & Mix
johnhamelink Nov 5, 2024
6c402c3
docs(Naming): get latest version produces a release, so call it that
johnhamelink Nov 5, 2024
f658514
fix(Docset): Docset tarballs should use the tgz extension
johnhamelink Nov 5, 2024
431a0dd
chore(Env): Set PORT=4000 by default
johnhamelink Nov 6, 2024
766e050
fix(Ecto): Remove references to ecto in ExUnit
johnhamelink Nov 6, 2024
30ef070
refactor(FileParser)!: Start rewriting the parser, this time along wi…
johnhamelink Nov 6, 2024
f41793a
test(Fixture)!: Implemented fixture checks for two HTML fixture docs
johnhamelink Nov 6, 2024
1276083
test(Fixtures): Add Fixtures (and fixes) for guides and exception pages
johnhamelink Nov 6, 2024
87639d1
feat(DocsetApi): Add support for protocols
johnhamelink Nov 6, 2024
4dbf303
feat(DocsetApi): Add support for Mix Tasks
johnhamelink Nov 6, 2024
c389aec
fix(DocsetApi): Fixed Behaviours namespace retreival (using title now)
johnhamelink Nov 6, 2024
17cdadc
feat(DocsetApi)!: Add a Mix Task for downloading any hex pkg in CLI
johnhamelink Nov 6, 2024
8e00674
docs(DocsetApi): Add ex_doc dependency
johnhamelink Nov 6, 2024
dd77618
refactor(FileParser): Rename parse_zeal_navigation/3 to parse/3
johnhamelink Nov 6, 2024
9dfa007
fix(FileParser): Fix Fileparser for exceptions in exdoc 0.28.6
johnhamelink Nov 6, 2024
e4997b0
fix(FileParser): Cleanup Type output remove the "t:" bit
johnhamelink Nov 6, 2024
39914de
fix(FileParser): Don't format content selector
johnhamelink Nov 6, 2024
dd5895e
fix(FileParser): Add fix for Modules in ExDoc 0.28.6
johnhamelink Nov 6, 2024
5f909a6
fix(FileParser): introduce concept of whole_find_finder/1
johnhamelink Nov 6, 2024
0a9c234
fix(Fixtures): Fixed version typo caught by new version identificatio…
johnhamelink Nov 6, 2024
27dd26b
test(coverage): Add a check to make sure all fixture files were proce…
johnhamelink Nov 6, 2024
99982b3
feat(FileParser): Added ability to determine ExDoc version
johnhamelink Nov 6, 2024
b4dd7bd
test(ExDocVersion): Ensure ExDoc version found = fixture filename
johnhamelink Nov 6, 2024
572a418
test(FileParser): Added test for ExDoc 0.28.6
johnhamelink Nov 6, 2024
8fa89e6
refactor(FileParser)!: Implemented version-specific handlers for exdo…
johnhamelink Nov 6, 2024
88c6669
test(FileParser): Handle exceptions in ExDoc 0.25.5, refactor functions
johnhamelink Nov 6, 2024
4c3bd13
feat(FileParser): Index guides in ExDoc 0.25
johnhamelink Nov 6, 2024
8187b10
style(Elixir): Cleanup style
johnhamelink Nov 6, 2024
2d2fcff
style(FileParser): Improved ordering of functions
johnhamelink Nov 6, 2024
fb1c253
feat(FileParser): Add concept of "banned files"
johnhamelink Nov 6, 2024
5985076
feat(FileParser): Enable support for ExDoc 0.23 (tzdata uses it)
johnhamelink Nov 6, 2024
8c06cc5
test(ExUnit): All tests now pass!
johnhamelink Nov 8, 2024
bfa27ce
feat(FileParser): Add support for Callbacks
johnhamelink Nov 8, 2024
d911891
test(FileParser): Added support for ExDoc 0.11.0 Macros
johnhamelink Nov 8, 2024
8159937
test(ExUnit): Update expectations on functions which now return a tuple
johnhamelink Nov 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# ^ added for shellcheck and file-type detection

# This installs nix-direnv for users that don't already have it.
if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM="
fi

if [[ $(type -t use_flake) != function ]]; then
echo "ERROR: use_flake function missing."
echo "Please update direnv to v2.30.0 or later."
exit 1
fi

# Pull in a generic elixir flake template
use flake "github:the-nix-way/dev-templates?dir=elixir"

export PORT=4000

# Add our own customisations on top
use flake


# Local Variables:
# mode: envrc-file
# End:
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/db
/deps
/*.ez
/result

# Generated on crash by the VM
erl_crash.dump
Expand All @@ -17,3 +18,4 @@ erl_crash.dump
priv/static/docsets/*.tgz
priv/static/docsets/*/*
priv/static/docsets/*.tar.gz
/.direnv/
45 changes: 45 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Code of Conduct

## Why have a Code of Conduct?

As contributors and maintainers of this project, we are committed to providing a friendly, safe and welcoming environment for all, regardless of age, disability, gender, nationality, race, religion, sexuality, or similar personal characteristic.

The goal of the Code of Conduct is to specify a baseline standard of behavior so that people with different social values and communication styles can talk about Hexdocs docset API effectively, productively, and respectfully, even in face of disagreements. The Code of Conduct also provides a mechanism for resolving conflicts in the community when they arise.

## Our Values

These are the values Hexdocs docset API developers should aspire to:

* Be friendly and welcoming
* Be kind
* Remember that people have varying communication styles and that not everyone is using their native language. (Meaning and tone can be lost in translation.)
* Interpret the arguments of others in good faith, do not seek to disagree.
* When we do disagree, try to understand why.
* Be thoughtful
* Productive communication requires effort. Think about how your words will be interpreted.
* Remember that sometimes it is best to refrain entirely from commenting.
* Be respectful
* In particular, respect differences of opinion. It is important that we resolve disagreements and differing views constructively.
* Be constructive
* Avoid derailing: stay on topic; if you want to talk about something else, start a new conversation.
* Avoid unconstructive criticism: don't merely decry the current state of affairs; offer — or at least solicit — suggestions as to how things may be improved.
* Avoid harsh words and stern tone: we are all aligned towards the well-being of the community and the progress of the ecosystem. Harsh words exclude, demotivate, and lead to unnecessary conflict.
* Avoid snarking (pithy, unproductive, sniping comments).
* Avoid microaggressions (brief and commonplace verbal, behavioral and environmental indignities that communicate hostile, derogatory or negative slights and insults towards a project, person or group).
* Be responsible
* What you say and do matters. Take responsibility for your words and actions, including their consequences, whether intended or otherwise.

The following actions are explicitly forbidden:

* Insulting, demeaning, hateful, or threatening remarks.
* Discrimination based on age, disability, gender, nationality, race, religion, sexuality, or similar personal characteristic.
* Bullying or systematic harassment.
* Unwelcome sexual advances.
* Incitement to any of these.


## Acknowledgements

This document was based on the Code of Conduct from the Elixir project.

https://github.com/elixir-lang/
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

57 changes: 46 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# DocsetApi

## **DocsetApi HAS MOVED**

DocsetApi is now being maintained over at https://github.com/hissssst/hexdocs_docset_api/

---

An API that produces docset packages (for https://zealdocs.org & dash.app) from any Elixir app or library with hexdocs documentation.

## Feed API

1. Start the server with `mix phx.start`
1. Start the server with `PORT=8080 mix phx.server` (or whatever port is available on your machine)
2. In Zeal, go to tools -> docsets -> Installed -> Add Feed
3. Insert the url in the format, `http://localhost:8080/feeds/<package_name>`

Expand All @@ -25,10 +31,10 @@ Add DocsetApi as a dependecy in `mix.exs`:
Put a mix task like this one in your app:

```elixir
defmodule Mix.Tasks.MyApp.GenerateDocsets do
defmodule Mix.Tasks.Hello.GenerateDocsets do
use Mix.Task

@usage "mix my_app.generate_docsets PATH"
@usage "mix hello.generate_docsets PATH"

@shortdoc "Generate Dash-compatible docsets for the app and dependencies."
@moduledoc """
Expand All @@ -43,18 +49,38 @@ defmodule Mix.Tasks.MyApp.GenerateDocsets do
Mix.Task.run("app.start")

# generate a docset for this codebase
DocsetApi.Builder.build("MyApp", "docs/exdoc", path)
DocsetApi.Builder.build("Hello", "doc")

# generate docsets for every dependency
configured_deps = Enum.map(MoodleNet.Mixfile.deps(), &dep_process(&1, path))
results =
Hello.MixProject.project[:deps]
|> IO.inspect(label: "Deps found for our package")
|> Enum.map(&dep_process(&1, path))

end
Mix.shell().info """
Conversion completed. Here are the results:

defp dep_process(dep, path) do
lib = elem(dep, 0)
"""


Enum.map(results, fn
%{release: %{name: name, version: version}} ->
Mix.shell().info " -> OK: #{name} @ #{version}"
{:error, name, message} ->
Mix.shell().error """

DocsetApi.Builder.build(Atom.to_string(lib), path)
-> Could not build docset for #{name}:
#{message}

"""
unknown ->
Mix.shell().error """

-> Unknown error:
#{inspect unknown}

"""
end)
end

def run(_args),
Expand All @@ -64,12 +90,21 @@ defmodule Mix.Tasks.MyApp.GenerateDocsets do

Usage:

#{@usage}
#{@usage}
""")

defp dep_process(dep, path) do
lib = elem(dep, 0)

case entry = DocsetApi.Builder.build(Atom.to_string(lib)) do
{:error, _pkg, _reason} -> entry
%{base_dir: _ } -> DocsetApi.Builder.copy_docset(entry, Path.expand(path))
end
end
end
```

Then run the task `mix moodle_net.generate_docsets /home/myuser/.local/share/Zeal/Zeal/docsets/` with your desired output directory.
Then run the task `mix hello.generate_docsets /home/myuser/.local/share/Zeal/Zeal/docsets/` with your desired output directory.

Voila!

Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.1.0
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config
import Config

# Configures the endpoint
config :docset_api, DocsetApi.Endpoint,
Expand Down
2 changes: 1 addition & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Config

# For development, we disable any cache and enable
# debugging and code reloading.
Expand Down
21 changes: 3 additions & 18 deletions config/prod.exs
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
use Mix.Config
import Config

# For production, we configure the host to read the PORT
# from the system environment. Therefore, you will need
# to set PORT=80 before running your server.
#
# You should also configure the url host to something
# meaningful, we use this information when generating URLs.
#
# Finally, we also include the path to a manifest
# containing the digested version of static files. This
# manifest is generated by the mix phoenix.digest task
# which you typically run after static files are built.
config :docset_api, DocsetApi.Endpoint,
http: [port: System.get_env("PORT")],
url: [host: System.get_env("DOMAIN_NAME"), port: 80],
cache_static_manifest: "priv/static/manifest.json"
config :docset_api, DocsetApi.Endpoint, server: true

# Do not print debug messages in production
config :logger, level: :info

config :docset_api, DocsetApi.Endpoint,
secret_key_base: System.get_env("SECRET_KET_BASE")
config :docset_api, DocsetApi.Endpoint, secret_key_base: System.get_env("SECRET_KET_BASE")

config :docset_api,
base_url: System.get_env("BASE_URL")
7 changes: 7 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Config

port = String.to_integer(System.fetch_env!("PORT"))

config :docset_api, DocsetApi.Endpoint,
http: [port: port],
url: [host: "localhost", port: port]
13 changes: 2 additions & 11 deletions config/test.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Config

# We don't run a server during test. If one is required,
# you can enable the server option below.
Expand All @@ -7,13 +7,4 @@ config :docset_api, DocsetApi.Endpoint,
server: false

# Print only warnings and errors during test
config :logger, level: :warn

# Configure your database
config :docset_api, DocsetApi.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "docset_api_test",
hostname: "localhost",
pool: Ecto.Adapters.SQL.Sandbox
config :logger, level: :warning
28 changes: 28 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{ pkgs ? <nixpkgs> }:
let
packages = pkgs.beam.packagesWith pkgs.beam.interpreters.erlang_27;
in
packages.mixRelease rec {
elixir = packages.elixir_1_17;
pname = "hexdocs_docset_api";
version = builtins.readFile ./VERSION;

enableDebugInfo = true;
stripDebug = false;

src = pkgs.fetchFromGitHub {
owner = "johnhamelink";
rev = "509316f9bf9570c6b2c8e1e25b980b7276e7c4ea";
repo = "${pname}";
sha256 = "sha256-ttXZP/v84rK2B7Fwdy3EedhmsyFmjN3dmKNPKNNzNBI=";
};

mixNixDeps = with pkgs; import ./mix.nix { inherit lib beamPackages; };

postBuild = ''
# for external task you need a workaround for the no deps check flag
# https://github.com/phoenixframework/phoenix/issues/2690
mix do deps.loadpaths --no-deps-check, phx.digest
mix phx.digest --no-deps-check
'';
}
75 changes: 75 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading