bin/pinpress in pinpress-1.4.0 vs bin/pinpress in pinpress-1.4.1

- old
+ new

@@ -153,11 +153,11 @@ # Request pin data from Pinboard and output the return data. output = PinPress.pin_yield(template, opts) puts output if output # Save the last-run date to the configuration file. - configuration.pin_templates[template_name.to_sym].last_run = Time.now.utc.iso8601 + configuration.pin_templates.find { |t| t.keys[0] == template_name.to_sym}.values[0].last_run = Time.now.utc.iso8601 configuration.save end c.desc 'Gets all pins from the last run date + 1' c.command :last do |last| @@ -166,11 +166,11 @@ # Figure out the template to use based on the passed argument (if any) # and/or the presence of a default template. template_name, template = PinPress.init_template(options[:m], PinPress::Template::TYPE_PIN) - last_run_date = configuration.pin_templates[template_name.to_sym].last_run + last_run_date = configuration.pin_templates.find { |t| t.keys[0] == template_name.to_sym }.values[0].last_run if last_run_date # Set one option: the start date. Set it to the last-run date + 1. opts = {} opts.merge!(fromdt: DateTime.parse(last_run_date) + 1) opts.merge!(PinPress.merge_common_options(options)) @@ -178,12 +178,12 @@ # Request pin data from Pinboard and output the return data. output = PinPress.pin_yield(template, opts) puts output if output # Save the last-run date to the configuration file. - configuration.pin_templates[template_name.to_sym].last_run = Time.now.utc.iso8601 - configuration.save + configuration.pin_templates.find { |t| t.keys[0] == template_name.to_sym}.values[0].last_run = Time.now.utc.iso8601 + configuration.save else messenger.warn("`pinpress pins` hasn't been run before.") end end end @@ -219,22 +219,23 @@ # Request tag data from Pinboard and output the return data. output = PinPress.tag_yield(template, opts) puts output if output # Save the last-run date to the configuration file. - configuration.tag_templates[template_name.to_sym].last_run = Time.now.utc.iso8601 + t_config = configuration.tag_templates.find { |t| t.keys[0] == template_name.to_sym}.values[0] + t_config.last_run = Time.now.utc.iso8601 configuration.save end c.desc 'Gets all tags from the last run date + 1' c.command :last do |last| last.action do |global_options, options, args| # Figure out the template to use based on the passed argument (if any) # and/or the presence of a default template. template_name, template = PinPress.init_template(options[:m], PinPress::Template::TYPE_TAG) - last_run_date = configuration.tag_templates[template_name.to_sym].last_run + last_run_date = configuration.tag_templates.find { |t| t.keys[0] == template_name.to_sym }.values[0].last_run if last_run_date PinPress.verbose = global_options[:v] # Set one option: the start date. Set it to the last-run date + 1. opts = {} @@ -244,10 +245,11 @@ # Request tag data from Pinboard and output the return data. output = PinPress.tag_yield(template, opts) puts output if output # Save the last-run date to the configuration file. - configuration.tag_templates[template_name.to_sym].last_run = Time.now.utc.iso8601 + t_config = configuration.tag_templates.find { |t| t.keys[0] == template_name.to_sym}.values[0] + t_config.last_run = Time.now.utc.iso8601 configuration.save else messenger.warn("`pinpress tags` hasn't been run before.") end end