2
0
Fork 0
mirror of https://github.com/kdabir/has.git synced 2024-11-11 14:40:48 +01:00

initial commit

This commit is contained in:
Kunal Dabir 2014-03-05 03:46:26 +05:30
parent 78e6748593
commit 63a0f7adb8
50 changed files with 577 additions and 2 deletions

View file

@ -1,2 +1,85 @@
dq
==
# dq
Check how developer friendly your machine is!
`curl -sL https://raw.github.com/kdabir/dq/master/bin/core/dq.sh | sh`
This should produce output like :
```
✔ curl
✔ git
✔ java
✔ node
✔ perl
✔ python
✔ ruby
✔ vi
Your dq is 8 / 8
```
There is more to it. Depending on what you develop, we have got some preselected profiles:
#### Minimal
To see if you have some common commands installed that a developer machine usually needs
`curl -sL https://raw.github.com/kdabir/dq/master/bin/core/dq.sh | sh`
#### ruby dev
`curl -sL https://raw.github.com/kdabir/dq/master/bin/ruby_dev/dq.sh | sh`
#### frontend dev
`curl -sL https://raw.github.com/kdabir/dq/master/bin/frontend_dev/dq.sh | sh`
#### java dev
`curl -sL https://raw.github.com/kdabir/dq/master/bin/java_dev/dq.sh | sh`
#### clojure dev
`curl -sL https://raw.github.com/kdabir/dq/master/bin/clojure_dev/dq.sh | sh`
#### groovy dev
`curl -sL https://raw.github.com/kdabir/dq/master/bin/groovy_dev/dq.sh | sh`
#### scala dev
`curl -sL https://raw.github.com/kdabir/dq/master/bin/scala_dev/dq.sh | sh`
#### db
`curl -sL https://raw.github.com/kdabir/dq/master/bin/db/dq.sh | sh`
#### all
**Feeling courageous**, see what all you have got :
`curl -sL https://raw.github.com/kdabir/dq/master/bin/all/dq.sh | sh`
This checks 35 commands on your box
## Rolling out your own
Checkout the repo, and from the root:
`ruby build.rb <group1> <group2>... | sh`
e.g. `ruby build.rb ruby_dev frontend | sh`
## About
Ever got onto a new machine or a remote server ? If you develop, you almost certainly need to check availability of your
tool-chain on command line. DQ is intended to relieve you from pain of checking each command individually.
It was named DQ as Developer Quotient (or Developer Friendliness Quotient of a machine), which may not be the most
apt name but that was the best name I could think of.
## Contributing
Please submit more command checks, it's very easy to do so. Fork the repo and send PR.
Issues and feedback welcomed.
## Paranoid ?
Don't want to run `curl` piping to `sh`. Understandably, you might be concerned. Worry not.
- The source is hosted and is served directly from github, no app server in the middle.
- If you still want to check, do a `curl -sL https://raw.github.com/kdabir/dq/master/bin/core/dq.sh | cat` first.
(basically, replacing `sh` with `cat`, to see the content of the file )
### ♥

117
bin/all/dq.sh Normal file
View file

@ -0,0 +1,117 @@
OK=0
KO=0
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
}
ant -version > /dev/null 2>&1
_dq_report 'ant' $?
bower --version > /dev/null 2>&1
_dq_report 'bower' $?
bundle -v > /dev/null 2>&1
_dq_report 'bundler' $?
## surprisingly no option for version that i could find of
clj --help > /dev/null 2>&1
_dq_report 'clojure' $?
coffee --version > /dev/null 2>&1
_dq_report 'coffee' $?
curl --version > /dev/null 2>&1
_dq_report 'curl' $?
emacs --version > /dev/null 2>&1
_dq_report 'emacs' $?
gem -v > /dev/null 2>&1
_dq_report 'gem' $?
git --version > /dev/null 2>&1
_dq_report 'git' $?
gradle -v > /dev/null 2>&1
_dq_report 'gradle' $?
groovy --version > /dev/null 2>&1
_dq_report 'groovy' $?
groovyc -version > /dev/null 2>&1
_dq_report 'groovyc' $?
grunt --version > /dev/null 2>&1
_dq_report 'grunt' $?
java -version > /dev/null 2>&1
_dq_report 'java' $?
# http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4380614
# jdk
javac -version > /dev/null 2>&1
_dq_report 'javac' $?
lazybones --version > /dev/null 2>&1
_dq_report 'lazybones' $?
lein -v > /dev/null 2>&1
_dq_report 'leiningen' $?
mongo --version > /dev/null 2>&1
_dq_report 'mongo client' $?
mongod --version > /dev/null 2>&1
_dq_report 'mongo server' $?
mvn -v > /dev/null 2>&1
_dq_report 'maven' $?
mysql --version > /dev/null 2>&1
_dq_report 'mysql client' $?
node --version > /dev/null 2>&1
_dq_report 'node' $?
npm --version > /dev/null 2>&1
_dq_report 'npm' $?
perl -v > /dev/null 2>&1
_dq_report 'perl' $?
psql --version > /dev/null 2>&1
_dq_report 'postgres client' $?
python --version > /dev/null 2>&1
_dq_report 'python' $?
rake -V > /dev/null 2>&1
_dq_report 'rake' $?
ruby -v > /dev/null 2>&1
_dq_report 'ruby' $?
rvm -v > /dev/null 2>&1
_dq_report 'rvm' $?
sass --version > /dev/null 2>&1
_dq_report 'sass' $?
# this guy downloads the entire internet before telling its version
sbt sbt-version > /dev/null 2>&1
_dq_report 'sbt' $?
scala -version > /dev/null 2>&1
# this guy has its own idea of exit codes, fix it!
if [ $? -eq 1 ]; then
STATUS=0
else
STATUS=1
fi
_dq_report 'scala' $STATUS
scalac -version > /dev/null 2>&1
_dq_report 'scalac' $?
vi --version > /dev/null 2>&1
_dq_report 'vi' $?
yo --version > /dev/null 2>&1
_dq_report 'yoeman' $?
echo Your dq is $OK / $(($OK+$KO))
exit $KO

