middleman-google_drive 0.3.12 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +31 -19
- data/lib/google_drive.rb +5 -2
- data/lib/middleman-google_drive/extension.rb +13 -8
- data/lib/middleman-google_drive/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1c2420556edf06c18a407789811a3ada8296fc3
|
4
|
+
data.tar.gz: 13193dfdfb7cb7e1823fb49b3a1cf81bb09b98ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d82ebc9e88acad2197093311be03e5b52ce07faf2a933e7e4c7b015c82faf60dbb8572ff481c85dcc1af700a4dc5a623b3a1c87bedfd532770be3dbaa044cb0
|
7
|
+
data.tar.gz: ba3c5896e4aae5664a5bcdc2540460c6f87c9cb0d8d16fed91124157139ae3e1927b5b50b1e24de05aaad322991d62b7a80b29f8dfdfcfd55c6ac3db52b359cd
|
data/.gitignore
CHANGED
@@ -1,22 +1,34 @@
|
|
1
1
|
*.gem
|
2
2
|
*.rbc
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
data/lib/google_drive.rb
CHANGED
@@ -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!
|
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
|
-
|
17
|
+
begin
|
18
|
+
@drive = ::GoogleDrive.new
|
18
19
|
|
19
|
-
|
20
|
+
@app = klass.inst
|
20
21
|
|
21
|
-
|
22
|
+
@cache_dir = File.join(@app.root, 'google_drive_cache')
|
22
23
|
|
23
|
-
|
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)
|
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.
|
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
|
12
|
+
date: 2015-08-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: middleman-core
|