class InfinumSetup::Base

Attributes

options[R]

Public Class Methods

install(options) click to toggle source
# File lib/infinum_setup/base.rb, line 7
def self.install(options)
  new(options).call
end
new(options = {}) click to toggle source
# File lib/infinum_setup/base.rb, line 3
def initialize(options = {})
  @options = options
end

Public Instance Methods

call() click to toggle source
# File lib/infinum_setup/base.rb, line 11
def call
  return unless team_programs.is_a?(Hash)
  programs.map(&:install)
end
programs() click to toggle source
# File lib/infinum_setup/base.rb, line 16
def programs
  @programs ||= team_programs.map do |name, settings|
    program_type(settings['type'], name).new(name, settings, options)
  end
end
team_programs(team = 'general') click to toggle source
# File lib/infinum_setup/base.rb, line 22
def team_programs(team = 'general')
  if InfinumSetup.dev?
    YAML.load_file("programs/#{team}.yml")
  else
    YAML.load(
      open("https://raw.github.com/infinum/infinum_setup/master/programs/#{team}.yml")
    )
  end
end

Private Instance Methods

interactive?() click to toggle source
# File lib/infinum_setup/base.rb, line 49
def interactive?
  options.interactive
end
program_type(type, name) click to toggle source
# File lib/infinum_setup/base.rb, line 36
def program_type(type, name)
  case type
  when 'brew' then Program::Brew
  when 'cask' then Program::Cask
  when 'gem' then Program::Gem
  when 'npm' then Program::Npm
  when 'script' then Program::Script
  when 'ruby_script' then Program::RubyScript
  else
    raise "#{name} -- Type #{type} not recognized"
  end
end
simulate?() click to toggle source
# File lib/infinum_setup/base.rb, line 53
def simulate?
  options.simulate
end