Skip to content

Commit

Permalink
Add 'haskell/repohs/' from commit '35c552e96366bb2f0ad5ba1861c0de0017…
Browse files Browse the repository at this point in the history
…a17c17'

git-subtree-dir: haskell/repohs
git-subtree-mainline: 622cbce
git-subtree-split: 35c552e
  • Loading branch information
deemp committed Jul 23, 2023
2 parents 622cbce + 35c552e commit d8771ce
Show file tree
Hide file tree
Showing 14 changed files with 806 additions and 0 deletions.
1 change: 1 addition & 0 deletions haskell/repohs/.ghci
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:load app/Main.hs
4 changes: 4 additions & 0 deletions haskell/repohs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.stack-work/
*~
.vscode
repos
3 changes: 3 additions & 0 deletions haskell/repohs/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog for repohs

## Unreleased changes
30 changes: 30 additions & 0 deletions haskell/repohs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Copyright Author name here (c) 2022

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

* Neither the name of Author name here nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45 changes: 45 additions & 0 deletions haskell/repohs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# repohs

Provides a convenient way to download several archives with source code

## How it works
* It defines several constants:
* `_PATH` - where all files will be stored
* `_LANGUAGE` - extension of files written in language of interest. For now, defines a single extension. E.g., `.py` for `Python`
* `_ZIPPED` - name of subdirectory in `_PATH` where the zipped archives will be stored
* `_UNZIPPED` - name of subdirectory in `_PATH` where the unzipped folders will be stored
* `_URLs` - a list of URLs of interest

* It will concurrently download the files and unpack them into corresponding folders
* Each zip-archive will be named after URL's path: file for `https://github.com/django/django/archive/refs/heads/main.zip` will become `django.django.archive.refs.heads.main.zip`
* Contents of such archive will be unpacked into subdirectory `django.django.archive.refs.heads.main`

* If you have any questions, have a look at [Main.hs](./app/Main.hs)

## SLOC
* See current results in the [report](./report)

## Requirements
1. `npm`
```sh
sudo apt install nodejs
```
1. A utility for counting code lines ([link](https://github.com/flosse/sloc))
```sh
sudo npm install -g sloc
```
1. `stack` ([link](https://docs.haskellstack.org/en/stable/install_and_upgrade/))

## Running
* From this project's root
```sh
stack run
```
* As a script. Assume you put the code into `script.hs` somewhere
```sh
chmod +x script.hs
./script.hs
```

## Articles
* [Resource Management in Haskell](https://aherrmann.github.io/programming/2016/01/04/resource-management-in-haskell/index.html)
2 changes: 2 additions & 0 deletions haskell/repohs/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
Loading

0 comments on commit d8771ce

Please sign in to comment.