Class: RoCommands::Navigate

Inherits:
Base show all
Defined in:
lib/ro_commands/navigate.rb

Instance Method Summary collapse

Methods inherited from Base

describe, inherited, method_added, meths, start, usage

Methods included from Bash

#_bash, #add_time, #bash, #bash_capture, #bash_capture_array, #bash_lines, #bash_per, #bash_system, #bundle_exec, #err, err, #handle_path, #kernel_system, out, #out, #status, status

Instance Method Details

#get_dir(name, dir = nil) ⇒ Object



10
11
12
# File 'lib/ro_commands/navigate.rb', line 10

def get_dir(name, dir=nil)
  Out.out _get_dir(name, dir)
end

#get_project(name, projects_dir = nil, lan = 'ruby') ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ro_commands/navigate.rb', line 16

def get_project(name, projects_dir = nil, lan='ruby')
  @name = name
  if lan == 'ruby'
    projects_dir ||= RoCommands.projects
  elsif lan == 'java'
    projects_dir ||= RoCommands.java
  end

  projects = Dir[File.join projects_dir, '**']

  projects.each do |path|
    dir = File.basename path
    if dir == name
      Out.out "path:#{path}  file:#{File.basename __FILE__} line:#{__LINE__}", "green"
      return path
    end
  end

  projects.each do |path|
    dir = File.basename path
    if dir.match(target)
      Out.out "#{path}   file:#{::File.basename __FILE__} line:#{__LINE__}", "green"
      return path
    end
  end

  Out.out("")
end

#get_roadmap(name = nil) ⇒ Object



54
55
56
57
58
# File 'lib/ro_commands/navigate.rb', line 54

def get_roadmap(name=nil)
  name ||= "README.md"
  path = File.join(RoCommands.root, name)
  Out.out path
end

#get_submodule(name, project = nil) ⇒ Object



47
48
49
50
# File 'lib/ro_commands/navigate.rb', line 47

def get_submodule(name, project=nil)
  project ||= Dir.pwd
  Out.out _get_dir(name, File.join(project, 'lib'))
end