Class: Pluto::Updater

Inherits:
Object
  • Object
show all
Includes:
LogUtils::Logging
Defined in:
lib/pluto/updater.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts, config) ⇒ Updater

Returns a new instance of Updater.



7
8
9
10
# File 'lib/pluto/updater.rb', line 7

def initialize( opts, config )
  @opts    = opts
  @config  = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



12
13
14
# File 'lib/pluto/updater.rb', line 12

def config
  @config
end

#optsObject (readonly)

Returns the value of attribute opts.



12
13
14
# File 'lib/pluto/updater.rb', line 12

def opts
  @opts
end

Instance Method Details

#run(arg) ⇒ Object



14
15
16
17
18
# File 'lib/pluto/updater.rb', line 14

def run( arg )
  arg = arg.downcase.gsub('.ini','').gsub('.yml','')  # remove file extension if present

  update_for( arg )
end

#update_for(site_key) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/pluto/updater.rb', line 20

def update_for( site_key )
  ###################
  # step 1) update subscriptions
  subscriber = Subscriber.new

  # pass along debug/verbose setting/switch
  subscriber.debug = true    if opts.verbose?
  subscriber.update_subscriptions_for( site_key, config )

  ##############################
  # step 2) update feeds
  refresher = Refresher.new

  # pass along debug/verbose setting/switch
  refresher.debug = true    if opts.verbose?
  refresher.update_feeds_for( site_key )
end