Class: LiquidLint::RakeTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/liquid_lint/rake_task.rb

Overview

Rake task interface for liquid-lint command line interface.

You can also specify the list of files as explicit task arguments:

Examples:

# Add the following to your Rakefile...
require 'liquid_lint/rake_task'

LiquidLint::RakeTask.new do |t|
  t.config = 'path/to/custom/liquid-lint.yml'
  t.files = %w[app/views/**/*.liquid custom/*.liquid]
  t.quiet = true # Don't display output from liquid-lint
end

# ...and then execute from the command line:
rake liquid_lint
# Add the following to your Rakefile...
require 'liquid_lint/rake_task'

LiquidLint::RakeTask.new

# ...and then execute from the command line (single quotes prevent shell
# glob expansion and allow us to have a space after commas):
rake 'liquid_lint[app/views/**/*.liquid, other_files/**/*.liquid]'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :liquid_lint) {|_self| ... } ⇒ RakeTask

Create the task so it exists in the current namespace.

Parameters:

  • name (Symbol) (defaults to: :liquid_lint)

    task name

Yields:

  • (_self)

Yield Parameters:



59
60
61
62
63
64
65
66
67
# File 'lib/liquid_lint/rake_task.rb', line 59

def initialize(name = :liquid_lint)
  @name = name
  @files = ['.'] # Search for everything under current directory by default
  @quiet = false

  yield self if block_given?

  define
end

Instance Attribute Details

#configString

Configuration file to use.

Returns:

  • (String)


42
43
44
# File 'lib/liquid_lint/rake_task.rb', line 42

def config
  @config
end

#filesArray<String>

List of files to lint (can contain shell globs).

Note that this will be ignored if you explicitly pass a list of files as task arguments via the command line or a task definition.

Returns:

  • (Array<String>)


49
50
51
# File 'lib/liquid_lint/rake_task.rb', line 49

def files
  @files
end

#nameString

Name of the task.

Returns:

  • (String)


38
39
40
# File 'lib/liquid_lint/rake_task.rb', line 38

def name
  @name
end

#quiettrue, false

Whether output from liquid-lint should not be displayed to the standard out stream.

Returns:

  • (true, false)


54
55
56
# File 'lib/liquid_lint/rake_task.rb', line 54

def quiet
  @quiet
end