Class: Sambot::Workflow::Workstation
- Inherits:
-
Object
- Object
- Sambot::Workflow::Workstation
- Defined in:
- lib/sambot/workflow/workstation.rb
Constant Summary collapse
- FORMULAS =
{ 'git': 'git', 'vault': 'vault', 'haproxy': 'haproxy', 'ruby-build': 'ruby-build', 'rbenv': 'rbenv' }
- CASKS =
{ 'virtualbox': 'virtualbox', 'vagrant': 'vagrant', 'chefdk': 'chef' }
- XCODE_INSTALLATION_SCRIPT =
'xcode-select --install'
Class Method Summary collapse
- .configure(username) ⇒ Object
- .install_casks(brew) ⇒ Object
- .install_formulas(brew) ⇒ Object
- .install_native_binaries ⇒ Object
- .update_environment_variables ⇒ Object
- .update_ruby ⇒ Object
Class Method Details
.configure(username) ⇒ Object
25 26 27 28 29 |
# File 'lib/sambot/workflow/workstation.rb', line 25 def self.configure(username) update_environment_variables install_native_binaries UI.info('Your workstation is now ready for use - please close this shell and open up a new one to start making use of your new environment') end |
.install_casks(brew) ⇒ Object
44 45 46 47 48 |
# File 'lib/sambot/workflow/workstation.rb', line 44 def self.install_casks(brew) CASKS.each do |formula, binary| brew.install_cask(formula, binary) end end |
.install_formulas(brew) ⇒ Object
50 51 52 53 54 |
# File 'lib/sambot/workflow/workstation.rb', line 50 def self.install_formulas(brew) FORMULAS.each do |formula, binary| brew.install_formula(formula, binary) end end |
.install_native_binaries ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sambot/workflow/workstation.rb', line 31 def self.install_native_binaries if `xcode-select version` UI.info("Not installing XCode Developer Tools as they are already present") else system(XCODE_INSTALLATION_SCRIPT) end brew = Brew.new brew.configure install_formulas(brew) install_casks(brew) update_ruby end |
.update_environment_variables ⇒ Object
56 57 58 59 |
# File 'lib/sambot/workflow/workstation.rb', line 56 def self.update_environment_variables UI.debug('Updating your Vault environment variables') Vault.setup_environment(Session::FORWARDS) end |
.update_ruby ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/sambot/workflow/workstation.rb', line 61 def self.update_ruby profile = File.read(File.("~/.bash_profile")) `echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile` unless /rbenv init/.match(profile) current_ruby = `ruby -v` if /ruby 2\.4/.match(current_ruby) UI.info("Ruby 2.4.0 is already installed") else UI.info("Installing Ruby 2.4.0") `rbenv install 2.4.0` `rbenv global 2.4.0` end end |