ahalogy-automation 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0431afa69e14b9bf60c4d90a7e1d9cdedd7adbee
4
- data.tar.gz: 82d44cc286d78b27435dcd31719fc29d71fcb7bb
3
+ metadata.gz: 4e4008bc5d9242be84f6a32dffbc8dc4e890408b
4
+ data.tar.gz: 84225b7e11d93b0750fb3bc2bd59e2bd3ed14b45
5
5
  SHA512:
6
- metadata.gz: a9fe7107e05a087bfc4afafeec91e2dde5bd3f0cd88e1e5a6a461ac19c455119721cdebfd722766f3d3d5e2962cf83ca005029bc754e2e5c0dcc135b69f59110
7
- data.tar.gz: 4541e2ed11f165b3b31f811e198483d3819e2daec0a4611a0f2a31b29b9e0430c9c371ae59ae4f73044722bf16c45ddb4d8a6a45e4e1cddbc084bfa7f7dc1950
6
+ metadata.gz: 2f352f0ae70d556f7436869e65f162ebb09b9ee938df047acb3ded7f7cd7395a0e765805537de7907731ba72cb518c6d099c1894d47618d0a15af0159f47b05f
7
+ data.tar.gz: d165033694a7333bbfb19163ff2f3a80c2003a9eea63072d831233c516a704b3117baf2c71b36bf77ee0a2980a331ae7795d90ab5a38c664b68ae463a35d34fa
data/TODO ADDED
@@ -0,0 +1,8 @@
1
+ features:
2
+ - add pinner group apps
3
+ - complete configuration of backblaze
4
+ - add local vimrc section so user customizations are not clobbered
5
+ - add sshkey generated to github account
6
+ - automatically clone required repos for developers (?)
7
+ issues:
8
+ - vim not finding colorscheme on first run
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'ahalogy-automation'
3
- gem.version = '0.0.2'
3
+ gem.version = '0.0.3'
4
4
  gem.licenses = ['MIT']
5
5
  gem.date = '2015-03-23'
6
6
  gem.summary = 'Scripts to handle IT automation.'
@@ -12,5 +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 'github', '~> 0'
15
+ gem.add_runtime_dependency 'daybreak', '~> 0.3.0'
16
+ gem.add_runtime_dependency 'github_api', '~> 0.12.3'
17
+ gem.add_runtime_dependency 'highline', '~> 1.7'
16
18
  end
data/bin/a5y-configure CHANGED
@@ -2,9 +2,10 @@
2
2
 
3
3
  require 'ahalogy/install-helper'
4
4
  require 'colorize'
5
- require 'github'
5
+ require 'daybreak'
6
+ require 'github_api'
7
+ require 'highline/import'
6
8
  require 'optparse'
7
- require 'pp'
8
9
 
9
10
  groups = ['developer', 'pinner', 'cs', 'marketing', 'content']
