middleman-google_drive 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +22 -17
- data/README.md +13 -4
- data/lib/middleman-google_drive/version.rb +1 -1
- data/lib/middleman-google_drive.rb +9 -4
- 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: 1afb11c7d973d269a92ed9ca7d3083d26d10be94
|
4
|
+
data.tar.gz: 2a716ee1cf4e9ac1cac6abcdcc0e7f9ebc312805
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea341f8b96380de5e5e67923ae3014f0a95dd401b4038a614dd5a4264efd3381501ee03250f6fdacd372a12c61f827ac698aace488c55e5358fccab72f2b8e1f
|
7
|
+
data.tar.gz: ee513b57b122fad012b277cef94343e10af928827171e47d6ed78fa2bdff19b5b9ecff2752d9597850991de3df6af9061c4798ee5681874c5bbb91ffbc3c5a34
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,27 @@
|
|
1
1
|
Copyright (c) 2014 Vox Media Inc., Ryan Mark, Pablo Mercado
|
2
|
+
All rights reserved.
|
2
3
|
|
3
|
-
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
8
|
+
list of conditions and the following disclaimer.
|
12
9
|
|
13
|
-
|
14
|
-
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
12
|
+
and/or other materials provided with the distribution.
|
15
13
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
* Neither the name of the {organization} nor the names of its
|
15
|
+
contributors may be used to endorse or promote products derived from
|
16
|
+
this software without specific prior written permission.
|
17
|
+
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
19
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
20
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
22
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
24
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
25
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
26
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
CHANGED
@@ -43,16 +43,25 @@ explanation](http://tarbell.readthedocs.org/en/latest/install.html#configure-goo
|
|
43
43
|
run middleman, you will be sent to a Google login prompt in order to
|
44
44
|
associate Middleman with your Google account. You should make sure that the
|
45
45
|
account that you choose has access to the spreadsheets you want to use in
|
46
|
-
Middleman.
|
47
|
-
|
48
|
-
|
46
|
+
Middleman.
|
47
|
+
|
48
|
+
You need to make sure that the `redirect_urls` setting for the client secrets
|
49
|
+
is `urn:ietf:wg:oauth:2.0:oob` and not another URL.
|
50
|
+
|
51
|
+
Protip: If somebody in your org has used this extension or something like it,
|
52
|
+
chances are that person has already created a client secrets file that can be
|
53
|
+
shared with you.
|
54
|
+
|
55
|
+
Once you authenticate with Google, a new file `~/.google_drive_oauth2.json`
|
56
|
+
will be created containing an key for communicating with Google Drive.
|
49
57
|
|
50
58
|
You can override the location of the client secrets and oauth2 JSON files with
|
51
59
|
the environment variables `GOOGLE_CLIENT_SECRETS` and `GOOGLE_DRIVE_OAUTH`.
|
52
60
|
|
53
61
|
If you plan to run Middleman on a server, you can use Google's server to server
|
54
62
|
authentication. This will kick in if you define the environment variables
|
55
|
-
`GOOGLE_OAUTH_PERSON`, `GOOGLE_OAUTH_ISSUER` and either `GOOGLE_OAUTH_KEYFILE`
|
63
|
+
`GOOGLE_OAUTH_PERSON`, `GOOGLE_OAUTH_ISSUER` and either `GOOGLE_OAUTH_KEYFILE`
|
64
|
+
or `GOOGLE_OAUTH_PRIVATE_KEY`.
|
56
65
|
|
57
66
|
## Contributing
|
58
67
|
|
@@ -30,8 +30,8 @@ module Middleman
|
|
30
30
|
if key
|
31
31
|
puts 'authenticating with key'
|
32
32
|
client = Google::APIClient.new(
|
33
|
-
application_name: '
|
34
|
-
application_version:
|
33
|
+
application_name: 'Middleman',
|
34
|
+
application_version: Middleman::GoogleDrive::VERSION,
|
35
35
|
authorization: Signet::OAuth2::Client.new(
|
36
36
|
token_credential_uri: 'https://accounts.google.com/o/oauth2/token',
|
37
37
|
audience: 'https://accounts.google.com/o/oauth2/token',
|
@@ -50,9 +50,14 @@ module Middleman
|
|
50
50
|
else
|
51
51
|
client = Google::APIClient.new(
|
52
52
|
application_name: 'Middleman',
|
53
|
-
application_version:
|
53
|
+
application_version: Middleman::GoogleDrive::VERSION
|
54
54
|
)
|
55
|
-
|
55
|
+
begin
|
56
|
+
file_storage = Google::APIClient::FileStorage.new(credentials)
|
57
|
+
rescue URI::InvalidURIError
|
58
|
+
File.delete credentials
|
59
|
+
file_storage = Google::APIClient::FileStorage.new(credentials)
|
60
|
+
end
|
56
61
|
if file_storage.authorization.nil?
|
57
62
|
unless File.exist? client_secrets
|
58
63
|
puts 'You need to create a client_secrets.json file and save it to `~/.google_client_secrets.json`. Find instructions here: http://tarbell.readthedocs.org/en/latest/install.html#configure-google-spreadsheet-access-optional'
|
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.0.
|
4
|
+
version: 0.0.2
|
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: 2014-06-
|
12
|
+
date: 2014-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: middleman-core
|