Refactor rake node provisioner

This commit is contained in:
Henrik Lissner 2014-09-05 17:03:57 -04:00
parent 6ebcfd11bb
commit 2fa693e994
5 changed files with 54 additions and 37 deletions

View file

@ -1,4 +1,4 @@
desc "Provision home server" desc "My home server"
task :callisto do task :callisto do
%w{ %w{
update update

View file

@ -1,2 +1,2 @@
desc "Provision main laptop" desc "My work laptop"
task :ganymede => :io task :ganymede => :io

View file

@ -1,38 +1,53 @@
desc "Provision main desktop" desc "My main computer"
task :io do task :io do
%w{ [ "update",
update "pkg:osx",
pkg:osx "pkg:zsh",
pkg:zsh "pkg:vim",
pkg:vim "pkg:emacs",
pkg:emacs "pkg:rbenv",
pkg:rbenv "pkg:pyenv",
pkg:pyenv "pkg:love"
}.each { |task| Rake::Task[task].invoke } ].each { |task| Rake::Task[task].invoke }
# Install my the mac-apps I commonly use
if is_mac? if is_mac?
%w{ [ "transmit",
transmit "transmission",
transmission "vlc",
vlc "flux",
flux "skype",
skype "adium",
adium "codekit",
codekit "mindnode-pro",
sequel-pro "sequel-pro",
scrivener "scrivener",
omnigraffle "omnigraffle",
love
qlcolorcode # Quicklook plugins
qlstephen "qlcolorcode",
qlmarkdown "qlstephen",
quicklook-json "qlmarkdown",
qlprettypatch "quicklook-json",
quicklook-csv "qlprettypatch",
betterzipql "quicklook-csv",
webp-quicklook "betterzipql",
suspicious-package "webp-quicklook",
}.each { |app| Package.cask_install app } "suspicious-package"
].each { |app| Package.cask_install app }
end
if system("rbenv versions | grep 2.1.2 >/dev/null")
sh_safe "rbenv install 2.1.2"
sh_safe "rbenv global 2.1.2"
sh_safe "~/.rbenv/shims/gem install bundler rspec cucumber jekyll"
end
if system("pyenv versions | grep 3.4.1 >/dev/null")
sh_safe "pyenv install 3.4.1"
sh_safe "pyenv global 3.4.1"
sh_safe "~/.pyenv/shims/pip install nose cython"
end end
end end

View file

@ -1,2 +1,2 @@
desc "Provision 2nd desktop" desc "My media desktop"
task :titan => :io task :titan => :io

View file

@ -1,12 +1,14 @@
require_relative 'lib/output' require_relative 'lib/output'
task :default => :update
desc "Update the node (based on hostname)" desc "Update the node (based on hostname)"
task :default, :node do |t, args| task :update, :node do |t, args|
args.with_defaults(:node => `hostname`.gsub('.local', '').strip) args.with_defaults(:node => `hostname`.gsub('.local', '').strip)
Rake::Task["setup:#{args.node}"].invoke Rake::Task["setup:#{args.node}"].invoke
end end
desc "Wipe the slate clean" # desc "Wipe the slate clean"
task :destroy do task :destroy do
# are you sure? # are you sure?
# are you really really sure? # are you really really sure?