Class: MacSetup::HomebrewRunner
- Inherits:
-
Object
- Object
- MacSetup::HomebrewRunner
- Defined in:
- lib/mac_setup/homebrew_runner.rb
Class Method Summary collapse
- .build_brewfile(config) ⇒ Object
- .install_cask(cask) ⇒ Object
- .print_args(opts) ⇒ Object
- .run(config, _status) ⇒ Object
Class Method Details
.build_brewfile(config) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/mac_setup/homebrew_runner.rb', line 19 def self.build_brewfile(config) brews = config.brews.map do |name, opts| [%(brew "#{name}"), print_args(opts)].compact.join(", ") end casks = (config.fonts + config.casks + config.quicklook).map do |name| "cask #{name}" end (brews + casks).join("\n") end |
.install_cask(cask) ⇒ Object
15 16 17 |
# File 'lib/mac_setup/homebrew_runner.rb', line 15 def self.install_cask(cask) Shell.run("brew cask install #{cask}") end |
.print_args(opts) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/mac_setup/homebrew_runner.rb', line 31 def self.print_args(opts) args = opts["args"] return unless args args_str = args.sort.map { |arg| %("#{arg}") }.join(", ") "args: [#{args_str}]" end |