helm/rake/pkg/emacs.rake

57 lines
1.4 KiB
Ruby
Raw Normal View History

2014-08-30 23:50:03 -07:00
if is_mac?
ENV["EMACS_D"] = File.expand_path("~/.emacs.d")
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
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"
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"
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
task :update => "emacs:install" do
2014-08-30 23:50:03 -07:00
echo "Updating emacs.d & packages"
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: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 }
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
end