2014-08-30 23:50:03 -07:00
|
|
|
if is_mac?
|
2014-07-17 05:11:18 -07:00
|
|
|
|
2014-09-20 13:37:45 -07:00
|
|
|
ENV["EMACS_D"] = File.expand_path("~/.emacs.d")
|
2014-07-17 05:11:18 -07:00
|
|
|
|
2014-09-20 13:37:45 -07:00
|
|
|
def emacs_reqs
|
|
|
|
[
|
|
|
|
"emacs --HEAD --use-git-head --with-gnutls --cocoa --keep-ctags --srgb",
|
|
|
|
"aspell --with-lang-en",
|
|
|
|
"cask",
|
|
|
|
"rsense",
|
|
|
|
"node"
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
def emacs_installed?
|
|
|
|
Dir.exists?(ENV["EMACS_D"])
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Ensure emacs 24.4 is installed & up to date"
|
2014-08-30 23:50:03 -07:00
|
|
|
task :emacs => "emacs:update"
|
|
|
|
|
|
|
|
namespace :emacs do
|
2014-07-17 05:18:53 -07:00
|
|
|
task :install do
|
2014-09-20 13:37:45 -07:00
|
|
|
emacs_reqs.each { |pkg| Package.install pkg }
|
|
|
|
unless emacs_installed?
|
|
|
|
echo "Installing emacs dependencies"
|
2014-09-05 14:03:26 -07:00
|
|
|
Package.install "homebrew/dupes/tidy --HEAD"
|
2014-09-20 13:37:45 -07:00
|
|
|
|
|
|
|
echo "Setting up Emacs"
|
|
|
|
github 'hlissner/emacs.d', '~/.emacs.d'
|
2014-08-30 23:50:03 -07:00
|
|
|
|
|
|
|
sh_safe "/usr/local/bin/npm install jshint -g"
|
|
|
|
sh_safe "/usr/local/bin/npm install jsonlint -g"
|
2014-09-20 13:37:45 -07:00
|
|
|
sh_safe "cd '#{ENV["EMACS_D"]}' && cask"
|
2014-08-30 23:50:03 -07:00
|
|
|
end
|
2014-07-17 05:18:53 -07:00
|
|
|
end
|
2014-07-17 05:11:18 -07:00
|
|
|
|
2014-09-20 13:37:45 -07:00
|
|
|
task :update => "emacs:install" do
|
2014-08-30 23:50:03 -07:00
|
|
|
echo "Updating emacs.d & packages"
|
2014-09-20 13:37:45 -07:00
|
|
|
sh_safe "cd '#{ENV["EMACS_D"]}' && git pull && cask update"
|
2014-09-05 14:03:26 -07:00
|
|
|
|
|
|
|
# Update rsense config
|
|
|
|
sh_safe "~/.rbenv/shims/ruby `brew --prefix rsense`/libexec/etc/config.rb > ~/.rsense"
|
2014-07-17 05:18:53 -07:00
|
|
|
end
|
2014-07-17 05:11:18 -07:00
|
|
|
|
2014-07-17 05:18:53 -07:00
|
|
|
task :remove do
|
2014-08-30 23:50:03 -07:00
|
|
|
echo "Uninstalling emacs"
|
|
|
|
Package.remove "emacs"
|
|
|
|
Package.remove "homebrew/dupes/tidy"
|
|
|
|
emacs_reqs.each { |pkg| Package.remove pkg }
|
|
|
|
|
2014-09-20 13:37:45 -07:00
|
|
|
rm_rf ENV["EMACS_D"] if Dir.exists? ENV["EMACS_D"]
|
2014-07-17 05:18:53 -07:00
|
|
|
end
|
2014-08-30 23:50:03 -07:00
|
|
|
end
|
|
|
|
|
2014-07-17 05:11:18 -07:00
|
|
|
end
|