ahalogy-automation 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/ahalogy-automation.gemspec +4 -4
- data/bin/a5y-configure +178 -182
- data/lib/ahalogy/install-helper.rb +18 -7
- metadata +15 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ba9385a1723584f9cedfd001dc0f6bdeb608c96
|
4
|
+
data.tar.gz: d0f8641b84854d7b45522b0df9519c129d6d7d43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16e3afbed2d39426d22c0125d21f9b940aba6e83a0d9272784e075e9b8070b1af3043cd118ec2dced26ee09d9c7e0862b8f0c511c6decf743a4a04eaa6805042
|
7
|
+
data.tar.gz: 376de91809e352a2778db8a8a0ce73c484172661e8cff3f76dc276b53bc7b53e4ea0e20a213e3b47e257f86e0e60be696f0cada9c90f1315a21d718d0f179e4d
|
data/Rakefile
CHANGED
data/ahalogy-automation.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'ahalogy-automation'
|
3
|
-
gem.version = '0.0.
|
3
|
+
gem.version = '0.0.4'
|
4
4
|
gem.licenses = ['MIT']
|
5
|
-
gem.date = '2015-
|
5
|
+
gem.date = '2015-05-05'
|
6
6
|
gem.summary = 'Scripts to handle IT automation.'
|
7
7
|
gem.description = 'Script that installs many applications on Ahalogy Mac computers.'
|
8
8
|
gem.authors = ['Zan Loy']
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.executables = ['a5y-configure']
|
13
13
|
|
14
14
|
gem.add_runtime_dependency 'colorize', '~> 0'
|
15
|
-
gem.add_runtime_dependency 'daybreak', '~> 0.3.0'
|
16
|
-
gem.add_runtime_dependency 'github_api', '~> 0.12.3'
|
15
|
+
gem.add_runtime_dependency 'daybreak', '~> 0.3', '>= 0.3.0'
|
16
|
+
gem.add_runtime_dependency 'github_api', '~> 0.12', '>= 0.12.3'
|
17
17
|
gem.add_runtime_dependency 'highline', '~> 1.7'
|
18
18
|
end
|
data/bin/a5y-configure
CHANGED
@@ -7,221 +7,217 @@ require 'github_api'
|
|
7
7
|
require 'highline/import'
|
8
8
|
require 'optparse'
|
9
9
|
|
10
|
-
|
10
|
+
user = ENV['USER']
|
11
|
+
fail 'This script should not be run as root.' if user == 'root'
|
12
|
+
|
13
|
+
groups = [:developer, :pinner, :cs, :designer]
|
11
14
|
options = {
|
12
|
-
:
|
13
|
-
:
|
15
|
+
groups: [:default],
|
16
|
+
verbose: false,
|
17
|
+
skip_filevault: false,
|
18
|
+
skip_github: false,
|
14
19
|
}
|
15
20
|
OptionParser.new do |opts|
|
16
21
|
groups.each do |group|
|
17
22
|
opts.on("--#{group}", "Install apps for #{group} group.") { options[:groups] << group }
|
18
23
|
end
|
19
|
-
opts.on(
|
24
|
+
opts.on('--all', 'Install all group apps.') { options[:groups] += groups }
|
25
|
+
opts.on('-l', '--list', 'List available groups.') do
|
20
26
|
puts "Available groups: #{groups.join(', ')}"
|
21
27
|
exit
|
22
28
|
end
|
23
|
-
opts.on(
|
24
|
-
opts.on(
|
29
|
+
opts.on('--skip-filevault', 'Skip configuration of FileVault.') { options[:skip_filevault] = true }
|
30
|
+
opts.on('--skip-github', 'Skip configuration of GitHub sshkey') { options[:skip_github] = true }
|
31
|
+
opts.on('-a', '--ask', '"Ask to confirm settings stored in settings database.') { options[:ask] = true }
|
32
|
+
opts.on('-d', '--debug', 'Enable debug messaging.') { options[:verbose] = true }
|
25
33
|
end.parse!
|
26
34
|
|
27
35
|
# Open settings database
|
28
36
|
db = Daybreak::DB.new File.expand_path('~/.ahalogy.db'), default: ''
|
29
37
|
# Verify values are already in the database or ask for them
|
30
|
-
|
31
|
-
db[:github_username]
|
32
|
-
|
33
|
-
|
34
|
-
db[:
|
38
|
+
unless options[:skip_github]
|
39
|
+
if options[:ask] or db[:github_username].empty?
|
40
|
+
db[:github_username] = ask('GitHub Username? (leave blank to skip)')
|
41
|
+
end
|
42
|
+
if !db[:github_username].empty? and (options[:ask] or db[:github_password].empty?)
|
43
|
+
db[:github_password] = ask('GitHub Password?') { |q| q.echo = 'x' }
|
44
|
+
end
|
35
45
|
end
|
46
|
+
|
36
47
|
db.flush # Write changes to disk.
|
37
48
|
|
38
|
-
cleanup = []
|
39
49
|
notes = []
|
40
50
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
run_cmd "xcode-select --install", "Installing Xcode CLI tools."
|
46
|
-
else
|
47
|
-
puts "Xcode CLI tools is already installed...skipped.".colorize(:green)
|
48
|
-
end
|
49
|
-
## Install full xcode
|
50
|
-
system 'xcodebuild &> /dev/null'
|
51
|
-
case $?.exitstatus
|
52
|
-
when 1
|
53
|
-
fail "The full xcode developer application needs to be installed before running this script."
|
54
|
-
when 69
|
55
|
-
puts "You need to agree to the Xcode license before continuing...".colorize(:red)
|
56
|
-
system("sudo xcodebuild -license")
|
51
|
+
begin
|
52
|
+
if options[:groups].include? :default
|
53
|
+
## Install xcode command line tools
|
54
|
+
system('xcode-select -v')
|
57
55
|
if $? != 0
|
58
|
-
|
56
|
+
run_cmd 'xcode-select --install', 'Installing Xcode CLI tools.'
|
57
|
+
else
|
58
|
+
puts 'Xcode CLI tools is already installed...skipped.'.colorize(:green)
|
59
|
+
end
|
60
|
+
## Install full xcode
|
61
|
+
system 'xcodebuild &> /dev/null'
|
62
|
+
case $?.exitstatus
|
63
|
+
when 1
|
64
|
+
fail 'The full xcode developer application needs to be installed before running this script.'.colorize(:red)
|
65
|
+
when 69
|
66
|
+
puts 'You need to agree to the Xcode license before continuing...'.colorize(:red)
|
67
|
+
system('sudo xcodebuild -license')
|
68
|
+
if $? != 0
|
69
|
+
fail 'Xcode is not configured correctly.'
|
70
|
+
end
|
59
71
|
end
|
60
|
-
end
|
61
72
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
github = Github.new basic_auth: "#{db[:github_username]}:#{db[:github_password]}"
|
71
|
-
unless github
|
72
|
-
puts 'Authenication with GitHub failed.'.colorize(:red)
|
73
|
-
puts 'If this is because you have previously entered the wrong username or password, re-run the script with the --ask argument.'
|
74
|
-
exit 1
|
73
|
+
# Enable FileVault
|
74
|
+
unless options[:skip_filevault]
|
75
|
+
begin
|
76
|
+
run_cmd "sudo fdesetup enable -user admin -usertoadd #{user}", 'Enabling FileVault... (skip by re-running script with --skip-filevault)'
|
77
|
+
notes << 'FileVault was enabled. You will need to reboot to start the encryption process.'
|
78
|
+
rescue
|
79
|
+
puts 'FileVault already enabled...skipped'.colorize(:green)
|
80
|
+
end
|
75
81
|
end
|
76
|
-
|
77
|
-
|
78
|
-
|
82
|
+
|
83
|
+
unless options[:skip_github]
|
84
|
+
# Let's setup our sshkey and github
|
85
|
+
if File.exists? File.expand_path('~/.ssh/id_rsa')
|
86
|
+
puts 'sshkey exists... skipped.'.colorize(:green)
|
87
|
+
else
|
88
|
+
run_cmd "ssh-keygen -f ~/.ssh/id_rsa -N ''", 'Generating sshkey.'
|
89
|
+
end
|
90
|
+
unless db[:github_username].empty?
|
91
|
+
local_key = File.read(File.expand_path('~/.ssh/id_rsa.pub')).split[0...-1].join(' ')
|
92
|
+
github = Github.new basic_auth: "#{db[:github_username]}:#{db[:github_password]}"
|
93
|
+
unless github
|
94
|
+
puts 'Authenication with GitHub failed.'.colorize(:red)
|
95
|
+
puts 'If this is because you have previously entered the wrong username or password, re-run the script with the --ask argument.'
|
96
|
+
fail
|
97
|
+
end
|
98
|
+
upload_key = true
|
99
|
+
github.users.keys.list.each do |entry|
|
100
|
+
upload_key = false if entry[:key] == local_key
|
101
|
+
end
|
102
|
+
if upload_key
|
103
|
+
github.users.keys.create title: 'uploaded via ahalogy-automation', key: local_key
|
104
|
+
else
|
105
|
+
puts 'SSH Key already installed on GitHub...skipped.'.colorize(:green)
|
106
|
+
end
|
107
|
+
end
|
79
108
|
end
|
80
|
-
|
81
|
-
|
109
|
+
|
110
|
+
# Enable system firewall
|
111
|
+
run_cmd 'sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 1', 'Enabling firewall.'
|
112
|
+
|
113
|
+
# Install homebrew
|
114
|
+
if File.exists? '/usr/local/bin/brew'
|
115
|
+
puts 'Homebrew already installed...skipped.'.colorize(:green)
|
82
116
|
else
|
83
|
-
|
117
|
+
run_cmd 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"', "Installing homebrew."
|
118
|
+
run_cmd 'brew doctor', 'Verifying Homebrew Install...'
|
84
119
|
end
|
85
|
-
end
|
86
|
-
|
87
|
-
# Enable FileVault
|
88
|
-
# run_cmd "sudo fdesetup enable -user admin -usertoadd enduser"
|
89
120
|
|
90
|
-
|
91
|
-
|
121
|
+
puts '*** STARTING APP INSTALLATION... NO FURTHER INPUT REQUIRED (hopefully) ***'.colorize(:red)
|
122
|
+
|
123
|
+
# Tap casks
|
124
|
+
run_cmd 'brew install caskroom/cask/brew-cask', 'Installing brew-cask...'
|
125
|
+
run_cmd 'brew tap caskroom/cask', 'Tapping caskroom/cask...'
|
126
|
+
run_cmd 'brew tap caskroom/fonts', 'Tapping caskroom/fonts...'
|
127
|
+
run_cmd 'brew tap caskroom/versions', 'Tapping caskroom/versions...'
|
128
|
+
run_cmd 'brew tap homebrew/dupes', 'Tapping homebrew/dupes...'
|
129
|
+
run_cmd 'brew tap homebrew/versions', 'Tapping homebrew/versions...'
|
130
|
+
|
131
|
+
### Install Applications
|
132
|
+
# BackBlaze
|
133
|
+
install_cask 'backblaze'
|
134
|
+
notes << "If this is the first run of the Ahalogy installer script, you will need to install BackBlaze by running:\n open '/opt/homebrew-cask/Caskroom/backblaze/latest/Backblaze Installer.app'"
|
135
|
+
# Hidden.app
|
136
|
+
target_dir = File.expand_path('~/Downloads')
|
137
|
+
filename = File.join(target_dir, 'hidden2.1.zip')
|
138
|
+
unless File.exists? filename
|
139
|
+
cmd = "curl -o #{filename} https://hiddenapp.com/static/downloads/hidden2.1.zip"
|
140
|
+
run_cmd(cmd, 'Downloading Hiddenapp...')
|
141
|
+
run_cmd "cd ~/Downloads && unzip -o #{filename}", 'Unzipping hiddenapp payload...'
|
142
|
+
notes << 'You will need to manually install Hidden.app. It has been unzipped in ~/Downloads.'
|
143
|
+
end
|
144
|
+
# Apps via Brew
|
145
|
+
install_brew [:git, :python, :python3, :cassandra]
|
146
|
+
install_brew 'macvim', '--override-system-vim --with-python3'
|
147
|
+
# Apps via Cask
|
148
|
+
install_cask [:github, 'google-chrome', 'google-drive', :screenhero, :textmate, :zoomus]
|
149
|
+
install_file 'vimrc', '~/.vimrc'
|
150
|
+
if File.directory? File.expand_path('~/.vim/bundle/Vundle.vim')
|
151
|
+
run_cmd 'cd ~/.vim/bundle/Vundle.vim && git pull', 'Updating Vundle via GitHub...'
|
152
|
+
else
|
153
|
+
run_cmd 'git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim', 'Installing Vundle via GitHub...'
|
154
|
+
end
|
155
|
+
run_cmd 'vim +BundleClean +BundleInstall +qall', 'Configuring Vundle...'
|
156
|
+
end # options[:groups] = default
|
157
|
+
|
158
|
+
if options[:groups].include? :developer
|
159
|
+
puts "### Starting installation of developer apps... ###"
|
160
|
+
install_brew [:node, :phantomjs, 'homebrew/versions/postgresql92', :redis, 'ruby-build', :nvm, :pow, :rbenv]
|
161
|
+
install_cask ['1password', :alfred, :anvil, :dash, :slack, :tower]
|
162
|
+
# Setup cql
|
163
|
+
run_cmd 'pip install cql &> /dev/null', 'Installing cql python module via pip...'
|
164
|
+
run_cmd 'pip3 install cql &> /dev/null', 'Installing cql python3 module via pip3...'
|
165
|
+
# Setup nvm
|
166
|
+
mkdir '~/.nvm'
|
167
|
+
add_line_to_file '~/.zshrc', 'export NVM_DIR=~/.nvm'
|
168
|
+
add_line_to_file '~/.zshrc', 'source $(brew --prefix nvm)/nvm.sh'
|
169
|
+
# Setup pow
|
170
|
+
if not File.directory? File.expand_path('~/Library/Application Support/Pow/Hosts')
|
171
|
+
run_cmd 'mkdir -p ~/Library/Application\ Support/Pow/Hosts', 'Creating support directory for pow hosts...'
|
172
|
+
end
|
173
|
+
if not File.symlink? File.expand_path('~/.pow')
|
174
|
+
run_cmd 'ln -s ~/Library/Application\ Support/Pow/Hosts ~/.pow', 'Symlinking pow hosts directory to ~/.pow ...'
|
175
|
+
end
|
176
|
+
run_cmd 'sudo pow --install-system', 'Configuring port 80 forwarding for pow...'
|
177
|
+
run_cmd 'pow --install-local', 'Configuring launchd agent for pow...'
|
178
|
+
run_cmd 'sudo launchctl load -w /Library/LaunchDaemons/cx.pow.firewall.plist', 'Configuring pow launchd agent to start on boot...'
|
179
|
+
run_cmd 'launchctl load -w ~/Library/LaunchAgents/cx.pow.powd.plist', 'Starting pow...'
|
180
|
+
# Setup rbenv
|
181
|
+
system("grep -q -F 'export RBENV_ROOT=/usr/local/var/rbenv' /etc/profile")
|
182
|
+
if $? != 0
|
183
|
+
run_cmd "echo 'export RBENV_ROOT=/usr/local/var/rbenv' | sudo tee -a /etc/profile > /dev/null", "Adding RBENV_ROOT to /etc/profile..."
|
184
|
+
end
|
185
|
+
system("grep -q -F 'rbenv init -' /etc/profile")
|
186
|
+
if $? != 0
|
187
|
+
run_cmd %q[echo 'eval "$(rbenv init -)"' | sudo tee -a /etc/profile > /dev/null], "Adding rbenv init to /etc/profile..."
|
188
|
+
end
|
189
|
+
mkdir '/usr/local/var/rbenv'
|
190
|
+
mkdir '/usr/local/var/rbenv/plugins'
|
191
|
+
if File.exists? '/usr/local/var/rbenv/plugins/rbenv-gem-rehash'
|
192
|
+
puts 'rbenv-gem-rehash already installed...skipped.'.colorize(:green)
|
193
|
+
else
|
194
|
+
run_cmd 'sudo git clone https://github.com/sstephenson/rbenv-gem-rehash.git /usr/local/var/rbenv/plugins/rbenv-gem-rehash', "Installing rbenv-gem-rehash..."
|
195
|
+
end
|
196
|
+
# OH MY ZSH!
|
197
|
+
if not File.directory? File.expand_path('~/.oh-my-zsh')
|
198
|
+
run_cmd "curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh", "Installing oh-my-zsh..."
|
199
|
+
end
|
200
|
+
# Set the default terminal theme to something more bareable.
|
201
|
+
#run_cmd 'defaults write com.apple.Terminal "Default Window Settings" "Pro"'
|
202
|
+
end # options[:groups] = developer
|
92
203
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
else
|
97
|
-
run_cmd 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"', "Installing homebrew."
|
98
|
-
run_cmd 'brew doctor', 'Verifying Homebrew Install...'
|
204
|
+
if options[:groups].include? :pinner
|
205
|
+
install_cask ['adobe-creative-cloud', 'microsoft-office', :joinme]
|
206
|
+
notes << "If this is the first time running a5y-configure, you will need to manually install Adobe Creative Cloud by running:\n open '/opt/homebrew-cask/Caskroom/adobe-creative-cloud/latest/Creative Cloud Installer.app'"
|
99
207
|
end
|
100
208
|
|
101
|
-
|
102
|
-
|
103
|
-
run_cmd 'brew tap caskroom/cask', 'Tapping caskroom/cask...'
|
104
|
-
run_cmd 'brew tap caskroom/fonts', 'Tapping caskroom/fonts...'
|
105
|
-
run_cmd 'brew tap caskroom/versions', 'Tapping caskroom/versions...'
|
106
|
-
run_cmd 'brew tap homebrew/dupes', 'Tapping homebrew/dupes...'
|
107
|
-
run_cmd 'brew tap homebrew/versions', 'Tapping homebrew/versions...'
|
108
|
-
|
109
|
-
### Install Applications
|
110
|
-
# BackBlaze
|
111
|
-
install_cask 'backblaze' # Will require cleanup task to run installer.
|
112
|
-
#cleanup << %q[run_cmd "open -a '/opt/homebrew-cask/Caskroom/backblaze/latest/Backblaze Installer.app'", 'Installing BackBlaze.']
|
113
|
-
notes << "If this is the first run of the Ahalogy installer script, you will need to install BackBlaze by running:\n open -a '/opt/homebrew-cask/Caskroom/backblaze/latest/Backblaze Installer.app'"
|
114
|
-
# Hidden.app
|
115
|
-
target_dir = File.expand_path('~/Downloads')
|
116
|
-
filename = File.join(target_dir, 'hidden2.1.zip')
|
117
|
-
cmd = "curl -o #{filename} https://hiddenapp.com/static/downloads/hidden2.1.zip"
|
118
|
-
run_cmd cmd, 'Downloading Hiddenapp...'
|
119
|
-
run_cmd "cd ~/Downloads && unzip -o #{filename}", 'Unzipping hiddenapp payload...'
|
120
|
-
#cleanup << %Q[run_cmd "sudo installer -pkg '#{target_dir}/hidden2.1/Hidden.pkg' -target /", 'Installing Hiddenapp...']
|
121
|
-
notes << 'You will need to manually install Hidden.app. It has been unzipped in ~/Downloads.'
|
122
|
-
# git
|
123
|
-
install_brew 'git' # No further configuration required.
|
124
|
-
# github
|
125
|
-
install_cask 'github' # Configuration will occur on first run of application.
|
126
|
-
# Google Chrome
|
127
|
-
install_cask 'google-chrome' # No further configuration required.
|
128
|
-
# Google Drive
|
129
|
-
install_cask 'google-drive' # Configuration will occur on first run of application.
|
130
|
-
# MacVim
|
131
|
-
install_brew 'macvim', '--override-system-vim --with-python3'
|
132
|
-
install_file 'vimrc', '~/.vimrc'
|
133
|
-
if File.directory? File.expand_path('~/.vim/bundle/Vundle.vim')
|
134
|
-
run_cmd 'cd ~/.vim/bundle/Vundle.vim && git pull', 'Updating Vundle via GitHub...'
|
135
|
-
else
|
136
|
-
run_cmd 'git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim', 'Installing Vundle via GitHub...'
|
137
|
-
end
|
138
|
-
run_cmd 'vim +BundleClean +BundleInstall +qall', 'Configuring Vundle...'
|
139
|
-
# Screen Hero
|
140
|
-
install_cask 'screenhero' # Configuration will occur on first run of application.
|
141
|
-
# TextMate
|
142
|
-
install_cask 'textmate'
|
143
|
-
# Zoom.us
|
144
|
-
install_cask 'zoomus' # Configuration will occur on first run of applicaiton.
|
145
|
-
|
146
|
-
end # options[:groups] = default
|
147
|
-
|
148
|
-
if options[:groups].include? 'developer'
|
149
|
-
puts "### Starting installation of developer apps... ###"
|
150
|
-
install_cask '1password'
|
151
|
-
install_cask 'alfred'
|
152
|
-
install_cask 'anvil'
|
153
|
-
install_brew 'python'
|
154
|
-
install_brew 'python3'
|
155
|
-
install_brew 'cassandra'
|
156
|
-
run_cmd 'pip install cql &> /dev/null', 'Installing cql python module via pip...'
|
157
|
-
run_cmd 'pip3 install cql &> /dev/null', 'Installing cql python3 module via pip3...'
|
158
|
-
install_cask 'dash'
|
159
|
-
install_brew 'node'
|
160
|
-
install_brew 'phantomjs'
|
161
|
-
install_brew 'homebrew/versions/postgresql92'
|
162
|
-
install_brew 'redis'
|
163
|
-
install_brew 'ruby-build'
|
164
|
-
install_cask 'slack'
|
165
|
-
install_cask 'tower'
|
166
|
-
# nvm
|
167
|
-
install_brew 'nvm'
|
168
|
-
mkdir '~/.nvm'
|
169
|
-
add_line_to_file '~/.zshrc', 'export NVM_DIR=~/.nvm'
|
170
|
-
add_line_to_file '~/.zshrc', 'source $(brew --prefix nvm)/nvm.sh'
|
171
|
-
# pow
|
172
|
-
install_brew 'pow'
|
173
|
-
if not File.directory? File.expand_path('~/Library/Application Support/Pow/Hosts')
|
174
|
-
run_cmd 'mkdir -p ~/Library/Application\ Support/Pow/Hosts', 'Creating support directory for pow hosts...'
|
175
|
-
end
|
176
|
-
if not File.symlink? File.expand_path('~/.pow')
|
177
|
-
run_cmd 'ln -s ~/Library/Application\ Support/Pow/Hosts ~/.pow', 'Symlinking pow hosts directory to ~/.pow ...'
|
178
|
-
end
|
179
|
-
run_cmd 'sudo pow --install-system', 'Configuring port 80 forwarding for pow...'
|
180
|
-
run_cmd 'pow --install-local', 'Configuring launchd agent for pow...'
|
181
|
-
run_cmd 'sudo launchctl load -w /Library/LaunchDaemons/cx.pow.firewall.plist', 'Configuring pow launchd agent to start on boot...'
|
182
|
-
run_cmd 'launchctl load -w ~/Library/LaunchAgents/cx.pow.powd.plist', 'Starting pow...'
|
183
|
-
# rbenv
|
184
|
-
install_brew 'rbenv'
|
185
|
-
system("grep -q -F 'export RBENV_ROOT=/usr/local/var/rbenv' /etc/profile")
|
186
|
-
if $? != 0
|
187
|
-
run_cmd "echo 'export RBENV_ROOT=/usr/local/var/rbenv' | sudo tee -a /etc/profile > /dev/null", "Adding RBENV_ROOT to /etc/profile..."
|
209
|
+
if options[:groups].include? :cs
|
210
|
+
install_cask 'microsoft-office'
|
188
211
|
end
|
189
|
-
system("grep -q -F 'rbenv init -' /etc/profile")
|
190
|
-
if $? != 0
|
191
|
-
run_cmd %q[echo 'eval "$(rbenv init -)"' | sudo tee -a /etc/profile > /dev/null], "Adding rbenv init to /etc/profile..."
|
192
|
-
end
|
193
|
-
Dir.mkdir '/usr/local/var/rbenv' if not Dir.exists? '/usr/local/var/rbenv'
|
194
|
-
Dir.mkdir '/usr/local/var/rbenv/plugins' if not Dir.exists? '/usr/local/var/rbenv/plugins'
|
195
|
-
if File.exists? '/usr/local/var/rbenv/plugins/rbenv-gem-rehash'
|
196
|
-
puts 'rbenv-gem-rehash already installed...skipped.'
|
197
|
-
else
|
198
|
-
run_cmd 'sudo git clone https://github.com/sstephenson/rbenv-gem-rehash.git /usr/local/var/rbenv/plugins/rbenv-gem-rehash', "Installing rbenv-gem-rehash..."
|
199
|
-
end
|
200
|
-
# OH MY ZSH!
|
201
|
-
if not File.directory? File.expand_path('~/.oh-my-zsh')
|
202
|
-
run_cmd "curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh", "Installing oh-my-zsh..."
|
203
|
-
end
|
204
|
-
# Set the default terminal theme to something more bareable.
|
205
|
-
#run_cmd 'defaults write com.apple.Terminal "Default Window Settings" "Pro"'
|
206
|
-
end # options[:groups] = developer
|
207
|
-
|
208
|
-
if options[:groups].include? 'pinner'
|
209
|
-
install_cask 'adobe-createive-cloud'
|
210
|
-
install_cask 'microsoft-office'
|
211
|
-
install_cask 'joinme'
|
212
|
-
end # options[:groups] = pinner
|
213
|
-
|
214
|
-
if options[:groups].include? 'cs'
|
215
|
-
install_cask 'microsoft-office'
|
216
|
-
end
|
217
212
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
cleanup.each do |cmd|
|
222
|
-
#puts "(cleanup) #{cmd}"
|
223
|
-
eval(cmd)
|
213
|
+
if options[:groups].include? :designer
|
214
|
+
install_cask [:slack, 'adobe-creative-cloud', 'sketch-tool', :invisionsync, :tower, :anvil]
|
215
|
+
notes << "If this is the first time running a5y-configure, you will need to manually install Adobe Creative Cloud by running:\n open '/opt/homebrew-cask/Caskroom/adobe-creative-cloud/latest/Creative Cloud Installer.app'"
|
224
216
|
end
|
217
|
+
rescue
|
218
|
+
raise
|
219
|
+
ensure
|
220
|
+
db.close
|
225
221
|
end
|
226
222
|
|
227
223
|
if not notes.empty?
|
@@ -12,41 +12,52 @@ def run_cmd(cmd, msg)
|
|
12
12
|
puts msg
|
13
13
|
puts "(cmd) '#{cmd}'".colorize(:blue)
|
14
14
|
system cmd
|
15
|
-
|
15
|
+
raise "Failed with exit code: #{$?}" if $? != 0
|
16
16
|
end
|
17
17
|
|
18
18
|
def install_brew(app, opts = '')
|
19
|
+
if app.is_a? Array
|
20
|
+
app.each { |a| install_brew a, opts }
|
21
|
+
return
|
22
|
+
end
|
19
23
|
%x[brew list -1 | grep "^#{app}$" &> /dev/null]
|
20
24
|
if $? == 0
|
21
|
-
# puts "(brew) #{app} already installed...skipped.".colorize(:green)
|
22
25
|
puts "(brew) updating #{app}...".colorize(:blue)
|
23
26
|
system "brew upgrade #{app} #{opts}"
|
24
27
|
else
|
25
28
|
puts "(brew) install #{app} #{opts}".colorize(:blue)
|
26
29
|
system "brew install #{app} #{opts}"
|
27
|
-
|
30
|
+
raise "Failed with exit code: #{$?}" if $? != 0
|
28
31
|
end
|
29
32
|
end
|
30
33
|
|
31
34
|
def uninstall_brew(app)
|
35
|
+
if app.is_a? Array
|
36
|
+
app.each { |a| uninstall_brew a }
|
37
|
+
return
|
38
|
+
end
|
32
39
|
%x[brew list -1 | grep "^#{app}$" &> /dev/null]
|
33
40
|
if $? != 0
|
34
41
|
puts "(brew) #{app} is not installed...skipped.".colorize(:green)
|
35
42
|
else
|
36
43
|
puts "(brew-uninstall) uninstall #{app}".colorize(:blue)
|
37
|
-
system 'brew', 'uninstall', '--force', app
|
38
|
-
|
44
|
+
system 'brew', 'uninstall', '--force', app.to_s
|
45
|
+
raise "Failed with exit code: #{$?}" if $? != 0
|
39
46
|
end
|
40
47
|
end
|
41
48
|
|
42
49
|
def install_cask(app)
|
50
|
+
if app.is_a? Array
|
51
|
+
app.each { |a| install_cask a }
|
52
|
+
return
|
53
|
+
end
|
43
54
|
%x[brew cask list #{app} &> /dev/null]
|
44
55
|
if $? == 0
|
45
56
|
puts "(cask) #{app} already installed...skipped.".colorize(:green)
|
46
57
|
else
|
47
58
|
puts "(cask) install #{app}".colorize(:blue)
|
48
|
-
system 'brew', 'cask', 'install', app
|
49
|
-
|
59
|
+
system 'brew', 'cask', 'install', app.to_s
|
60
|
+
raise "Failed with exit code: #{$?}" if $? != 0
|
50
61
|
end
|
51
62
|
end
|
52
63
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ahalogy-automation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zan Loy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -29,6 +29,9 @@ dependencies:
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.3'
|
34
|
+
- - ">="
|
32
35
|
- !ruby/object:Gem::Version
|
33
36
|
version: 0.3.0
|
34
37
|
type: :runtime
|
@@ -36,6 +39,9 @@ dependencies:
|
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
41
|
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0.3'
|
44
|
+
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: 0.3.0
|
41
47
|
- !ruby/object:Gem::Dependency
|
@@ -43,6 +49,9 @@ dependencies:
|
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.12'
|
54
|
+
- - ">="
|
46
55
|
- !ruby/object:Gem::Version
|
47
56
|
version: 0.12.3
|
48
57
|
type: :runtime
|
@@ -50,6 +59,9 @@ dependencies:
|
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
52
61
|
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0.12'
|
64
|
+
- - ">="
|
53
65
|
- !ruby/object:Gem::Version
|
54
66
|
version: 0.12.3
|
55
67
|
- !ruby/object:Gem::Dependency
|
@@ -99,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
111
|
version: '0'
|
100
112
|
requirements: []
|
101
113
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.2.2
|
103
115
|
signing_key:
|
104
116
|
specification_version: 4
|
105
117
|
summary: Scripts to handle IT automation.
|