From 1858c4076c3292547d47e81103681cf22f83102d Mon Sep 17 00:00:00 2001 From: CJ Horton <17039873+radditude@users.noreply.github.com> Date: Wed, 26 Aug 2020 21:41:45 -0700 Subject: [PATCH] allow updating a configured manifest file Previously, calling Papers::ManifestUpdater.new.update! updated config/papers_manifest.yml by default. This change allows the updater to use the manifest file that has been globally configured if it exists. --- lib/papers/manifest_command.rb | 2 +- spec/manifest_updater_spec.rb | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/papers/manifest_command.rb b/lib/papers/manifest_command.rb index 413048a..182efdb 100644 --- a/lib/papers/manifest_command.rb +++ b/lib/papers/manifest_command.rb @@ -1,7 +1,7 @@ module Papers class ManifestCommand def initialize(manifest_path = nil) - @manifest_path = manifest_path || File.join('config', 'papers_manifest.yml') + @manifest_path = manifest_path || Papers.config.manifest_file || File.join('config', 'papers_manifest.yml') end def manifest_exists? diff --git a/spec/manifest_updater_spec.rb b/spec/manifest_updater_spec.rb index 7b92a4f..3e0ab83 100644 --- a/spec/manifest_updater_spec.rb +++ b/spec/manifest_updater_spec.rb @@ -170,4 +170,31 @@ expect(updater.update).to eq(expected) end end + + describe "with a configured manifest file path" do + let(:path) { "/config/papers_manifest_custom.yml" } + subject(:updater) { Papers::ManifestUpdater.new } + let(:original_content) { <