Skip to content

Commit

Permalink
Remove "included profiles"
Browse files Browse the repository at this point in the history
This is now part of the edhub-validator
  • Loading branch information
joodie committed Nov 28, 2023
1 parent f699399 commit 74b7cf2
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ BABASHKA_VERSION:=1.3.186-SNAPSHOT

exec_base_name=apie
release_name=$(exec_base_name)-$(version)
source_files=$(shell find src assets profiles -type f)
source_files=$(shell find src assets -type f)
current_arch=$(shell bb dev/current_arch.clj)

# uberjar is the babashka uberjar (not a java-compatible jar)
Expand Down
2 changes: 1 addition & 1 deletion bb.edn
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{:paths ["src" "assets" "profiles"]
{:paths ["src" "assets"]
:deps
{this/project {:local/root "."}}}
2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{:paths ["src" "assets" "profiles"]
{:paths ["src" "assets"]
:deps {org.clojure/tools.cli {:mvn/version "1.0.219"}
ring/ring-codec {:mvn/version "1.2.0"}
org.babashka/http-client {:mvn/version "0.4.15"}
Expand Down
Empty file removed profiles/.keep
Empty file.
9 changes: 0 additions & 9 deletions src/nl/jomco/apie/included_profiles.clj

This file was deleted.

50 changes: 22 additions & 28 deletions src/nl/jomco/apie/main.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
[clojure.pprint :as pprint]
[clojure.string :as string]
[clojure.tools.cli :refer [parse-opts]]
[nl.jomco.apie.included-profiles :as included-profiles]
[nl.jomco.apie.report :as report]
[nl.jomco.apie.spider :as spider]
[ring.util.codec :as codec]))
Expand All @@ -30,13 +29,9 @@
["-p" "--report REPORT-PATH" "Path to write report."
:id :report-path
:default "report.html"]
(if-let [[default] included-profiles/profiles]
["-r" "--profile PROFILE" "Path to profile or name of builtin profile"
:id :profile
:default default]
["-r" "--profile PROFILE" "Path to profile"
:id :profile
:missing "PROFILE is missing"])
["-r" "--profile PROFILE" "Path to profile"
:id :profile
:missing "PROFILE is missing"]
["-S" "--no-spider" "Disable spidering (re-use observations from OBSERVATIONS-PATH)."
:id :no-spider?
:default false]
Expand Down Expand Up @@ -120,32 +115,31 @@
;; str needed to coerce hiccup "rawstring"
(str (report/report spec-data (read-edn observations-path) base-url)))))

(defn main
[{:keys [no-spider? no-report? profile] :as options}]
(let [profile* (file-or-resource profile)
parent-dir (file-parent profile*)
{:keys [openapi-spec]
:as profile-data} (read-edn profile*)
;; if the profile configuration is indicated by a file path
;; not in the current working directory, try to find the
;; corresponding openapi spec in the same directory.
spec-data (if parent-dir
(read-json (io/file parent-dir openapi-spec))
(read-json (file-or-resource openapi-spec)))]
(when-not no-spider?
(spider spec-data profile-data options))
(when-not no-report?
(report spec-data options))))

(defn -main
[& args]
(let [{:keys [errors summary]
{:keys [no-spider? no-report? profile] :as options} :options}
(parse-opts args cli-options)]
(let [{:keys [errors summary options]} (parse-opts args cli-options)]
(when (seq errors)
(run! println errors)
(println summary)
(when included-profiles/profiles
(println "\nBuiltin profiles:")
(run! #(println " - " %) included-profiles/profiles))
(System/exit 1))
(let [profile* (file-or-resource profile)
parent-dir (file-parent profile*)
{:keys [openapi-spec]
:as profile-data} (read-edn profile*)
;; if the profile configuration is indicated by a file path
;; not in the current working directory, try to find the
;; corresponding openapi spec in the same directory.
spec-data (if parent-dir
(read-json (io/file parent-dir openapi-spec))
(read-json (file-or-resource openapi-spec)))]
(when-not no-spider?
(spider spec-data profile-data options))
(when-not no-report?
(report spec-data options)))))
(main options)))

(comment

Expand Down

0 comments on commit 74b7cf2

Please sign in to comment.