-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add archive source fetching strategy
- grab file and unzip in source cache dir - accept flags for git and archive for uri - shasum written to `REVISION` - add basic vagrant box for testing
- Loading branch information
1 parent
295d87c
commit 6bee2ef
Showing
24 changed files
with
551 additions
and
165 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
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,10 @@ | ||
Vagrant.configure("2") do |config| | ||
config.vm.box = "opscode-ubuntu-12.04" | ||
config.vm.box_url = "https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box" | ||
|
||
config.ssh.max_tries = 15 | ||
config.ssh.timeout = 120 | ||
|
||
config.vm.provision :shell, :path => "bootstrap.sh" | ||
config.vm.define "boxi" | ||
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,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
apt-get update | ||
apt-get install -y ruby1.9.3 unzip curl | ||
|
||
mkdir -p /data/serverside && chown vagrant:vagrant /data/serverside |
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,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
engineyard-serverside deploy --verbose \ | ||
--account-name serverside-testing \ | ||
--app serverside \ | ||
--config '{"deployed_by":"The Mothership"}' \ | ||
--environment-name production \ | ||
--framework-env production \ | ||
--instances localhost \ | ||
--instance-roles localhost:solo \ | ||
--archive https://github.com/engineyard/todo/archive/master.zip | ||
# --ref master \ | ||
# --git https://github.com/engineyard/todo.git |
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,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
rm *.gem && gem build engineyard-serverside.gemspec && sudo gem install *.gem |
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
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
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,76 @@ | ||
require 'pathname' | ||
require 'engineyard-serverside/spawner' | ||
|
||
class EY::Serverside::Strategy | ||
attr_reader :uri, :opts, :source_cache, :ref, :shell | ||
alias repository_cache source_cache | ||
|
||
class << self | ||
attr_reader :required_opts | ||
def require_opts(*names) | ||
@required_opts ||= [] | ||
@required_opts += names | ||
end | ||
|
||
def for(type) | ||
const_get(type) | ||
end | ||
end | ||
|
||
def initialize(shell, opts={}) | ||
@shell = shell | ||
@opts = opts | ||
|
||
if self.class.required_opts && !self.class.required_opts.all? {|name| @opts[name] } | ||
raise ArgumentError, | ||
"Missing required key(s) (#{self.class.required_opts.join(', ')} required)" | ||
end | ||
|
||
@ref = @opts[:ref] | ||
@uri = @opts[:uri].to_s if @opts[:uri] | ||
@source_cache = Pathname.new(@opts[:repository_cache]) if @opts[:repository_cache] | ||
end | ||
|
||
protected | ||
|
||
def in_source_cache(&block) | ||
raise ArgumentError, "Block required" unless block | ||
source_cache.mkpath | ||
Dir.chdir(source_cache, &block) | ||
end | ||
|
||
def escape(*shell_commands) | ||
Escape.shell_command(shell_commands) | ||
end | ||
|
||
def runner | ||
EY::Serverside::Spawner | ||
end | ||
|
||
# Internal: Run a command. | ||
# | ||
# cmd - A string command. | ||
# | ||
# Returns an instance of Spawner. | ||
def run(cmd) | ||
runner.run(cmd, shell, nil) | ||
end | ||
|
||
# Internal: Run a command and return the output. | ||
# | ||
# cmd - A string command. | ||
# | ||
# Returns the output of the command. | ||
def run_and_output(cmd) | ||
run(cmd).output | ||
end | ||
|
||
# Internal: Run a command and check if it was successful. | ||
# | ||
# cmd - A string command. | ||
# | ||
# Returns success. | ||
def run_and_success?(cmd) | ||
run(cmd).success? | ||
end | ||
end |
Oops, something went wrong.