Sha256: 046d7919c47703e15048a735ee80ea3ecef7cc07ea1bac1490d97686ee23ffda

Contents?: true

Size: 960 Bytes

Versions: 29

Compression:

Stored size: 960 Bytes

Contents

module Steep
  class Project
    attr_reader :targets
    attr_reader :steepfile_path

    def initialize(steepfile_path:)
      @targets = []
      @steepfile_path = steepfile_path

      unless steepfile_path.absolute?
        raise "Project#initialize(steepfile_path:): steepfile_path should be absolute path"
      end
    end

    def base_dir
      steepfile_path.parent
    end

    def relative_path(path)
      path.relative_path_from(base_dir)
    rescue ArgumentError
      path
    end

    def absolute_path(path)
      (base_dir + path).cleanpath
    end

    def target_for_source_path(path)
      targets.find do |target|
        target.possible_source_file?(path)
      end
    end

    def targets_for_path(path)
      if target = target_for_source_path(path)
        target
      else
        ts = targets.select {|target| target.possible_signature_file?(path) }
        unless ts.empty?
          ts
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
steep-1.3.1 lib/steep/project.rb
steep-1.4.0.dev.2 lib/steep/project.rb
steep-1.4.0.dev.1 lib/steep/project.rb
steep-1.3.0 lib/steep/project.rb
steep-1.3.0.pre.2 lib/steep/project.rb
steep-1.3.0.pre.1 lib/steep/project.rb
steep-1.2.1 lib/steep/project.rb
steep-1.2.0 lib/steep/project.rb
steep-1.2.0.pre.1 lib/steep/project.rb