Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send more VCS details to lolsrv #181

Merged
merged 4 commits into from
Jan 1, 2014
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions lib/lolcommits/git_info.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
module Lolcommits
class GitInfo
include Methadone::CLILogging
attr_accessor :sha, :message, :repo_internal_path, :repo
attr_accessor :sha, :message, :repo_internal_path, :repo, :url

def remote_https_url(url)
url.gsub(':','/').gsub(/^git@/,'https://').gsub(/\.git$/,'') + '/commit/'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you change to 2 space indentation?

end

def initialize
debug "GitInfo: attempting to read local repository"
Expand All @@ -13,7 +17,9 @@ def initialize
self.message = commit.message.split("\n").first
self.sha = commit.sha[0..10]
self.repo_internal_path = g.repo.path
regex = /.*[:\/]([\w\-]*).git/
self.url = remote_https_url(g.remote.url) if g.remote.url

regex = /.*[:]([\/\w\-]*).git/
match = g.remote.url.match regex if g.remote.url
if match
self.repo = match[1]
Expand All @@ -24,7 +30,7 @@ def initialize
debug "GitInfo: parsed the following values from commit:"
debug "GitInfo: \t#{self.message}"
debug "GitInfo: \t#{self.sha}"
debug "GitInfo: \t#{self.repo_internal_path}"
debug "GitInfo: \t#{self.repo_internal_path}"
debug "GitInfo: \t#{self.repo}"
end
end
Expand Down
10 changes: 6 additions & 4 deletions lib/lolcommits/plugins/lolsrv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def initialize(runner)
def run
return unless valid_configuration?
fork { sync() }
end
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird indentation..


def is_configured?
!configuration["enabled"].nil? && configuration["server"]
Expand Down Expand Up @@ -51,9 +51,11 @@ def upload(file, sha)
RestClient.post(
configuration["server"] + "/uplol",
:lol => File.new(file),
:sha => sha
)
rescue => e
:url => self.runner.url + sha,
:repo => self.runner.repo,
:date => File.ctime(file),
:sha => sha)
rescue => error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be rescue => e

log_error(e,"ERROR: Upload of lol #{sha} FAILED #{e.class} - #{e.message}")
return
end
Expand Down
3 changes: 2 additions & 1 deletion lib/lolcommits/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Lolcommits
class Runner
attr_accessor :capture_delay, :capture_stealth, :capture_device, :message, :sha,
:snapshot_loc, :main_image, :repo, :config, :repo_internal_path,
:font, :capture_animate
:font, :capture_animate, :url

include Methadone::CLILogging
include ActiveSupport::Callbacks
Expand All @@ -31,6 +31,7 @@ def initialize(attributes={})
self.message = git_info.message if self.message.nil?
self.repo_internal_path = git_info.repo_internal_path
self.repo = git_info.repo
self.url = git_info.url
end
end

Expand Down