<commit_before><commit_msg>added convenience helpers extension, mvd from the hadoop example<commit_after>=begin rdoc

== Convenience Helpers

Adds a few handy packages and aliases for developing poolparty instances.

== Usage

    has_convenience_helpers

== Examples

    $ inspect-poolparty-recipes # => will vim the poolparty chef recipe file
    $ cd-cookbooks              # => cd into the poolparty cookbooks directory
    $ tree                      # => show the directory structure as a nice tree
    /var/poolparty/dr_configure/chef/cookbooks/poolparty# tree
    .
    |-- attributes
    |   `-- poolparty.rb
    |-- recipes
    |   `-- default.rb
    `-- templates
        `-- default
            |-- etc
            |   |-- jvm.erb
            |   `-- motd.erb
            |-- home
            |   `-- hadoop
            |       `-- ssh
            |           `-- hadoop_id_rsa.erb
            `-- usr
                `-- local
                    `-- hadoop
                        `-- conf
                            |-- hadoop-env.sh.erb
                            `-- hadoop-site.xml.erb

=end

module PoolParty
  module Plugin
    class ConvenienceHelpers < Plugin
      def before_load(o={}, &block)
        add_packages
        add_aliases
        add_binaries
        add_profile_updates
      end

      def add_packages
        has_package "tree"
        has_package "vim-nox"
        has_package" screen"
        has_package" irb"
      end

      def add_aliases
        has_bash_alias :name => "inspect-poolparty-recipes", :value => "vi /var/poolparty/dr_configure/chef/cookbooks/poolparty/recipes/default.rb"
        has_bash_alias :name => "cd-cookbooks", :value => "pushd /var/poolparty/dr_configure/chef/cookbooks/poolparty"
      end

      def add_binaries
        has_exec "wget http://gist.github.com/raw/131294/0622454b2cc2f787c04d20ab3d47e888e31edcd4/gistfile1 -O /usr/bin/xtail && chmod +x /usr/bin/xtail", 
          :not_if => "test -e /usr/bin/xtail"
        has_exec "curl timkay.com/aws/aws -o /usr/bin/aws", :not_if => "test -e /usr/bin/aws"
      end

      def add_profile_updates
        has_exec %Q{echo \\"export PS1='\\\\u@\\\\h \\\\A \\\\w (#{cloud_name}) $ '\\" >> /root/.profile}, :not_if => "grep PS1 /root/.profile | grep #{cloud_name}"
        # bind '"\e[A":history-search-backward'
        # bind '"\e[B":history-search-forward'
      end

    end
  end
end


{'fraction_non_alphanumeric': 0.12158808933002481, 'fraction_numerical': 0.014061207609594707, 'mean_word_length': 1.6937639198218264, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, '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': '1441550', 'n_tokens_mistral': 817, 'n_tokens_neox': 775, 'n_words': 161}