This repository has been archived by the owner on Sep 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pranav Raja
committed
Aug 2, 2013
1 parent
e15991a
commit 4696482
Showing
18 changed files
with
228 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
credentials.yml | ||
config.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
source :rubygems | ||
|
||
gem 'aws-sdk' | ||
|
||
group :development, :test do | ||
gem 'rspec' | ||
end | ||
|
||
gem 'rake' | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require 'bundler/gem_tasks' |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- encoding: utf-8 -*- | ||
$:.push File.expand_path("../lib", __FILE__) | ||
require 'beanstalkify/version' | ||
|
||
Gem::Specification.new do |s| | ||
s.name = 'beanstalkify' | ||
s.version = Beanstalkify::VERSION | ||
s.summary = "Beanstalk automation for dummies" | ||
s.description = "Create Amazon Elastic Beanstalk apps and deploy versions from the command line" | ||
s.authors = ["Pranav Raja"] | ||
s.email = 'rickdangerous1@gmail.com' | ||
s.files = `git ls-files`.split("\n") | ||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | ||
s.require_paths = ["lib"] | ||
s.homepage = 'https://github.com/pranavraja/beanstalkify' | ||
s.license = 'MIT' | ||
|
||
s.add_dependency 'aws-sdk' | ||
s.add_development_dependency "rspec" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require 'beanstalkify/environment' | ||
require 'beanstalkify/deploy' | ||
|
||
module Beanstalkify | ||
class Application | ||
attr_accessor :stack, :config | ||
|
||
# config is an array of hashes: | ||
# :namespace, :option_name, :value | ||
def initialize(stack, config) | ||
@stack = stack | ||
@config = config.map { |c| Hash[c.map { |k, v| [k.to_sym,v]}] } | ||
end | ||
|
||
# Deploy an archive to an environment. | ||
# If the environment doesn't exist, it will be created. | ||
def deploy!(archive, environment_name) | ||
deployment = Deploy.new(archive) | ||
env = Environment.new(environment_name) | ||
if deployment.deployed? | ||
puts "#{deployment.application.version} is already uploaded." | ||
else | ||
deployment.upload! | ||
deployment.wait! | ||
end | ||
if env.status.empty? | ||
puts "Creating stack '#{@stack}' for #{deployment.application.name}-#{deployment.application.version}..." | ||
env.create!(deployment.application, @stack, @config) | ||
env.wait!("Launching") | ||
else | ||
puts "Deploying #{deployment.application.version} to #{environment_name}..." | ||
env.deploy!(deployment.application, @config) | ||
env.wait!("Updating") | ||
end | ||
puts "Done. Visit http://#{env.url} in your browser." | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
module Beanstalkify | ||
class Archive | ||
attr_accessor :path | ||
|
||
def initialize(path) | ||
@path = path | ||
end | ||
|
||
def name | ||
filename.split('-')[0] | ||
end | ||
|
||
def version | ||
File.basename(@path, '.*').split('-')[-1] | ||
end | ||
|
||
def filename | ||
File.basename(@path) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'aws-sdk' | ||
|
||
module Beanstalkify | ||
class Beanstalk | ||
@@config = {} | ||
def self.configure!(config={}) | ||
# Convert string keys to symbols | ||
@@config = Hash[config.map{|(k,v)| [k.to_sym,v]}] | ||
end | ||
def self.api | ||
AWS.config(@@config) | ||
AWS::ElasticBeanstalk.new.client | ||
end | ||
end | ||
end |
Oops, something went wrong.