Class: SvnVersionControl
- Inherits:
-
Object
- Object
- SvnVersionControl
- Defined in:
- lib/header-inserter/svn_version_control.rb
Constant Summary collapse
- @@entry_start =
/^[-]{72}$/
- @@valid =
/\s*r\d{1,} \| \S+ \| .* | \d{1,} line[s]?\n\n.*\n/
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #history(file_path) ⇒ Object
-
#initialize(server_path) ⇒ SvnVersionControl
constructor
A new instance of SvnVersionControl.
- #retrieve_log(file_path) ⇒ Object
Constructor Details
#initialize(server_path) ⇒ SvnVersionControl
Returns a new instance of SvnVersionControl.
8 9 10 11 |
# File 'lib/header-inserter/svn_version_control.rb', line 8 def initialize server_path @path = server_path @logs = {} end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/header-inserter/svn_version_control.rb', line 4 def path @path end |
Instance Method Details
#history(file_path) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/header-inserter/svn_version_control.rb', line 20 def history file_path mods = [] log = retrieve_log file_path log.split(@@entry_start).each do |entry| mods << Modification.parse(entry) if @@valid.match(entry) end mods.reverse end |
#retrieve_log(file_path) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/header-inserter/svn_version_control.rb', line 13 def retrieve_log file_path if not @logs.has_key?(file_path) @logs[file_path] = %x[svn log #{@path + file_path}] end @logs[file_path] end |