Skip to content

Commit

Permalink
#262: Directory not empty @ dir_s_rmdir
Browse files Browse the repository at this point in the history
Fixed #262
  • Loading branch information
dgroup committed Nov 25, 2020
1 parent 3645830 commit 264d5e0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lazylead.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ tasks instead of solving technical problems."
s.add_runtime_dependency "rufus-scheduler", "3.6.0"
s.add_runtime_dependency "slop", "4.4"
s.add_runtime_dependency "sqlite3", "1.4.2"
s.add_runtime_dependency "tempfile", "0.1.0"
s.add_runtime_dependency "tilt", "2.0.10"
s.add_runtime_dependency "tmpdir", "0.1.0"
s.add_runtime_dependency "tzinfo", "1.1"
s.add_runtime_dependency "tzinfo-data", "1.2019.3"
s.add_runtime_dependency "vcs4sql", "0.1.0"
Expand Down
24 changes: 16 additions & 8 deletions lib/lazylead/task/svn/diff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
# OR OTHER DEALINGS IN THE SOFTWARE.

require "tmpdir"
require "tempfile"
require "nokogiri"
require "backtrace"
require "active_support/core_ext/hash/conversions"
Expand Down Expand Up @@ -59,18 +59,26 @@ def send_email(stdout, postman, opts)
Dir.mktmpdir do |dir|
name = "svn-log-#{Date.today.strftime('%d-%b-%Y')}.html"
f = File.open(File.join(dir, name), "w")
f.write(
Email.new(
opts["template-attachment"],
opts.merge(stdout: stdout, version: Lazylead::VERSION)
).render
)
postman.send opts.merge(stdout: stdout, attachments: [f.path])
begin
f.write make_attachment(stdout, opts)
f.close
postman.send opts.merge(stdout: stdout, attachments: [f.path])
ensure
File.delete(f)
end
rescue StandardError => e
@log.error "ll-010: Can't send an email for #{opts} due to " \
"#{Backtrace.new(e)}' based on #{stdout}'"
end
end

# Assemble HTML for attachment based on SVN output
def make_attachment(stdout, opts)
Email.new(
opts["template-attachment"],
opts.merge(stdout: stdout, version: Lazylead::VERSION)
).render
end
end
end
end
Expand Down
18 changes: 9 additions & 9 deletions lib/messages/svn_diff.erb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
.commit * {
padding-left: 4px;
font-size: 8px;
line-height: 15px;
line-height: 12px;
}
</style>
<title>SVN log</title>
Expand All @@ -89,17 +89,17 @@
<% stdout.split("------------------------------------------------------------------------").reject(&:blank?).reverse.each do |commit| %>
<div class="commit">
<% commit.split("\n").reject(&:blank?).each_with_index do |line, index| %>
<% if index.zero? %>
<% details = line.split("|").map(&:strip).reject(&:blank?) %>
<p style="background: gainsboro;">
<p style="background: gainsboro;">
<% if index.zero? %>
<% details = line.split("|").map(&:strip).reject(&:blank?) %>
<a href="<%= commit_url %><%= details[0][1..-1] %>"><%= details[0] %></a>
by <a href="<%= user %><%= details[1] %>"><%= details[1] %></a>
at <span style="color: #275a90;"><%= details[2] %></span>
</p>
<% end %>
<% if index == 1 %>
<p style="background: gainsboro;"><%= line %></p>
<% end %>
<% end %>
<% if index == 1 %>
<span style="padding-left: 4px"><%= line %></span>
<% end %>
</p>
<% end %>
</div>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion lib/messages/svn_diff_attachment.erb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<% end %>
<% end %>
</div>
<br/><br/><br/>
<br/>
<% end %>
<p>Posted by
<a href="https://github.com/dgroup/lazylead">lazylead v<%= version %></a>.
Expand Down

0 comments on commit 264d5e0

Please sign in to comment.