26
bin/clojure_dev/dq.sh Normal file
View file

@ -0,0 +1,26 @@
OK=0
KO=0
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
}
## surprisingly no option for version that i could find of
clj --help > /dev/null 2>&1
_dq_report 'clojure' $?
emacs --version > /dev/null 2>&1
_dq_report 'emacs' $?
java -version > /dev/null 2>&1
_dq_report 'java' $?
lein -v > /dev/null 2>&1
_dq_report 'leiningen' $?
echo Your dq is $OK / $(($OK+$KO))
exit $KO

38
bin/core/dq.sh Normal file
View file

@ -0,0 +1,38 @@
OK=0
KO=0
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
}
curl --version > /dev/null 2>&1
_dq_report 'curl' $?
git --version > /dev/null 2>&1
_dq_report 'git' $?
java -version > /dev/null 2>&1
_dq_report 'java' $?
node --version > /dev/null 2>&1
_dq_report 'node' $?
perl -v > /dev/null 2>&1
_dq_report 'perl' $?
python --version > /dev/null 2>&1
_dq_report 'python' $?
ruby -v > /dev/null 2>&1
_dq_report 'ruby' $?
vi --version > /dev/null 2>&1
_dq_report 'vi' $?
echo Your dq is $OK / $(($OK+$KO))
exit $KO

28
bin/db/dq.sh Normal file
View file

@ -0,0 +1,28 @@
OK=0
KO=0
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
}
mongo --version > /dev/null 2>&1
_dq_report 'mongo client' $?
mongod --version > /dev/null 2>&1
_dq_report 'mongo server' $?
mysql --version > /dev/null 2>&1
_dq_report 'mysql client' $?
psql --version > /dev/null 2>&1
_dq_report 'postgres client' $?
echo Your dq is $OK / $(($OK+$KO))
exit $KO

17
bin/frontend_dev/dq.sh Normal file
View file

@ -0,0 +1,17 @@
OK=0
KO=0
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
}
echo Your dq is $OK / $(($OK+$KO))
exit $KO

27
bin/groovy_dev/dq.sh Normal file
View file

@ -0,0 +1,27 @@
OK=0
KO=0
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
}
gradle -v > /dev/null 2>&1
_dq_report 'gradle' $?
groovy --version > /dev/null 2>&1
_dq_report 'groovy' $?
groovyc -version > /dev/null 2>&1
_dq_report 'groovyc' $?
java -version > /dev/null 2>&1
_dq_report 'java' $?
lazybones --version > /dev/null 2>&1
_dq_report 'lazybones' $?
echo Your dq is $OK / $(($OK+$KO))
exit $KO

30
bin/java_dev/dq.sh Normal file
View file

@ -0,0 +1,30 @@
OK=0
KO=0
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
}
ant -version > /dev/null 2>&1
_dq_report 'ant' $?
gradle -v > /dev/null 2>&1
_dq_report 'gradle' $?
java -version > /dev/null 2>&1
_dq_report 'java' $?
# http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4380614
# jdk
javac -version > /dev/null 2>&1
_dq_report 'javac' $?
mvn -v > /dev/null 2>&1
_dq_report 'maven' $?
echo Your dq is $OK / $(($OK+$KO))
exit $KO

31
bin/ruby_dev/dq.sh Normal file
View file

