Sha256: 734c0b4bc0b6b73fa7a2c1881203dd3b70a03088e0bf08c438677167c83de5fa

Contents?: true

Size: 984 Bytes

Versions: 5

Compression:

Stored size: 984 Bytes

Contents

require "thor"

module Codelation
  class Cli < Thor
  private

    # Install dependencies for building and installing everything else.
    def install_dependencies
      unless `which brew`.length > 1
        print_command("Installing Homebrew from http://brew.sh")
        print_command("Re-run `codelation developer:install after Homebrew has been installed`")
        sleep 3
        exec('ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"')
      end
      run_command("brew update")
      formulas = %w(bash chruby git heroku-toolbelt imagemagick node openssl ruby-install shellcheck v8 wget)
      formulas.each do |formula|
        brew_install(formula)
      end
    end

    def brew_install(formula)
      run_command("brew unlink #{formula}") if outdated_formulas.include?("#{formula}\n")
      run_command("brew install #{formula}")
    end

    def outdated_formulas
      @outdated_formulas ||= `brew outdated`
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
codelation-cli-0.0.27 lib/codelation/development/dependencies.rb
codelation-cli-0.0.26 lib/codelation/development/dependencies.rb
codelation-cli-0.0.25 lib/codelation/development/dependencies.rb
codelation-cli-0.0.24 lib/codelation/development/dependencies.rb
codelation-cli-0.0.23 lib/codelation/development/dependencies.rb