Class: Tractive::RevmapGenerator
- Inherits:
-
Object
- Object
- Tractive::RevmapGenerator
- Defined in:
- lib/tractive/revmap_generator.rb
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(input_file, svn_url, svn_local_path, git_local_repo_path, output_file = "revmap.txt") ⇒ RevmapGenerator
constructor
A new instance of RevmapGenerator.
Constructor Details
#initialize(input_file, svn_url, svn_local_path, git_local_repo_path, output_file = "revmap.txt") ⇒ RevmapGenerator
Returns a new instance of RevmapGenerator.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/tractive/revmap_generator.rb', line 5 def initialize(input_file, svn_url, svn_local_path, git_local_repo_path, output_file = "revmap.txt") @input_file = input_file @git_local_repo_path = git_local_repo_path @svn_url = svn_url @svn_local_path = svn_local_path @duplicate_commits = {} @duplicate_message_commits = {} @last_revision = nil @pinwheel = %w[| / - \\] @skipped = [] @output_file = output_file end |
Instance Method Details
#generate ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/tractive/revmap_generator.rb', line 18 def generate line_count = File.read(@input_file).scan(/\n/).count i = 0 File.open(@output_file, "w+") do |file| File.foreach(@input_file) do |line| i += 1 info = extract_info_from_line(line) next if @last_revision == info[:revision] @last_revision = info[:revision] print_revmap_info(info, file) percent = ((i.to_f / line_count) * 100).round(2) progress = "=" * (percent.to_i / 2) unless i < 2 printf("\rProgress: [%<progress>-50s] %<percent>.2f%% %<spinner>s", progress: progress, percent: percent, spinner: @pinwheel.rotate!.first) end end $logger.info "\n\nFollowing revisions are skipped because they don't have a corresponding git commit. #{@skipped}" end |