Class: IronHammer::Version

Inherits:
Object
  • Object
show all
Defined in:
lib/iron_hammer/version.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Version

Returns a new instance of Version.



14
15
16
17
18
19
20
21
22
# File 'lib/iron_hammer/version.rb', line 14

def initialize params={}
  @major        = params[:major]        || '#'
  @minor        = params[:minor]        || '#'
  @revision     = params[:revision]     || '#'
  @build_number = params[:build_number] || '##'
  @control_hash = params[:control_hash] || '**********'
  @built_by     = params[:built_by]     || 'MACSkeptic Iron Hammer'
  @timestamp    = params[:timestamp]    || Time.now.strftime('%Y-%m-%d %H:%M:%S')
end

Instance Attribute Details

#build_numberObject

Returns the value of attribute build_number.



6
7
8
# File 'lib/iron_hammer/version.rb', line 6

def build_number
  @build_number
end

#built_byObject

Returns the value of attribute built_by.



9
10
11
# File 'lib/iron_hammer/version.rb', line 9

def built_by
  @built_by
end

#control_hashObject

Returns the value of attribute control_hash.



7
8
9
# File 'lib/iron_hammer/version.rb', line 7

def control_hash
  @control_hash
end

#majorObject

Returns the value of attribute major.



10
11
12
# File 'lib/iron_hammer/version.rb', line 10

def major
  @major
end

#minorObject

Returns the value of attribute minor.



11
12
13
# File 'lib/iron_hammer/version.rb', line 11

def minor
  @minor
end

#revisionObject

Returns the value of attribute revision.



12
13
14
# File 'lib/iron_hammer/version.rb', line 12

def revision
  @revision
end

#timestampObject

Returns the value of attribute timestamp.



8
9
10
# File 'lib/iron_hammer/version.rb', line 8

def timestamp
  @timestamp
end

Instance Method Details

#create!(path, name = 'version.yaml') ⇒ Object



33
34
35
# File 'lib/iron_hammer/version.rb', line 33

def create! path, name='version.yaml'
  IronHammer::Utils::FileSystem::write! :path => path, :name => name, :content => to_yaml
end

#to_yamlObject



24
25
26
27
28
29
30
31
# File 'lib/iron_hammer/version.rb', line 24

def to_yaml
  { 
    'Version' => { 'Major' => @major, 'Minor' => @minor, 'Revision' => @revision },
    'Build' => { 'Number' => @build_number, 'Hash' => @control_hash },
    'Timestamp' => @timestamp,
    'Built By' => @built_by 
  }.to_yaml
end