Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds new environment tasks #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boucher.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |s|
s.name = "boucher"
s.version = "0.3.1"
s.version = "0.3.2"
s.authors = ["'Micah Micah'"]
s.email = ["'[email protected]'"]
s.homepage = "http://github.com/8thlight/boucher"
Expand Down
41 changes: 41 additions & 0 deletions lib/boucher/tasks/environment.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require 'boucher/compute'
require 'boucher/env'
require 'boucher/io'
require 'boucher/meals'
require 'boucher/provision'
require 'boucher/servers'
require 'boucher/volumes'
require 'retryable'

namespace :environment do
desc "Stops all servers in the specified environment"
task :stop, [:env] do |t, args|
servers = Boucher::Servers.in_env(args.env)
Boucher::Servers.stop(servers) if !servers.empty?
end

desc "Starts all servers in the specified environment"
task :start, [:env] do |t, args|
servers = Boucher::Servers.in_env(args.env)
Boucher::Servers.start(servers) if !servers.empty?
end

desc "Restarts all servers in the specified environment"
task :restart, [:env] do |t, args|
servers = Boucher::Servers.in_env(args.env)
Boucher::Servers.restart(servers) if !servers.empty?
end

desc "Terminates all servers in the specified environment"
task :terminate, [:env] do |t, args|
servers = Boucher::Servers.in_env(args.env)
begin
Boucher::Servers.terminate(servers) if !servers.empty?
rescue => e
puts "\nTermination failed. This may be due to termination protection. If
you're sure you wish to disable this protection, select the instance in the AWS
web console and click Instance Actions -> Change Termination Protection -> Yes."
raise
end
end
end