<commit_before>#
# Cookbook Name:: rs_sandbox
# Recipe:: default
#
#  Copyright 2011 <NAME>
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.

grep_bin = value_for_platform("windows" => {"default" => "findstr"}, "default" => "grep")

# TODO: Is there a better way to do this? Like an attributes/windows.rb file?
if node[:platform] == "windows"
  node[:rs_sandbox][:home] = `echo %RS_SANDBOX_HOME%`.strip
  node[:rs_sandbox][:gem_bin] = "#{node[:rs_sandbox][:home]}\\Ruby\\bin\\ruby.exe #{node[:rs_sandbox][:home]}\\Ruby\\bin\\gem"
  node[:rs_sandbox][:rl_user_home_dir] = `echo %USERPROFILE%`.strip
  
  gem_source_already_added = `#{node[:rs_sandbox][:gem_bin]} sources --list | #{grep_bin} "http://rubygems.org"`
  
  if gem_source_already_added.strip == ""
    Chef::Log.info("Adding http://rubygems.org to gem source for RightScale sandbox")
    `#{node[:rs_sandbox][:gem_bin]} sources --add http://rubygems.org/`
  end
else
  t = template "/root/.gemrc" do
    source "gemrc.erb"
  end
  
  t.run_action(:create)
end
<commit_msg>Revert "Do it in the compile phase yo"<commit_after>#
# Cookbook Name:: rs_sandbox
# Recipe:: default
#
#  Copyright 2011 <NAME>
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.

grep_bin = value_for_platform("windows" => {"default" => "findstr"}, "default" => "grep")

# TODO: Is there a better way to do this? Like an attributes/windows.rb file?
if node[:platform] == "windows"
  node[:rs_sandbox][:home] = `echo %RS_SANDBOX_HOME%`.strip
  node[:rs_sandbox][:gem_bin] = "#{node[:rs_sandbox][:home]}\\Ruby\\bin\\ruby.exe #{node[:rs_sandbox][:home]}\\Ruby\\bin\\gem"
  node[:rs_sandbox][:rl_user_home_dir] = `echo %USERPROFILE%`.strip
  
  gem_source_already_added = `#{node[:rs_sandbox][:gem_bin]} sources --list | #{grep_bin} "http://rubygems.org"`
  
  if gem_source_already_added.strip == ""
    Chef::Log.info("Adding http://rubygems.org to gem source for RightScale sandbox")
    `#{node[:rs_sandbox][:gem_bin]} sources --add http://rubygems.org/`
  end
else
  template "/root/.gemrc" do
    source "gemrc.erb"
  end
end

{'fraction_non_alphanumeric': 0.14215686274509803, 'fraction_numerical': 0.00522875816993464, 'mean_word_length': 4.495511669658887, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7234978', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1015, 'n_words': 303}