Class: SyntaxTree::Rake::Task

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/syntax_tree/rake/task.rb

Overview

A parent Rake task that runs a command on a set of source files.

Direct Known Subclasses

CheckTask, WriteTask

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :"stree:#{command}", source_files = ::Rake::FileList["lib/**/*.rb"], plugins = [], print_width = DEFAULT_PRINT_WIDTH, target_ruby_version = Gem::Version.new(RUBY_VERSION), ignore_files = "") {|_self| ... } ⇒ Task

Returns a new instance of Task.

Yields:

  • (_self)

Yield Parameters:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/syntax_tree/rake/task.rb', line 36

def initialize(
  name = :"stree:#{command}",
  source_files = ::Rake::FileList["lib/**/*.rb"],
  plugins = [],
  print_width = DEFAULT_PRINT_WIDTH,
  target_ruby_version = Gem::Version.new(RUBY_VERSION),
  ignore_files = ""
)
  @name = name
  @source_files = source_files
  @plugins = plugins
  @print_width = print_width
  @target_ruby_version = target_ruby_version
  @ignore_files = ignore_files

  yield self if block_given?
  define_task
end

Instance Attribute Details

#ignore_filesObject

Glob pattern to ignore source files. Defaults to ”.



34
35
36
# File 'lib/syntax_tree/rake/task.rb', line 34

def ignore_files
  @ignore_files
end

#nameObject

Name of the task.



14
15
16
# File 'lib/syntax_tree/rake/task.rb', line 14

def name
  @name
end

#pluginsObject

The set of plugins to require. Defaults to [].



22
23
24
# File 'lib/syntax_tree/rake/task.rb', line 22

def plugins
  @plugins
end

Max line length. Defaults to 80.



26
27
28
# File 'lib/syntax_tree/rake/task.rb', line 26

def print_width
  @print_width
end

#source_filesObject

Glob pattern to match source files. Defaults to ‘lib/*/.rb’.



18
19
20
# File 'lib/syntax_tree/rake/task.rb', line 18

def source_files
  @source_files
end

#target_ruby_versionObject

The target Ruby version to use for formatting. Defaults to Gem::Version.new(RUBY_VERSION).



30
31
32
# File 'lib/syntax_tree/rake/task.rb', line 30

def target_ruby_version
  @target_ruby_version
end