Sha256: 26df29c9242348a5c8a83a225a166b069dd49f6393d09f8316fff4a3839a637b

Contents?: true

Size: 938 Bytes

Versions: 12

Compression:

Stored size: 938 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)
    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
        [
          nil,
          targets.select do |target|
            target.possible_signature_file?(path)
          end
        ]
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
steep-0.49.1 lib/steep/project.rb
steep-0.49.0 lib/steep/project.rb
steep-0.48.0 lib/steep/project.rb
steep-0.47.1 lib/steep/project.rb
steep-0.47.0 lib/steep/project.rb
steep-0.46.0 lib/steep/project.rb
steep-0.45.0 lib/steep/project.rb
steep-0.44.1 lib/steep/project.rb
steep-0.44.0 lib/steep/project.rb
steep-0.43.1 lib/steep/project.rb
steep-0.43.0 lib/steep/project.rb
steep-0.42.0 lib/steep/project.rb