Class: SlimLint::RakeTask

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

Overview

Rake task interface for slim-lint command line interface.

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

Examples:

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

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

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

SlimLint::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 'slim_lint[app/views/**/*.slim, other_files/**/*.slim]'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Create the task so it exists in the current namespace.

Parameters:

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

    task name

Yields:

  • (_self)

Yield Parameters:



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

def initialize(name = :slim_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/slim_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/slim_lint/rake_task.rb', line 49

def files
  @files
end

#nameString

Name of the task.

Returns:

  • (String)


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

def name
  @name
end

#quiettrue, false

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

Returns:

  • (true, false)


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

def quiet
  @quiet
end