From 1c44e8be14fd123ba426a5d41de4bbb5bc90c531 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 19 Aug 2026 19:27:26 +0900 Subject: [PATCH] Fix feed inspection to report when no feed is discovered --- doc/VERSIONS | 1 + lib/automatic/cli.rb | 4 +++- spec/lib/automatic/cli_spec.rb | 14 +++++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/doc/VERSIONS b/doc/VERSIONS index 5eadeab..778ba45 100644 --- a/doc/VERSIONS +++ b/doc/VERSIONS @@ -6,6 +6,7 @@ v26.08 (Release Date: TBD) - Support Ruby 3.3 through 4.0 and modernize the codebase for current Ruby and maintained library APIs, validating representative versions in CI. - Harden Recipe loading with safe YAML parsing, structural validation and framework-specific errors. - Restructure the CLI with help and version options, predictable error reporting and documented exit statuses. +- Report a clear CLI error when feed inspection discovers no feed instead of raising an internal exception. - Verify TLS certificates when publishing to Instapaper instead of accepting an unverified connection. - Modernize gem packaging and dependency policy, separating core requirements from optional plugin dependencies so that an installation can be minimal, complete or extended one plugin at a time, and excluding development and generated files. - Classify every shipped plugin by its current support status rather than simulating obsolete services in tests. diff --git a/lib/automatic/cli.rb b/lib/automatic/cli.rb index 829987a..658883f 100644 --- a/lib/automatic/cli.rb +++ b/lib/automatic/cli.rb @@ -5,7 +5,7 @@ # License:: The GPL version 3, or LGPL version 3 (Dual License). # Contact:: idnanashi@gmail.com # Created:: Aug 14, 2026 -# Updated:: Aug 14, 2026 +# Updated:: Aug 19, 2026 # Copyright:: Copyright (c) 2012-2026 Automatic Ruby Developers. # # Everything that belongs to being a command: option parsing, the subcommands, @@ -218,6 +218,8 @@ def inspect_url(argv) require 'pp' url = argv.shift || missing_argument('inspect') feeds = Feedbag.find(url) + raise Automatic::Error, "no feed found at #{url}" if feeds.empty? + @stdout.puts feeds.pretty_inspect @stdout.puts Automatic::FeedParser.get_url(feeds.pop).pretty_inspect end diff --git a/spec/lib/automatic/cli_spec.rb b/spec/lib/automatic/cli_spec.rb index 4843a57..d1771a2 100644 --- a/spec/lib/automatic/cli_spec.rb +++ b/spec/lib/automatic/cli_spec.rb @@ -5,7 +5,7 @@ # License:: The GPL version 3, or LGPL version 3 (Dual License). # Contact:: idnanashi@gmail.com # Created:: Aug 14, 2026 -# Updated:: Aug 14, 2026 +# Updated:: Aug 19, 2026 # Copyright:: Copyright (c) 2012-2026 Automatic Ruby Developers. require File.expand_path(File.join(File.dirname(__FILE__), '../../spec_helper')) @@ -80,6 +80,18 @@ def run(*argv, root_dir: APP_ROOT) end end + describe "the inspect subcommand" do + it "fails cleanly when no feed is discovered" do + stub_const("Feedbag", Class.new) + allow(Automatic).to receive(:require_optional) + allow(Feedbag).to receive(:find).and_return([]) + + expect(run("inspect", "https://example.com/")).to eq Automatic::CLI::EXIT_FAILURE + expect(err.string).to match(%r{no feed found at https://example\.com/}) + expect(out.string).to be_empty + end + end + describe "running a recipe" do # A recipe of plugins that reach nothing: the framework is exercised # end to end without a network, which is what the suite is allowed to do.