Class: FPM::Fry::Source::Git
- Inherits:
-
Object
- Object
- FPM::Fry::Source::Git
- Defined in:
- lib/fpm/fry/source/git.rb
Overview
Used to build directly from git.
It automatically recognizes the following url patterns:
- git://…
- git+…://…
- user@host:….git
- https://….git
- https://git.…
Defined Under Namespace
Classes: Cache
Constant Summary collapse
- REGEX =
%r!\A(?:git:|\S+@\S+:\S+\.git\z|https?:(?://git\.|.*\.git\z)|ssh:.*\.git\z|git\+[a-z0-9]+:)!
Instance Attribute Summary collapse
-
#file_map ⇒ Hash<String,String>?
readonly
The file map for generating a docker file.
-
#git ⇒ String
readonly
The git binary (default: “git”).
-
#logger ⇒ Cabin::Channel
readonly
Logger.
-
#rev ⇒ String
readonly
The git rev to pull (default “HEAD”).
- #to ⇒ String? readonly
-
#url ⇒ URI
readonly
The uri to pull from.
Class Method Summary collapse
-
.guess(url) ⇒ nil, Numeric
Guesses if this url is a git url.
- .name ⇒ :git
Instance Method Summary collapse
- #build_cache(tempdir) ⇒ Cache
-
#initialize(url, options = {}) ⇒ Git
constructor
A new instance of Git.
Constructor Details
#initialize(url, options = {}) ⇒ Git
Returns a new instance of Git.
113 114 115 116 117 118 119 120 121 |
# File 'lib/fpm/fry/source/git.rb', line 113 def initialize( url, = {} ) url = url.sub(/\A(\S+@\S+):(\S+\.git)\z/,'ssh://\1/\2') @url = URI(url) @logger = .fetch(:logger){ Cabin::Channel.get } @rev = [:branch] || [:tag] || [:rev] || 'HEAD' @file_map = [:file_map] @git = [:git] || 'git' @to = [:to] end |
Instance Attribute Details
#file_map ⇒ Hash<String,String>? (readonly)
Returns the file map for generating a docker file.
99 100 101 |
# File 'lib/fpm/fry/source/git.rb', line 99 def file_map @file_map end |
#git ⇒ String (readonly)
Returns the git binary (default: “git”).
93 94 95 |
# File 'lib/fpm/fry/source/git.rb', line 93 def git @git end |
#logger ⇒ Cabin::Channel (readonly)
Returns logger.
90 91 92 |
# File 'lib/fpm/fry/source/git.rb', line 90 def logger @logger end |
#rev ⇒ String (readonly)
Returns the git rev to pull (default “HEAD”).
96 97 98 |
# File 'lib/fpm/fry/source/git.rb', line 96 def rev @rev end |
#to ⇒ String? (readonly)
105 106 107 |
# File 'lib/fpm/fry/source/git.rb', line 105 def to @to end |
#url ⇒ URI (readonly)
Returns the uri to pull from.
102 103 104 |
# File 'lib/fpm/fry/source/git.rb', line 102 def url @url end |
Class Method Details
.guess(url) ⇒ nil, Numeric
Guesses if this url is a git url.
39 40 41 |
# File 'lib/fpm/fry/source/git.rb', line 39 def self.guess( url ) Source::guess_regex(REGEX, url) end |
.name ⇒ :git
24 25 26 |
# File 'lib/fpm/fry/source/git.rb', line 24 def self.name :git end |