Class: OsxInstaller

Inherits:
GenericInstaller show all
Defined in:
lib/osx_ruby_dev_install/osx_installer.rb

Constant Summary collapse

USER_LOCAL_BIN =
"/usr/local/bin"

Instance Attribute Summary

Attributes inherited from GenericInstaller

#env, #interpolator, #script_list, #server_info

Instance Method Summary collapse

Methods inherited from GenericInstaller

#initialize

Constructor Details

This class inherits a constructor from GenericInstaller

Instance Method Details

#homebrew_installObject



12
13
14
15
16
17
18
19
20
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 12

def homebrew_install
  installed = package_installed("#{USER_LOCAL_BIN}/brew")

  if installed
    puts "homebrew already installed."
  else
    run(server_info, "brew", env)
  end
end

#init_launch_agentObject



52
53
54
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 52

def init_launch_agent
  run(server_info, "init_launch_agent", env)
end

#jenkins_installObject



106
107
108
109
110
111
112
113
114
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 106

def jenkins_install
  installed = package_installed "/usr/local/opt/jenkins/libexec/jenkins.war"

  if installed
    puts "jenkins already installed."
  else
    run(server_info, "jenkins", env)
  end
end

#jenkins_restartObject



116
117
118
119
120
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 116

def jenkins_restart
  started = service_started("homebrew.mxcl.jenkins")

  run(server_info, "jenkins_restart", env.merge({started: started}))
end

#mysql_installObject



56
57
58
59
60
61
62
63
64
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 56

def mysql_install
  installed = package_installed "#{USER_LOCAL_BIN}/mysql"

  if installed
    puts "mysql already installed."
  else
    run(server_info, "mysql", env)
  end
end

#mysql_restartObject



66
67
68
69
70
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 66

def mysql_restart
  started = service_started("homebrew.mxcl.mysql")

  run(server_info, "mysql_restart", env.merge({started: started}))
end

#npm_installObject



32
33
34
35
36
37
38
39
40
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 32

def npm_install
  installed = package_installed "#{USER_LOCAL_BIN}/npm"

  if installed
    puts "npm already installed."
  else
    run(server_info, "npm", env)
  end
end

#postgres_create(user, schemas) ⇒ Object



138
139
140
141
142
143
144
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 138

def postgres_create user, schemas
  create_postgres_user user, schemas.first

  schemas.each do |schema|
    create_postgres_schema user, schema
  end
end

#postgres_drop(user, schemas) ⇒ Object



146
147
148
149
150
151
152
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 146

def postgres_drop user, schemas
  schemas.each do |schema|
    drop_postgres_schema schema
  end

  drop_postgres_user user, schemas.first
end

#postgres_installObject



72
73
74
75
76
77
78
79
80
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 72

def postgres_install
  installed = package_installed "#{USER_LOCAL_BIN}/postgres"

  if installed
    puts "postgres already installed."
  else
    run(server_info, "postgres", env)
  end
end

#postgres_restartObject



82
83
84
85
86
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 82

def postgres_restart
  started = service_started("homebrew.mxcl.postgres")

  run(server_info, "postgres_restart", env.merge({started: started}))
end

#postgres_startObject



92
93
94
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 92

def postgres_start
  run server_info, "postgres_start", env
end

#postgres_stopObject



88
89
90
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 88

def postgres_stop
  run server_info, "postgres_stop", env
end

#postgres_test(schema) ⇒ Object



154
155
156
157
158
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 154

def postgres_test schema
  result = get_postgres_schemas schema

  puts result
end

#prepareObject



6
7
8
9
10
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 6

def prepare
  env['password'] = ask_password("Enter password for #{env[:node][:user]}: ")

  run(server_info.merge(capture_output: false, sudo: true), "prepare", env)
end

#qt_installObject



42
43
44
45
46
47
48
49
50
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 42

def qt_install
  installed = package_installed "#{USER_LOCAL_BIN}/qmake"

  if installed
    puts "qt already installed."
  else
    run(server_info, "qt", env)
  end
end

#ruby_installObject



96
97
98
99
100
101
102
103
104
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 96

def ruby_install
  installed = package_installed "#{ENV['HOME']}/.rvm/rubies/ruby-1.9.3-p429/bin/ruby"

  if installed
    puts "ruby already installed."
  else
    run(server_info, "ruby", env)
  end
end

#rvm_installObject



22
23
24
25
26
27
28
29
30
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 22

def rvm_install
  installed = package_installed "#{ENV['HOME']}/.rvm/bin/rvm"

  if installed
    puts "rvm already installed."
  else
    run(server_info, "rvm", env)
  end
end

#selenium_installObject



122
123
124
125
126
127
128
129
130
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 122

def selenium_install
  installed = package_installed "/usr/local/opt/selenium-server-standalone/selenium-server-standalone*.jar"

  if installed
    puts "selenium already installed."
  else
    run(server_info, "selenium", env)
  end
end

#selenium_restartObject



132
133
134
135
136
# File 'lib/osx_ruby_dev_install/osx_installer.rb', line 132

def selenium_restart
  started = service_started("homebrew.mxcl.selenium-server-standalone")

  run(server_info, "selenium_restart", env.merge({started: started}))
end