Skip to content
This repository was archived by the owner on Nov 23, 2021. It is now read-only.

Commit e692593

Browse files
tangjeff0gitbook-bot
authored andcommitted
GitBook: [main] 3 pages and 2 assets modified
1 parent e8a5a38 commit e692593

File tree

4 files changed

+322
-3
lines changed

4 files changed

+322
-3
lines changed

SUMMARY.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
* [Page](community/athens-guide/feature-list/page.md)
3737
* [Slash Commands](community/athens-guide/feature-list/slash-commands.md)
3838
* [Contributor Guide](community/get-involved/README.md)
39+
* [Setup](community/get-involved/setup.md)
3940
* [Code of Conduct](community/get-involved/code-of-conduct.md)
4041

41-
## COMPANY
42-

community/athens-guide/feature-list/backups.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Backups in Athens are stored in your main DB folder and have a `.bkp` file exten
2424

2525
Before we proceed to the next step, locate your current `index.transit` file and relocate it to another folder.
2626

27-
![](../../../.gitbook/assets/123552515-160cc780-d794-11eb-961d-8c277b3f632e%20%281%29.gif)
27+
![](../../../.gitbook/assets/123552515-160cc780-d794-11eb-961d-8c277b3f632e%20%281%29%20%281%29.gif)
2828

2929
#### Locate the backup file you want to restore from
3030

community/get-involved/setup.md