10
11
  options = {
@@ -19,10 +20,23 @@ OptionParser.new do |opts|
19
20
  puts "Available groups: #{groups.join(', ')}"
20
21
  exit
21
22
  end
23
+ opts.on("-a", "--ask", "Ask to confirm settings stored in settings database.") { options[:ask] = true }
22
24
  opts.on("-d", "--debug", "Enable debug messaging.") { options[:verbose] = true }
23
25
  end.parse!
24
26
 
27
+ # Open settings database
28
+ db = Daybreak::DB.new File.expand_path('~/.ahalogy.db'), default: ''
29
+ # Verify values are already in the database or ask for them
30
+ if options[:ask] or db[:github_username].empty?
31
+ db[:github_username] = ask('GitHub Username? (leave blank to skip)')
32
+ end
33
+ if options[:ask] or db[:github_password].empty?
34
+ db[:github_password] = ask('GitHub Password? (leave blank to skip)') { |q| q.echo = 'x' }
35
+ end
36
+ db.flush # Write changes to disk.
37
+
25
38
  cleanup = []
39
+ notes = []
26
40
 
27
41
  if options[:groups].include? 'default'
28
42
  ## Install xcode command line tools
@@ -30,7 +44,7 @@ if options[:groups].include? 'default'
30
44
  if $? != 0
31
45
  run_cmd "xcode-select --install", "Installing Xcode CLI tools."
32
46
  else
33
- puts "Xcode CLI tools is already installed...skipped."
47
+ puts "Xcode CLI tools is already installed...skipped.".colorize(:green)
34
48
  end
35
49
  ## Install full xcode
36
50
  system 'xcodebuild &> /dev/null'
@@ -45,12 +59,30 @@ if options[:groups].include? 'default'
45
59
  end
46
60
  end
47
61
 
48
- # Let's setup our sshkey and github (we need this to pull the config repo)
62
+ # Let's setup our sshkey and github
49
63
  if File.exists? File.expand_path("~/.ssh/id_rsa")
50
64
  puts "sshkey exists... skipped."
51
65
  else
52
66
  run_cmd "ssh-keygen -f ~/.ssh/id_rsa -N ''", "Generating sshkey."
53
67
  end
68
+ unless db[:github_username].empty?
69
+ local_key = File.read(File.expand_path('~/.ssh/id_rsa.pub')).split[0...-1].join(' ')
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
75
+ end
76
+ upload_key = true
77
+ github.users.keys.list.each do |entry|
78
+ upload_key = false if entry[:key] == local_key
79
+ end
80
+ if upload_key
81
+ github.users.keys.create title: 'uploaded via ahalogy-automation', key: local_key
82
+ else
83
+ puts 'SSH Key already installed on GitHub...skipped.'.colorize(:green)
84
+ end
85
+ end
54
86
 
55
87
  # Enable FileVault
56
88
  # run_cmd "sudo fdesetup enable -user admin -usertoadd enduser"
@@ -75,12 +107,27 @@ if options[:groups].include? 'default'
75
107
  run_cmd 'brew tap homebrew/versions', 'Tapping homebrew/versions...'
76
108
 
77
109
  ### Install Applications
110
+ # BackBlaze
78
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
79
123
  install_brew 'git' # No further configuration required.
124
+ # github
80
125
  install_cask 'github' # Configuration will occur on first run of application.
126
+ # Google Chrome
81
127
  install_cask 'google-chrome' # No further configuration required.
128
+ # Google Drive
82
129
  install_cask 'google-drive' # Configuration will occur on first run of application.
83
- #install_cask 'macvim'
130
+ # MacVim
84
131
  install_brew 'macvim', '--override-system-vim --with-python3'
85
132
  install_file 'vimrc', '~/.vimrc'
86
133
  if File.directory? File.expand_path('~/.vim/bundle/Vundle.vim')
@@ -89,12 +136,13 @@ if options[:groups].include? 'default'
89
136
  run_cmd 'git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim', 'Installing Vundle via GitHub...'
90
137
  end
91
138
  run_cmd 'vim +BundleClean +BundleInstall +qall', 'Configuring Vundle...'
139
+ # Screen Hero
92
140
  install_cask 'screenhero' # Configuration will occur on first run of application.
141
+ # TextMate
93
142
  install_cask 'textmate'
143
+ # Zoom.us
94
144
  install_cask 'zoomus' # Configuration will occur on first run of applicaiton.
95
145
 
96
- # Run BackBlaze Installer
97
- cleanup << %q[run_cmd "open -a '/opt/homebrew-cask/Caskroom/backblaze/latest/Backblaze Installer.app'", "Installing BackBlaze."]
98
146
  end # options[:groups] = default
99
147
 
100
148
  if options[:groups].include? 'developer'
@@ -109,20 +157,19 @@ if options[:groups].include? 'developer'
109
157
  run_cmd 'pip3 install cql &> /dev/null', 'Installing cql python3 module via pip3...'
110
158
  install_cask 'dash'
111
159
  install_brew 'node'
112
- install_brew 'nvm'
113
160
  install_brew 'phantomjs'
114
161
  install_brew 'homebrew/versions/postgresql92'
115
- install_brew 'pow'
116
- install_brew 'rbenv'
117
162
  install_brew 'redis'
118
163
  install_brew 'ruby-build'
119
164
  install_cask 'slack'
120
165
  install_cask 'tower'
121
- # Configure nvm
166
+ # nvm
167
+ install_brew 'nvm'
122
168
  mkdir '~/.nvm'
123
169
  add_line_to_file '~/.zshrc', 'export NVM_DIR=~/.nvm'
124
170
  add_line_to_file '~/.zshrc', 'source $(brew --prefix nvm)/nvm.sh'
125
- # Configure pow
171
+ # pow
172
+ install_brew 'pow'
126
173
  if not File.directory? File.expand_path('~/Library/Application Support/Pow/Hosts')
127
174
  run_cmd 'mkdir -p ~/Library/Application\ Support/Pow/Hosts', 'Creating support directory for pow hosts...'
128
175
  end
@@ -133,7 +180,8 @@ if options[:groups].include? 'developer'
133
180
  run_cmd 'pow --install-local', 'Configuring launchd agent for pow...'
134
181
  run_cmd 'sudo launchctl load -w /Library/LaunchDaemons/cx.pow.firewall.plist', 'Configuring pow launchd agent to start on boot...'
135
182
  run_cmd 'launchctl load -w ~/Library/LaunchAgents/cx.pow.powd.plist', 'Starting pow...'
136
- # Configure rbenv
183
+ # rbenv
184
+ install_brew 'rbenv'
137
185
  system("grep -q -F 'export RBENV_ROOT=/usr/local/var/rbenv' /etc/profile")
138
186
  if $? != 0
139
187
  run_cmd "echo 'export RBENV_ROOT=/usr/local/var/rbenv' | sudo tee -a /etc/profile > /dev/null", "Adding RBENV_ROOT to /etc/profile..."
@@ -153,10 +201,32 @@ if options[:groups].include? 'developer'
153
201
  if not File.directory? File.expand_path('~/.oh-my-zsh')
154
202
  run_cmd "curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh", "Installing oh-my-zsh..."
155
203
  end
204
+ # Set the default terminal theme to something more bareable.
205
+ #run_cmd 'defaults write com.apple.Terminal "Default Window Settings" "Pro"'
156
206
  end # options[:groups] = developer
157
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
+
218
+ # Cleanup tasks
219
+ db.close
158
220
  if not cleanup.empty?
159
221
  cleanup.each do |cmd|
160
- puts "(cleanup) #{cmd}"
222
+ #puts "(cleanup) #{cmd}"
223
+ eval(cmd)
224
+ end
225
+ end
226
+
227
+ if not notes.empty?
228
+ puts '### Installer Notes ###'.colorize(:red)
229
+ notes.each_with_index do |note, index|
230
+ puts "#{index + 1}. #{note}"
161
231
  end
162
232
  end
@@ -85,7 +85,7 @@ let NERDTreeShowHidden=1
85
85
  let g:solarized_termcolors=256
86
86
  let g:solarized_termtrans=1
87
87
  set background=dark
88
- colorscheme solarized
88
+ :silent! colorscheme solarized
89
89
 
90
90
  "gvim options
91
91
  if has("gui_running")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ahalogy-automation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zan Loy
@@ -25,19 +25,47 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: github
28
+ name: daybreak
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.3.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 0.3.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: github_api
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.12.3
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.12.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: highline
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.7'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.7'
41
69
  description: Script that installs many applications on Ahalogy Mac computers.
42
70
  email: zan.loy@gmail.com
43
71
  executables:
@@ -46,6 +74,7 @@ extensions: []
46
74
  extra_rdoc_files: []
47
75
  files:
48
76
  - Rakefile
77
+ - TODO
49
78
  - ahalogy-automation.gemspec
50
79
  - bin/a5y-configure
51
80
  - data/ahalogy-automation/vimrc