Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #179 from roderik/improvement/bash-it

Globally installed bash-it
  • Loading branch information...
commit 11fa0d8abb2ebfd5cc69baa16083e15123083b61 2 parents e04aa47 + 3025611
Matthew Kocher mkocher authored
5 attributes/bash_it.rb
@@ -10,5 +10,8 @@
10 10 bash_it/custom/ensure_usr_local_bin_first.bash
11 11 bash_it/custom/add_user_initials_to_git_prompt_info.bash
12 12 ],
13   - 'theme' => 'bobby'
  13 + 'theme' => 'bobby',
  14 + 'dir' => ::File.expand_path(".bash_it", WS_HOME),
  15 + 'bashrc_path' => ::File.expand_path(".bash_profile", WS_HOME),
  16 + 'repository' => 'http://github.com/revans/bash-it.git'
14 17 }
2  attributes/bash_profile_include.rb
... ... @@ -1,2 +0,0 @@
1   -node.default["bash_includes_subdir"]="#{WS_HOME}/.bash_profile_includes"
2   -node.default["bash_bashrc"]="#{WS_HOME}/.bash_profile"
2  providers/bash_it_custom_plugin.rb
... ... @@ -1,6 +1,6 @@
1 1 action :create do
2 2 script_name = ::File.basename(new_resource.name)
3   - bash_it_custom_dir = ::File.join(::BASH_IT_DIR, "custom")
  3 + bash_it_custom_dir = ::File.join(node['bash_it']['dir'], "custom")
4 4
5 5 template ::File.expand_path(script_name, bash_it_custom_dir) do
6 6 source new_resource.name
2  providers/bash_it_enable_feature.rb
@@ -9,7 +9,7 @@ def script_type(type)
9 9 (type == 'plugins') ? 'plugin' : type
10 10 end
11 11
12   - type_dir = ::File.expand_path(type, BASH_IT_DIR)
  12 + type_dir = ::File.expand_path(type, node['bash_it']['dir'])
13 13 enabled_dir = ::File.expand_path("enabled", type_dir)
14 14 available_dir = ::File.expand_path("available", type_dir)
15 15
22 providers/bash_profile_include.rb
... ... @@ -1,22 +0,0 @@
1   -action :create do
2   -
3   - directory node["bash_includes_subdir"] do
4   - owner WS_USER
5   - end
6   -
7   - template node["bash_bashrc"] do
8   - source "bash_profile.erb"
9   - cookbook 'pivotal_workstation'
10   - owner WS_USER
11   - mode "0755"
12   - variables({
13   - :subdir => node["bash_includes_subdir"]
14   - })
15   - end
16   -
17   - template "#{node["bash_includes_subdir"]}/#{new_resource.name}.sh" do
18   - source "bash_profile-#{new_resource.name}.sh.erb"
19   - owner WS_USER
20   - mode "0755"
21   - end
22   -end
32 recipes/bash_it.rb
... ... @@ -1,35 +1,27 @@
1   -::BASH_IT_DIR = ::File.expand_path(".bash_it", WS_HOME)
2 1 bash_it_version = version_string_for('bash_it')
3 2
4 3 git "#{Chef::Config[:file_cache_path]}/bash_it" do
5   - repository 'http://github.com/revans/bash-it.git'
  4 + repository node['bash_it']['repository']
6 5 revision bash_it_version
7 6 destination "#{Chef::Config[:file_cache_path]}/bash_it"
8 7 action :sync
9 8 end
10 9
11   -execute "Copying bash-it's .git to #{BASH_IT_DIR}" do
12   - command "rsync -axSH #{Chef::Config[:file_cache_path]}/bash_it/ #{BASH_IT_DIR}"
13   - user WS_USER
14   -end
15   -
16   -template ::File.expand_path(".bash_it_theme", WS_HOME) do
17   - source "bash_it/theme.erb"
  10 +directory node['bash_it']['dir'] do
18 11 owner WS_USER
  12 + mode "0777"
19 13 end
20 14
21   -execute "add BASH_IT configuration to .bash_profile" do
22   - configuration = <<-CONFIGURATION.gsub(/^\s+/, '')
23   - # START-BASH_IT
24   - export BASH_IT=$HOME/.bash_it
25   - source $HOME/.bash_it_theme
26   -
27   - source $BASH_IT/bash_it.sh
28   - # END-BASH_IT
29   - CONFIGURATION
30   - command "echo '#{configuration}' >> #{WS_HOME}/.bash_profile"
  15 +execute "Copying bash-it's .git to #{node['bash_it']['dir']}" do
  16 + command "rsync -axSH #{Chef::Config[:file_cache_path]}/bash_it/ #{node['bash_it']['dir']}"
31 17 user WS_USER
32   - not_if "grep 'START-BASH_IT' #{WS_HOME}/.bash_profile"
  18 +end
  19 +
  20 +template node['bash_it']['bashrc_path'] do
  21 + source "bash_it/bashrc.erb"
  22 + cookbook 'pivotal_workstation'
  23 + owner WS_USER
  24 + mode "0777"
33 25 end
34 26
35 27 node['bash_it']['enabled_plugins'].each do |feature_type, features|
10 templates/default/bash_it/bashrc.erb
... ... @@ -0,0 +1,10 @@
  1 +export PATH="/usr/local/bin:$PATH"
  2 +
  3 +# Path to the bash it configuration
  4 +export BASH_IT="<%= node["bash_it"]["dir"] %>"
  5 +
  6 +# Lock and Load a custom theme file
  7 +export BASH_IT_THEME="<%= node["bash_it"]["theme"] %>"
  8 +
  9 +# Load Bash It
  10 +source $BASH_IT/bash_it.sh
1  templates/default/bash_it/theme.erb
... ... @@ -1 +0,0 @@
1   -export BASH_IT_THEME="<%= node["bash_it"]["theme"] %>"

0 comments on commit 11fa0d8

Please sign in to comment.
Something went wrong with that request. Please try again.