middleman-google_drive 0.3.7 → 0.3.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: e6e32b879616fad6395114d05253258a05443e0d
4
- data.tar.gz: 9982c8cb4a69d3738ebab577c7ae949d54871a7a
3
+ metadata.gz: 3df0fbb18193aa6fe173b40a9ed814873cbb1582
4
+ data.tar.gz: f5c810323a5c049eb9e65536461aad67c97aa742
5
5
  SHA512:
6
- metadata.gz: 16a7af3d97a59131704011cb05b54b1622a62689be0c19d1c08acb05e231bcbf52437290dea3efc62f0ef8238690db5d43a504931fe6b38442e8832556f3d76d
7
- data.tar.gz: caa621486afd2db102bb59b6dc52b239430b558761c30b3ab333e4ad8ffcfc487ffffff05dead27f8b7a168afc9c492ecc50f688957b3e4e58186434e808a818
6
+ metadata.gz: f20fb3f52cb79986ff6a223daf4ce4a202ffc7a4cbc366fa04b26e0a83c87b14e098fc0cf55924326fbb6b486df3dc0cde9f8eabb150bd1322f52a79c15c9a45
7
+ data.tar.gz: aaacbd90befe43e65916c423ff4f799d7789cb5d986d763d1138417ec62e1bfe353a6aef377ff7b8ad7ba8ad1e2c49645a46c2d62a6c6c7569d51ebd3aacfb5a
data/lib/google_drive.rb CHANGED
@@ -114,14 +114,13 @@ class GoogleDrive
114
114
  if filename.nil?
115
115
  # get a temporary file. The export is binary, so open the tempfile in
116
116
  # write binary mode
117
- Tempfile.create(
118
- ['googledoc', ".#{type}"],
119
- binmode: mime_for(type.to_s).binary?) do |fp|
120
- filename = fp.path
121
- fp.write contents
122
- end
117
+ fp = Tempfile.create(
118
+ ['googledoc', ".#{type}"], binmode: mime_for(type.to_s).binary?)
119
+ filename = fp.path
120
+ fp.write(contents)
121
+ fp.close
123
122
  else
124
- open(filename, 'wb') { |fp| fp.write contents }
123
+ open(filename, 'wb') { |f| f.write(contents) }
125
124
  end
126
125
  filename
127
126
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module GoogleDrive
3
- VERSION = '0.3.7'
3
+ VERSION = '0.3.8'
4
4
  end
5
5
  end
@@ -30,14 +30,14 @@ class TestGoogleDrive < MiniTest::Test
30
30
  def test_export_to_file
31
31
  filename = @drive.export_to_file(@doc_file_id, :html)
32
32
  assert_equal '.html', File.extname(filename)
33
- assert File.exist?(filename)
33
+ assert File.exist?(filename), "Export file is missing #{filename}"
34
34
  assert_not_nil File.read(filename) =~ /^<html>/
35
35
  File.unlink(filename)
36
36
 
37
37
  [@new_sheet_file_id, @old_sheet_file_id].each do |file_id|
38
38
  filename = @drive.export_to_file(file_id, :xlsx)
39
39
  assert_equal '.xlsx', File.extname(filename)
40
- assert File.exist?(filename)
40
+ assert File.exist?(filename), "Export file is missing #{filename}"
41
41
  File.unlink(filename)
42
42
  end
43
43
  end
@@ -45,9 +45,9 @@ class TestGoogleDrive < MiniTest::Test
45
45
  def test_prepare_spreadsheet
46
46
  [@old_sheet_file_id, @new_sheet_file_id].each do |file_id|
47
47
  #filename = "/tmp/google_drive_#{file_id}.xlsx"
48
- filename = @drive.export_to_file(file_id, :xlsx, filename)
48
+ filename = @drive.export_to_file(file_id, :xlsx)
49
49
  assert_equal '.xlsx', File.extname(filename)
50
- assert File.exist?(filename)
50
+ assert File.exist?(filename), "Export file is missing #{filename}"
51
51
  data = @drive.prepare_spreadsheet(filename)
52
52
  assert_has_key data, 'microcopy'
53
53
  assert_has_key data['microcopy'], 'help'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-google_drive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Mark