+320
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,320 @@
1+
# Setup
2+
3+
## Running Athens Locally
4+
5+
[Video version of this for Mac](https://www.loom.com/share/63618f2a2b2249e3923577fb88fabfdc).
6+
7+
These dependencies are needed to get Athens up and running. To install them, follow the instructions in the links.
8+
9+
1. [Java 11 and Leiningen](https://purelyfunctional.tv/guide/how-to-install-clojure/) \(Leiningen installs Clojure\)
10+
2. [Node 12](https://nodejs.org/en/download/) and [Yarn](https://classic.yarnpkg.com/en/docs/install/#mac-stable)
11+
12+
_If you want to use Windows Subsystem for Linux \(WSL\),_ [_try this tutorial_](https://www.notion.so/Beginner-Clojure-Environment-Setup-Windows-36f70c16b9a7420da3cd797a3eb712fa#6a53854de58d4f07ba6319d868fba29c)_._
13+
14+
After you've got these dependencies, clone the Git repository to your hard drive:
15+
16+
```text
17+
git clone https://github.com/athensresearch/athens.git
18+
```
19+
20+
Then `cd athens/` and run the following commands.
21+
22+
Pull JavaScript dependencies:
23+
24+
```text
25+
yarn
26+
```
27+
28+
Pull Java dependencies and build, then start a local HTTP server for Athens:
29+
30+
```text
31+
lein dev
32+
```
33+
34+
In another terminal, run:
35+
36+
```text
37+
yarn run electron .
38+
```
39+
40+
Another window should open automatically. That's your Athens!
41+
42+
Now make sure you can run code in a REPL and that you know how to use re-frame-10x.
43+
44+
### Running in Docker
45+
46+
Docker doesn't work perfectly well anymore, because we are using Electron. Electron requires access to local resources such as `resources/index.html`.
47+
48+
If you run `yarn run electron .` from your local system, but are running Athens from within Docker, it won't work. Furthermore, if you run `yarn run electron .` from within your Docker system, the GUI won't popup on your local system. The workaround would be to sync the `resources/` files from Docker to a local folder.
49+
50+
The following command runs Athens in a docker container, but does not provide a workaround to actually run Electron.
51+
52+
```text
53+
docker build -t athens .
54+
docker run -it -p 3000:3000 -p 8777:8777 -p 9630:9630 athens
55+
```
56+
57+
## Deploying Athens and Devcards
58+
59+
You should deploy your version of Athens and [Devcards](https://github.com/bhauman/devcards) if you are making UI-releated pull requests to Athens. This will allow developers and designers to interact with your code, which is essential for reviewing UI changes.
60+
61+
Athens Devcards can be found at [https://athensresearch.github.io/athens/cards.html](https://athensresearch.github.io/athens/cards.html).
62+
63+
### Automated Deploys
64+
65+
We've setup GitHub Actions so that each time you commit to your fork on GitHub, GitHub Actions automatically lints, tests, and styles your code.
66+
67+
If these scripts pass, GitHub builds your code and then deploys it to [https://YOUR\_GITHUB.github.io/athens/](https://YOUR_GITHUB.github.io/athens/) and [https://YOUR\_GITHUB.github.io/athens/cards.html](https://YOUR_GITHUB.github.io/athens/cards.html).
68+
69+
To begin doing automated deploys, just make sure your Actions are enabled at [https://github.com/YOUR\_GITHUB/athens/actions](https://github.com/YOUR_GITHUB/athens/actions). Then start pushing code!
70+
71+
### Manual Deploys
72+
73+
To build and deploy Athens and Devcards from your local development environment:
74+
75+
1. Build your JavaScript bundle\(s\) with either `lein dev`, `lein devcards`, or `lein compile`.
76+
2. Run `lein gh-pages`.
77+
3. Open [http:///github.io/athens/](http:///github.io/athens/) and [http:///github.io/athens/cards.html](http:///github.io/athens/cards.html). Sometimes this takes a minute to be updated.
78+
79+
Notes:
80+
81+
* If you want to compile Athens and Devcards one time without hot-reloading, run `lein compile`.
82+
* If you are actively developing Athens and not Devcards, run `lein dev` to hot-reload the Athens application.
83+
* If you are actively developing DevCards and not Athens, run `lein devcards` to hot-reload Devcards.
84+
* If you want to build Athens and Devcards, because you are testing a component on DevCards and Athens at the same time, you should run `lein dev` and `lein devcards` in two terminals.
85+
* If both builds are running, it doesn't matter which port you go to \(i.e. `3000` or `3001`\), because both HTTP servers can serve assets.
86+
* More docs should be written in the future on how to connect a REPL to either build, depending on your text editor.
87+
88+
## Connecting your REPL
89+
90+
The REPL is one of the core features of Clojure. REPL-driven programming can make you code faster, with less tests and bugs. This [video](https://vvvvalvalval.github.io/posts/what-makes-a-good-repl.html#what_does_a_good_repl_give_you?:~:text=What%20does%20a%20good%20REPL%20give%20you%3F,-The) demonstrates this.
91+
92+
* Make sure you can run Athens locally before proceeding with this section.
93+
* Refer to shadow-cljs [editor integration docs](https://shadow-cljs.github.io/docs/UsersGuide.html#_editor_integration) for more details.
94+
* nREPL port is 8777, as defined in [shadow-cljs.edn](shadow-cljs.edn).
95+
96+
### Cursive
97+
98+
[https://www.loom.com/share/a2cc5f36f8814704948a57e8277c04e9](https://www.loom.com/share/45d7c61703324089a425a9c91b14445b)
99+
100+
### CIDER
101+
102+
[Video tutorial](https://www.loom.com/share/a2cc5f36f8814704948a57e8277c04e9)
103+
104+
### Calva
105+
106+
```text
107+
Editor - Visual Studio Code
108+
Calva plugin: v2.0.126 Built on: 2020-07-09
109+
OS - Windows 10, MacOS Catalina v10.15.6
110+
```
111+
112+
1. In VS Code, run `ctrl+shift+c` and `ctrl+shift+j` \(`ctrl+alt+c ctrl+alt+j` in Windows 10\) to jack into a repl session.
113+
2. Pick shadow-cljs.
114+
3. Select `:main` and `:renderer` profile for shadow-cljs to watch.
115+
4. Select the `:renderer` build to connect to.
116+
5. In another terminal tab, run `npx electron .`
117+
118+
### Vim Plugins
119+
120+
* [ ] TODO vim-iced
121+
* [ ] TODO conjure
122+
* \[X\] TODO fireplace
123+
124+
#### Fireplace
125+
126+
[Fireplace](https://github.com/tpope/vim-fireplace) is a popular Clojure\(script\) development plugin for Vim \(and Neovim\) text editor. It's main dependency is the [cider-nrepl](https://github.com/clojure-emacs/cider-nrepl) which already included as a development dependency.
127+
128+
Assume you already executed the commands described above in different terminal sessions and have the Athens instance running. And of course assume you installed vim-fireplace plugin too.
129+
130+
```text
131+
lein dev # in one terminal, running nrepl server on port 8777
132+
yarn run electron . # another terminal running the Athens app itself
133+
```
134+
135+
Now open any Clojure file in Vim. This will load vim-fireplace plugin and necessary commands. First, we need to connect Clojure \(not Clojurescript yet\) runtime;
136+
137+
```text
138+
:FireplaceConnect 8777
139+
```
140+
141+
Clojure part is done. Now to connect Clojurescript runtime with vim-fireplace;
142+
143+
```text
144+
:Piggieback :renderer
145+
```
146+
147+
To test your development environment you can try to evaluate some Clojurescript and see the results on Athens running in electron;
148+
149+
```text
150+
:CljsEval (js/alert "hello!")
151+
```
152+
153+
You supposed to see an alert on electron app saying "hello!" and your Vim instance would be blocked until you acknowledge the alert message.
154+
155+
If all goes well, now you can see documentation of symbols \(binding: K\), go to definition \(binding: \[ C-d\) and so fort. See `:help fireplace` for more information.
156+
157+
#### Conjure
158+
159+
[Conjure](https://github.com/Olical/conjure) is an interactive environment for evaluating code within your running program for Neovim. [Installing Conjure](https://github.com/Olical/conjure#installation)
160+
161+
Its main dependency is the [cider-nrepl](https://github.com/clojure-emacs/cider-nrepl). Create the following file at `~/.shadow-cljs/config.edn` to add the dependency:
162+
163+
```text
164+
{:dependencies
165+
[[cider/cider-nrepl "0.26.0"]]}
166+
;; this version may be out of date, check whichever is available
167+
```
168+
169+
See [shadow-cljs docs](https://shadow-cljs.github.io/docs/UsersGuide.html#user-config) for more info.
170+
171+
Now that we're set up, lets start the development environment;
172+
173+
```text
174+
lein dev # in one terminal, running nrepl server on port 8777
175+
yarn run electron . # another terminal running the Athens app itself
176+
```
177+
178+
Open any Clojurescript file in Neovim. Conjure will connect automatically to the leiningen nrepl server and you should see a temporary floating buffer in the top right corner of your editor showing a successful connection.
179+
180+
To get that buffer back and to keep it open in a horizontal split:
181+
182+
```text
183+
:ConjureLogSplit
184+
```
185+
186+
To connect to the Clojurescript runtime;
187+
188+
```text
189+
:ConjureShadowSelect renderer
190+
```
191+
192+
In the log buffer you should see;
193+
194+
```text
195+
; --------------------------------------------------------------------------------
196+
; shadow-cljs (select): renderer
197+
; (out) To quit, type: :cljs/quit
198+
[:selected :renderer]
199+
```
200+
201+
To test your development environment you can try to evaluate some Clojurescript and see the results on Athens running in electron;
202+
203+
```text
204+
:ConjureEval (js/alert "hello!")
205+
```
206+
207+
You should see an alert in the electron app saying "hello!". All further evaluations will be blocked until you acknowledge the alert message.
208+
209+
Congratulations, you're connected!
210+
211+
To learn more about how to evaluate things with Conjure, please refer to `:help conjure`, `:help conjure-client-clojure-nrepl` and `:ConjureSchool` \(an interactive tutorial\). See also: \[Conjures quickstart guide to Clojurescript\]\([https://github.com/Olical/conjure/wiki/Quick-start:-ClojureScript-\(shadow-cljs](https://github.com/Olical/conjure/wiki/Quick-start:-ClojureScript-%28shadow-cljs)\)\) and [Clojure](https://github.com/Olical/conjure/wiki/Quick-start:-Clojure)
212+
213+
## Using re-frame-10x
214+
215+
The right sidebar has [`re-frame-10x`](https://github.com/day8/re-frame-10x/tree/master/src/day8) developer tools. You can toggle it open and close with `ctrl-h`, but you must not be focused on a block \(ctrl-h has a specific action in some operating systems\).
216+
217+
Once you have 10x open, you can hover over blocks' bullets to see some of their datascript data.
218+
219+
By default, 10x is closed everytime Athens starts. Sometimes you want 10x to be open immediately on start. To do, comment out the two lines of JavaScript code in `index.html`, where localStorage sets 10x to be closed by default.
220+
221+
## Running CI Scripts Locally
222+
223+
After each submitted PR to Athens, GitHub Actions runs the continuous integration workflow declared in `.github/workflows/build.yml`. This workflow runs scripts from [`script/`](script) to test, lint, and build Athens. You can see these workflows in practice in the [Actions tab](https://github.com/athensresearch/athens/actions/).
224+
225+
However, it's a lot faster if you run these tests locally, so you don't have to submit a PR each time to make sure the workflow succeeds. You may need to install additional dependencies, though.
226+
227+
### Testing
228+
229+
No additional installation is needed. Just run this:
230+
231+
```text
232+
lein test
233+
```
234+
235+
The output will look something like this:
236+
237+
```text
238+
$ lein test
239+
240+
Testing athens.block-test
241+
242+
Testing athens.parser-test
243+
244+
Testing athens.patterns-test
245+
246+
Ran 4 tests containing 16 assertions.
247+
0 failures, 0 errors.
248+
```
249+
250+
### Linting
251+
252+
We are linting Clojure code using [clj-kondo](https://github.com/borkdude/clj-kondo). Our clj-kondo configuration is in [`.clj-kondo/config.edn`](.clj-kondo/config.edn).
253+
254+
For this linting to work, you will need to install `clj-kondo`. Instructions are in [`clj-kondo`’s installation guide](https://github.com/borkdude/clj-kondo/blob/master/doc/install.md).
255+
256+
To see the problems reported by clj-kondo, run `script/lint`. Example run:
257+
258+
```text
259+
$ script/lint
260+
linting took 257ms, errors: 0, warnings: 0
261+
```
262+
263+
Your editor may also be able to integrate with clj-kondo’s output. For example, if you use [Calva](https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva) for VS Code, then clj-kondo’s messages are reported in the Problems panel.
264+
265+
### Clojure Styling
266+
267+
To format your code or check that your code is formatted correctly, you will need to use `cljstyle`. Instructions for installing it are [in `cljstyle`’s README](https://github.com/greglook/cljstyle/tree/master#installation).
268+
269+
To check if your Clojure code is formatted correctly, run `cljstyle check`. If there is no output and the return code is zero, you’re good. You can also run `script/style`, but currently it only works if you’re running Linux.
270+
271+
To reformat all your Clojure files in place, run `cljstyle fix`.
272+
273+
### Unused Variable Checking
274+
275+
To set this up, first make sure that a global `clojure` binary is installed. You won’t necessarily have a `clojure` binary installed just because you installed Leiningen.
276+
277+
Next, just run `script/carve`. The first time you run it it will download [Carve](https://github.com/borkdude/carve) as a dependency, which takes about a minute and outputs lots of messages. On subsequent runs `script/carve` won’t output anything unless an unused variable was found.
278+
279+
## Git and GitHub Style Guide
280+
281+
### Commits
282+
283+
Follow guidelines from [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). Specifically, begin each commit with one of the following types:
284+
285+
```text
286+
build:
287+
ci:
288+
chore:
289+
docs:
290+
feat:
291+
fix:
292+
perf:
293+
refactor:
294+
revert:
295+
style:
296+
test:
297+
```
298+
299+
See some real examples in our [commit history](https://github.com/athensresearch/athens/commits/master).
300+
301+
### Issues
302+
303+
Please create issues using [our templates](https://github.com/athensresearch/athens/issues/new/choose). However, you will almost certainly get feedback and help faster in our [Discord](https://discord.gg/GCJaV3V)!
304+
305+
### Pull Requests
306+
307+
If your PR is related to other issue\(s\), reference it by issue number. You can close issues smoothly with [GitHub keywords](https://help.github.com/en/enterprise/2.16/user/github/managing-your-work-on-github/closing-issues-using-keywords):
308+
309+
```text
310+
close #1
311+
fix #2
312+
resolve #2
313+
```
314+
315+
This repo only allows those with merge permissions to "Squash and Merge" PRs. This makes reverts easier if they are needed.
316+
317+
## Developer Resources
318+
319+
* download [Sample Athens Databases](https://drive.google.com/drive/u/3/folders/1E8z-s33PfzNCGxEsZNQlB5niVq9bKQg0) from our google drive
320+

0 commit comments

Comments
 (0)