middleman-google_drive 0.3.12 → 0.3.13

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: 807f06b351002d6fc92541c068eb1b7ab3b752a2
4
- data.tar.gz: 1eee546218576b35ce5d82955d963195dfe7b93b
3
+ metadata.gz: a1c2420556edf06c18a407789811a3ada8296fc3
4
+ data.tar.gz: 13193dfdfb7cb7e1823fb49b3a1cf81bb09b98ba
5
5
  SHA512:
6
- metadata.gz: 77a8be8d0b27b9bf609f8be34cc52f7b8317831043ec4c55e92d659bbb9b6d3ff85437f538c96aecfce0d8c1695c3a0b96962beefa670af8b87e642834298d8e
7
- data.tar.gz: 20e40768a296d8b47d89a8692ba87784cf89d9208598b84eb90ae0baf103e1f47ed201a319a8c51b903c520bb5731643a3b88a7d29d87d91a081d36a50a0408f
6
+ metadata.gz: 9d82ebc9e88acad2197093311be03e5b52ce07faf2a933e7e4c7b015c82faf60dbb8572ff481c85dcc1af700a4dc5a623b3a1c87bedfd532770be3dbaa044cb0
7
+ data.tar.gz: ba3c5896e4aae5664a5bcdc2540460c6f87c9cb0d8d16fed91124157139ae3e1927b5b50b1e24de05aaad322991d62b7a80b29f8dfdfcfd55c6ac3db52b359cd
data/.gitignore CHANGED
@@ -1,22 +1,34 @@
1
1
  *.gem
2
2
  *.rbc
3
- .bundle
4
- .config
5
- .yardoc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
6
29
  Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
30
+ .ruby-version
31
+ .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
@@ -181,7 +181,6 @@ class GoogleDrive
181
181
  else
182
182
  # otherwise parse the sheet into a hash
183
183
  data[title] = load_table(sheet.extract_data)
184
- puts "Rows in #{title}: #{data[title].length}"
185
184
  end
186
185
  end
187
186
  return data
@@ -223,7 +222,11 @@ class GoogleDrive
223
222
  return [] if table.length < 2
224
223
  header = table.shift # Get the header row
225
224
  # remove blank rows
226
- table.reject! { |row| row.nil? || row.map { |r| r.to_s }.reduce(:+).strip.empty? }
225
+ table.reject! do |row|
226
+ row.nil? || row
227
+ .map { |r| r.nil? || r.to_s.strip.empty? }
228
+ .reduce(true) { |m, col| m && col }
229
+ end
227
230
  table.map do |row|
228
231
  # zip headers with current row, convert it to a hash
229
232
  header.zip(row).to_h unless row.nil?
@@ -14,18 +14,23 @@ module Middleman
14
14
  def initialize(klass, options_hash = {}, &block)
15
15
  super
16
16
 
17
- @drive = ::GoogleDrive.new
17
+ begin
18
+ @drive = ::GoogleDrive.new
18
19
 
19
- @app = klass.inst
20
+ @app = klass.inst
20
21
 
21
- @cache_dir = File.join(@app.root, 'google_drive_cache')
22
+ @cache_dir = File.join(@app.root, 'google_drive_cache')
22
23
 
23
- Dir.mkdir(@cache_dir) unless Dir.exist?(@cache_dir)
24
+ Dir.mkdir(@cache_dir) unless Dir.exist?(@cache_dir)
25
+
26
+ handle_option(options.load_sheets, :xlsx)
27
+ handle_option(options.load_docs, :txt)
28
+ handle_option(options.load_docs_html, :html)
29
+ handle_option(options.load_docs_archieml, :archieml)
30
+ rescue Faraday::ConnectionFailed => ex
31
+ puts "== Can't connect to Google (#{ex.message})"
32
+ end
24
33
 
25
- handle_option(options.load_sheets, :xlsx)
26
- handle_option(options.load_docs, :txt)
27
- handle_option(options.load_docs_html, :html)
28
- handle_option(options.load_docs_archieml, :archieml)
29
34
  end
30
35
 
31
36
  def handle_option(option, type)
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module GoogleDrive
3
- VERSION = '0.3.12'
3
+ VERSION = '0.3.13'
4
4
  end
5
5
  end
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.12
4
+ version: 0.3.13
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-06-03 00:00:00.000000000 Z
12
+ date: 2015-08-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core