helm/rake/pkg/emacs.rake

83 lines
1.9 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
2015-01-12 20:23:09 -08:00
[ "emacs --with-gnutls --cocoa",
"ispell",
"cask",
"rsense",
2015-01-12 20:23:09 -08:00
"markdown" ]
end
def node_reqs
%w{jshint jsonlint js-beautify git://github.com/ramitos/jsctags.git}
end
def setup
echo "Installing emacs dependencies"
emacs_reqs.each { |pkg| Package.install pkg }
end
def setup_node
echo "Installing node dependencies"
node_reqs.each do |pkg|
sh_safe "/usr/local/bin/npm install -g #{pkg}"
end
end
def setup_emacs_d
echo "Setting up emacs.d & updating cask"
github 'hlissner/emacs.d', '~/.emacs.d'
sh_safe "cd '#{ENV["EMACS_D"]}' && cask install"
end
def emacs_installed?
Dir.exists?(ENV["EMACS_D"])
end
2015-01-12 20:23:09 -08:00
#
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
2015-01-12 20:23:09 -08:00
desc "Install emacs completely"
task :install => ["nodejs:install", :setup, :setup_node, :setup_emacs_d]
desc "Setup required homebrew packages"
task :setup do
setup if !emacs_installed? || ENV["FORCE"]
end
desc "Setup required node & node plugins"
task :setup_node do
setup_node if !emacs_installed? || ENV["FORCE"]
end
desc "Setup emacs.d folder, plugins and cask"
task :setup_emacs_d do
setup_emacs_d if !emacs_installed? || ENV["FORCE"]
2014-07-17 05:18:53 -07:00
end
task :update => "emacs:install" do
2015-01-12 20:23:09 -08:00
if emacs_installed?
echo "Updating emacs.d & packages"
sh_safe "cd '#{ENV["EMACS_D"]}' && git pull && cask update"
2014-09-05 14:03:26 -07:00
2015-01-12 20:23:09 -08:00
# Update rsense config
sh_safe "/usr/bin/env ruby `brew --prefix rsense`/libexec/etc/config.rb > ~/.rsense"
end
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"
2015-01-12 20:23:09 -08:00
emacs_reqs.each { |pkg| Package.remove pkg.split.first }
2014-08-30 23:50:03 -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
end