summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshumakl <shumakl@purdue.edu>2014-04-03 11:51:37 -0400
committershumakl <shumakl@purdue.edu>2014-04-03 11:51:37 -0400
commitbed5a14c1e8bd4af7a066664f0ec2b57979bc96b (patch)
tree17271699ef186edcfa80df38afefd4540798a3a6
parentef22599880973aae8464bacb82e3a04d6277bc43 (diff)
modify generate.sh to use tab-indent in the app/ directory
-rwxr-xr-xbin/autoindent10
-rwxr-xr-xgenerate.sh18
2 files changed, 18 insertions, 10 deletions
diff --git a/bin/autoindent b/bin/autoindent
new file mode 100755
index 0000000..c45da1e
--- /dev/null
+++ b/bin/autoindent
@@ -0,0 +1,10 @@
+#!/bin/bash
+file=$1
+sed -i 's/^\s*//' "$file"
+emacs --batch "$file" \
+ --eval '(setq indent-tabs-mode t)' \
+ --eval '(setq ruby-indent-level 4)' \
+ --eval '(setq tab-width 4)' \
+ --eval '(setq make-backup-files nil)' \
+ --eval '(indent-region (point-min) (point-max) nil)' \
+ -f save-buffer
diff --git a/generate.sh b/generate.sh
index d960a56..728e122 100755
--- a/generate.sh
+++ b/generate.sh
@@ -1,17 +1,13 @@
#!/bin/bash
-set -x
-# The generate.sh bash file is used to generate all of the necessary .rb files to run the website
-#
+# The generate.sh bash file is used to generate all of the necessary
+# .rb files to run the website
+set -x
-# To Start Rails Server:
-# bundle exec rails server
-#
-# To Clear the Generated Files:
-# git clean -df
-#
-#NOTEST='--skip-test-unit'
+# figure out where we are running from
+srcdir=$(dirname "$(readlink -f "$0")")
+cd "$srcdir"
git rm -rf app test config/routes.rb db/migrate
git checkout clean-start -- app test config/routes.rb
@@ -65,4 +61,6 @@ bundle exec rake db:drop RAILS_ENV=development
bundle exec rake db:migrate RAILS_ENV=development
bundle exec rake db:seed
+find app -type f -name '*.rb' -exec bin/autoindent {} \;
+
git add app test config/routes.rb db/migrate db/schema.rb