-
Notifications
You must be signed in to change notification settings - Fork 14
Recursive deps #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Recursive deps #12
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
dc4d543
Implement no-project meta data
kgann 4e8e123
tree-seq implementation
kgann 08e04a2
fix grammar
kgann a83e802
remove dust.util namespace
kgann 338aad0
remove get-deps from bash script
kgann 17fc787
eval project map
kgann d5f8efa
remove tree-seq
kgann 7745a5c
implicitly load dependencies to gather info from project.pxi
kgann 06fdc9c
generate load-path for all dependencies and their source-paths
kgann ab9532f
correctly determine if dependency resolved
kgann e95f27c
update readme
kgann 3449e69
cleanup load-path nested doseqs
kgann 3c4d138
write .load-path file so repl task can output dependencies fetched
kgann 551bad3
remove implicit dependency fetching
kgann 373c0f8
always fetch dependencies
kgann 61c8c0e
remove dust.deps atom
kgann c789a7c
update README
kgann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| deps | ||
| .load-path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| (ns dust.deps | ||
| (require pixie.string :as str) | ||
| (require pixie.io :as io) | ||
| (require pixie.fs :as fs) | ||
| (require dust.project :as p)) | ||
|
|
||
| (defn cmd | ||
| [& args] | ||
| (sh (str/join " " args))) | ||
|
|
||
| (defn rm [file] | ||
| (cmd "rm" file)) | ||
|
|
||
| (defn mkdir [file] | ||
| (cmd "mkdir" "-p" file)) | ||
|
|
||
| (defn download [url file] | ||
| (cmd "curl" "--silent" "--location" "--output" file url)) | ||
|
|
||
| (defn extract-to [archive dir] | ||
| (mkdir dir) | ||
| (cmd "tar" "--strip-components" 1 "--extract" "--directory" dir "--file" archive)) | ||
|
|
||
| (defn write-load-path | ||
| "Write .load-path for project" | ||
| [project] | ||
| (let [paths (mapcat (fn [{:keys [path source-paths]}] | ||
| (if path | ||
| (map #(str path "/" %) source-paths) | ||
| source-paths)) | ||
| (:dependencies project))] | ||
| (io/spit ".load-path" | ||
| (str "--load-path " (str/join " --load-path " paths))))) | ||
|
|
||
| (defn load-project | ||
| "Load project.pxi in dir - return project map" | ||
| [dir] | ||
| (-> (io/slurp (str dir "/project.pxi")) | ||
| (read-string) | ||
| (rest) | ||
| (p/project->map) | ||
| (eval) | ||
| (assoc :path dir))) | ||
|
|
||
| (defn resolve-dependency | ||
| "Download and extract dependency - return dependency project map." | ||
| [[name version]] | ||
| (let [url (str "https://github.com/" name "/archive/" version ".tar.gz") | ||
| file-name (str "deps/" (str/replace (str name) "/" "-") ".tar.gz") | ||
| dep-dir (str "deps/" name)] | ||
| (when (not (fs/exists? (fs/->Dir dep-dir))) | ||
| (println "Downloading" name) | ||
| (download url file-name) | ||
| (extract-to file-name dep-dir) | ||
| (rm file-name)) | ||
| (load-project dep-dir))) | ||
|
|
||
| (defn get-deps | ||
| "Recursively download and extract all project dependencies." | ||
| [project] | ||
| (let [child-fn #(map resolve-dependency (:dependencies %)) | ||
| dep-dir "deps"] | ||
| (when (fs/exists? (fs/->Dir dep-dir)) | ||
| (cmd "rm" "-r" dep-dir)) | ||
| (mkdir dep-dir) | ||
| (assoc project :dependencies | ||
| (vec (tree-seq :dependencies child-fn project))))) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
:pathused anywhere?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, right here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah sorry, i missed that. :)