Module: Automatic

Defined in:
lib/automatic.rb,
lib/automatic/cli.rb,
lib/automatic/log.rb,
lib/automatic/http.rb,
lib/automatic/opml.rb,
lib/automatic/recipe.rb,
lib/automatic/version.rb,
lib/automatic/pipeline.rb,
lib/automatic/feed_maker.rb,
lib/automatic/feed_parser.rb

Overview

Name

Automatic::FeedParser

Author: id774 (More info: http://id774.net)

Source Code

https://github.com/id774/automaticruby

License

The GPL version 3, or LGPL version 3 (Dual License).

Contact

idnanashi@gmail.com

Created

Feb 19, 2012

Updated

Aug 14, 2026

Copyright

Copyright (c) 2012-2026 Automatic Ruby Developers.

Fetching and parsing, on the way into the pipeline. What leaves here has the shape described in doc/PLUGINS.md section 3.4.

Defined Under Namespace

Modules: FeedMaker, FeedParser, Http, Log, OPML, Pipeline, Plugin Classes: CLI, Error, InvalidRecipeError, NoPluginError, NoRecipeError, Recipe

Constant Summary collapse

USER_DIR =

The user directory, relative to the home directory.

'/.automatic'
VERSION =

The release version. The VERSION file at the repository root carries the same number and the gemspec reads it from there; a spec asserts that the two agree. See doc/POLICY.md section 10.

'26.08'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.root_dirObject

Returns the value of attribute root_dir.



42
43
44
# File 'lib/automatic.rb', line 42

def root_dir
  @root_dir
end

Class Method Details

.config_dirObject



78
79
80
# File 'lib/automatic.rb', line 78

def config_dir
  File.join(@root_dir.to_s, 'config')
end

.plugins_dirObject



74
75
76
# File 'lib/automatic.rb', line 74

def plugins_dir
  File.join(@root_dir.to_s, 'plugins')
end

.require_optional(feature, needed_by:, gem_name: feature) ⇒ Object

Require a gem that only one plugin, or one optional path, needs, and turn its absence into a message naming the gem, what wanted it and how to get it. Nothing here resolves, installs or tracks a dependency: the require is the plugin's own, made where the plugin makes it, and this only replaces cannot load such file -- dalli with a sentence an operator can act on. See doc/POLICY.md section 9.1 and doc/PLUGINS.md section 3.8.

Automatic.require_optional('sanitize', needed_by: 'FilterSanitize')

gem_name is given where it differs from the path required, as active_record does from the activerecord gem.



55
56
57
58
59
60
61
62
63
# File 'lib/automatic.rb', line 55

def require_optional(feature, needed_by:, gem_name: feature)
  require feature
rescue LoadError => e
  raise LoadError,
        "The `#{gem_name}` gem is not installed. It is needed by #{needed_by}. " \
        "Install it with `gem install #{gem_name}`, or in a source checkout add " \
        'its group to the bundle; see the optional plugin dependencies in ' \
        "doc/DEPLOYMENT.md. (#{e.message})"
end

.run(args = {}) ⇒ Object

Run one Recipe. root_dir is the installation root; user_dir is honoured only under AUTOMATIC_RUBY_ENV=test, which is how the specs point the plugin loader at a fixture directory.



68
69
70
71
72
# File 'lib/automatic.rb', line 68

def run(args = {})
  self.root_dir = args[:root_dir]
  self.user_dir = args[:user_dir]
  Automatic::Pipeline.run(args[:recipe])
end

.user_config_dirObject

Where a Recipe named by a bare filename is looked for.



102
103
104
# File 'lib/automatic.rb', line 102

def user_config_dir
  File.join(user_dir.to_s, 'config')
end

.user_dirObject

Defaults to ~/.automatic when nothing has set it, so that a caller which never went through .run still resolves the user directory.



84
85
86
# File 'lib/automatic.rb', line 84

def user_dir
  @user_dir ||= default_user_dir
end

.user_dir=(dir) ⇒ Object



88
89
90
91
92
93
94
95
# File 'lib/automatic.rb', line 88

def user_dir=(dir)
  @user_dir =
    if ENV['AUTOMATIC_RUBY_ENV'] == 'test' && !dir.nil?
      dir
    else
      default_user_dir
    end
end

.user_plugins_dirObject



97
98
99
# File 'lib/automatic.rb', line 97

def user_plugins_dir
  File.join(user_dir.to_s, 'plugins')
end