Sha256: 1204fd3504394f81d30ed0d890b5915b575e0f7a3b9e62904d9ed02da13ddc56

Contents?: true

Size: 814 Bytes

Versions: 6

Compression:

Stored size: 814 Bytes

Contents

require 'zombie_scout/ruby_source'
require 'pathname'

module ZombieScout
  class RubyProject

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

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

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

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zombie_scout-0.0.6 lib/zombie_scout/ruby_project.rb
zombie_scout-0.0.5 lib/zombie_scout/ruby_project.rb
zombie_scout-0.0.4 lib/zombie_scout/ruby_project.rb
zombie_scout-0.0.3 lib/zombie_scout/ruby_project.rb
zombie_scout-0.0.2 lib/zombie_scout/ruby_project.rb
zombie_scout-0.0.1 lib/zombie_scout/ruby_project.rb