class FPM::Fry::Source::Git

Used to build directly from git.

@example in a recipe

source 'https://github.com/ggreer/the_silver_searcher.git'

It automatically recognizes the following url patterns:

- git://…
- git+…://…
- user@host:….git
- https://….git
- https://git.…

Constants

REGEX

Attributes

file_map[R]

@return [Hash<String,String>,nil] the file map for generating a docker file

git[R]

@return [String] the git binary (default: “git”)

logger[R]

@return [Cabin::Channel] logger

rev[R]

@return [String] the git rev to pull (default “HEAD”)

to[R]

@return [String,nil]

url[R]

@return [URI] the uri to pull from

Public Class Methods

guess( url ) click to toggle source

Guesses if this url is a git url.

@example not a git url

FPM::Fry::Source::Git.guess( "bzr://something" ) #=> nil

@example a git url

FPM::Fry::Source::Git.guess( "git://something" ) #=> 4

@param [URI,String] url @return [nil] when this uri doesn’t match @return [Numeric] number of characters that were used

# File lib/fpm/fry/source/git.rb, line 39
def self.guess( url )
  Source::guess_regex(REGEX, url)
end
name() click to toggle source

@return [:git]

# File lib/fpm/fry/source/git.rb, line 24
def self.name
  :git
end
new( url, options = {} ) click to toggle source

@param [URI] url the url to pull from @param [Hash] options @option options [Cabin::Channel] :logger (cabin default channel) @option options [String] :branch git branch to pull @option options [String] :tag git tag to pull @option options [Hash<String,String>] :file_map ({“”=>“”}) the file map to create the docker file from

# File lib/fpm/fry/source/git.rb, line 113
def initialize( url, options = {} )
  url = url.sub(/\A(\S+@\S+):(\S+\.git)\z/,'ssh://\1/\2')
  @url = URI(url)
  @logger = options.fetch(:logger){ Cabin::Channel.get }
  @rev = options[:branch] || options[:tag] || options[:rev] || 'HEAD'
  @file_map = options[:file_map]
  @git = options[:git] || 'git'
  @to = options[:to]
end

Public Instance Methods

build_cache(tempdir) click to toggle source

@param [String] tempdir @return [Cache]

# File lib/fpm/fry/source/git.rb, line 125
def build_cache(tempdir)
  Cache.new(self, tempdir)
end