Class: AutoTagger
- Inherits:
-
Object
- Object
- AutoTagger
- Defined in:
- lib/auto_tagger/auto_tagger.rb
Defined Under Namespace
Classes: EnvironmentCannotBeBlankError
Instance Attribute Summary collapse
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
-
#stage ⇒ Object
readonly
Returns the value of attribute stage.
-
#working_directory ⇒ Object
readonly
Returns the value of attribute working_directory.
Instance Method Summary collapse
- #create_tag(commit = nil) ⇒ Object
-
#initialize(stage, path = nil) ⇒ AutoTagger
constructor
A new instance of AutoTagger.
- #latest_tag ⇒ Object
Constructor Details
#initialize(stage, path = nil) ⇒ AutoTagger
Returns a new instance of AutoTagger.
7 8 9 10 11 12 |
# File 'lib/auto_tagger/auto_tagger.rb', line 7 def initialize(stage, path = nil) raise EnvironmentCannotBeBlankError if stage.to_s.strip == "" @working_directory = File.(path ||= Dir.pwd) @repository = Repository.new(@working_directory) @stage = stage end |
Instance Attribute Details
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
5 6 7 |
# File 'lib/auto_tagger/auto_tagger.rb', line 5 def repository @repository end |
#stage ⇒ Object (readonly)
Returns the value of attribute stage.
5 6 7 |
# File 'lib/auto_tagger/auto_tagger.rb', line 5 def stage @stage end |
#working_directory ⇒ Object (readonly)
Returns the value of attribute working_directory.
5 6 7 |
# File 'lib/auto_tagger/auto_tagger.rb', line 5 def working_directory @working_directory end |
Instance Method Details
#create_tag(commit = nil) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/auto_tagger/auto_tagger.rb', line 14 def create_tag(commit = nil) repository..fetch new_tag = repository..create(stage, commit) repository..push new_tag end |
#latest_tag ⇒ Object
21 22 23 24 |
# File 'lib/auto_tagger/auto_tagger.rb', line 21 def latest_tag repository..fetch repository..latest_from(stage) end |