Class: OsxProvision
- Inherits:
-
BaseProvision
- Object
- BaseProvision
- OsxProvision
- Defined in:
- lib/osx_provision/version.rb,
lib/osx_provision/osx_provision.rb
Constant Summary collapse
- VERSION =
"0.9.8"- USER_LOCAL_BIN =
"/usr/local/bin"
Instance Method Summary collapse
-
#brew ⇒ Object
def prepare env = ask_password(“Enter password for #[:user]: ”).
-
#initialize(parent_class, config_file_name = ".osx_provision.json", scripts_file_names = []) ⇒ OsxProvision
constructor
A new instance of OsxProvision.
- #jenkins ⇒ Object
- #jenkins_restart ⇒ Object
- #mysql ⇒ Object
- #mysql_create_schemas ⇒ Object
- #mysql_drop_schemas ⇒ Object
- #mysql_restart ⇒ Object
- #npm ⇒ Object
- #postgres ⇒ Object
- #postgres_create_schemas ⇒ Object
- #postgres_drop_schemas ⇒ Object
- #postgres_restart ⇒ Object
- #qt ⇒ Object
- #ruby ⇒ Object
- #rvm ⇒ Object
- #selenium ⇒ Object
- #selenium_restart ⇒ Object
Constructor Details
#initialize(parent_class, config_file_name = ".osx_provision.json", scripts_file_names = []) ⇒ OsxProvision
Returns a new instance of OsxProvision.
6 7 8 9 10 |
# File 'lib/osx_provision/osx_provision.rb', line 6 def initialize parent_class, config_file_name=".osx_provision.json", scripts_file_names=[] scripts_file_names.unshift(File.("osx_provision_scripts.sh", File.dirname(__FILE__))) # make it first super end |
Instance Method Details
#brew ⇒ Object
def prepare
env['password'] = ask_password("Enter password for #{env[:node][:user]}: ")
run(server_info.merge(capture_output: false, sudo: true), "prepare", env)
end
18 19 20 21 22 23 24 25 26 |
# File 'lib/osx_provision/osx_provision.rb', line 18 def brew installed = package_installed("#{USER_LOCAL_BIN}/brew") if installed puts "homebrew already installed." else run(server_info, "brew", env) end end |
#jenkins ⇒ Object
100 101 102 103 104 105 106 107 108 |
# File 'lib/osx_provision/osx_provision.rb', line 100 def jenkins 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_restart ⇒ Object
110 111 112 113 114 |
# File 'lib/osx_provision/osx_provision.rb', line 110 def jenkins_restart started = service_started("homebrew.mxcl.jenkins") run(server_info, "jenkins_restart", env.merge({started: started})) end |
#mysql ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'lib/osx_provision/osx_provision.rb', line 58 def mysql installed = package_installed "#{USER_LOCAL_BIN}/mysql" if installed puts "mysql already installed." else run(server_info, "mysql", env) end end |
#mysql_create_schemas ⇒ Object
144 145 146 147 148 |
# File 'lib/osx_provision/osx_provision.rb', line 144 def mysql_create_schemas env[:mysql][:app_schemas].each do |schema| run(server_info, "mysql_create_schema", env.merge(schema: schema)) end end |
#mysql_drop_schemas ⇒ Object
150 151 152 153 154 |
# File 'lib/osx_provision/osx_provision.rb', line 150 def mysql_drop_schemas env[:mysql][:app_schemas].each do |schema| run(server_info, "mysql_drop_schema", env.merge(schema: schema)) end end |
#mysql_restart ⇒ Object
68 69 70 71 72 |
# File 'lib/osx_provision/osx_provision.rb', line 68 def mysql_restart started = service_started("homebrew.mxcl.mysql") run(server_info, "mysql_restart", env.merge({started: started})) end |
#npm ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/osx_provision/osx_provision.rb', line 38 def npm installed = package_installed "#{USER_LOCAL_BIN}/npm" if installed puts "npm already installed." else run(server_info, "npm", env) end end |
#postgres ⇒ Object
74 75 76 77 78 79 80 81 82 |
# File 'lib/osx_provision/osx_provision.rb', line 74 def postgres installed = package_installed "#{USER_LOCAL_BIN}/postgres" if installed puts "postgres already installed." else run(server_info, "postgres", env) end end |
#postgres_create_schemas ⇒ Object
132 133 134 135 136 |
# File 'lib/osx_provision/osx_provision.rb', line 132 def postgres_create_schemas env[:postgres][:app_schemas].each do |schema| run(server_info, "postgres_create_schema", env.merge(schema: schema)) end end |
#postgres_drop_schemas ⇒ Object
138 139 140 141 142 |
# File 'lib/osx_provision/osx_provision.rb', line 138 def postgres_drop_schemas env[:postgres][:app_schemas].each do |schema| run(server_info, "postgres_drop_schema", env.merge(schema: schema)) end end |
#postgres_restart ⇒ Object
84 85 86 87 88 |
# File 'lib/osx_provision/osx_provision.rb', line 84 def postgres_restart started = service_started("homebrew.mxcl.postgres") run(server_info, "postgres_restart", env.merge({started: started})) end |
#qt ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/osx_provision/osx_provision.rb', line 48 def qt installed = package_installed "#{USER_LOCAL_BIN}/qmake" if installed puts "qt already installed." else run(server_info, "qt", env) end end |
#ruby ⇒ Object
90 91 92 93 94 95 96 97 98 |
# File 'lib/osx_provision/osx_provision.rb', line 90 def ruby installed = package_installed "#{ENV['HOME']}/.rvm/rubies/ruby-1.9.3-p527/bin/ruby" if installed puts "ruby already installed." else run(server_info, "ruby", env) end end |
#rvm ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/osx_provision/osx_provision.rb', line 28 def rvm installed = package_installed "#{ENV['HOME']}/.rvm/bin/rvm" if installed puts "rvm already installed." else run(server_info, "rvm", env) end end |
#selenium ⇒ Object
116 117 118 119 120 121 122 123 124 |
# File 'lib/osx_provision/osx_provision.rb', line 116 def selenium 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_restart ⇒ Object
126 127 128 129 130 |
# File 'lib/osx_provision/osx_provision.rb', line 126 def selenium_restart started = service_started("homebrew.mxcl.selenium-server-standalone") run(server_info, "selenium_restart", env.merge({started: started})) end |