Rewrote/restructured provisioner rakefiles
This commit is contained in:
parent
8a4947dd9c
commit
d304364e81
|
@ -1,19 +0,0 @@
|
|||
require_relative 'lib/output'
|
||||
|
||||
desc "Provision the node"
|
||||
task :init,:node do |t,args|
|
||||
args.with_defaults(:node => `hostname`.gsub('.local', '').strip)
|
||||
# TODO: chop off the *.local in osx hostnames
|
||||
|
||||
path = "#{File.dirname(__FILE__)}/node/#{args.node}.rb"
|
||||
if File.exists?(path)
|
||||
echo "Setting up node: #{args.node}"
|
||||
require_relative "node/#{args.node}"
|
||||
echo "Done!"
|
||||
else
|
||||
echo "#{args.node} node does not exist!"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Update the node"
|
||||
task :default => :init
|
24
rake/lib/deploy.rb
Normal file
24
rake/lib/deploy.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
|
||||
module Project
|
||||
|
||||
def create(dirs=[])
|
||||
|
||||
end
|
||||
|
||||
def template(template, vars={}, dest="")
|
||||
|
||||
end
|
||||
|
||||
def update(name)
|
||||
|
||||
end
|
||||
|
||||
def remove(name)
|
||||
|
||||
end
|
||||
|
||||
class Template
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
|
|
@ -40,6 +40,10 @@ module Homebrew
|
|||
sh_safe "#{BIN} remove #{keg}"
|
||||
end
|
||||
|
||||
def self.remove_cask(keg)
|
||||
sh_safe "#{BIN} cask uninstall #{keg}"
|
||||
end
|
||||
|
||||
def self.has_keg?(keg)
|
||||
system("#{BIN} search #{keg}")
|
||||
end
|
||||
|
|
4
rake/lib/rake.rb
Normal file
4
rake/lib/rake.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
def load_all(glob)
|
||||
Dir.glob("#{File.dirname(__FILE__)}/../#{glob}") { |file| load file }
|
||||
end
|
13
rake/node/callisto.rake
Normal file
13
rake/node/callisto.rake
Normal file
|
@ -0,0 +1,13 @@
|
|||
|
||||
desc "Provision home server"
|
||||
task :callisto do
|
||||
%w{
|
||||
osx
|
||||
homebrew
|
||||
zsh
|
||||
vim
|
||||
nginx
|
||||
mongodb
|
||||
gitlab
|
||||
}.each { |task| Rake::Task[task].invoke }
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
%w{
|
||||
osx
|
||||
homebrew
|
||||
zsh
|
||||
vim
|
||||
rbenv
|
||||
mongodb
|
||||
}.each { |task| Rake::Task[task].invoke }
|
3
rake/node/ganymede.rake
Normal file
3
rake/node/ganymede.rake
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
desc "Provision main laptop"
|
||||
task :ganymede => :io
|
|
@ -1 +0,0 @@
|
|||
require_relative "io"
|
30
rake/node/io.rake
Normal file
30
rake/node/io.rake
Normal file
|
@ -0,0 +1,30 @@
|
|||
require_relative '../lib/homebrew'
|
||||
|
||||
desc "Provision main desktop"
|
||||
task :io do
|
||||
%w{
|
||||
pkg:osx
|
||||
pkg:homebrew
|
||||
pkg:zsh
|
||||
pkg:vim
|
||||
pkg:emacs
|
||||
pkg:rbenv:v1_9
|
||||
pkg:rbenv:v2_0
|
||||
pkg:rbenv:update
|
||||
}.each { |task| Rake::Task[task].invoke }
|
||||
|
||||
%w{
|
||||
transmit
|
||||
transmission
|
||||
vlc
|
||||
flux
|
||||
skype
|
||||
adium
|
||||
codekit
|
||||
mongohub
|
||||
sequel-pro
|
||||
scrivener
|
||||
omnigraffle
|
||||
love
|
||||
}.each { |app| Homebrew.install_cask app }
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
require_relative '../lib/homebrew'
|
||||
|
||||
%w{
|
||||
osx
|
||||
homebrew
|
||||
zsh
|
||||
vim
|
||||
rbenv:v1_9
|
||||
rbenv:v2_0
|
||||
rbenv:update
|
||||
}.each { |task| Rake::Task[task].invoke }
|
||||
|
||||
%w{
|
||||
transmit
|
||||
transmission
|
||||
vlc
|
||||
flux
|
||||
skype
|
||||
adium
|
||||
codekit
|
||||
mongohub
|
||||
sequel-pro
|
||||
scrivener
|
||||
omnigraffle
|
||||
love
|
||||
}.each { |app| Homebrew.install_cask app }
|
|
@ -1 +0,0 @@
|
|||
require_relative "io"
|
3
rake/node/titan.rake
Normal file
3
rake/node/titan.rake
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
desc "Provision 2nd desktop"
|
||||
task :titan => :io
|
5
rake/pkg.rake
Normal file
5
rake/pkg.rake
Normal file
|
@ -0,0 +1,5 @@
|
|||
require_relative "lib/rake"
|
||||
|
||||
verbose(false)
|
||||
|
||||
namespace :pkg do load_all("pkg/*.rake") end
|
26
rake/pkg/emacs.rake
Normal file
26
rake/pkg/emacs.rake
Normal file
|
@ -0,0 +1,26 @@
|
|||
desc "Ensure emacs is installed and up to date"
|
||||
task :emacs => "emacs:update"
|
||||
|
||||
namespace :emacs do
|
||||
|
||||
task :install do
|
||||
Homebrew.install("emacs", "--with-gnutls --cocoa --keep-ctags --srgb")
|
||||
Homebrew.install "aspell"
|
||||
github('hlissner/emacs.d', '~/.emacs.d')
|
||||
end
|
||||
|
||||
task :update do
|
||||
echo "Updating emacs.d"
|
||||
sh_safe "cd ~/.emacs.d && git pull"
|
||||
|
||||
echo "You'll have to update emacs manually!"
|
||||
end
|
||||
|
||||
task :remove do
|
||||
echo "Uninstalling emacs"
|
||||
Homebrew.remove "emacs"
|
||||
Homebrew.remove "aspell"
|
||||
rm_rf "~/.emacs.d" if Dir.exists? "~/.emacs.d"
|
||||
end
|
||||
|
||||
end
|
|
@ -1,13 +1,10 @@
|
|||
require_relative "../lib/output"
|
||||
require_relative "../lib/homebrew"
|
||||
require_relative "../lib/sh"
|
||||
|
||||
require_relative "lib/output"
|
||||
require_relative "lib/homebrew"
|
||||
require_relative "lib/sh"
|
||||
|
||||
desc "Ensure homebrew is installed and up to date"
|
||||
desc 'Install/update homebrew'
|
||||
task :homebrew => 'homebrew:update'
|
||||
|
||||
verbose(false)
|
||||
|
||||
namespace :homebrew do
|
||||
|
||||
task :install do
|
||||
|
@ -49,6 +46,7 @@ namespace :homebrew do
|
|||
echo "Homebrew is installed. Moving on."
|
||||
end
|
||||
|
||||
desc "Update homebrew and upgrade brews"
|
||||
task :update => "homebrew:install" do
|
||||
echo "Updating homebrew..."
|
||||
Homebrew.update
|
||||
|
@ -60,4 +58,3 @@ namespace :homebrew do
|
|||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
require_relative 'lib/output'
|
||||
require_relative '../lib/output'
|
||||
|
||||
task :osx do
|
||||
if system('defaults read com.apple.finder _FXShowPosixPathInTitle >&/dev/null')
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
require_relative 'lib/homebrew'
|
||||
require_relative 'lib/rbenv'
|
||||
require_relative '../lib/homebrew'
|
||||
require_relative '../lib/rbenv'
|
||||
|
||||
task :rbenv => 'rbenv:update'
|
||||
|
||||
|
@ -47,4 +46,16 @@ namespace :rbenv do
|
|||
end
|
||||
end
|
||||
|
||||
namespace :gem do
|
||||
|
||||
task :install, [:gem, :all_rubies] do |t, args|
|
||||
|
||||
end
|
||||
|
||||
task :remove, [:gem, :all_rubies] do |t, args|
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
39
rake/pkg/vim.rake
Normal file
39
rake/pkg/vim.rake
Normal file
|
@ -0,0 +1,39 @@
|
|||
require_relative "../lib/output"
|
||||
require_relative "../lib/homebrew"
|
||||
require_relative "../lib/sh"
|
||||
|
||||
desc "Ensure vim/macvim is installed and up to date"
|
||||
task :vim => "vim:update"
|
||||
|
||||
namespace :vim do
|
||||
|
||||
task :install do
|
||||
%w{lua luajit}.each { |pkg| Homebrew.install pkg }
|
||||
%w{vim macvim}.each { |pkg| Homebrew.install(pkg, '--with-lua --with-luajit') }
|
||||
|
||||
unless Dir.exists? (File.expand_path("~/.vim"))
|
||||
github('hlissner/vim', '~/.vim')
|
||||
github('Shougo/neobundle.vim', '~/.vim/bundle/neobundle.vim')
|
||||
end
|
||||
end
|
||||
|
||||
task :update => 'vim:install' do
|
||||
path = File.expand_path("~/.vim")
|
||||
|
||||
echo "Updating vim"
|
||||
sh "cd #{path} && git pull"
|
||||
|
||||
echo "Updating vim plugins"
|
||||
Dir.glob("#{path}/bundle/*") do |f|
|
||||
echo ":: Updating #{File.basename(f)}:"
|
||||
sh_safe "cd #{f} && git pull"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Remove vim"
|
||||
task :remove do
|
||||
echo "Uninstalling vim"
|
||||
%w{vim macvim}.each { |pkg| Homebrew.remove pkg }
|
||||
end
|
||||
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
require_relative 'lib/sh'
|
||||
require_relative 'lib/git'
|
||||
require_relative '../lib/sh'
|
||||
require_relative '../lib/git'
|
||||
|
||||
desc "Ensure zsh and oh-my-zsh is installed and set"
|
||||
task :zsh => 'zsh:update'
|
|
@ -1,42 +0,0 @@
|
|||
require_relative 'lib/output'
|
||||
require_relative 'lib/homebrew'
|
||||
require_relative 'lib/pyenv'
|
||||
|
||||
task :pyenv => 'pyenv:update'
|
||||
|
||||
namespace :pyenv do
|
||||
|
||||
# task :install do
|
||||
# unless Pyenv.is_installed?
|
||||
# echo "Installing pyenv"
|
||||
# Pyenv.bootstrap
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# task :v2 => :install do
|
||||
# # v = "2.0.0-p451"
|
||||
# # unless Pyenv.is_version_installed?(v)
|
||||
# # echo "Building ruby #{v}"
|
||||
# # Pyenv.install v, GLOBAL_GEMS
|
||||
# # end
|
||||
# end
|
||||
#
|
||||
# task :v3 => :install do
|
||||
# # v = "1.9.3-p545"
|
||||
# # unless Pyenv.is_version_installed?(v)
|
||||
# # echo "Building ruby #{v}"
|
||||
# # Pyenv.install v, GLOBAL_GEMS
|
||||
# # end
|
||||
# end
|
||||
#
|
||||
# task :remove do
|
||||
# # Pyenv.destroy
|
||||
# end
|
||||
|
||||
task :update => :install do
|
||||
echoerr "Pyenv rakefile not yet implemented!"
|
||||
# Pyenv.installed_versions.each { |v| Pyenv.update v }
|
||||
end
|
||||
|
||||
end
|
||||
|
16
rake/setup.rake
Normal file
16
rake/setup.rake
Normal file
|
@ -0,0 +1,16 @@
|
|||
require_relative 'lib/output'
|
||||
|
||||
desc "Update the node (based on hostname)"
|
||||
task :default, :node do |t, args|
|
||||
args.with_defaults(:node => `hostname`.gsub('.local', '').strip)
|
||||
Rake::Task["setup:#{args.node}"].invoke
|
||||
end
|
||||
|
||||
desc "Wipe the slate clean"
|
||||
task :destroy do
|
||||
# are you sure?
|
||||
# are you really really sure?
|
||||
# TODO: EXTERMINATE!
|
||||
end
|
||||
|
||||
namespace :setup do load_all("node/*.rake") end
|
|
@ -1,40 +0,0 @@
|
|||
|
||||
require_relative "lib/output"
|
||||
require_relative "lib/homebrew"
|
||||
require_relative "lib/sh"
|
||||
|
||||
desc "Ensure vim/macvim is installed and up to date"
|
||||
task :vim => "vim:update"
|
||||
|
||||
namespace :vim do
|
||||
|
||||
task :install do
|
||||
%w{lua luajit}.each { |pkg| Homebrew.install pkg }
|
||||
%w{vim macvim}.each { |pkg| Homebrew.install(pkg, '--with-lua --with-luajit') }
|
||||
|
||||
unless Dir.exists? (File.expand_path("~/.vim"))
|
||||
github('hlissner/vim', '~/.vim')
|
||||
github('Shougo/neobundle.vim', '~/.vim/bundle/neobundle.vim')
|
||||
end
|
||||
end
|
||||
|
||||
task :update => 'vim:install' do
|
||||
path = File.expand_path("~/.vim")
|
||||
|
||||
echo "Updating vim"
|
||||
sh "cd #{path} && git pull"
|
||||
|
||||
echo "Updating vim plugins"
|
||||
Dir.glob("#{path}/bundle/*") do |f|
|
||||
echo ":: Updating #{File.basename(f)}:"
|
||||
sh_safe "cd #{f} && git pull"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Remove vim"
|
||||
task :remove do
|
||||
echo "Uninstalling vim"
|
||||
%w{vim macvim}.each { |pkg| Homebrew.remove pkg }
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue