Update rakefile
This commit is contained in:
parent
e58a3cbab4
commit
31981ee179
|
@ -3,51 +3,77 @@ if is_mac?
|
||||||
ENV["EMACS_D"] = File.expand_path("~/.emacs.d")
|
ENV["EMACS_D"] = File.expand_path("~/.emacs.d")
|
||||||
|
|
||||||
def emacs_reqs
|
def emacs_reqs
|
||||||
[
|
[ "emacs --with-gnutls --cocoa",
|
||||||
"emacs --HEAD --use-git-head --with-gnutls --cocoa --keep-ctags --srgb",
|
"ispell",
|
||||||
"aspell --with-lang-en",
|
|
||||||
"cask",
|
"cask",
|
||||||
"rsense",
|
"rsense",
|
||||||
"node"
|
"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
|
end
|
||||||
|
|
||||||
def emacs_installed?
|
def emacs_installed?
|
||||||
Dir.exists?(ENV["EMACS_D"])
|
Dir.exists?(ENV["EMACS_D"])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#
|
||||||
desc "Ensure emacs 24.4 is installed & up to date"
|
desc "Ensure emacs 24.4 is installed & up to date"
|
||||||
task :emacs => "emacs:update"
|
task :emacs => "emacs:update"
|
||||||
|
|
||||||
namespace :emacs do
|
namespace :emacs do
|
||||||
task :install do
|
desc "Install emacs completely"
|
||||||
emacs_reqs.each { |pkg| Package.install pkg }
|
task :install => ["nodejs:install", :setup, :setup_node, :setup_emacs_d]
|
||||||
unless emacs_installed?
|
|
||||||
echo "Installing emacs dependencies"
|
|
||||||
Package.install "homebrew/dupes/tidy --HEAD"
|
|
||||||
|
|
||||||
echo "Setting up Emacs"
|
desc "Setup required homebrew packages"
|
||||||
github 'hlissner/emacs.d', '~/.emacs.d'
|
task :setup do
|
||||||
|
setup if !emacs_installed? || ENV["FORCE"]
|
||||||
|
end
|
||||||
|
|
||||||
sh_safe "/usr/local/bin/npm install jshint -g"
|
desc "Setup required node & node plugins"
|
||||||
sh_safe "/usr/local/bin/npm install jsonlint -g"
|
task :setup_node do
|
||||||
sh_safe "cd '#{ENV["EMACS_D"]}' && cask"
|
setup_node if !emacs_installed? || ENV["FORCE"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "Setup emacs.d folder, plugins and cask"
|
||||||
|
task :setup_emacs_d do
|
||||||
|
setup_emacs_d if !emacs_installed? || ENV["FORCE"]
|
||||||
end
|
end
|
||||||
|
|
||||||
task :update => "emacs:install" do
|
task :update => "emacs:install" do
|
||||||
echo "Updating emacs.d & packages"
|
if emacs_installed?
|
||||||
sh_safe "cd '#{ENV["EMACS_D"]}' && git pull && cask update"
|
echo "Updating emacs.d & packages"
|
||||||
|
sh_safe "cd '#{ENV["EMACS_D"]}' && git pull && cask update"
|
||||||
|
|
||||||
# Update rsense config
|
# Update rsense config
|
||||||
sh_safe "~/.rbenv/shims/ruby `brew --prefix rsense`/libexec/etc/config.rb > ~/.rsense"
|
sh_safe "/usr/bin/env ruby `brew --prefix rsense`/libexec/etc/config.rb > ~/.rsense"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
task :remove do
|
task :remove do
|
||||||
echo "Uninstalling emacs"
|
echo "Uninstalling emacs"
|
||||||
Package.remove "emacs"
|
Package.remove "emacs"
|
||||||
Package.remove "homebrew/dupes/tidy"
|
Package.remove "homebrew/dupes/tidy"
|
||||||
emacs_reqs.each { |pkg| Package.remove pkg }
|
emacs_reqs.each { |pkg| Package.remove pkg.split.first }
|
||||||
|
|
||||||
rm_rf ENV["EMACS_D"] if Dir.exists? ENV["EMACS_D"]
|
rm_rf ENV["EMACS_D"] if Dir.exists? ENV["EMACS_D"]
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,8 +34,7 @@ if is_mac?
|
||||||
"node"
|
"node"
|
||||||
].each { |pkg| Package.install pkg }
|
].each { |pkg| Package.install pkg }
|
||||||
|
|
||||||
[ "dropbox",
|
[ "appcleaner",
|
||||||
"appcleaner",
|
|
||||||
"vagrant",
|
"vagrant",
|
||||||
"virtualbox",
|
"virtualbox",
|
||||||
"growlnotify",
|
"growlnotify",
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
PYENV_ROOT = File.expand_path("~/.pyenv")
|
PYENV_ROOT = File.expand_path("~/.pyenv")
|
||||||
ENV["PYTHON_VERSION"] = "3.4.1"
|
|
||||||
|
|
||||||
def pyenv_installed?
|
def pyenv_installed?
|
||||||
Dir.exists?(PYENV_ROOT)
|
Dir.exists?(PYENV_ROOT)
|
||||||
|
@ -45,14 +44,15 @@ namespace :pyenv do
|
||||||
sh_safe "eval \"$(#{PYENV_ROOT}/bin/pyenv virtualenv-init -)\""
|
sh_safe "eval \"$(#{PYENV_ROOT}/bin/pyenv virtualenv-init -)\""
|
||||||
end
|
end
|
||||||
|
|
||||||
py_version = ENV["PYTHON_VERSION"]
|
['3.4.1', '2.7.8'].each do |version|
|
||||||
unless pyenv_version_installed? py_version
|
unless pyenv_version_installed? version
|
||||||
# Install global python + packages
|
# Install global python + packages
|
||||||
echo "Setting up default python (#{py_version})", 2
|
echo "Setting up default python (#{version})", 2
|
||||||
sh_safe "pyenv install #{py_version}"
|
sh_safe "pyenv install #{version}"
|
||||||
sh_safe "pyenv global #{py_version}"
|
sh_safe "pyenv global #{version}"
|
||||||
sh_safe "PYENV_VERSION=#{py_version} #{PYENV_ROOT}/shims/pip install cython"
|
sh_safe "PYENV_VERSION=#{version} #{PYENV_ROOT}/shims/pip install cython"
|
||||||
sh_safe "PYENV_VERSION=#{py_version} #{PYENV_ROOT}/shims/pip install nose virtualenv pyyaml ipython"
|
sh_safe "PYENV_VERSION=#{version} #{PYENV_ROOT}/shims/pip install nose virtualenv pyyaml ipython"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue