likadan 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/likadan +2 -3
- data/lib/likadan-diffs.html.erb +17 -0
- data/lib/likadan_uploader.rb +17 -6
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9633d8286039253609c245ba5316b69850820057
|
4
|
+
data.tar.gz: a8b0daed7a75e501d2d6e9b1f8dcea770055dcf5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7deadd379cffc9cc3757d51fda36152d9bbe5b599b06858b5d482eb354819bb08795073adb312fde54066b3ec6f917aba1d02e08477ecd8dfddd7acd86fd2250
|
7
|
+
data.tar.gz: 4516dc833613cdf48c5d4a68fab6b514015637547df5b98cbc0406499354fab2fd1d1d82c155d6ed547c8f42b75face2ff81829595d2258335c5a66de173dc57
|
data/bin/likadan
CHANGED
@@ -30,9 +30,8 @@ when 'approve', 'reject'
|
|
30
30
|
LikadanAction.new(example_name, width).send(action)
|
31
31
|
|
32
32
|
when 'upload_diffs'
|
33
|
-
|
34
|
-
|
35
|
-
end
|
33
|
+
# `upload_diffs` returns a URL to a static html file
|
34
|
+
puts LikadanUploader.new.upload_diffs
|
36
35
|
else
|
37
36
|
abort "Unknown action \"#{action}\""
|
38
37
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Likadan diffs</title>
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<h1>Likadan diffs</h1>
|
8
|
+
<p>File generated: <%= Time.now %></p>
|
9
|
+
|
10
|
+
<% diff_images.each do |diff| %>
|
11
|
+
<h3>
|
12
|
+
<%= diff[:name] %> @ <%= diff[:width] %>
|
13
|
+
</h3>
|
14
|
+
<p><img src="<%= diff[:url] %>"></p>
|
15
|
+
<% end %>
|
16
|
+
</body>
|
17
|
+
</html>
|
data/lib/likadan_uploader.rb
CHANGED
@@ -17,12 +17,23 @@ class LikadanUploader
|
|
17
17
|
bucket = service.buckets.build(SecureRandom.hex)
|
18
18
|
bucket.save(location: :us)
|
19
19
|
|
20
|
-
current_snapshots[:diffs].map do |diff|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
diff_images = current_snapshots[:diffs].map do |diff|
|
21
|
+
image = bucket.objects.build("#{diff[:name]}_#{diff[:width]}.png")
|
22
|
+
image.content = open(diff[:file])
|
23
|
+
image.content_type = 'image/png'
|
24
|
+
image.save
|
25
|
+
diff[:url] = image.url
|
26
|
+
diff
|
26
27
|
end
|
28
|
+
|
29
|
+
html = bucket.objects.build('likadan-diffs.html')
|
30
|
+
html.content =
|
31
|
+
ERB.new(
|
32
|
+
File.read(File.expand_path(
|
33
|
+
File.join(File.dirname(__FILE__), 'likadan-diffs.html.erb')))
|
34
|
+
).result(binding)
|
35
|
+
html.content_type = 'text/html'
|
36
|
+
html.save
|
37
|
+
html.url
|
27
38
|
end
|
28
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: likadan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henric Trotzig
|
@@ -138,6 +138,7 @@ extensions: []
|
|
138
138
|
extra_rdoc_files: []
|
139
139
|
files:
|
140
140
|
- bin/likadan
|
141
|
+
- lib/likadan-diffs.html.erb
|
141
142
|
- lib/likadan_action.rb
|
142
143
|
- lib/likadan_runner.rb
|
143
144
|
- lib/likadan_server.rb
|