@ -0,0 +1,31 @@
OK=0
KO=0
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
}
bundle -v > /dev/null 2>&1
_dq_report 'bundler' $?
gem -v > /dev/null 2>&1
_dq_report 'gem' $?
rake -V > /dev/null 2>&1
_dq_report 'rake' $?
ruby -v > /dev/null 2>&1
_dq_report 'ruby' $?
rvm -v > /dev/null 2>&1
_dq_report 'rvm' $?
echo Your dq is $OK / $(($OK+$KO))
exit $KO

37
bin/scala_dev/dq.sh Normal file
View file

@ -0,0 +1,37 @@
OK=0
KO=0
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
}
java -version > /dev/null 2>&1
_dq_report 'java' $?
# this guy downloads the entire internet before telling its version
sbt sbt-version > /dev/null 2>&1
_dq_report 'sbt' $?
scala -version > /dev/null 2>&1
# this guy has its own idea of exit codes, fix it!
if [ $? -eq 1 ]; then
STATUS=0
else
STATUS=1
fi
_dq_report 'scala' $STATUS
scalac -version > /dev/null 2>&1
_dq_report 'scalac' $?
echo Your dq is $OK / $(($OK+$KO))
exit $KO

30
build.rb Normal file
View file

@ -0,0 +1,30 @@
# Usage:
# ruby build.rb <group1> <group2>... | sh
groups = {
:all => "*/*",
:core => "core/*",
:java_dev => ["core/java", "java/*"],
:clojure_dev => ["core/java", "clojure/*"],
:groovy_dev => ["core/java","java/gradle", "groovy/*"],
:scala_dev => ["core/java", "scala/*"],
:ruby_dev => ["core/ruby", "ruby/*"],
:frontend_dev => ["core/*", "frontend/*"],
:db => ["db/*"]
}
tap_it = Proc.new { |it| $stderr.puts "tapped - #{it}" }
# use `.tap(&tap_it)` at any point in chain to print the values
# tap_it writes to `stderr`
# `ruby build.rb > /dev/null` to exclude the stdout of the script
content =
(ARGV.empty? ? ["core"] : ARGV) # groups_to_load
.collect { |group| groups[group.to_sym] }.flatten.compact # patterns
.collect { |pattern| Dir["lib/#{pattern}.sh"] }.flatten.uniq # sh files
.sort { |x, y| File.basename(x) <=> File.basename(y) } # sort, remove if you dont want
.collect { |file| File.read(file) }.join("\n") # concat
puts [File.read("include/setup.sh"), content, File.read("include/report.sh")].join("\n")

10
build.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
ruby build.rb groovy_dev > bin/groovy_dev/dq.sh
ruby build.rb ruby_dev > bin/ruby_dev/dq.sh
ruby build.rb scala_dev > bin/scala_dev/dq.sh
ruby build.rb java_dev > bin/java_dev/dq.sh
ruby build.rb db > bin/db/dq.sh
ruby build.rb core > bin/core/dq.sh
ruby build.rb clojure_dev > bin/clojure_dev/dq.sh
ruby build.rb all > bin/all/dq.sh
ruby build.rb forntend_dev > bin/frontend_dev/dq.sh

3
include/report.sh Normal file
View file

@ -0,0 +1,3 @@
echo Your dq is $OK / $(($OK+$KO))
exit $KO

12
include/setup.sh Normal file
View file

@ -0,0 +1,12 @@
OK=0
KO=0
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
}

3
lib/clojure/clj.sh Normal file
View file

@ -0,0 +1,3 @@
## surprisingly no option for version that i could find of
clj --help > /dev/null 2>&1
_dq_report 'clojure' $?

2
lib/clojure/emacs.sh Normal file
View file

@ -0,0 +1,2 @@
emacs --version > /dev/null 2>&1
_dq_report 'emacs' $?

2
lib/clojure/lein.sh Normal file
View file

@ -0,0 +1,2 @@
lein -v > /dev/null 2>&1
_dq_report 'leiningen' $?

2
lib/core/curl.sh Normal file
View file

@ -0,0 +1,2 @@
curl --version > /dev/null 2>&1
_dq_report 'curl' $?

2
lib/core/git.sh Normal file
View file

@ -0,0 +1,2 @@
git --version > /dev/null 2>&1
_dq_report 'git' $?

2
lib/core/java.sh Normal file
View file

@ -0,0 +1,2 @@
java -version > /dev/null 2>&1
_dq_report 'java' $?

2
lib/core/node.sh Normal file
View file

@ -0,0 +1,2 @@
node --version > /dev/null 2>&1
_dq_report 'node' $?

2
lib/core/perl.sh Normal file
View file

@ -0,0 +1,2 @@
perl -v > /dev/null 2>&1
_dq_report 'perl' $?

2
lib/core/python.sh Normal file
View file

@ -0,0 +1,2 @@
python --version > /dev/null 2>&1
_dq_report 'python' $?

2
lib/core/ruby.sh Normal file
View file

@ -0,0 +1,2 @@
ruby -v > /dev/null 2>&1
_dq_report 'ruby' $?

