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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c819c2e72385e0ced6484f460d9d6d3b823ac0e8
4
- data.tar.gz: 28121b0f18c48c24aa9cb192f723fef7849ee10c
3
+ metadata.gz: 9633d8286039253609c245ba5316b69850820057
4
+ data.tar.gz: a8b0daed7a75e501d2d6e9b1f8dcea770055dcf5
5
5
  SHA512:
6
- metadata.gz: af7a48e0cbb10972164e7d5e13e0773464626db94f657ff2b4f5da4b9e6c571825c18c6f76987aded196538dc6809a0c7a3cfbc0c525190cb2810731d15620ae
7
- data.tar.gz: 71c73c0bdacfc073d290f44cbd7422ecf2de86c9287ef4b60facd771e974f2f747fe2e3a39f57deb2ecfb6eafab34f7d5bfb7ad5ffd03e3f6faf18b980f5ab14
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
- LikadanUploader.new.upload_diffs.each do |url|
34
- puts url
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>
@@ -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
- object = bucket.objects.build("#{diff[:name]}_#{diff[:width]}.png")
22
- object.content = open(diff[:file])
23
- object.content_type = 'image/png'
24
- object.save
25
- object.url
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.7
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