Remove unused libs in rakefiles

This commit is contained in:
Henrik Lissner 2014-08-31 02:54:28 -04:00
parent 56d2675384
commit 067eeb7bb8
5 changed files with 3 additions and 180 deletions

View file

@ -1,26 +0,0 @@
class Project
template_folder = "templates"
def dirs(dirs=[])
dirs.each do |d|
mkdir_p d unless Dir.exists? d
end
end
def template(template, dest="", vars={})
template_file = "#{template_folder}/#{template}.erb"
dest_file = "#{dest}/#{File.basename(template)}"
raise "Template file doesn't exist" unless File.exists? template_file
raise "Destination folder doesn't exist" unless Dir.exists? dest
raise "Destination file already exists" unless File.exists? dest_file
erb = ERB.new(File.read(template_file))
File.open(dest_file) do |f|
f.puts(erb.result(binding))
end
end
end

View file

@ -1,78 +0,0 @@
require_relative 'sh'
include Rake::DSL
module Homebrew
BIN = "/usr/local/bin/brew"
def self.bootstrap
unless self.is_installed?
sh_safe 'ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"'
echo "Homebrew is installed! Restart the shell then rake."
exit
end
end
def self.destroy
if self.is_installed?
sh_safe 'rm -rf /usr/local/Cellar /usr/local/.git ~/Library/Caches/Homebrew'
sh_safe 'brew prune'
['Library/Homebrew', 'Library/Aliases', 'Library/Formula', 'Library/Contributions'].each do |dir|
sh_safe "rm -r #{dir}"
end
end
end
def self.install(keg, options=nil)
sh_safe "#{BIN} install #{keg} #{options}" unless self.is_keg_installed?(keg)
end
def self.install_cask(cask, options=nil)
sh_safe "#{BIN} cask install #{cask} #{options}" unless self.is_cask_installed?(cask)
end
def self.tap(tap)
sh_safe "#{BIN} tap #{tap}" unless self.is_tapped? tap
end
def self.remove(keg)
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
def self.is_keg_installed?(keg)
system("#{BIN} list | grep -w '#{keg}' >& /dev/null")
end
def self.is_cask_installed?(cask)
system("#{BIN} cask list | grep -w '#{cask}' >& /dev/null")
end
def self.is_tapped?(tap)
system("#{BIN} tap | grep -w '#{tap}' >& /dev/null")
end
def self.is_installed?
File.exists?("/usr/local/bin/brew")
end
def self.prefix(keg)
`#{BIN} --prefix #{keg}`.strip
end
def self.update(*args)
if args.length > 0
sh_safe "#{BIN} upgrade #{args.join(' ')}"
else
sh_safe "#{BIN} update && #{BIN} upgrade"
end
end
end

View file

@ -1,16 +0,0 @@
module Pyenv
BREWS = %w{pbenv pyenv-pip-rehash pyenv-virtualenv}
PIP_BIN = "/usr/local/opt/pyenv/shims/pip"
def self.bootstrap
end
def self.destroy
end
end

View file

@ -1,58 +0,0 @@
include Rake::DSL
require_relative 'homebrew'
module Rbenv
BREWS = %w{rbenv ruby-build rbenv-vars rbenv-gem-rehash}
GEM_BIN = "/usr/local/opt/rbenv/shims/gem"
def self.bootstrap
unless self.is_installed?
BREWS.each { |pkg| Homebrew.install pkg }
echo "Rbenv is installed! Restart the shell then rake."
exit
end
end
def self.destroy
if self.is_installed?
BREWS.each { |pkg| Homebrew.remove pkg }
# sh_safe "rm -rf #{Homebrew.prefix 'rbenv'}"
end
end
def self.install(version, gems=[])
unless self.is_version_installed?(version)
sh_safe "rbenv install #{version}"
sh_safe "RBENV_VERSION=#{version} #{GEM_BIN} install #{gems.join(' ')}"
end
end
def self.update(version)
cmd = self._sudo(version)
sh_safe "RBENV_VERSION=#{version} #{cmd} #{GEM_BIN} update"
sh_safe "RBENV_VERSION=#{version} #{cmd} #{GEM_BIN} clean"
end
def self.is_installed?
Homebrew.is_keg_installed? "rbenv"
end
def self.is_version_installed?(version)
system("rbenv versions | grep -w #{version} &>/dev/null")
end
def self.installed_versions
`ls -1 #{Homebrew.prefix 'rbenv'}/versions`.split("\n")
end
def self._sudo(version)
if version == 'system'
return "sudo"
else
return ""
end
end
end

View file

@ -1,7 +1,8 @@
require_relative "lib/rake" require_relative "lib/git"
require_relative "lib/os" require_relative "lib/os"
require_relative "lib/sh"
require_relative "lib/output" require_relative "lib/output"
require_relative "lib/rake"
require_relative "lib/sh"
verbose(false) verbose(false)