Sha256: e9394f7d066798dfbaa111669bd644ed2e3ee6624f9ea0bfee831221b9c8ecd2

Contents?: true

Size: 1.37 KB

Versions: 37

Compression:

Stored size: 1.37 KB

Contents

module OhlohScm::Parsers
	class HumanWriter
		# Note that we use << instead of write() or puts() in this writer because
		# the << operator works on both File and String objects.

		attr_accessor :buffer
		def initialize(buffer='')
			@buffer = buffer
		end

		def write_preamble(opts = {})
		end

		def write_commit(commit)
			@buffer << "--------------- #{'-' * 40}\n"
			@buffer << "token:          #{commit.token.to_s}\n"

			@buffer << "committer name: #{commit.committer_name}\n" if commit.committer_name
			@buffer << "committer mail: <#{commit.committer_email}>\n" if commit.committer_email
			@buffer << "committer date: #{commit.committer_date}\n" if commit.committer_date

			@buffer << "author name:    #{commit.author_name}\n" if commit.author_name
			@buffer << "author mail:    <#{commit.author_email}>\n" if commit.author_email
			@buffer << "author date:    #{commit.author_date}\n" if commit.author_date

			if commit.diffs && commit.diffs.any?
				commit.diffs.each do |diff|
					@buffer << "                #{diff.action} #{diff.path}\n"
				end
			end

			if commit.directories && commit.directories.any?
				commit.directories.each do |d|
					@buffer << "                #{d}\n"
				end
			end

			if commit.message
				@buffer << "\n#{commit.message}"
				@buffer << "\n" unless commit.message[-1..-1] == "\n"
			end

			@buffer << "\n"
		end

		def write_postamble
		end
	end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
ohloh_scm-2.5.1 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.4.14 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.4.13 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.4.12 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.4.11 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.4.10 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.4.9 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.4.8 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.4.7 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.4.6 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.4.5 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.4.4 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.4.3 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.4.1 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.4.0 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.3.5 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.3.4 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.3.2 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.3.1 lib/ohloh_scm/parsers/human_writer.rb
ohloh_scm-2.3.0 lib/ohloh_scm/parsers/human_writer.rb