stevenson 2.2.2 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/stevenson/application.rb +0 -1
- data/lib/stevenson/deployers/s3.rb +14 -4
- data/lib/stevenson/output_filter.rb +3 -3
- data/lib/stevenson/output_filter/generator.rb +1 -1
- data/lib/stevenson/output_filters/jekyll.rb +1 -1
- data/lib/stevenson/output_filters/zip.rb +7 -3
- data/lib/stevenson/version.rb +1 -1
- data/spec/lib/output_filter/generator_spec.rb +4 -4
- data/spec/lib/output_filters/jekyll_spec.rb +3 -2
- data/spec/lib/output_filters/zip_spec.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2626791a8038889e6ac36440208c3625a5adf3ae
|
4
|
+
data.tar.gz: 839f9c26cd3f01c0ccf9ab5fde9d328013c7e750
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee524f0970ac01c4acfefb25669d98f546d84f0a5edf63f31b2a567cc14d35cbab8ed22d28983f659d110536c04adff180591119397aa9aa62152b1dcbf77ae2
|
7
|
+
data.tar.gz: a06f034f5885649317729a9cd2b53e87ada3671c5c713f0b8cb9b63102bd0018d199a06e4606b89a1be730a29446ca5d4cf9feae88731d622a43607d3cb6c04a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
2.3.0 (December 30th, 2015)
|
2
|
+
- Fix zip creation
|
3
|
+
- Add ability to specify zip filename
|
4
|
+
- Pass CLI options to Output Filters
|
5
|
+
|
1
6
|
2.2.2 (December 11th, 2015)
|
2
7
|
- Add a clearer error message to Template message
|
3
8
|
- Refactor user directory fetch to try ENV (or default to root on
|
@@ -13,12 +13,22 @@ module Stevenson
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def deploy!(directory)
|
16
|
-
|
16
|
+
entries_for(directory).each do |file_path, file_name|
|
17
17
|
s3_bucket.files.create(
|
18
|
-
key: File.join(deployment_key,
|
19
|
-
body: File.read(
|
18
|
+
key: File.join(deployment_key, file_name),
|
19
|
+
body: File.read(file_path),
|
20
20
|
public: true,
|
21
|
-
) if File.file?(
|
21
|
+
) if File.file?(file_path)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def entries_for(directory)
|
26
|
+
if File.file?(directory)
|
27
|
+
[
|
28
|
+
[directory, File.basename(directory)]
|
29
|
+
]
|
30
|
+
else
|
31
|
+
Dir.glob("#{directory}/**/*").collect { |f| [f, f.partition(directory).last] }
|
22
32
|
end
|
23
33
|
end
|
24
34
|
|
@@ -6,7 +6,7 @@ module Stevenson
|
|
6
6
|
autoload :Generator, 'stevenson/output_filter/generator'
|
7
7
|
|
8
8
|
class Base
|
9
|
-
attr_reader :directory
|
9
|
+
attr_reader :directory, :options
|
10
10
|
|
11
11
|
def self.included(filter)
|
12
12
|
filter.extend ClassMethods
|
@@ -20,8 +20,8 @@ module Stevenson
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def initialize(directory)
|
24
|
-
@directory = directory
|
23
|
+
def initialize(directory, options)
|
24
|
+
@directory, @options = directory, options
|
25
25
|
end
|
26
26
|
|
27
27
|
def output
|
@@ -5,12 +5,16 @@ module Stevenson
|
|
5
5
|
class Zip < Base
|
6
6
|
|
7
7
|
def output
|
8
|
-
"#{
|
8
|
+
File.join(directory, "#{zip_file_name}.zip").tap do |output_zip_path|
|
9
9
|
# Zip up the output directory
|
10
|
-
write directory,
|
10
|
+
write directory, output_zip_path
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
def zip_file_name
|
15
|
+
options[:zip] == "zip" ? File.basename(directory) : options[:zip]
|
16
|
+
end
|
17
|
+
|
14
18
|
private
|
15
19
|
|
16
20
|
def write(inputDir, outputFile)
|
@@ -31,7 +35,7 @@ module Stevenson
|
|
31
35
|
zipFilePath = path == "" ? entry : File.join(path, entry)
|
32
36
|
diskFilePath = File.join(@inputDir, zipFilePath)
|
33
37
|
if File.directory?(diskFilePath)
|
34
|
-
io.mkdir(zipFilePath)
|
38
|
+
io.mkdir(zipFilePath) unless io.find_entry(zipFilePath)
|
35
39
|
subdir = Dir.entries(diskFilePath); subdir.delete("."); subdir.delete("..")
|
36
40
|
writeEntries(subdir, zipFilePath, io)
|
37
41
|
else
|
data/lib/stevenson/version.rb
CHANGED
@@ -11,7 +11,7 @@ describe Stevenson::OutputFilter::Generator do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should create a new filter for the jekyll filter's output" do
|
14
|
-
expect(Stevenson::OutputFilter::Jekyll).to receive(:new).with(template.local_directory).and_call_original
|
14
|
+
expect(Stevenson::OutputFilter::Jekyll).to receive(:new).with(template.local_directory, options).and_call_original
|
15
15
|
subject.generate!(template)
|
16
16
|
end
|
17
17
|
|
@@ -20,16 +20,16 @@ describe Stevenson::OutputFilter::Generator do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
context "when more than one filter exists" do
|
23
|
-
let(:options) { { zip:
|
23
|
+
let(:options) { { zip: "zip" } }
|
24
24
|
let(:zip_filter) { double(:zip_filter, output: zip_output) }
|
25
25
|
|
26
26
|
it "should build subsequent filters with the previous' output" do
|
27
|
-
expect(Stevenson::OutputFilter::Zip).to receive(:new).with(jekyll_output).and_return(zip_filter)
|
27
|
+
expect(Stevenson::OutputFilter::Zip).to receive(:new).with(jekyll_output, options).and_return(zip_filter)
|
28
28
|
subject.generate!(template)
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should return the subsequent filter's output" do
|
32
|
-
allow(Stevenson::OutputFilter::Zip).to receive(:new).with(jekyll_output).and_return(zip_filter)
|
32
|
+
allow(Stevenson::OutputFilter::Zip).to receive(:new).with(jekyll_output, options).and_return(zip_filter)
|
33
33
|
expect(subject.generate!(template)).to eq zip_output
|
34
34
|
end
|
35
35
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
describe Stevenson::OutputFilter::Jekyll do
|
2
|
+
let(:options) { {} }
|
2
3
|
let(:temporary_directory) { '/tmp/directory' }
|
3
4
|
let(:template) { double(:template, local_directory: temporary_directory) }
|
4
|
-
subject { described_class.new(template.local_directory) }
|
5
|
+
subject { described_class.new(template.local_directory, options) }
|
5
6
|
|
6
7
|
describe '#output' do
|
7
8
|
it "should change into the template's directory" do
|
@@ -17,7 +18,7 @@ describe Stevenson::OutputFilter::Jekyll do
|
|
17
18
|
|
18
19
|
it 'outputs a jekyll compiled directory' do
|
19
20
|
allow(Dir).to receive(:chdir).with(temporary_directory)
|
20
|
-
expect(subject.output).to eq File.join(temporary_directory, '_site'
|
21
|
+
expect(subject.output).to eq File.join(temporary_directory, '_site')
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
describe Stevenson::OutputFilter::Zip do
|
2
|
+
let(:options) { { zip: "zip"} }
|
2
3
|
let(:temporary_directory) { '/tmp/directory' }
|
3
4
|
let(:template) { double(:template, local_directory: temporary_directory) }
|
4
|
-
subject { described_class.new(template.local_directory) }
|
5
|
+
subject { described_class.new(template.local_directory, options) }
|
5
6
|
|
6
7
|
describe '#output' do
|
7
|
-
let(:output_zip) { "#{temporary_directory}.zip" }
|
8
|
+
let(:output_zip) { "#{temporary_directory}/#{File.basename(temporary_directory)}.zip" }
|
8
9
|
|
9
10
|
it "should zip the files in temporary_directory to the zip" do
|
10
11
|
expect(subject).to receive(:write).with(temporary_directory, output_zip).and_return(true)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stevenson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RootsRated
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|