<commit_before>require 'serverspec'
require 'pathname'

include Serverspec::Helper::Exec

# serverspec's FreeBSD support is craptastic. We'll just make it think
# it's executing on OS X.
if RUBY_PLATFORM =~ /freebsd/
  include Serverspec::Helper::Darwin
else
  include Serverspec::Helper::DetectOS
end

if RUBY_PLATFORM =~ /darwin/
  describe command('pkgutil --pkg-info=com.apple.pkg.CLTools_Executables') do
    it { should return_exit_status 0 }
  end
end

describe 'ccache' do
  describe command('/usr/local/bin/ccache --version') do
    it { should return_stdout(/3\.1\.9/) }
  end

  %w(gcc g++ cc c++).each do |compiler|
    describe file("/usr/local/bin/#{compiler}") do
      it { should be_linked_to('/usr/local/bin/ccache') }
    end
  end
end

describe 'ruby' do
  describe command('/usr/local/bin/ruby --version') do
    it { should return_stdout(/^ruby 2\.1\.1(.+)/) }
  end
end

describe 'bash' do
  describe command('/usr/local/bin/bash --version') do
    it { should return_stdout(/4\.3/) }
  end
end

describe 'git' do
  describe command('/usr/local/bin/git --version') do
    it { should return_stdout(/1\.9\.0/) }
  end
end

describe '$PATH' do
  # On RHEL, +sudo+ does not execute a login shell by default. We can't simply
  # check the $PATH because ServerSpec doesn't execute a login shell
  # automatically.
  describe command("su - omnibus -c 'echo $PATH'") do
    it { should return_stdout(%r{^/usr/local/bin(.+)}) }
  end
end<commit_msg>Check for the omnibus user<commit_after>require 'serverspec'
require 'pathname'

include Serverspec::Helper::Exec

# serverspec's FreeBSD support is craptastic. We'll just make it think
# it's executing on OS X.
if RUBY_PLATFORM =~ /freebsd/
  include Serverspec::Helper::Darwin
else
  include Serverspec::Helper::DetectOS
end

if RUBY_PLATFORM =~ /darwin/
  describe command('pkgutil --pkg-info=com.apple.pkg.CLTools_Executables') do
    it { should return_exit_status 0 }
  end
end

describe 'ccache' do
  describe command('/usr/local/bin/ccache --version') do
    it { should return_stdout(/3\.1\.9/) }
  end

  %w(gcc g++ cc c++).each do |compiler|
    describe file("/usr/local/bin/#{compiler}") do
      it { should be_linked_to('/usr/local/bin/ccache') }
    end
  end
end

describe 'ruby' do
  describe command('/usr/local/bin/ruby --version') do
    it { should return_stdout(/^ruby 2\.1\.1(.+)/) }
  end
end

describe 'bash' do
  describe command('/usr/local/bin/bash --version') do
    it { should return_stdout(/4\.3/) }
  end
end

describe 'git' do
  describe command('/usr/local/bin/git --version') do
    it { should return_stdout(/1\.9\.0/) }
  end
end

describe '$PATH' do
  # On RHEL, +sudo+ does not execute a login shell by default. We can't simply
  # check the $PATH because ServerSpec doesn't execute a login shell
  # automatically.
  describe command("su - omnibus -c 'echo $PATH'") do
    it { should return_stdout(%r{^/usr/local/bin(.+)}) }
  end
end

describe user('omnibus') do
  it { should exist }
  it { should have_login_shell '/bin/bash' }
end
{'fraction_non_alphanumeric': 0.1400854981913844, 'fraction_numerical': 0.007892140743176587, 'mean_word_length': 3.4538799414348462, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6075266', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1026, 'n_words': 306}