Class: Buildable
- Inherits:
-
Object
- Object
- Buildable
- Defined in:
- lib/buildable.rb
Instance Attribute Summary collapse
-
#commit ⇒ Object
Returns the value of attribute commit.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
-
#checkout ⇒ Object
:yields: source directory.
-
#initialize(name:, repository:, commit:) ⇒ Buildable
constructor
A new instance of Buildable.
Constructor Details
#initialize(name:, repository:, commit:) ⇒ Buildable
Returns a new instance of Buildable.
5 6 7 8 9 |
# File 'lib/buildable.rb', line 5 def initialize(name:, repository:, commit:) @name = name.downcase @repository = repository @commit = commit end |
Instance Attribute Details
#commit ⇒ Object
Returns the value of attribute commit.
2 3 4 |
# File 'lib/buildable.rb', line 2 def commit @commit end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/buildable.rb', line 2 def name @name end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
2 3 4 |
# File 'lib/buildable.rb', line 2 def repository @repository end |
Instance Method Details
#checkout ⇒ Object
:yields: source directory
11 12 13 14 15 16 |
# File 'lib/buildable.rb', line 11 def checkout # :yields: source directory Dir.mktmpdir("#{name}-build") do |dir| system("git -C #{repository} archive #{commit} | tar -x -C #{dir}") or raise "Git error" yield dir end end |