Class: Bump::BumpInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/bump/domain/bump_info.rb

Overview

The bump information model

Instance Method Summary collapse

Constructor Details

#initialize(version, files) ⇒ BumpInfo

Returns a new instance of BumpInfo.

Parameters:



11
12
13
14
15
16
17
18
# File 'lib/bump/domain/bump_info.rb', line 11

def initialize version, files
    @version = version
    @files = files

    @before_version = @version.to_s
    @after_version = @version.to_s

end

Instance Method Details

#afterVersionString

Returns the version number after the bumping.

Returns:

  • (String)


101
102
103
# File 'lib/bump/domain/bump_info.rb', line 101

def afterVersion
    @after_version
end

#beforeVersionString

Returns the version number before the bumping.

Returns:

  • (String)


108
109
110
# File 'lib/bump/domain/bump_info.rb', line 108

def beforeVersion
    @before_version
end

#bump(level) ⇒ void

This method returns an undefined value.

Performs bumping version

Parameters:

  • level (Symbol)


38
39
40
41
# File 'lib/bump/domain/bump_info.rb', line 38

def bump level
    @version.bump level
    @after_version = @version.to_s
end

#checkBoolean

Checks the all the version patterns are available

Returns:

  • (Boolean)


84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/bump/domain/bump_info.rb', line 84

def check

    createUpdateRules.each do |rule|

        if not rule.patternExists
            return false
        end

    end

    return true

end

#createUpdateRulesArray<Bump::FileUpdateRule>

Creates file update rules according to the current settings.

Returns:



62
63
64
65
66
# File 'lib/bump/domain/bump_info.rb', line 62

def createUpdateRules
    @files.map { |file, pattern|
        FileUpdateRuleFactory.create(file, pattern, @before_version, @after_version)
    }.flatten
end

#filesArray

Returns files setting list

Returns:

  • (Array)


30
31
32
# File 'lib/bump/domain/bump_info.rb', line 30

def files
    @files
end

#performUpdatevoid

This method returns an undefined value.

Performs all updates.



71
72
73
74
75
76
77
78
79
# File 'lib/bump/domain/bump_info.rb', line 71

def performUpdate

    createUpdateRules.each do |rule|

        rule.perform

    end

end

#setPreid(preid) ⇒ void

This method returns an undefined value.

Sets the preid



46
47
48
49
# File 'lib/bump/domain/bump_info.rb', line 46

def setPreid preid
    @version.setPreid preid
    @after_version = @version.to_s
end

#updateRulesArray<Bump::FileUpdateRules>

Gets the file update rules

Returns:

  • (Array<Bump::FileUpdateRules>)


54
55
56
# File 'lib/bump/domain/bump_info.rb', line 54

def updateRules
    createUpdateRules
end

#versionBump::VersionNumber

Returns the version number object

Returns:



23
24
25
# File 'lib/bump/domain/bump_info.rb', line 23

def version
    @version
end