Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
hbt committed Nov 28, 2018
1 parent 3e8bf1d commit 7458040
Show file tree
Hide file tree
Showing 18 changed files with 2,263 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
out
/!out/.notempty
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "deps/gitinspector"]
path = deps/gitinspector
url = https://github.com/hbt/gitinspector
[submodule "deps/git_stats"]
path = deps/git_stats
url = https://github.com/hbt/git_stats
60 changes: 60 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
FROM ubuntu:16.04

#// TODO(hbt) ENHANCE optimize

RUN apt-get update && apt-get install -y git
RUN apt-get update && apt-get install -y python python-pip

RUN mkdir /deps && cd /deps && \
git clone https://github.com/frost-nzcr4/find_forks

RUN cd /deps/find_forks && pip install -r requirements-prod.txt

#// TODO(hbt) NEXT testing rm
RUN mkdir /tests && cd /tests && git clone https://github.com/hbt/mouseless

RUN apt-get install -y curl gawk autoconf automake bison libffi-dev libgdbm-dev libncurses5-dev libsqlite3-dev libtool libyaml-dev pkg-config sqlite3 zlib1g-dev libgmp-dev libreadline6-dev libssl-dev
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && curl -sSL https://get.rvm.io | bash -s stable --ruby=2.1.3

RUN cd /deps && git clone https://github.com/hbt/github-backup

#// TODO(hbt) NEXT optimize

RUN /bin/bash -l -c "rvm use 2.1.3"
RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"
RUN /bin/bash -l -c "cd /deps/github-backup && bundle"
#RUN /bin/bash -l -c "ruby /deps/github-backup/bin/github-backup -u frost-nzcr4 -r find_forks -o /deps -f "
#https://github.com/frost-nzcr4/find_forks


#RUN cd /deps && git clone https://github.com/hbt/github-backup
#RUN cd /deps/github-backup && bundle

RUN apt-get install -y php

RUN cd / && git clone https://github.com/hbt/gitinspector

RUN apt-get install -y locales


RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment && \
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
echo "LANG=en_US.UTF-8" > /etc/locale.conf && \
locale-gen en_US.UTF-8

ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

RUN cd /deps && git clone https://github.com/hbt/git_stats
RUN /bin/bash -l -c "rvm use 2.1.3 && cd /deps/git_stats && bundle"

ENV PATH="/git-forks-analysis/bin:${PATH}"
ADD . /git-forks-analysis
ADD ./config/php.ini /etc/php/7.0/cli/php.ini


#// TODO(hbt) NEXT testing rm
#RUN find-forks-recursively -u frost-nzcr4 -r find_forks -o /deps -f
#RUN cd /tests/mouseless && find-forks

72 changes: 71 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,72 @@
# git-forks-analysis
Analyze forks network to find hidden gems

Analyze forks network to find interesting forks, commits, file changes.


## Why build it?

* Frustration with navigation forks graph / network on GitHub
* Too many forks with nothing interesting and noisy commits
* Wanting to find changes made to a file, function or a set of lines across the network to avoid duplicating the work (fixing similar bugs or building similar features)

## How does it work?

* Gets all forks and all branches into a single repository
* Make available git data mining tools such as `gitinspector` and `git_stats`. Use the tools in this repository as they have been modified to work across all branches
* View other `Tips` below on how to search across the forks network using Git commands


[//]: # (// TODO(hbt) ENHANCE simplify Config)


// TODO(hbt) NEXT add instructions

## How to install it?

// TODO(hbt) NEXT add submodules init -- test from scratch
```bash

git clone https://github.com/hbt/git-forks-analysis
docker-compose pull hbtlabs/git-forks-analysis

```

## How to use it?

// TODO(hbt) ENHANCE check code highlight

To generate HTML visualization of forks

```
cd bin
./analyze-forks username repository
# retrieve all direct forks for https://github.com/hbt/mouseless
./analyze-forks hbt mouseless
# retrieve all forks recursively (the whole network) https://github.com/frost-nzcr4/find_forks -- purposefully chose a small repo to avoid running this by mistake
./analyze-forks-deep frost-nzcr4 find_forks
```

view generated html files in `out` directory for:

- gitinspector in /out/repo.html e.g /out/mouseless.html
- quick_stats in /out/repo/quick_stats/index.html e.g /opt/mouseless/quick_stats/index.html


Calling the `gitinspector` directly via CLI

```bash

./bin/gitinspector /out/mouseless
./bin/gitinspector --grading=true /out/mouseless
./bin/gitinspector --grading=true --format=html /out/mouseless

```




4 changes: 4 additions & 0 deletions bin/analyze-forks
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

docker-compose -f $(dirname $0)/../docker-compose.yml run --rm --workdir /out --entrypoint "/git-forks-analysis-src/scripts/analyze-forks.php" git-forks-analysis "$@"

4 changes: 4 additions & 0 deletions bin/analyze-forks-deep
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

docker-compose -f $(dirname $0)/../docker-compose.yml run --rm --workdir /out --entrypoint "/git-forks-analysis-src/scripts/analyze-forks-deep.php" git-forks-analysis "$@"

7 changes: 7 additions & 0 deletions bin/find-forks
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

if [ ! -f /.dockerenv ]; then
echo "Skipping. Not in docker container";
fi

python /deps/find_forks
13 changes: 13 additions & 0 deletions bin/find-forks-recursively
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

if [ ! -f /.dockerenv ]; then
echo "Skipping. Not in docker container";
fi

rm -rf /root/.ssh
cp -R /root/.ssh2 /root/.ssh
chmod 600 /root/.ssh/config
chown -R root:root /root/.ssh

params=$@
bash -l -c "rvm use 2.1.3 && ruby --version && ruby /deps/github-backup/bin/github-backup $params"
4 changes: 4 additions & 0 deletions bin/gitinspector
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

docker-compose -f $(dirname $0)/../docker-compose.yml run --rm --workdir /out --entrypoint "/git-forks-analysis-src/deps/gitinspector/gitinspector.py" git-forks-analysis "$@"

Loading

0 comments on commit 7458040

Please sign in to comment.