middleman-google_drive 0.3.1 → 0.3.3
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/.rubocop.yml +30 -0
- data/lib/middleman-google_drive/extension.rb +34 -18
- data/lib/middleman-google_drive/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df94f7285904bfdc980f5c9b41f462419510d229
|
4
|
+
data.tar.gz: d21820a19625117878fac1a193f31886405cc2b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0491070a92dac3f1b78bcf9c344505ff85d00e06ced6c3f8483fd549fd0d4793f30198ff327073e8fb7590a06f4a9506fb502f26b707b6e3889f36f1ce425f2
|
7
|
+
data.tar.gz: 335652541d98d74f3ac22138bbdc2c618c0f11977f22e93fbfd83d33b3f32843cba2aff811ea8c496bb8e137e1cfd9ab5d988ec66d17eaa6a43d07662f622a75
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
AllCops:
|
3
|
+
Include:
|
4
|
+
- '**/Rakefile'
|
5
|
+
- '**/Capfile'
|
6
|
+
Exclude:
|
7
|
+
- 'db/migrate/**/*'
|
8
|
+
- 'vendor/**/*'
|
9
|
+
RunRailsCops: true
|
10
|
+
|
11
|
+
Style/HashSyntax:
|
12
|
+
EnforcedStyle: hash_rockets
|
13
|
+
|
14
|
+
Style/LineLength:
|
15
|
+
Max: 100
|
16
|
+
|
17
|
+
Style/NumericLiterals:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Style/ClassAndModuleChildren:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Style/SignalException:
|
24
|
+
EnforcedStyle: only_raise
|
25
|
+
|
26
|
+
Style/ClassLength:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Style/MethodLength:
|
30
|
+
Enabled: false
|
@@ -27,14 +27,39 @@ module Middleman
|
|
27
27
|
def handle_option(option, type)
|
28
28
|
if option.is_a? Hash
|
29
29
|
option.each do |name, key|
|
30
|
-
|
30
|
+
store_data(name, load_doc(key.to_s, type))
|
31
31
|
end
|
32
32
|
elsif type == 'spreadsheet'
|
33
33
|
load_doc(option.to_s, type).each do |name, sheet|
|
34
|
-
|
34
|
+
store_data(name, sheet)
|
35
35
|
end
|
36
36
|
else
|
37
|
-
|
37
|
+
store_data('doc', load_doc(option.to_s, type))
|
38
|
+
end
|
39
|
+
rescue Faraday::ConnectionFailed => exc
|
40
|
+
if @drive.server?
|
41
|
+
puts "== FAILED to load Google Doc \"#{exc.message}\""
|
42
|
+
else
|
43
|
+
puts <<-MSG
|
44
|
+
== Could not connect to Google Drive. Local data will be used.
|
45
|
+
MSG
|
46
|
+
end
|
47
|
+
rescue GoogleDrive::GoogleDriveError => exc
|
48
|
+
if @drive.server?
|
49
|
+
puts "== FAILED to load Google Doc \"#{exc.message}\""
|
50
|
+
else
|
51
|
+
puts <<-MSG
|
52
|
+
|
53
|
+
Could not load the Google Doc.
|
54
|
+
|
55
|
+
Things to check:
|
56
|
+
- Make sure the Google Doc key is correct
|
57
|
+
- Make sure you're logging in with the correct account
|
58
|
+
- Make sure you have access to the document
|
59
|
+
|
60
|
+
Google said "#{exc.message}." It might be a lie.
|
61
|
+
MSG
|
62
|
+
@drive.clear_auth
|
38
63
|
end
|
39
64
|
end
|
40
65
|
|
@@ -55,23 +80,14 @@ module Middleman
|
|
55
80
|
== #{doc['alternateLink']}
|
56
81
|
MSG
|
57
82
|
data
|
58
|
-
|
59
|
-
if @drive.server?
|
60
|
-
puts "== FAILED to load Google Doc \"#{exc.message}\""
|
61
|
-
else
|
62
|
-
puts <<-MSG
|
63
|
-
|
64
|
-
Could not load the Google Doc.
|
65
|
-
|
66
|
-
Things to check:
|
67
|
-
- Make sure the Google Doc key is correct
|
68
|
-
- Make sure you're logging in with the correct account
|
69
|
-
- Make sure you have access to the document
|
83
|
+
end
|
70
84
|
|
71
|
-
|
72
|
-
|
73
|
-
|
85
|
+
def store_data(key, data)
|
86
|
+
backup_file = File.join(@app.root, @app.data_dir, "#{key}.json")
|
87
|
+
File.open(backup_file, 'w') do |f|
|
88
|
+
f.write(JSON.pretty_generate(data))
|
74
89
|
end
|
90
|
+
@app.data.store(key, data)
|
75
91
|
end
|
76
92
|
end
|
77
93
|
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.
|
4
|
+
version: 0.3.3
|
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-
|
12
|
+
date: 2015-03-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: middleman-core
|
@@ -132,6 +132,7 @@ extensions: []
|
|
132
132
|
extra_rdoc_files: []
|
133
133
|
files:
|
134
134
|
- ".gitignore"
|
135
|
+
- ".rubocop.yml"
|
135
136
|
- Gemfile
|
136
137
|
- LICENSE.txt
|
137
138
|
- README.md
|