Class: HamlLint::RakeTask

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

Overview

Rake task interface for haml-lint command line interface.

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

Examples:

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

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

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

HamlLint::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 'haml_lint[app/views/**/*.haml, other_files/**/*.haml]'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Create the task so it exists in the current namespace.

Parameters:

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

    task name

Yields:

  • (_self)

Yield Parameters:



57
58
59
60
61
62
63
64
65
# File 'lib/haml_lint/rake_task.rb', line 57

def initialize(name = :haml_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)


40
41
42
# File 'lib/haml_lint/rake_task.rb', line 40

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>)


47
48
49
# File 'lib/haml_lint/rake_task.rb', line 47

def files
  @files
end

#nameString

Name of the task.

Returns:

  • (String)


36
37
38
# File 'lib/haml_lint/rake_task.rb', line 36

def name
  @name
end

#quiettrue, false

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

Returns:

  • (true, false)


52
53
54
# File 'lib/haml_lint/rake_task.rb', line 52

def quiet
  @quiet
end