Skip to content

Commit

Permalink
add lines to diff for git_control
Browse files Browse the repository at this point in the history
  • Loading branch information
tshedor committed Jan 3, 2015
1 parent a31d8ce commit 4459894
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 8 additions & 4 deletions lib/maximus/git_control.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class GitControl
# @param opts [Hash] options passed directly to config
# @option opts [Config object] :config custom Maximus::Config object
# @option opts [String] :commit accepts sha, "working", "last", or "master".
# @return [void] this method is used to set up instance variables
def initialize(opts = {})
opts[:config] ||= Maximus::Config.new({ commit: opts[:commit] })
@config ||= opts[:config]
Expand All @@ -22,7 +21,6 @@ def initialize(opts = {})
end

# 30,000 foot view of a commit
#
# @param commit_sha [String] the sha of the commit
# @return [Hash] commit data
def commit_export(commit_sha = sha)
Expand Down Expand Up @@ -266,11 +264,17 @@ def vccommit(commit_sha = sha)
end

# Get general stats of commit on HEAD versus last commit on master branch
# @modified 0.1.4
# @param new_commit [Git::Object]
# @param old_commit [Git::Object]
# @return [Git::Diff] hash of abbreviated, useful stats
# @return [Git::Diff] hash of abbreviated, useful stats with added lines
def diff(new_commit = vccommit, old_commit = master_commit)
@g.diff(new_commit, old_commit).stats
stats = @g.diff(new_commit, old_commit).stats
return if lines.blank? || diff.blank?
lines.each do |filename, filelines|
stats[:files][filename][:lines_added] = filelines if stats[:files].has_key?(filename)
end
stats
end

# Get remote URL
Expand Down
3 changes: 1 addition & 2 deletions roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
* Add JSLint (maybe)
* Add W3 validator (maybe)
* Regex path names on phantomas and wraith to defend against injection and bad characters
* include lines_added in this GitControll#diff output
* Test for < ruby 2.0 or require 2.0 < in gemspec
* Test for < ruby 2.0 or require 2.0 < in gemspec

0 comments on commit 4459894

Please sign in to comment.