class Mako::Subscribe

Public Class Methods

perform(args) click to toggle source
# File lib/mako/commands/subscribe.rb, line 5
def self.perform(args)
  if args.empty?
    Mako.errors.add_error 'No feeds to find'
    return
  end
  feeds = Mako::FeedFinder.new(uris: args).find
  write_to_subscriptions(feeds)
  Mako.logger.info "Subscribed to the following feeds: #{feeds}"
end
write_to_subscriptions(feed_urls) click to toggle source
# File lib/mako/commands/subscribe.rb, line 15
def self.write_to_subscriptions(feed_urls)
  path = File.expand_path(Dir.glob('subscriptions.*').first, Dir.pwd)
  Mako::SubscriptionListWriter.new(feeds: feed_urls, destination: path).append_and_write
end