Sha256: 1a5e1ce935e5435f3efa14a2394453dc2ac172d514284327b69aa388a01cc139

Contents?: true

Size: 591 Bytes

Versions: 2

Compression:

Stored size: 591 Bytes

Contents

module EacLauncher
  module Stereotypes
    class GitSubrepo
      include EacLauncher::Stereotype

      class << self
        def match?(path)
          File.exist?(path.subpath('.gitrepo')) && subrepo_url(path) != 'none'
        end

        def color
          :light_cyan
        end

        def subrepo_url(path)
          File.read(path.subpath('.gitrepo')).each_line do |l|
            m = /remote\s*=\s(.+)/.match(l)
            return m[1] if m
          end
          raise ::EacLauncher::Git::Error.new(path, '"remote = ... " not found')
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eac_launcher-0.2.0 lib/eac_launcher/stereotypes/git_subrepo.rb
eac_launcher-0.1.7 lib/eac_launcher/stereotypes/git_subrepo.rb