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
@return [Hash<String,String>,nil] the file map for generating a docker file
@return [String] the git binary (default: “git”)
@return [Cabin::Channel] logger
@return [String] the git rev to pull (default “HEAD”)
@return [String,nil]
@return [URI] the uri to pull from
Public Class Methods
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
@return [:git]
# File lib/fpm/fry/source/git.rb, line 24 def self.name :git end
@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
@param [String] tempdir @return [Cache]
# File lib/fpm/fry/source/git.rb, line 125 def build_cache(tempdir) Cache.new(self, tempdir) end