module Compostr

Get the loggers, get the config, expose WP

Constants

VERSION

Public Class Methods

config() click to toggle source

Access configuration hash.

# File lib/compostr.rb, line 30
def self.config
  @@config ||= load_conf
end
delete_post(post_id) click to toggle source

Delete a post with given wordpress post_id

# File lib/compostr.rb, line 55
def self.delete_post post_id
  begin
    Compostr::wp.deletePost(blog_id: 0, post_id: post_id)
  rescue XMLRPC::FaultException
    false
  end
end
load_conf() click to toggle source

Load and memoize 'compostr.conf'.

# File lib/compostr.rb, line 25
def self.load_conf
  @@config = OpenStruct.new YAML.load_file 'compostr.conf'
end
logger() click to toggle source

Access the logger, initialize and memoize it on demand.

# File lib/compostr.rb, line 45
def self.logger
  @@logger ||= Logger.new(STDOUT)
end
logger=(logger) click to toggle source

Set the logger.

# File lib/compostr.rb, line 50
def self.logger= logger
  @@logger = logger
end
wp() click to toggle source

Access (and/or initialize) Rubypress client, settings initially pulled from the configuration.

# File lib/compostr.rb, line 36
def self.wp
  @wp ||= Rubypress::Client.new(host: config.host,
                                username: config.username,
                                password: config.password,
                                use_ssl:  config.use_ssl,
                                path:     config.path || "/xmlrpc.php")
end