class Tempo::Controllers::Arrange

Public Class Methods

make_child_project(options, parent_args, child_args) click to toggle source
# File lib/tempo/controllers/arrange_controller.rb, line 44
def make_child_project(options, parent_args, child_args)
  parent = match_project :arrange, options, parent_args
  child = match_project :arrange, options, child_args
  parent << child
  @projects.save_to_file options
  Views::arrange_parent_child parent, child
end
make_root_project(options, args) click to toggle source
# File lib/tempo/controllers/arrange_controller.rb, line 32
def make_root_project(options, args)
  root = match_project :arrange, options, args
  if root.parent == :root
    Views::arrange_already_root root
  else
    parent = match_project :arrange, {id: true}, root.parent
    parent.remove_child root
    @projects.save_to_file options
    Views::arrange_root root
  end
end
parse(options, args) click to toggle source
# File lib/tempo/controllers/arrange_controller.rb, line 8
def parse(options, args)

  return Views.project_assistance if Model::Project.index.empty?

  return Views::arrange_parse_error unless args.include? ":"

  parent_args = []
  child_args = []
  in_parent = true
  args.each do |a|
    if a != ":"
      in_parent ? parent_args << a : child_args << a
    else
      in_parent = false
    end
  end

  if parent_args.empty?
    make_root_project options, child_args
  else
    make_child_project options, parent_args, child_args
  end
end