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

Commit 775370a

Browse files
Add lein-auto so we can lein auto test TDD.
1 parent 64a95d2 commit 775370a

File tree

8 files changed

+338
-592
lines changed

8 files changed

+338
-592
lines changed

README.org

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
* hn-reader
22

33
#+ATTR_HTML: title="Clojars"
4-
[[https://clojars.org/scrapper][file:https://img.shields.io/clojars/v/scrapper.svg]]
4+
[[https://clojars.org/hn-reader][file:https://img.shields.io/clojars/v/hn-reader.svg]]
55

66
#+ATTR_HTML: title="Jarkeeper"
7-
[[https://jarkeeper.com/agilecreativity/hn-scrapper][file:https://jarkeeper.com/agilecreativity/hn-scrapper/status.svg]]
7+
[[https://jarkeeper.com/agilecreativity/hn-reader][file:https://jarkeeper.com/agilecreativity/hn-reader/status.svg]]
88

99
Access to all of the latest news from [[https://news.ycombinator.com/][Hacker News]].
1010

@@ -68,11 +68,6 @@ Now get the list of all news from [[https://news.ycombinator.com/news][Hacker Ne
6868

6969
** Example Sessions and Outputs
7070

71-
*** Sample sessions (animated gif)
72-
73-
#+ATTR_HTML: title="sample-session.gif"
74-
[[https://github.com/agilecreativity/hn-reader/raw/master/doc/sample-session.gif][file:https://github.com/agilecreativity/hn-reader/raw/master/doc/sample-session.gif]]
75-
7671
*** Sample sessions (screencasts)
7772

7873
#+ATTR_HTML: title="sample-session.webm"
@@ -82,12 +77,6 @@ Now get the list of all news from [[https://news.ycombinator.com/news][Hacker Ne
8277

8378
[[https://github.com/agilecreativity/hn-reader/blob/master/doc/sample-output.org][sample output in org-mode format]]
8479

85-
** Features idea
86-
87-
- Export/print first level content of hackernews to PDFs or Epubs
88-
- Group the results in some ways (topics, keywords, link to YouTube?)
89-
- Persist the result to html pages and store the link just once!
90-
9180
** Useful Links
9281

9382
- [[https://github.com/mischov/reaver][reaver]]
@@ -104,7 +93,6 @@ Now get the list of all news from [[https://news.ycombinator.com/news][Hacker Ne
10493

10594
** License
10695

107-
Copyright © 2016 Burin Choomnuan
96+
Copyright © 2016-2017 Burin Choomnuan
10897

109-
Distributed under the Eclipse Public License either version 1.0 or (at
110-
your option) any later version.
98+
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Tips.org

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,21 @@
1818
*** [[https://clojuredocs.org/clojure.test/deftest][Testing in Clojure]]
1919
*** [[http://rubyforgood.org/2017.html]]
2020
*** How to TDD/BDD in Clojure like using watch for file changes and run tests?
21-
*** How to switch between test/source when doing TDD in Clojure?
21+
*** How to switch betwe
22+
23+
** Notes from [[http://www.buildfunthings.com/][buildfunthing.com - Productive (CIDER) Testing]]
24+
25+
| Command | Emacs's shotcuts | | | |
26+
|---------------------+------------------+---+---+---|
27+
| cider-test-run-test | | | | |
28+
| more command here | | | | |
29+
|---------------------+------------------+---+---+---|
30+
31+
** Write the elisp function that will do copy of previous sexp
32+
33+
#+BEGIN_EXAMPLE
34+
(is (= 3
35+
(some-function 1 2)))
36+
;; |< cursor position at this point
37+
;; we like to be able to copy this one without using =sp-copy-sexp=
38+
#+END_EXAMPLE

doc/sample-output.org

Lines changed: 297 additions & 573 deletions
Large diffs are not rendered by default.

doc/sample-session.gif

-1.1 MB
Binary file not shown.

doc/sample-session.webm

-4.24 MB
Binary file not shown.

project.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
:bin-path "~/bin"
1313
:bootclasspath true}
1414
:plugins [[lein-bin "0.3.4"]
15-
[lein-cljfmt "0.5.3"]]
15+
[lein-cljfmt "0.5.3"]
16+
[lein-auto "0.1.3"]]
1617
:dependencies [[org.clojure/clojure "1.8.0"]
1718
[reaver "0.1.2"]
1819
[org.clojure/tools.cli "0.3.5"]

src/clj/com/agilecreativity/hn_reader/main.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
(slurp (hacker-news-url page-number)))
3434

3535
(defn- discussion-url
36+
"Create a discussion url for hacker news."
3637
[vote-url]
3738
(let [article-id (re-find #"\d+" vote-url)
3839
article-url (str "https://news.ycombinator.com/item?id=" article-id)]
@@ -94,6 +95,7 @@
9495
(str "[[" url "][" url-desc "]]")))
9596

9697
(defn hn-link-url-item
98+
"Create hacker new url item."
9799
([url url-desc]
98100
(hn-link-url-item url url-desc 0))
99101
([url url-desc level]
@@ -135,7 +137,7 @@
135137
" "
136138
"The recent " page-count " pages from Hacker News\n"))
137139
(.newLine w)
138-
;; Note: Hacker News only show the last 20 pages
140+
;; Note: Hacker News only show the last 12 pages
139141
(doseq [n (range (Integer. page-count))]
140142
(let [content (extract-data (inc n))]
141143
(comment (clojure.pprint/pprint content))

test/com/agilecreativity/hn_reader/main_test.clj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@
1616
(is (= " - [[http://www.google.com][Google]]"
1717
(hr/hn-link-url-item "http://www.google.com" "Google" 2))))
1818

19+
(deftest repeat-string-test
20+
(is (= ""
21+
(hr/repeat-string 0 "a")) "zero number will result in empty string")
22+
(is (= ""
23+
(hr/repeat-string -1 "a")) "negative number will result in empty string")
24+
(is (= "1111"
25+
(hr/repeat-string 4 "1")) "positive number will result in proper result"))
26+
27+
(deftest hn-make-org-list-test
28+
(is (= " - " (hr/hn-make-org-list 1)))
29+
(is (= "- " (hr/hn-make-org-list 0)))
30+
(is (= " - " (hr/hn-make-org-list 2)))
31+
(is (= " * " (hr/hn-make-org-list 2 "*"))))
32+
1933
(deftest hacker-new-collector-test
2034
(hn-link-url-test)
2135
(hn-link-url-item-test))

0 commit comments

Comments
 (0)