Class: Homebrew
Instance Method Summary
collapse
Methods inherited from Config
#config_file, #create_workspace, #global, #workspace_directory
Instance Method Details
#brewfile ⇒ Object
19
20
21
|
# File 'lib/myosx/homebrew.rb', line 19
def brewfile
return File.join(Config.new.workspace_directory, 'Brewfile')
end
|
#brewfile_out(packages) ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'lib/myosx/homebrew.rb', line 23
def brewfile_out(packages)
output = ''
packages.each do |type, package_array|
package_array.each do |package|
output << "#{type} '#{package}'\n"
end
end
return output
end
|
#bundle ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/myosx/homebrew.rb', line 33
def bundle
system("brew tap Homebrew/bundle")
puts "Updating Brewfile"
File.open(brewfile, "w+") {
|file| file.write(brewfile_out(packages))
}
puts "Installing packages from #{brewfile}"
system("brew", "bundle", "--file=#{brewfile}")
end
|
#config ⇒ Object
11
12
13
|
# File 'lib/myosx/homebrew.rb', line 11
def config
Config.new.global['homebrew']
end
|
#exec ⇒ Object
45
46
47
|
# File 'lib/myosx/homebrew.rb', line 45
def exec
bundle
end
|
#packages ⇒ Object
15
16
17
|
# File 'lib/myosx/homebrew.rb', line 15
def packages
config['packages']
end
|