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.

Yields:

  • (_self)

Yield Parameters:


54
55
56
57
58
59
60
61
62
# File 'lib/haml_lint/rake_task.rb', line 54

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)

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

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

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

def files
  @files
end

#nameString

Name of the task.

Returns:

  • (String)

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

def name
  @name
end

#quiettrue, false

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

Returns:

  • (true, false)

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

def quiet
  @quiet
end