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

Make Owen portable #30

Closed
jacobjwalters opened this issue May 4, 2021 · 3 comments
Closed

Make Owen portable #30

jacobjwalters opened this issue May 4, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@jacobjwalters
Copy link
Collaborator

Currently, we assume a POSIX-compliant system in a few places. It'd be nice if we could support Windows also, as this would allow those who do not have WSL/access to a Unix system to help contribute.

We rely on POSIX features in:

  • :instance (with getProcessID)
  • :update (we assume a shell with && for command sequencing)

Providing a generic getProcessID should be fairly simple. The idea is to add a new file that abstracts over OS differences using the CPP extension, which allows us to use the C Pre-Processor to conditionally import a library.

Replacing the chained call in update should be fairly simple, as I believe that System.Process provides methods to choose where to spawn a process.

Additionally, we depend on the following (Unix) utilities

  • git
  • cd (note that this is a shell built-in, and thus can't be installed!)
  • fortune
  • cowsay
  • sh (implicitly in :update)

Fixing the above would remove the sh and cd dependencies, but the others are hard dependencies of owen features, so short of reimplementing them in Haskell we're stuck with them.

Conditionally enabling these features by using #29 would perhaps be the most elegant way of handling this.

@yutotakano yutotakano added the enhancement New feature or request label May 5, 2021
@yutotakano
Copy link
Collaborator

As it is expected Git and Stack would be installed if they are doing Haskell stuff on Windows (sorry pure cabal users), we should be fine with those two. cd is universal and works with the same syntax. && works as expected (it executes the second command only if the first was successful).

@jacobjwalters
Copy link
Collaborator Author

&& does rely on a POSIX-compliant shell though. That should be fairly easy to fix though (since the idiomatic way of doing so would be chaining Process.spawnCommand calls in an IO monad (there's a version of Process.spawnCommand that accepts a working directory IIRC)

@yutotakano yutotakano added this to Ideas in the cloud in General Development via automation May 6, 2021
@yutotakano yutotakano moved this from Ideas in the cloud to Done pog in General Development Jun 27, 2021
@jacobjwalters
Copy link
Collaborator Author

jacobjwalters commented Jun 27, 2021

This is almost very nearly complete, but the git repo is hardcoded to ~/owenbot.hs, meaning that :update won't work on Windows (and likewise, it won't be able to find the git info at startup).

In the future, this will get moved to a config file.

Since this is mostly for convenience with the production instance (which runs on Linux), it's not a big problem. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
General Development
  
Done pog
Development

No branches or pull requests

2 participants