Sha256: 2a23534c1699e9f91df38b14f60d46ed4ce6b3211e0eb70fa27968b032c5fc9c

Contents?: true

Size: 998 Bytes

Versions: 4

Compression:

Stored size: 998 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 diff-so-fancy 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

4 entries across 4 versions & 1 rubygems

Version Path
codelation-cli-0.2.0 lib/codelation/development/dependencies.rb
codelation-cli-0.1.1 lib/codelation/development/dependencies.rb
codelation-cli-0.1.0 lib/codelation/development/dependencies.rb
codelation-cli-0.0.28 lib/codelation/development/dependencies.rb