Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Create rake tasks for testing with vagrant.

  • Loading branch information...
commit 04001d4a96e3358a146ac05cc020dcf7cf8ae917 1 parent f35ba6e
@jthurman42 jthurman42 authored
Showing with 59 additions and 0 deletions.
  1. +1 −0  Gemfile
  2. +20 −0 Gemfile.lock
  3. +38 −0 Rakefile
View
1  Gemfile
@@ -6,4 +6,5 @@ gem 'activerecord'
gem 'statemachine'
gem 'colorize'
gem 'choice'
+gem 'vagrant'
View
20 Gemfile.lock
@@ -12,15 +12,34 @@ GEM
activesupport (3.2.9)
i18n (~> 0.6)
multi_json (~> 1.0)
+ archive-tar-minitar (0.5.2)
arel (3.0.2)
builder (3.0.4)
+ childprocess (0.3.6)
+ ffi (~> 1.0, >= 1.0.6)
choice (0.1.6)
colorize (0.5.8)
+ erubis (2.7.0)
+ ffi (1.2.0)
i18n (0.6.1)
+ json (1.5.4)
+ log4r (1.1.10)
multi_json (1.4.0)
mysql (2.8.1)
+ net-scp (1.0.4)
+ net-ssh (>= 1.99.1)
+ net-ssh (2.2.2)
statemachine (2.0.1)
tzinfo (0.3.35)
+ vagrant (1.0.5)
+ archive-tar-minitar (= 0.5.2)
+ childprocess (~> 0.3.1)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6.0)
+ json (~> 1.5.1)
+ log4r (~> 1.1.9)
+ net-scp (~> 1.0.4)
+ net-ssh (~> 2.2.2)
PLATFORMS
ruby
@@ -31,3 +50,4 @@ DEPENDENCIES
colorize
mysql (= 2.8.1)
statemachine
+ vagrant
View
38 Rakefile
@@ -0,0 +1,38 @@
+require 'vagrant'
+
+# Default to running a test
+task :default => :test
+
+# Functional test
+desc "Test the code!"
+task :test do
+ # Startup the environment
+ env = Vagrant::Environment.new
+ puts "Configuring vagrant instances..."
+ env.cli("up")
+
+ if $?.exitstatus == 0
+ # Run the script against vagrant
+ exec("./mysql_role_swap.rb -c cluster.yml -f")
+ else
+ puts "Failed to start the vagrant environment!"
+ end
+end
+
+desc "Shutdown the vagrant environment"
+task :stop do
+ # Startup the environment
+ env = Vagrant::Environment.new
+ puts "Stopping vagrant instances..."
+ env.cli("halt")
+end
+
+desc "Remove any lingering vagrant instances"
+task :clean do
+ # Startup the environment
+ env = Vagrant::Environment.new
+ puts "Stopping vagrant instances..."
+ env.cli("halt")
+ puts "Deleting vagrant instances..."
+ env.cli("destroy", "--force")
+end
Please sign in to comment.
Something went wrong with that request. Please try again.