diff --git a/.gitignore b/.gitignore index 2bedd4f..75147fa 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,6 @@ log/searchd.development.pid *~ \#* .\#* -.DS_Store +*.DS_Store *.swp .vagrant* diff --git a/.travis.yml b/.travis.yml index b43d5da..4d77d3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ script: "bundle exec rake ci:setup db:drop db:create db:migrate spec" rvm: - - 1.8.7 + - 1.9.3 diff --git a/Gemfile.lock b/Gemfile.lock index 78f4088..7a185b1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -42,7 +42,7 @@ GEM acts-as-taggable-on (2.1.1) rails addressable (2.3.2) - annotate (2.6.2) + annotate (2.6.5) activerecord (>= 2.3.0) rake (>= 0.8.7) arel (3.0.3) @@ -51,10 +51,9 @@ GEM builder mime-types xml-simple - aws-sdk (1.36.0) + aws-sdk (1.45.0) json (~> 1.4) nokogiri (>= 1.4.4) - uuidtools (~> 2.1) bcrypt (3.1.7) bcrypt-ruby (3.1.5) bcrypt (>= 3.1.3) @@ -69,14 +68,14 @@ GEM selenium-webdriver (>= 0.0.27) xpath (~> 0.1.3) celerity (0.9.2) - childprocess (0.5.1) + childprocess (0.5.3) ffi (~> 1.0, >= 1.0.11) - chunky_png (1.3.0) + chunky_png (1.3.1) climate_control (0.0.3) activesupport (>= 3.0) - cocaine (0.5.3) + cocaine (0.5.4) climate_control (>= 0.0.3, < 1.0) - columnize (0.3.6) + columnize (0.8.9) compass (0.12.2) chunky_png (~> 1.2) fssm (>= 0.2.7) @@ -85,29 +84,29 @@ GEM compass (>= 0.10.0) culerity (0.2.15) daemons (1.1.9) - database_cleaner (1.2.0) - debugger (1.6.6) + database_cleaner (1.3.0) + debugger (1.6.8) columnize (>= 0.3.1) debugger-linecache (~> 1.2.0) - debugger-ruby_core_source (~> 1.3.2) + debugger-ruby_core_source (~> 1.3.5) debugger-linecache (1.2.0) - debugger-ruby_core_source (1.3.2) + debugger-ruby_core_source (1.3.5) devise (1.4.9) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.0.3) warden (~> 1.0.3) diff-lcs (1.2.5) - docile (1.1.3) + docile (1.1.5) drx (0.4.5) erubis (2.7.0) eventmachine (1.0.3) - excon (0.25.3) + excon (0.37.0) factory_girl (4.4.0) activesupport (>= 3.0.0) factory_girl_rails (4.4.1) factory_girl (~> 4.4.0) railties (>= 3.0.0) - faker (1.2.0) + faker (1.3.0) i18n (~> 0.5) fakeweb (1.3.0) faraday (0.9.0) @@ -117,18 +116,19 @@ GEM actionpack (>= 3.0) friendly_id4 (4.0.0.beta3) fssm (0.2.10) - geocoder (1.1.9) + geocoder (1.2.2) haml (3.1.8) has_scope (0.5.1) - hashie (2.0.5) - heroku (3.2.3) - heroku-api (~> 0.3.7) + hashie (2.1.2) + heroku (3.8.4) + heroku-api (~> 0.3.17) launchy (>= 0.3.2) netrc (~> 0.7.7) rest-client (~> 1.6.1) rubyzip - heroku-api (0.3.15) - excon (~> 0.25.1) + heroku-api (0.3.18) + excon (~> 0.27) + multi_json (~> 1.8) hike (1.2.3) httparty (0.8.3) multi_json (~> 1.0) @@ -138,36 +138,35 @@ GEM has_scope (~> 0.5.0) responders (~> 0.6) journey (1.0.4) - jquery-rails (3.1.0) + jquery-rails (3.1.1) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.6.8) - jwt (0.1.11) - multi_json (>= 1.5) + jwt (1.0.0) launchy (2.4.2) addressable (~> 2.3) - macaddr (1.6.7) + macaddr (1.7.1) systemu (~> 2.6.2) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) metaclass (0.0.4) mime-types (1.25.1) - mini_portile (0.5.2) - mocha (1.0.0) + mini_portile (0.6.0) + mocha (1.1.0) metaclass (~> 0.0.1) - multi_json (1.9.0) + multi_json (1.10.1) multi_xml (0.5.5) multipart-post (2.0.0) net-dns (0.6.1) netrc (0.7.7) nifty-generators (0.4.6) - nokogiri (1.6.1) - mini_portile (~> 0.5.0) + nokogiri (1.6.2.1) + mini_portile (= 0.6.0) oauth (0.4.7) - oauth2 (0.9.3) + oauth2 (0.9.4) faraday (>= 0.8, < 0.10) - jwt (~> 0.1.8) + jwt (~> 1.0) multi_json (~> 1.3) multi_xml (~> 0.5) rack (~> 1.2) @@ -176,17 +175,17 @@ GEM rack (~> 1.0) omniauth-facebook (1.6.0) omniauth-oauth2 (~> 1.1) - omniauth-foursquare (1.0.0) + omniauth-foursquare (1.0.1) omniauth (~> 1.0) omniauth-oauth2 (~> 1.0) - omniauth-github (1.1.1) + omniauth-github (1.1.2) omniauth (~> 1.0) omniauth-oauth2 (~> 1.1) omniauth-google-apps (0.0.2) omniauth (~> 1.0) omniauth-openid (~> 1.0) ruby-openid-apps-discovery (~> 1.2.0) - omniauth-linkedin (0.1.0) + omniauth-linkedin (0.2.0) omniauth-oauth (~> 1.0) omniauth-oauth (1.0.1) oauth @@ -212,7 +211,7 @@ GEM cocaine (>= 0.0.2) mime-types pg (0.17.1) - polyglot (0.3.4) + polyglot (0.3.5) powder (0.2.1) thor (>= 0.11.5) rack (1.4.5) @@ -223,7 +222,7 @@ GEM rack-openid (1.3.1) rack (>= 1.1.0) ruby-openid (>= 2.1.8) - rack-ssl (1.3.3) + rack-ssl (1.3.4) rack rack-test (0.6.2) rack (>= 1.0) @@ -252,28 +251,32 @@ GEM responders (0.6.5) rest-client (1.6.7) mime-types (>= 1.16) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.8) - rspec-expectations (2.14.5) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.6) - rspec-rails (2.14.1) + rspec (3.0.0) + rspec-core (~> 3.0.0) + rspec-expectations (~> 3.0.0) + rspec-mocks (~> 3.0.0) + rspec-core (3.0.2) + rspec-support (~> 3.0.0) + rspec-expectations (3.0.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.0.0) + rspec-mocks (3.0.2) + rspec-support (~> 3.0.0) + rspec-rails (3.0.1) actionpack (>= 3.0) - activemodel (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) + rspec-core (~> 3.0.0) + rspec-expectations (~> 3.0.0) + rspec-mocks (~> 3.0.0) + rspec-support (~> 3.0.0) + rspec-support (3.0.2) ruby-openid (2.1.8) ruby-openid-apps-discovery (1.2.0) ruby-openid (>= 2.1.7) - rubyzip (1.1.0) + rubyzip (1.1.4) sass (3.1.21) - selenium-webdriver (2.40.0) + selenium-webdriver (2.42.0) childprocess (>= 0.5.0) multi_json (~> 1.0) rubyzip (~> 1.0) @@ -299,23 +302,22 @@ GEM daemons (>= 1.0.9) eventmachine (>= 1.0.0) rack (>= 1.0.0) - thor (0.18.1) + thor (0.19.1) tilt (1.4.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.38) + tzinfo (0.3.39) utility_belt (1.1.0) Platform (>= 0.4.0) aws-s3 (>= 0.4.0) wirble (>= 0.1.2) uuid (2.3.7) macaddr (~> 1.0) - uuidtools (2.1.4) warden (1.0.6) rack (>= 1.0) websocket (1.0.7) - will_paginate (3.0.5) + will_paginate (3.0.6) wirble (0.1.3) xml-simple (1.1.3) xpath (0.1.4) diff --git a/README.markdown b/README.markdown index 85b42a4..d33f2f4 100644 --- a/README.markdown +++ b/README.markdown @@ -52,29 +52,28 @@ You can avoid installing the dependencies listed above on your machine by runnin Before proceeding you need to have installed: -* [VirtualBox](https://www.virtualbox.org/wiki/Downloads) -* [Vagrant](http://www.vagrantup.com/) +* [VirtualBox 4.3.12](https://www.virtualbox.org/wiki/Downloads) +* [Vagrant 1.6.0](http://www.vagrantup.com/) To start up a vm: -* Clone this repo to your machine -* `cd wearetechwomen` on your machine -* `vagrant up` on your machine -* Wait for the vm to load. The first time you run this command it will take a while as it installs a bunch of software. - You'll know it's done when you see: `SETUP COMPLETE: We Are Tech Women works in Vagrant!` -* `vagrant ssh` this will get you into the vm without a password -* `cd watw` -* `bundle install` -* `./go` to start the server" +* Clone this repository +* `host $ cd wearetechwomen` +* `host $ vagrant up` +* `host $ vagrant ssh` this will get you into the vm without a password +* `vagrant $ cd source` +* `vagrant $ bundle install` +* `vagrant $ bundle exec rake db:create db:migrate db:test:prepare` to create database, migrate, prepare db tests +* `vagrant $ ./go` to start the server * Go to http://localhost:3000 in your browser Not familiar with Vagrant? Check out the [Getting Started](http://docs.vagrantup.com/v2/getting-started/index.html) guide. -`vagrant ssh` will get you onto the vm where you can run rake/rails commands, etc. +The code directory on your machine is mounted into the vm. When you ssh in it's in the `source` folder. \ +You can edit files and perform git operations on your host computer using your tools of choice and the changes will be reflected on the vm. -The code directory on your machine is mounted into the vm. When you ssh in it's in the `watw` folder. You can edit files and perform git operations on your host computer using your tools of choice and the changes will be reflected on the vm. - -After your first `vagrant up` you can [stop](http://docs.vagrantup.com/v2/getting-started/teardown.html) and [start](http://docs.vagrantup.com/v2/getting-started/up.html) the vm more quickly. The initial provisioning only needs to run once. If anything happens with your setup you can `vagrant destroy` and `vagrant up` to bring back a fresh environment. +After your first `vagrant up` you can [stop](http://docs.vagrantup.com/v2/getting-started/teardown.html) +and [start](http://docs.vagrantup.com/v2/getting-started/up.html) the vm more quickly. The initial provisioning only needs to run once. If anything happens with your setup you can `vagrant destroy` and `vagrant up` to bring back a fresh environment. ## Original Developer Notes diff --git a/Vagrantfile b/Vagrantfile index 0ab774c..d3b5cad 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,29 +1,67 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -Vagrant.configure("2") do |config| - # Every Vagrant virtual environment requires a box to build off of. - config.vm.box = "precise64" +# -*- mode: ruby -*- +# vi: set ft=ruby : - # The url from where the 'config.vm.box' box will be fetched if it - # doesn't already exist on the user's system. - config.vm.box_url = "http://files.vagrantup.com/precise64.box" +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" - # port-forwarding - config.vm.network :forwarded_port, guest: 3000, host: 3000 +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + # All Vagrant configuration is done here. The most common configuration + # options are documented and commented below. For a complete reference, + # please see the online documentation at vagrantup.com. + + config.vm.hostname = "watw-dev-box" + + # Every Vagrant virtual environment requires a box to build off of. + config.vm.box = "hashicorp/precise64" + + # Post 'vagrant up' message + config.vm.post_up_message = "SETUP COMPLETE: We Are Tech Women works in Vagrant! + Use 'vagrant ssh' to access the virtual machine" + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8080" will access port 80 on the guest machine. + config.vm.network :forwarded_port, guest: 3000, host: 3000 + # Create a private network, which allows host-only access to the machine + # using a specific IP. config.vm.network :private_network, ip: "192.168.33.10" + # Create a public network, which generally matched to bridged network. + # Bridged networks make the machine appear as another physical device on + # your network. + # config.vm.network :public_network + + # If true, then any SSH connections made will enable agent forwarding. + config.ssh.forward_agent = true + # Share an additional folder to the guest VM. The first argument is # the path on the host to the actual folder. The second argument is # the path on the guest to mount the folder. And the optional third # argument is a set of non-required options. - config.vm.synced_folder ".", "/home/vagrant/watw" + config.vm.synced_folder ".", "/home/vagrant/source" + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + config.vm.provider "virtualbox" do |v| + v.gui = false + + # Use VBoxManage to customize the VM. For example to change memory: + v.customize ["modifyvm", :id, "--memory", "2048"] + end - config.vm.provider :virtualbox do |vb| - vb.customize ["modifyvm", :id, "--memory", "2048"] + # Enable provisioning with Puppet stand alone. Puppet manifests + # are contained in a directory path relative to this Vagrantfile. + config.vm.provision "puppet" do |puppet| + puppet.manifests_path = "puppet/manifests" + puppet.manifest_file = "default.pp" + puppet.module_path = "puppet/modules" + puppet.options = "--verbose --debug" end - config.vm.provision "shell", path: "vagrant_install.sh", privileged: "false" + # Set environment variable + #env ARCHFLAGS="-arch x86_64" end diff --git a/puppet/manifests/default.pp b/puppet/manifests/default.pp new file mode 100644 index 0000000..9c18306 --- /dev/null +++ b/puppet/manifests/default.pp @@ -0,0 +1,19 @@ +$ruby_version = "1.9.3" + +file { '/etc/motd': + content => " +*********************************** + + We Are Tech Women Development + +- OS: Ubuntu 12.04 +- Ruby: ${ruby_version} +- IP: 192.168.33.10 + +*********************************** +\n" +} + +class { setup: + ruby_version => $ruby_version +} diff --git a/puppet/modules/setup/manifests/init.pp b/puppet/modules/setup/manifests/init.pp new file mode 100644 index 0000000..8d1e0a8 --- /dev/null +++ b/puppet/modules/setup/manifests/init.pp @@ -0,0 +1,85 @@ +# inspired by https://github.com/rails/rails-dev-box/blob/master/puppet/manifests/default.pp + +class setup($ruby_version = "1.9.3") { + + $ar_databases = ['activerecord_unittest', 'activerecord_unittest2'] + $as_vagrant = 'sudo -u vagrant -H bash -l -c' + $home = '/home/vagrant/' + + Exec { + path => ['/usr/sbin', '/usr/bin', '/sbin', '/bin'] + } + + # --- Preinstall Stage --------------------------------------------------------- + + stage { 'preinstall': + before => Stage['main'] + } + + class apt_get_update { + exec { 'apt-get -y update': + unless => "test -e ${home}/.rvm" + } + } + class { 'apt_get_update': + stage => preinstall + } + + # --- Packages ----------------------------------------------------------------- + + package { 'curl': + ensure => installed + } + + package { 'build-essential': + ensure => installed + } + + package { 'git-core': + ensure => installed + } + + # Nokogiri dependencies. + package { ['libxml2', 'libxml2-dev', 'libxslt1-dev', 'libpq-dev']: + ensure => installed + } + + # ExecJS runtime. + package { 'nodejs': + ensure => installed + } + + # Image Macgick + package { 'imagemagick': + ensure => installed + } + + package { 'postgresql': + ensure => installed + } + + # --- Ruby --------------------------------------------------------------------- + + exec { 'install_rvm': + command => "${as_vagrant} 'curl -L https://get.rvm.io | bash -s stable'", + creates => "${home}/.rvm/bin/rvm", + require => Package['curl'] + } + + exec { 'install_ruby': + # We run the rvm executable directly because the shell function assumes an + # interactive environment, in particular to display messages or ask questions. + # The rvm executable is more suitable for automated installs. + + # use a ruby patch level known to have a binary + command => "${as_vagrant} '${home}/.rvm/bin/rvm install ruby-${ruby_version} --binary --autolibs=enabled && rvm alias create default ${ruby_version}'", + creates => "${home}/.rvm/bin/ruby", + require => Exec['install_rvm'] + } + + # RVM installs a version of bundler, but for edge Rails we want the most recent one. + exec { "${as_vagrant} 'gem install bundler --no-rdoc --no-ri'": + creates => "${home}/.rvm/bin/bundle", + require => Exec['install_ruby'] + } +} diff --git a/vagrant_install.sh b/vagrant_install.sh deleted file mode 100644 index ec599e8..0000000 --- a/vagrant_install.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -# update apt-get -sudo apt-get update -sudo apt-get upgrade - -# install git -sudo apt-get install git -y - -# install curl -sudo apt-get install curl -y - -# install rvm -curl -L get.rvm.io | bash -s stable - -source /usr/local/rvm/scripts/rvm - -rvm requirements - -# setup ruby -rvm install 1.9.3 -rvm use 1.9.3 --default - -# update the gems if rvm doesn't -rvm rubygems current -rvm rvmrc warning ignore allGemfiles - -# attempt to give access to where rvm is installed, -# TODO: fix this -sudo mkdir /usr/local/rvm -sudo chmod a+xwr /usr/local/rvm - -# install rails -gem install rails --no-ri --no-rdoc - -# update gems -gem update --system - -# install bundler -gem install bundler - -# install postgres -sudo apt-get install postgresql libpq-dev -y - -# install imagemagick -sudo apt-get install imagemagick - -# go to the source directory -cd watw - -# install dependencies -env ARCHFLAGS="-arch x86_64" bundle install - -# create database, migrate, prepare db tests -bundle install -bundle exec rake db:create db:migrate db:test:prepare - -date > /etc/vagrant_provisioned_at - -echo "SETUP COMPLETE: We Are Tech Women works in Vagrant!" -echo "Use 'vagrant ssh' to access the vm" -echo "cd watw" -echo "bundle install" -echo "./go to start the server" -echo "Go to http://localhost:3000 in your browser"