Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/dpl/providers/netlify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,20 @@ class Netlify < Provider
opt '--functions FUNCS', 'Specify a functions folder to deploy'
opt '--message MSG', 'A message to include in the deploy log'
opt '--prod', 'Deploy to production'
opt '--json', 'Output json data'

def deploy
shell "netlify deploy #{deploy_opts}"
output = shell "netlify deploy #{deploy_opts}", echo: false, capture:true
info output
if json
shell "echo \"#{output.gsub(/\n/, '').gsub(/"/, '\"')}\" > ./NETLIFY_DEPLOY_JSON_ID_#{site}.json"
end
end

private

def deploy_opts
opts_for(%i(site auth dir functions message prod))
opts_for(%i(site auth dir functions message prod json))
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions spec/dpl/providers/netlify_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
it { should have_run 'netlify deploy --site="id" --auth="token" --prod' }
end

describe 'given --json' do
it { should have_run 'netlify deploy --site="id" --auth="token" --json' }
end

describe 'with credentials in env vars', run: false do
let(:args) { %w(--site id) }
env NETLIFY_AUTH: 'token'
Expand Down