Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdefreyne committed Jan 5, 2017
1 parent 03501ba commit 84f706c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/nanoc/deploying/deployers/git.rb
Expand Up @@ -39,6 +39,7 @@ def run
begin
run_shell_cmd(%W( git config --get remote.#{remote}.url ))
rescue Nanoc::Extra::Piper::Error
# TODO: test
raise "Please add a remote called '#{remote}' to the repo inside #{source_path}."
end
end
Expand All @@ -47,6 +48,7 @@ def run
begin
run_shell_cmd(%W( git checkout #{branch} ))
rescue
# TODO: test
raise "Branch '#{branch}' does not exist inside #{source_path}. Please create one and try again."
end

Expand All @@ -66,6 +68,7 @@ def run
private

def run_shell_cmd(cmd)
# TODO: test
if dry_run
puts cmd.join(' ')
else
Expand All @@ -76,6 +79,7 @@ def run_shell_cmd(cmd)

def clean_repo?
if dry_run && !File.exist?('.git')
# TODO: test
true
else
stdout = StringIO.new
Expand Down
21 changes: 21 additions & 0 deletions spec/nanoc/deploying/git_spec.rb
@@ -0,0 +1,21 @@
describe Nanoc::Deploying::Deployers::Git do
let(:deployer) { described_class.new(output_dir, options) }

subject { deployer.run }

let(:output_dir) { 'output/' }
let(:options) { {} }

context 'output dir does not exist' do
it 'raises' do
# FIXME: Prefer Nanoc::Int::Errors::GenericTrivial
# FIXME: Improve wording (build -> output, …)
expect { subject }.to raise_error(
RuntimeError, "output/ does not exist. Please build your site first.")
end
end

context 'output dir exists' do
# …
end
end

0 comments on commit 84f706c

Please sign in to comment.