Class: Legworker::Legs
- Inherits:
-
Object
- Object
- Legworker::Legs
- Defined in:
- lib/legworker.rb
Instance Method Summary collapse
-
#setup_app(options) ⇒ Object
—————————————————————————-.
-
#vagrant(options) ⇒ Object
—————————————————————————-.
Instance Method Details
#setup_app(options) ⇒ Object
Setup Application & Databases
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/legworker.rb', line 34 def setup_app() = {} vagrant_file = 'config/puppet/manifests/vagrant.pp' file = File.open(vagrant_file) contents = file.read contents.gsub!('_APPLICATION_NAME_',[:application_name]) contents.gsub!('_DEV_USER_',[:dev_user]) contents.gsub!('_DEV_PASS_',[:dev_pass]) contents.gsub!('_PROD_USER_',[:prod_user]) contents.gsub!('_PROD_PASS_',[:prod_pass]) File.open(vagrant_file, "w") { |f| f.puts contents } database_yml = "config/puppet/templates/database.yml.erb" db = File.open(database_yml) db_contents = db.read db_contents.gsub!("_DEV_DATABASE_",[:dev_database]) db_contents.gsub!("_PROD_DATABASE_",[:prod_database]) db_contents.gsub!('_DEV_USER_',[:dev_user]) db_contents.gsub!('_DEV_PASS_',[:dev_pass]) db_contents.gsub!('_PROD_USER_',[:prod_user]) db_contents.gsub!('_PROD_PASS_',[:prod_pass]) File.open(database_yml, "w") { |f| f.puts db_contents } end |
#vagrant(options) ⇒ Object
Download Vagrant & Puppet
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/legworker.rb', line 12 def vagrant() # download useful things system('curl -sS https://s3.amazonaws.com/legworker/Vagrantfile > Vagrantfile') # download puppet.zip system('curl -sS https://s3.amazonaws.com/legworker/puppet.zip > puppet.zip') system('unzip puppet.zip -d config') system('rm puppet.zip') system('rm -rf config/__MACOSX || exit') system('rm -rf Gemfile') system('curl -sS https://s3.amazonaws.com/legworker/Gemfile > Gemfile') self.setup_app() end |