Skip to content

Commit

Permalink
Connect #28 begin notional plan for git note/history storage
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Glusman authored and bglusman committed Aug 31, 2015
1 parent f3f963e commit dce8aa5
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
6 changes: 6 additions & 0 deletions debt_ceiling.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'rubycritic', '~> 1.4'
s.add_runtime_dependency 'chronic', '~> 0.10'
s.add_runtime_dependency 'configurations', '~> 2.0'
#maybe? or maybe light enough not to rely on
if !`which cmake`.empty?
s.add_runtime_dependency 'rugged', '~> 0.23'
else
s.post_install_message = "NOTICE: Debt Ceiling git integration relies on rugged, which requires cmake to be installed"
end
s.add_development_dependency 'pry', '~> 0.10'
s.add_development_dependency 'rake', '~> 10.3'
s.add_development_dependency 'rspec', '~> 3.1'
Expand Down
19 changes: 19 additions & 0 deletions lib/debt_ceiling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,23 @@ module DebtCeiling
def audit(dir='.', opts= {})
Audit.new(dir, opts)
end

def dig(dir='.', opts={})
if rugged_available?
ArcheologicalDig.new(dir, opts)
else
fail "rugged gem not installed, dig feature relies on rugged and cmake"
end
end

def rugged_available?
return nil if java_platform? || `which cmake`.empty?
require 'rugged'
require_relative 'debt_ceiling/archeological_dig'
true
end

def java_platform?
['jruby', 'java'].include?(RUBY_PLATFORM)
end
end
29 changes: 29 additions & 0 deletions lib/debt_ceiling/archeological_dig.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module DebtCeiling
class ArcheologicalDig

def initialize(path='.', opts={})
selected_git_commits(path) do |commit|
checkout_commit(commit)
next if config_note_present_on_commit(commit)
result = Audit.new(opts.merge(skip_report: true, warn_only: true, preconfigured: true))
create_note_on_commit(result, commit)
end
end

def selected_git_commits(path)
[].each do |x|
yield x
end
end

def checkout_commit(commit)
end

def config_note_present_on_commit(commit)
end

def create_note_on_commit(result, commit)
end

end
end

0 comments on commit dce8aa5

Please sign in to comment.