Class: Autoversion::Gitter
- Inherits:
-
Object
- Object
- Autoversion::Gitter
show all
- Defined in:
- lib/autoversion/gitter.rb
Defined Under Namespace
Classes: DirtyStaging, NotOnStableBranch
Instance Method Summary
collapse
Constructor Details
#initialize(path, config) ⇒ Gitter
Returns a new instance of Gitter.
12
13
14
15
16
|
# File 'lib/autoversion/gitter.rb', line 12
def initialize path, config
@path = path
@config = config
@repo = Git.open(path)
end
|
Instance Method Details
#commit!(versionType, currentVersion) ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/autoversion/gitter.rb', line 43
def commit! versionType, currentVersion
return false unless @config[:actions].include?(:commit)
raise NotOnStableBranch if versionType == :major && !on_stable_branch?
write_commit currentVersion
write_tag currentVersion if @config[:actions].include?(:tag)
end
|
#dir_is_clean? ⇒ Boolean
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/autoversion/gitter.rb', line 24
def dir_is_clean?
true
end
|
#ensure_cleanliness! ⇒ Object
18
19
20
21
22
|
# File 'lib/autoversion/gitter.rb', line 18
def ensure_cleanliness!
if @config[:actions].include?(:commit)
raise DirtyStaging unless dir_is_clean?
end
end
|
#on_stable_branch? ⇒ Boolean
39
40
41
|
# File 'lib/autoversion/gitter.rb', line 39
def on_stable_branch?
@repo.current_branch == @config[:stable_branch].to_s
end
|