Class: Diff
- Inherits:
-
AbtionScripts::Base
- Object
- AbtionScripts::Base
- Diff
- Defined in:
- lib/abtion_scripts/diff.rb
Constant Summary collapse
- DAY =
86400
Constants included from AbtionScripts::Colorize
AbtionScripts::Colorize::COLOR_CODES
Instance Attribute Summary
Attributes inherited from AbtionScripts::Base
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from AbtionScripts::Base
#app_names, #app_root, #bundler?, #ci?, description, help, #heroku, #heroku_app_name, inherited, #initialize, load_scripts_deferred, #rails?, run, #run_script, script_classes, script_names, scripts, #step, #system!, #yarn?
Methods included from AbtionScripts::Colorize
Constructor Details
This class inherits a constructor from AbtionScripts::Base
Class Method Details
.name ⇒ Object
2 3 4 |
# File 'lib/abtion_scripts/diff.rb', line 2 def self.name "diff" end |
Instance Method Details
#run ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/abtion_scripts/diff.rb', line 8 def run yesterday = (Time.now - DAY).strftime("%Y-%m-%d") last_sha = `git log --after "#{yesterday} 00:00" --before "#{yesterday} 23:59" --format="format:%H"` .strip .split("\n") .last start_sha = `git log "#{last_sha}^" --format="format:%H"` .strip .split("\n") .first repo = `git remote -v | grep github | awk '{ print $2 }' | head -n 1`.strip repo.gsub!(/\.git/, "") repo.gsub!(/[email protected]:/, "") github_repo = repo.split("/")[-2..-1].join("/") system("open https://github.com/#{github_repo}/compare/#{start_sha}...master") end |