diff options
author | ytti <saku@ytti.fi> | 2018-04-25 16:12:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-25 16:12:44 +0300 |
commit | 583bc422448a234a215113a15f8a6976c50b2296 (patch) | |
tree | b3f757e6f37aa058a0c80e4ded3ef82553bc98c1 /lib/oxidized/output/gitcrypt.rb | |
parent | 9a7d16c00163c421d2c9f3cb2783c76633860336 (diff) | |
parent | dffae0f76656a57da8f5473ce21955638cbe1f7f (diff) |
Merge pull request #1296 from wk/the-great-makeover
the great makeover - standardize layout, alignment, indentation
Diffstat (limited to 'lib/oxidized/output/gitcrypt.rb')
-rw-r--r-- | lib/oxidized/output/gitcrypt.rb | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/oxidized/output/gitcrypt.rb b/lib/oxidized/output/gitcrypt.rb index 0567458..2da0179 100644 --- a/lib/oxidized/output/gitcrypt.rb +++ b/lib/oxidized/output/gitcrypt.rb @@ -22,7 +22,7 @@ module Oxidized if @cfg.empty? Oxidized.asetus.user.output.gitcrypt.user = 'Oxidized' Oxidized.asetus.user.output.gitcrypt.email = 'o@example.com' - Oxidized.asetus.user.output.gitcrypt.repo = File.join(Config::Root, 'oxidized.git') + Oxidized.asetus.user.output.gitcrypt.repo = File.join(Config::Root, 'oxidized.git') Oxidized.asetus.save :user raise NoConfig, 'no output git config, edit ~/.config/oxidized/config' end @@ -60,13 +60,13 @@ module Oxidized end end - def store file, outputs, opt={} + def store file, outputs, opt = {} @msg = opt[:msg] @user = (opt[:user] or @cfg.user) @email = (opt[:email] or @cfg.email) @opt = opt @commitref = nil - repo = @cfg.repo + repo = @cfg.repo outputs.types.each do |type| type_cfg = '' @@ -86,7 +86,6 @@ module Oxidized update repo, file, outputs.to_cfg end - def fetch node, group begin repo, path = yield_repo_and_path(node, group) @@ -115,7 +114,7 @@ module Oxidized unlock repo walker = repo.log.path(path) i = -1 - tab = [] + tab = [] walker.each do |commit| hash = {} hash[:date] = commit.date.to_s @@ -131,7 +130,7 @@ module Oxidized end end - #give the blob of a specific revision + # give the blob of a specific revision def get_version node, group, oid begin repo, path = yield_repo_and_path(node, group) @@ -145,7 +144,7 @@ module Oxidized end end - #give a hash with the patch of a diff between 2 revision and the stats (added and deleted lines) + # give a hash with the patch of a diff between 2 revision and the stats (added and deleted lines) def get_diff node, group, oid1, oid2 begin diff_commits = nil @@ -160,15 +159,15 @@ module Oxidized stats = [diff.stats[:files][node.name][:insertions], diff.stats[:files][node.name][:deletions]] diff.each do |patch| if /#{node.name}\s+/.match(patch.patch.to_s.lines.first) - diff_commits = {:patch => patch.patch.to_s, :stat => stats} + diff_commits = { :patch => patch.patch.to_s, :stat => stats } break end end else stat = commit.parents[0].diff(commit).stats - stat = [stat[:files][node.name][:insertions],stat[:files][node.name][:deletions]] + stat = [stat[:files][node.name][:insertions], stat[:files][node.name][:deletions]] patch = commit.parents[0].diff(commit).patch - diff_commits = {:patch => patch, :stat => stat} + diff_commits = { :patch => patch, :stat => stat } end lock repo diff_commits @@ -199,10 +198,10 @@ module Oxidized file = File.join @opt[:group], file else repo = if repo.is_a?(::String) - File.join File.dirname(repo), @opt[:group] + '.git' - else - repo[@opt[:group]] - end + File.join File.dirname(repo), @opt[:group] + '.git' + else + repo[@opt[:group]] + end end end |