Class: Deployments::Project
- Inherits:
-
Object
- Object
- Deployments::Project
- Defined in:
- lib/deployments/project.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
-
#tag_names ⇒ Object
readonly
Returns the value of attribute tag_names.
Instance Method Summary collapse
- #commits ⇒ Object
-
#initialize(path) ⇒ Project
constructor
A new instance of Project.
- #previous_tag ⇒ Object
- #tag ⇒ Object
Constructor Details
#initialize(path) ⇒ Project
Returns a new instance of Project.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/deployments/project.rb', line 8 def initialize(path) @path = path @repo = Grit::Repo.new(path) versions = @repo..map do |tag| Versionomy.parse(tag.name) end.sort @tag_names = versions.map {|v| v.to_s} end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/deployments/project.rb', line 6 def path @path end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
6 7 8 |
# File 'lib/deployments/project.rb', line 6 def repo @repo end |
#tag_names ⇒ Object (readonly)
Returns the value of attribute tag_names.
6 7 8 |
# File 'lib/deployments/project.rb', line 6 def tag_names @tag_names end |
Instance Method Details
#commits ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/deployments/project.rb', line 19 def commits commits = (repo) if (commits || repo.commits).inject({}) do |hash, commit| hash[commit.id] = { :message => commit., :created_at => commit.date.to_s } hash end end |
#previous_tag ⇒ Object
35 36 37 38 39 40 |
# File 'lib/deployments/project.rb', line 35 def previous_tag tag_name = File.read(VERSION_FILE).strip if File.exists?(VERSION_FILE) tag_name ||= tag_names[tag_names.size - 2] find_repo_tag(tag_name) end |
#tag ⇒ Object
31 32 33 |
# File 'lib/deployments/project.rb', line 31 def tag tag_names.last if end |