module Canvas::Workflow

Constants

VERSION

Public Class Methods

client() click to toggle source

Access the Canvas client for this Canvas Workflow site.

@return [Canvas::Client] the Canvas client for this Canvas Workflow site

# File lib/canvas/workflow.rb, line 26
def self.client
  @client ||= Client.new(config)
end
config() click to toggle source

Access the configuration object for this Canvas Workflow site.

@return the configuration object for this Canvas Workflow site

# File lib/canvas/workflow.rb, line 18
def self.config
  # load user configuration
  @config ||= YAML.load_file('_config.yml')['canvas']
end
excluded?(file) click to toggle source

Is file excluded from upload?

@param file [String] a file name @return [Boolean] true if the file has been excluded from upload.

# File lib/canvas/workflow.rb, line 34
def self.excluded?(file)
  return false if config['exclude'].nil?

  # get the list of files that has been explicitly excluded
  @excluded ||= Dir.glob(config['exclude'].map do |f|
    if File.directory?(f)
      if f.end_with?("/")
        f + "**/*"
      else
        f + "/**/*"
      end
    else
      f
    end
  end)

  # check if the param file has been excluded
  @excluded.include?(file)
end
included?(file) click to toggle source

Is file included for upload?

@param file [String] a file name @return [Boolean] true if the file has been included for upload.

# File lib/canvas/workflow.rb, line 58
def self.included?(file)
  return false if config['include'].nil?

  # get the list of files that has been explicitly included
  @included ||= Dir.glob(config['include'].map do |f|
    if File.directory?(f)
      if f.end_with?("/")
        f + "**/*"
      else
        f + "/**/*"
      end
    else
      f
    end
  end)

  # check if the param file has been included
  @included.include?(file)
end