Permalink
Browse files

Quick attempt at making a program to print your own (non-forked) repos

  • Loading branch information...
j16r committed Apr 15, 2012
1 parent e6dcd1f commit 1e9b65c51a9c503dfb07666fe03ce6fb0fee43cb
Showing with 38 additions and 23 deletions.
  1. +0 −13 README
  2. +12 −0 README.md
  3. +5 −3 project.clj
  4. +21 −1 src/github_projects/core.clj
  5. +0 −6 test/github_projects/test/core.clj
View
13 README
@@ -1,13 +0,0 @@
-# github-projects
-
-FIXME: write description
-
-## Usage
-
-FIXME: write
-
-## License
-
-Copyright (C) 2012 FIXME
-
-Distributed under the Eclipse Public License, the same as Clojure.
View
@@ -0,0 +1,12 @@
+# Github Projects
+
+My first attempt at a standalone Clojure app, a simple program to print a
+manifest of your github projects. Built with Leiningen.
+
+## Usage
+
+Invoke with Leiningen passing in your github username like so:
+
+```
+lein run excepttheweasel
+```
View
@@ -1,3 +1,5 @@
-(defproject github-projects "1.0.0-SNAPSHOT"
- :description "FIXME: write description"
- :dependencies [[org.clojure/clojure "1.3.0"]])
+(defproject github-projects "0.0.1"
+ :description "Get a list of your wholly owned projects on github"
+ :dependencies [[org.clojure/clojure "1.3.0"]
+ [clj-github "1.1.0-alpha1"]]
+ :main github-projects.core)
@@ -1 +1,21 @@
-(ns github-projects.core)
+(ns github-projects.core
+ (:require [clj-github.core :as github]))
+
+(defn print-usage []
+ (println "projects <github_username>"))
+
+(defn owned-projects [user]
+ (remove #(:fork %1)
+ (github/make-request ["repos/show" user] :sift :repositories)))
+
+(defn print-projects [user]
+ (println
+ (clojure.string/join "\n"
+ (map #(format "Project: %s, URL: %s" (:description %1) (:url %1))
+ (owned-projects user)))))
+
+(defn -main [& args]
+ (let [user (first args)]
+ (if (clojure.string/blank? user)
+ (print-usage)
+ (print-projects user))))
@@ -1,6 +0,0 @@
-(ns github-projects.test.core
- (:use [github-projects.core])
- (:use [clojure.test]))
-
-(deftest replace-me ;; FIXME: write
- (is false "No tests have been written."))

0 comments on commit 1e9b65c

Please sign in to comment.