Class: GitDump::Version
- Inherits:
-
Object
- Object
- GitDump::Version
- Includes:
- Base
- Defined in:
- lib/git_dump/version.rb,
lib/git_dump/version/base.rb,
lib/git_dump/version/builder.rb
Overview
Reading version
Defined Under Namespace
Modules: Base Classes: Builder
Instance Attribute Summary collapse
-
#annotation ⇒ Object
readonly
Returns the value of attribute annotation.
-
#commit_time ⇒ Object
readonly
Returns the value of attribute commit_time.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
-
#sha ⇒ Object
readonly
Returns the value of attribute sha.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(repo, id, sha, attributes = {}) ⇒ Version
constructor
A new instance of Version.
- #inspect ⇒ Object
-
#push(url, options = {}) ⇒ Object
Send this version to repo at url Use :progress => true to show progress.
-
#remove ⇒ Object
Remove this version.
Methods included from Base
Constructor Details
#initialize(repo, id, sha, attributes = {}) ⇒ Version
Returns a new instance of Version.
28 29 30 31 32 33 34 35 36 |
# File 'lib/git_dump/version.rb', line 28 def initialize(repo, id, sha, attributes = {}) fail ArgumentError, 'Expected Repo' unless repo.is_a?(Repo) @repo, @id, @sha = repo, id, sha @time = attributes[:time] @commit_time = attributes[:commit_time] @annotation = attributes[:annotation] @description = attributes[:description] end |
Instance Attribute Details
#annotation ⇒ Object (readonly)
Returns the value of attribute annotation.
27 28 29 |
# File 'lib/git_dump/version.rb', line 27 def annotation @annotation end |
#commit_time ⇒ Object (readonly)
Returns the value of attribute commit_time.
27 28 29 |
# File 'lib/git_dump/version.rb', line 27 def commit_time @commit_time end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
27 28 29 |
# File 'lib/git_dump/version.rb', line 27 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
26 27 28 |
# File 'lib/git_dump/version.rb', line 26 def id @id end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
26 27 28 |
# File 'lib/git_dump/version.rb', line 26 def repo @repo end |
#sha ⇒ Object (readonly)
Returns the value of attribute sha.
26 27 28 |
# File 'lib/git_dump/version.rb', line 26 def sha @sha end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
26 27 28 |
# File 'lib/git_dump/version.rb', line 26 def time @time end |
Class Method Details
.by_id(repo, id) ⇒ Object
22 23 24 |
# File 'lib/git_dump/version.rb', line 22 def self.by_id(repo, id) list(repo).find{ |version| version.id == id } end |
.list(repo) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/git_dump/version.rb', line 11 def self.list(repo) repo.tag_entries.map do |entry| Version.new(repo, entry[:name], entry[:sha], { :time => entry[:author_time], :commit_time => entry[:commit_time], :annotation => entry[:tag_message], :description => entry[:commit_message], }) end end |
Instance Method Details
#inspect ⇒ Object
49 50 51 |
# File 'lib/git_dump/version.rb', line 49 def inspect "#<#{self.class} id=#{@id} sha=#{@sha} tree=#{@tree.inspect}>" end |
#push(url, options = {}) ⇒ Object
Send this version to repo at url Use :progress => true to show progress
40 41 42 |
# File 'lib/git_dump/version.rb', line 40 def push(url, = {}) repo.push(url, id, ) end |
#remove ⇒ Object
Remove this version
45 46 47 |
# File 'lib/git_dump/version.rb', line 45 def remove repo.remove_tag(id) end |