Skip to content
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

Conf file for repo locations #2

Closed
wants to merge 8 commits into from
Closed

Conf file for repo locations #2

wants to merge 8 commits into from

Conversation

RandomGuyOnTheInternet1234
Copy link
Contributor

Uses conf.json for the locations of the repos, instead of just using a default location.

jakeinc added 3 commits January 26, 2017 18:28
Uses conf.json location for gcc repo
Contains locations for Github repo locations
Uses repo locations are specified in json.conf
Copy link
Owner

@dgopstein dgopstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good!

Some thoughts:

  1. Probably constants.clj can go away, since the conf can completely replace it.

  2. Did you consider using a specialized configuration library instead of raw json? There are a lot of benefits, like explicitly handling multiple users, and multiple environments, like test vs development. See for example:
    https://github.com/yogthos/config
    https://github.com/grammarly/omniconf
    https://github.com/levand/immuconf

  3. I saw you made a second pull request where you added the json library. Can you unify these two? Before I pull your changes I want to be able to run your code, but I can't if one won't work without the other.


(def ag-path (expand-home "~/opt/src/the_silver_searcher"))
(def gcc-path (expand-home (get conf-data :gcc-path)))
(def gcc-repo (gitp/load-repo "Z:\\Github\\gcc"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Z:\Github\gcc looks specific to your machine?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

@@ -19,7 +20,7 @@
)))

(deftest bugzilla-id-test
(let [gcc-repo (gitp/load-repo (expand-home "~/opt/src/gcc"))
(let [gcc-repo (gitp/load-repo (expand-home (get (json/read-str (slurp (resource-path "conf.json")):key-fn keyword) :gcc-path)))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using conf values should be shorter/easier.

@RandomGuyOnTheInternet1234
Copy link
Contributor Author

  1. I'm not opposed to keeping constants.clj to declare global variables. For example, when the gcc-path is needed in atom_path_test.clj I accessed it using atom-finder.constants/gcc-path. What do you think?

  2. I'm a little confused on what exactly you would like me to implement. I think raw JSON is fine for what I've written so far, but what new requirements would you like me to work on that would better use a specialized config library?

  3. Fixed! Sorry, I've used Git very little, so I'm still kind of finding my way around.

@dgopstein
Copy link
Owner

(2.1) As the json is now, a conf lookup is kinda clunk. It looks like: (:gcc-path (json/read-str (slurp (resource-path "conf.json")):key-fn keyword)).

(2.2) Managing several people's conf files is kinda a hassle, your config settings are different than mine, are different than henry's, managing that ourselves is doable, but annoying, whereas external libraries often make that easier.

(2.3) Building off (2.2) it's usually a really good idea to have a special config setting for test, dev (1-per-developer), and production. Test files can be small and lightweight and required, whereas dev can be big and heavy and optional, and prod can be whatever we need for real paper-worthy results.

(1) What you propose is certainly ok, but I think once 2.1 is addressed, atom-finder.constants/gcc-path is actually more annoying than just (:gcc-path conf)

(3) Great, thanks! No problem, git is a huge headache for the first few dozen times you use it until you get the hang of it. Then it becomes awesome, but it's definitely big and scary regardless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants