Module: Brewmaster

Defined in:
lib/brewmaster.rb,
lib/brewmaster/cli.rb,
lib/brewmaster/version.rb,
lib/brewmaster/coordinator.rb,
lib/brewmaster/configuration.rb,
lib/brewmaster/brew_collection.rb,
lib/brewmaster/cask_collection.rb,
lib/brewmaster/ruby_collection.rb

Defined Under Namespace

Classes: BrewCollection, CLI, CaskCollection, Configuration, Coordinator, RubyCollection

Constant Summary collapse

BOOTSTRAP_CONFIG_PATH =
File.expand_path('~/.bootstrap.yml')
VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.bootstrap!Object



7
8
9
10
11
12
# File 'lib/brewmaster.rb', line 7

def self.bootstrap!
  install_homebrew
  install_brew_cask
  setup_load_paths
  install_ruby_tools
end

.install_brew_caskObject



22
23
24
25
# File 'lib/brewmaster.rb', line 22

def self.install_brew_cask
  `brew tap phinze/homebrew-cask`
  `brew install brew-cask`
end

.install_homebrewObject



14
15
16
# File 'lib/brewmaster.rb', line 14

def self.install_homebrew
  `ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"`
end

.install_ruby_toolsObject



27
28
29
# File 'lib/brewmaster.rb', line 27

def self.install_ruby_tools
  BrewCollection.new(['chruby', 'ruby-build']).install_missing
end

.setup_brew_cask_load_pathObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/brewmaster.rb', line 52

def self.setup_brew_cask_load_path
  begin
    # build brew-cask into loadpath
    cask_bin = `which brew-cask.rb`.strip
    cask_bin_path = `dirname #{cask_bin}`.strip
    cask_bin_link = `readlink #{cask_bin}`.strip
    cask_real_path = Pathname.new(File.join(cask_bin_path,cask_bin_link)).realpath

    $: << File.expand_path('../../rubylib', cask_real_path)

    require 'cask'
  rescue => e
    puts 'You seem to be missing brew-cask'
  end
end

.setup_homebrew_load_pathObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/brewmaster.rb', line 36

def self.setup_homebrew_load_path
  begin
    # build homebrew into loadpath
    $: << File.join(`brew --prefix`.strip, 'Library', 'Homebrew')

    require 'global'
    require 'formula'
    require 'keg'
    require 'cmd/install'
    require 'cmd/outdated'
    require 'cmd/upgrade'
  rescue
    puts 'You seem to be missing homebrew'
  end
end

.setup_load_pathsObject



31
32
33
34
# File 'lib/brewmaster.rb', line 31

def self.setup_load_paths
  setup_homebrew_load_path
  setup_brew_cask_load_path
end

.update_homebrewObject



18
19
20
# File 'lib/brewmaster.rb', line 18

def self.update_homebrew
  `brew update`
end