buildfoundation / mainframer

Tool for remote builds. Sync project to remote machine, execute command, sync back.
Apache License 2.0
1.73k stars 162 forks source link

User-level config files in $HOME directory. #213

Open artem-zinnatullin opened 6 years ago

artem-zinnatullin commented 6 years ago

As we're making Mainframer OS-wide tool #185, we need to add support for configuration files stored in user-home $HOME directory that will be used in case when work-dir doesn't have them.

Purpose of this feature is to enable use cases like:

$ git clone newproject
$ cd newproject
$ mainframer make build

When you have project(s) you don't want to configure specifically and just let Mainframer do its work with 0-setup on project level.

Current plan:

There is an existing PR #189 that was targeting 2.x version of Mainframer and not fully compatible with 3.x rewritten in Rust, so we'll merge parts of #189 (specifically integration tests) and add another PR to implement this functionality in Mainframer.

@ming13 do you agree with details like ~/.mainframer as folder name and non-merge behavior?

arturdryomov commented 6 years ago

Please don’t forget about XDG_CONFIG (Linux-specific).

On other note, I think we should actually merge configs like Git does. Take global first, merge with local and use the result. It is not that hard actually, especially since we have a real programming language to use.

Pozzoooo commented 6 years ago

@ming13 The integration tests are actually testing properly merged config file like you described, though for the ignore files it is using the local and fall backing for the shared ones, so no merge tests for ignores.

Also, there is a small challenge on this approach, as user could run mainframer at any folder, it might happen to run in the wrong folder. It happened to me some times, I end up syncing stuff I didn't wanted to, and just realize it after the command fail as there was no "gradlew" or something like this (it happend some times on home folder, just terrible :laughing: ). I've tested a few ideas on my fork, the one I liked the most so far is prompt the user to confirm when it is happen to be a new folder.

artem-zinnatullin commented 6 years ago

Merging is not that easy tho, specifically because we don't have a format to unignore stuff like git does:

.idea
!.idea/codeStyleSettings.xml