middleman-google_drive 0.2.9 → 0.3.0

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: db9609d6202f67290e821eaef30d6a8f725bf755
4
- data.tar.gz: 8194a550336602c7b2ec7da8f41c57f999052ffd
3
+ metadata.gz: c270c9613c9786889867c2f5e2181a96552f8f84
4
+ data.tar.gz: e03c80eaecd186d9fd239e491ff6eebf6f2bf3ec
5
5
  SHA512:
6
- metadata.gz: 06bc7722edc97543391b8852e23096af25849ee00bb5c2843a983053c8e55b57ca8576b7ec0b23085607a6315cef3a68f3d29f4ef559e6e5c715e278c80c906a
7
- data.tar.gz: 7842e26e597c2faef5eb2eb203ca826334eaadd0b1a901ed925bfc77bcfceb498a45f4a132dd786cedd9d6c2fc223232e68856ae140b55ada8e76b511bd6177a
6
+ metadata.gz: 076797830737c62c200b0b6fa10c724611b6ad7a64c5b6ecdd5e4f50c909f7b0036324b8ffdeb5d7f76f94d95f4959449276c557d9cdbd93046b8660f4d7e1d6
7
+ data.tar.gz: c1cbf78b8fdc84afc68ed748ce57d880a82cbfb89bec5156188210160f462807d49bb7f14de87c8f4610aecb0bfe3977f20a738da180c43877fe84d812a5e4ab
data/README.md CHANGED
@@ -34,16 +34,6 @@ single document with multiple worksheets. If you only need a single document...
34
34
  activate :google_drive, load_sheets: 'mygoogledocumentkey'
35
35
  ```
36
36
 
37
- ------
38
-
39
- ### WARNING!!!!
40
-
41
- You can only reliably load old-style google spreadsheets. These spreadsheets have URLs that look like this: `https://docs.google.com/a/spreadsheet/ccc?key=mygoogledocumentkey#gid=4`. If you create a brand new google spreadsheet, it will load without crashing but the worksheet names and data will be all mixed up.
42
-
43
- Click this link to create a new old-style google spreadsheet: [g.co/oldsheets](http://g.co/oldsheets)
44
-
45
- ------
46
-
47
37
  You can then use the worksheets in your templates (make sure your worksheets
48
38
  have names that only contain alpha-numeric characters; no spaces or strange things).
49
39
 
data/lib/google_drive.rb CHANGED
@@ -3,6 +3,7 @@ require 'google/api_client'
3
3
  require 'google/api_client/client_secrets'
4
4
  require 'google/api_client/auth/file_storage'
5
5
  require 'google/api_client/auth/installed_app'
6
+ require 'rubyXL'
6
7
 
7
8
  class GoogleDrive
8
9
  attr_reader :client
@@ -50,8 +51,6 @@ class GoogleDrive
50
51
  end
51
52
 
52
53
  def spreadsheet(key)
53
- require 'roo'
54
-
55
54
  list_resp = find(key)
56
55
 
57
56
  # Grab the export url. We're gonna request the spreadsheet
@@ -72,8 +71,8 @@ class GoogleDrive
72
71
  fp.write get_resp.body
73
72
  fp.close
74
73
 
75
- # now open the file with Roo
76
- ret = Roo::Spreadsheet.open(filename)
74
+ # now open the file with spreadsheet
75
+ ret = RubyXL::Parser.parse(filename)
77
76
 
78
77
  fp.unlink # delete our tempfile
79
78
 
@@ -83,14 +82,15 @@ class GoogleDrive
83
82
  def prepared_spreadsheet(key)
84
83
  xls = spreadsheet(key)
85
84
  data = {}
86
- xls.each_with_pagename do |title, sheet|
85
+ xls.worksheets.each do |sheet|
86
+ title = sheet.sheet_name
87
87
  # if the sheet is called microcopy, copy or ends with copy, we assume
88
88
  # the first column contains keys and the second contains values.
89
89
  # Like tarbell.
90
90
  if %w(microcopy copy).include?(title.downcase) ||
91
91
  title.downcase =~ /[ -_]copy$/
92
92
  data[title] = {}
93
- sheet.each do |row|
93
+ sheet.extract_data.each do |row|
94
94
  # if the key name is reused, create an array with all the entries
95
95
  if data[title].keys.include? row[0]
96
96
  if data[title][row[0]].is_a? Array
@@ -104,8 +104,7 @@ class GoogleDrive
104
104
  end
105
105
  else
106
106
  # otherwise parse the sheet into a hash
107
- sheet.header_line = 2 # a bug in Roo.
108
- data[title] = sheet.parse(headers: true)
107
+ data[title] = sheet.get_table[:table]
109
108
  end
110
109
  end
111
110
  data
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module GoogleDrive
3
- VERSION = '0.2.9'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_runtime_dependency 'middleman-core', '~> 3'
23
23
  spec.add_runtime_dependency 'retriable', '~> 1.4'
24
24
  spec.add_runtime_dependency 'google-api-client', '< 0.8'
25
- spec.add_runtime_dependency 'roo'
25
+ spec.add_runtime_dependency 'rubyXL'
26
26
  spec.add_runtime_dependency 'archieml'
27
27
  spec.add_development_dependency 'bundler', '~> 1.6'
28
28
  spec.add_development_dependency 'rake'
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.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Mark
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-07 00:00:00.000000000 Z
12
+ date: 2015-03-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core
@@ -54,7 +54,7 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0.8'
56
56
  - !ruby/object:Gem::Dependency
57
- name: roo
57
+ name: rubyXL
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ">="