Class: Liquigen::ChangeSet

Inherits:
Object
  • Object
show all
Defined in:
lib/liquigen/change_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_name) ⇒ ChangeSet

Returns a new instance of ChangeSet.



7
8
9
10
11
# File 'lib/liquigen/change_set.rb', line 7

def initialize(file_name)
  self.id = file_name
  self.author = "#{git_user} <#{git_email}>"
  self.changes = []
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



4
5
6
# File 'lib/liquigen/change_set.rb', line 4

def author
  @author
end

#changesObject

Returns the value of attribute changes.



5
6
7
# File 'lib/liquigen/change_set.rb', line 5

def changes
  @changes
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/liquigen/change_set.rb', line 3

def id
  @id
end

Instance Method Details

#git_emailObject



19
20
21
22
23
# File 'lib/liquigen/change_set.rb', line 19

def git_email
  email = []
  IO.popen('git config -l | grep user.email') { |x| email = x.gets }
  email = email.gsub(/user.email=(\w*)/, '\1').strip
end

#git_userObject



13
14
15
16
17
# File 'lib/liquigen/change_set.rb', line 13

def git_user
  author = ''
  IO.popen('git config -l | grep user.name') { |x| author = x.gets }
  author = author.gsub(/user.name=(\w*)/, '\1').strip || 'yourname'
end