diff options
| author | ytti <saku@ytti.fi> | 2016-05-17 23:35:15 +0300 | 
|---|---|---|
| committer | ytti <saku@ytti.fi> | 2016-05-17 23:35:15 +0300 | 
| commit | 6c38bdbed01d9ae9f54571daddda958985e3a9d8 (patch) | |
| tree | 6b5e72347e49e3090bb006313a85df2f8ef7a77d /lib/oxidized | |
| parent | 4848ddb3237bcd6f01cefcda04cddfa3be2e328f (diff) | |
| parent | 75be4e1a07644cb29226a90126a28ee8bcc3ef1d (diff) | |
Merge pull request #421 from danilopopeye/master
fix the git group path config
Diffstat (limited to 'lib/oxidized')
| -rw-r--r-- | lib/oxidized/output/git.rb | 17 | 
1 files changed, 15 insertions, 2 deletions
| diff --git a/lib/oxidized/output/git.rb b/lib/oxidized/output/git.rb index 39e155e..1e32a5e 100644 --- a/lib/oxidized/output/git.rb +++ b/lib/oxidized/output/git.rb @@ -21,7 +21,14 @@ class Git < Output        Oxidized.asetus.save :user        raise NoConfig, 'no output git config, edit ~/.config/oxidized/config'      end -    @cfg.repo = File.expand_path @cfg.repo + +    if @cfg.repo.respond_to?(:each) +      @cfg.repo.each do |group, repo| +        @cfg.repo["#{group}="] = File.expand_path repo +      end +    else +      @cfg.repo = File.expand_path @cfg.repo +    end    end    def store file, outputs, opt={} @@ -152,13 +159,19 @@ class Git < Output    def update repo, file, data      return if data.empty? +      if @opt[:group]        if @cfg.single_repo?          file = File.join @opt[:group], file        else -        repo = File.join File.dirname(repo), @opt[:group] + '.git' +        repo = if repo.is_a?(String) +                 File.join File.dirname(repo), @opt[:group] + '.git' +               else +                 repo[@opt[:group]] +               end        end      end +      begin        repo = Rugged::Repository.new repo        update_repo repo, file, data, @msg, @user, @email | 
