-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
d567aa2
commit 5242225
Showing
11 changed files
with
119 additions
and
20 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
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 |
---|---|---|
@@ -1,16 +1,22 @@ | ||
require 'formatron/s3_path' | ||
|
||
class Formatron | ||
# manage the configuration stored on S3 | ||
module S3Configuration | ||
def self.deploy(aws, configuration, target) | ||
aws.upload( | ||
configuration.kms_key(target), | ||
configuration.bucket(target), | ||
File.join(target, configuration.name(target), 'config.json'), | ||
S3Path.path(configuration, target, 'config.json'), | ||
configuration.config(target).to_json | ||
) | ||
end | ||
|
||
def self.destroy(_aws, _formatronfile, _target) | ||
def self.destroy(aws, configuration, target) | ||
aws.delete( | ||
configuration.bucket(target), | ||
S3Path.path(configuration, target, 'config.json') | ||
) | ||
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,16 @@ | ||
class Formatron | ||
# defines the S3 bucket keys for consistency | ||
module S3Path | ||
def self.path(configuration, target, sub_path) | ||
File.join _base_path(configuration, target), sub_path | ||
end | ||
|
||
def self._base_path(configuration, target) | ||
File.join target, configuration.name(target) | ||
end | ||
|
||
private_class_method( | ||
:_base_path | ||
) | ||
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
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 |
---|---|---|
|
@@ -6,9 +6,4 @@ | |
skip 'should do something' do | ||
end | ||
end | ||
|
||
describe '::destroy' do | ||
skip 'should do something' do | ||
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
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,27 @@ | ||
require 'spec_helper' | ||
require 'formatron/aws' | ||
require 'formatron/configuration' | ||
require 'formatron/s3_path' | ||
|
||
describe Formatron::S3Path do | ||
target = 'target' | ||
name = 'name' | ||
sub_path = 'sub_path' | ||
|
||
before(:each) do | ||
@aws = instance_double 'Formatron::AWS' | ||
@configuration = instance_double 'Formatron::Configuration' | ||
end | ||
|
||
describe '::path' do | ||
it 'should create a standard path including the ' \ | ||
'configuration name and target' do | ||
expect(@configuration).to receive(:name).once.with( | ||
target | ||
) { name } | ||
expect(Formatron::S3Path.path(@configuration, target, sub_path)).to eql( | ||
File.join(target, name, sub_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