Class: Lolcommits::Uploader
- Inherits:
-
Thor
- Object
- Thor
- Lolcommits::Uploader
- Includes:
- Thor::Actions
- Defined in:
- lib/lolcommits-uploader/version.rb,
lib/lolcommits-uploader/uploader.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Method Summary collapse
Instance Method Details
#disable ⇒ Object
29 30 31 |
# File 'lib/lolcommits-uploader/uploader.rb', line 29 def disable gsub_file "#{repo.dir.to_s}/.git/hooks/post-commit", "lolcommits-uploader upload &> /dev/null &", "" end |
#enable ⇒ Object
24 25 26 |
# File 'lib/lolcommits-uploader/uploader.rb', line 24 def enable append_file "#{repo.dir.to_s}/.git/hooks/post-commit", "lolcommits-uploader upload &> /dev/null &" end |
#upload ⇒ Object
6 7 8 |
# File 'lib/lolcommits-uploader/uploader.rb', line 6 def upload upload_file repo.log.first.sha[0..10] end |
#upload_all ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/lolcommits-uploader/uploader.rb', line 11 def upload_all files = Dir[File.("~/.lolcommits/#{repo_name}/*.jpg")] = ProgressBar.new('Uploading', files.size) files.each do |filename| match = filename.match(/\/([0-9a-f]+)\.jpg$/) next unless match && !uploaded?(match[1]) upload_file match[1] .inc end .finish end |