Class: Projects::ListTask

Inherits:
Anvil::Task show all
Defined in:
lib/tasks/projects/list_task.rb

Instance Attribute Summary

Attributes inherited from Anvil::Task

#options

Attributes included from Anvil::Task::Options

#parser_block

Instance Method Summary collapse

Methods inherited from Anvil::Task

#logger, #run

Methods included from Anvil::Task::ClassMethods

#after, #afters, #assure, #assures, #before, #befores, #descendants, #run

Methods included from Anvil::Task::Naming

#description, #from_name, #get_namespace, #task_name

Methods included from Anvil::Task::Options

#build_parser, #configure_parser, #help, #parse_options!, #parser

Constructor Details

#initialize(_options = {}) ⇒ ListTask

Returns a new instance of ListTask.



7
# File 'lib/tasks/projects/list_task.rb', line 7

def initialize(_options = {}); end

Instance Method Details

#list_projects(names) ⇒ Object



17
18
19
# File 'lib/tasks/projects/list_task.rb', line 17

def list_projects(names)
  printf("%s\n", names.join("\n"))
end

#projectsObject



13
14
15
# File 'lib/tasks/projects/list_task.rb', line 13

def projects
  Dir.glob('*').select { |f| File.directory?(f) }.sort
end

#taskObject



9
10
11
# File 'lib/tasks/projects/list_task.rb', line 9

def task
  Dir.chdir(Anvil::Config.base_projects_path) { list_projects(projects) }
end