2
lib/core/vi.sh Normal file
View file

@ -0,0 +1,2 @@
vi --version > /dev/null 2>&1
_dq_report 'vi' $?

2
lib/db/mongo.sh Normal file
View file

@ -0,0 +1,2 @@
mongo --version > /dev/null 2>&1
_dq_report 'mongo client' $?

2
lib/db/mongod.sh Normal file
View file

@ -0,0 +1,2 @@
mongod --version > /dev/null 2>&1
_dq_report 'mongo server' $?

2
lib/db/mysql.sh Normal file
View file

@ -0,0 +1,2 @@
mysql --version > /dev/null 2>&1
_dq_report 'mysql client' $?

2
lib/db/psql.sh Normal file
View file

@ -0,0 +1,2 @@
psql --version > /dev/null 2>&1
_dq_report 'postgres client' $?

2
lib/frontend/bower.sh Normal file
View file

@ -0,0 +1,2 @@
bower --version > /dev/null 2>&1
_dq_report 'bower' $?

2
lib/frontend/coffee.sh Normal file
View file

@ -0,0 +1,2 @@
coffee --version > /dev/null 2>&1
_dq_report 'coffee' $?

2
lib/frontend/grunt.sh Normal file
View file

@ -0,0 +1,2 @@
grunt --version > /dev/null 2>&1
_dq_report 'grunt' $?

2
lib/frontend/npm.sh Normal file
View file

@ -0,0 +1,2 @@
npm --version > /dev/null 2>&1
_dq_report 'npm' $?

2
lib/frontend/sass.sh Normal file
View file

@ -0,0 +1,2 @@
sass --version > /dev/null 2>&1
_dq_report 'sass' $?

2
lib/frontend/yo.sh Normal file
View file

@ -0,0 +1,2 @@
yo --version > /dev/null 2>&1
_dq_report 'yoeman' $?

2
lib/groovy/groovy.sh Normal file
View file

@ -0,0 +1,2 @@
groovy --version > /dev/null 2>&1
_dq_report 'groovy' $?

2
lib/groovy/groovyc.sh Normal file
View file

@ -0,0 +1,2 @@
groovyc -version > /dev/null 2>&1
_dq_report 'groovyc' $?

2
lib/groovy/lazybones.sh Normal file
View file

@ -0,0 +1,2 @@
lazybones --version > /dev/null 2>&1
_dq_report 'lazybones' $?

2
lib/java/ant.sh Normal file
View file

@ -0,0 +1,2 @@
ant -version > /dev/null 2>&1
_dq_report 'ant' $?

2
lib/java/gradle.sh Normal file
View file

@ -0,0 +1,2 @@
gradle -v > /dev/null 2>&1
_dq_report 'gradle' $?

4
lib/java/javac.sh Normal file
View file

@ -0,0 +1,4 @@
# http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4380614
# jdk
javac -version > /dev/null 2>&1
_dq_report 'javac' $?

2
lib/java/mvn.sh Normal file
View file

@ -0,0 +1,2 @@
mvn -v > /dev/null 2>&1
_dq_report 'maven' $?

2
lib/ruby/bundle.sh Normal file
View file

@ -0,0 +1,2 @@
bundle -v > /dev/null 2>&1
_dq_report 'bundler' $?

2
lib/ruby/gem.sh Normal file
View file

@ -0,0 +1,2 @@
gem -v > /dev/null 2>&1
_dq_report 'gem' $?

2
lib/ruby/rake.sh Normal file
View file

@ -0,0 +1,2 @@
rake -V > /dev/null 2>&1
_dq_report 'rake' $?

2
lib/ruby/rvm.sh Normal file
View file

@ -0,0 +1,2 @@
rvm -v > /dev/null 2>&1
_dq_report 'rvm' $?

3
lib/scala/sbt.sh Normal file
View file

@ -0,0 +1,3 @@
# this guy downloads the entire internet before telling its version
sbt sbt-version > /dev/null 2>&1
_dq_report 'sbt' $?

10
lib/scala/scala.sh Normal file
View file

@ -0,0 +1,10 @@
scala -version > /dev/null 2>&1
# this guy has its own idea of exit codes, fix it!
if [ $? -eq 1 ]; then
STATUS=0
else
STATUS=1
fi
_dq_report 'scala' $STATUS

2
lib/scala/scalac.sh Normal file
View file

@ -0,0 +1,2 @@
scalac -version > /dev/null 2>&1
_dq_report 'scalac' $?

4
urls.rb Normal file
View file

@ -0,0 +1,4 @@
Dir["bin/**/*.sh"].each { |file|
puts "#### " + File.dirname(file).gsub("bin/", "").gsub("_", " ")
puts "`curl -sL https://raw.github.com/kdabir/dq/master/#{file} | sh`"
}