Class: ZombieScout::RubyProject

Inherits:
Object
  • Object
show all
Defined in:
lib/zombie_scout/ruby_project.rb

Instance Method Summary collapse

Constructor Details

#initialize(*globs) ⇒ RubyProject

Returns a new instance of RubyProject.



7
8
9
10
# File 'lib/zombie_scout/ruby_project.rb', line 7

def initialize(*globs)
  @globs = globs
  @globs = %w[app config lib] if @globs.empty?
end

Instance Method Details

#foldersObject

TODO this is only called from Mission…weird?



33
34
35
36
37
# File 'lib/zombie_scout/ruby_project.rb', line 33

def folders  # TODO this is only called from Mission...weird?
  %w[app config lib].select { |folder|
    Dir.exist?(folder)
  }
end

#globsObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/zombie_scout/ruby_project.rb', line 22

def globs
  pathnames = @globs.map { |g| Pathname.new(g) }
  pathnames.map { |pathname|
    if pathname.directory?
      "#{pathname}/**/*.rb"
    else
      pathname.to_s
    end
  }
end

#ruby_file_pathsObject



16
17
18
19
20
# File 'lib/zombie_scout/ruby_project.rb', line 16

def ruby_file_paths
  globs.map { |glob| Dir.glob(glob) }.flatten.map { |path|
    path.sub(/^\//, '')
  }
end

#ruby_sourcesObject



12
13
14
# File 'lib/zombie_scout/ruby_project.rb', line 12

def ruby_sources
  ruby_file_paths.map { |path| RubySource.new(path) }
end