Class: Liquigen::ChangeSet
- Inherits:
-
Object
- Object
- Liquigen::ChangeSet
- Defined in:
- lib/liquigen/change_set.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#changes ⇒ Object
Returns the value of attribute changes.
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
- #git_email ⇒ Object
- #git_user ⇒ Object
-
#initialize(file_name) ⇒ ChangeSet
constructor
A new instance of ChangeSet.
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. = "#{git_user} <#{git_email}>" self.changes = [] end |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
4 5 6 |
# File 'lib/liquigen/change_set.rb', line 4 def @author end |
#changes ⇒ Object
Returns the value of attribute changes.
5 6 7 |
# File 'lib/liquigen/change_set.rb', line 5 def changes @changes end |
#id ⇒ Object
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_email ⇒ Object
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_user ⇒ Object
13 14 15 16 17 |
# File 'lib/liquigen/change_set.rb', line 13 def git_user = '' IO.popen('git config -l | grep user.name') { |x| = x.gets } = .gsub(/user.name=(\w*)/, '\1').strip || 'yourname' end |