middleman-spreadsheet 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1259e8e1a1357c6e0a95455117be302b671576a5
4
- data.tar.gz: 711cc54f680d3a22b7861a6afbccc457ccfa9e3e
3
+ metadata.gz: 51c67cf8110e3e5ecd9f70f0f6fe469b2a35647b
4
+ data.tar.gz: dfa4b6c549204b420277a1fb7d5fc8238a01d53a
5
5
  SHA512:
6
- metadata.gz: 9fcd9eb87f0d5cd21a8a53cb81dc5c1ae70c9810f96cd257421fa98dbd4f445411c84d4952de7e9ec9f5fd793705e835695e76f7f746d24c2e07bee5b6ac72ef
7
- data.tar.gz: fa3add330bc3a2d9a24b9fa8db8cd8fe100d4647b06eb379c1295870097338c2fc3dc12607c16e88f32908151dad790fa705af9746e870c8a962019013287d37
6
+ metadata.gz: e20a0a4f88458b71db63dc5a5f832c8e71429ff66e1ec1221991311b2c09e370f396c3960445f3d76495a13b8cc4583bf9a26dfd58c306b60655f540d20119ba
7
+ data.tar.gz: 617a29a065fed3a228ab3cec2303db9f0e269b561115e9627acd8572b4b829a4ff5743d791dc0a576a3fc05fcf30957fa38cf3b5631adf50a26692a39c77db70
data/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # middleman-spreadsheet
2
+
3
+ Middleman extension for using Google spreadsheet as data files. Edit
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'middleman-spreadsheet'
11
+ ```
12
+
13
+ And then execute:
14
+ ```
15
+ $ bundle
16
+ ```
17
+
18
+ ## Setup
19
+
20
+ 1. Go to [Google API Console](https://console.developers.google.com/apis/credentials) and creates your own API credentials.
21
+ 2. Create google credentials json like
22
+ ```
23
+ {
24
+ "client_id": "xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
25
+ "client_secret": "xxxxxxxxxxxxxxxxxxxxxxxx"
26
+ }
27
+ ```
28
+ 3. Activate `:spreadsheet` like below.
29
+ ```ruby
30
+ activate :spreadsheet do |spreadsheet|
31
+ spreadsheet.config = "google_credentials.json"
32
+ spreadsheet.spreadsheet_url = "https://docs.google.com/spreadsheets/d/xxxxxxxxxxxxxxxxxxxxx/edit#gid=0"
33
+ end
34
+ ```
35
+
36
+ If you want to manage credentials without json, you could to use `spreadsheet.credentials` option.
37
+
38
+ ## Usage
39
+ ### Create spreadsheet
40
+ Create spreadsheet.
41
+
42
+ ![](spreadsheet.png)
43
+
44
+ ### Specify spreadsheet
45
+ You can specify spreadsheet by `spreadsheet_url`
46
+
47
+ ```ruby
48
+ spreadsheet.spreadsheet_url = "https://docs.google.com/spreadsheets/d/xxxxxxxxxxxxxxxxxxxxx/edit#gid=0"
49
+ ```
50
+
51
+ or `spreadsheet_key`
52
+
53
+ ```ruby
54
+ spreadsheet.spreadsheet_key = "xxxxxxxxxxxxxxxxxxxxx"
55
+ ```
56
+ or `spreadsheet_title`.
57
+
58
+ ```ruby
59
+ spreadsheet.spreadsheet_title = "foo bar sheet"
60
+ ```
61
+
62
+
63
+ ### Use in template
64
+ You can use `data.spreadsheet.<worksheet_title>` like below.
65
+
66
+ ```haml
67
+ %ul
68
+ - data.spreadsheet.Sheet1.each do |item|
69
+ %li #{item.id} #{item.foo} #{item.foo}
70
+ ```
71
+
72
+ ### Use in `config.rb`
73
+ You can use `app.data.spreadsheet.<worksheet_title>` like below.
74
+
75
+ ```ruby
76
+ app.data.spreadsheet.Sheet1.each do |row|
77
+ proxy "/foo/#{row.id}.html", "/items/show.html", locals: { foo: row }
78
+ end
79
+ ```
80
+
81
+ ## Contributing
82
+
83
+ Bug reports and pull requests are welcome on GitHub at https://github.com/hogelog/middlmean-spreadsheet.
84
+
85
+
86
+ ## License
87
+
88
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -6,6 +6,7 @@ module Middleman
6
6
  class CredentialsNotFound < Exception; end
7
7
 
8
8
  class Extension < ::Middleman::Extension
9
+ option :config, nil, 'Google API credentials config json'
9
10
  option :credentials, nil, 'Google API credentials'
10
11
  option :data_name, "spreadsheet", 'Spreadsheet key'
11
12
  option :spreadsheet_key, nil, 'Spreadsheet key'
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module Spreadsheet
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
data/spreadsheet.png ADDED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-spreadsheet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - hogelog
@@ -75,11 +75,13 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - ".gitignore"
77
77
  - Gemfile
78
+ - README.md
78
79
  - Rakefile
79
80
  - lib/middleman-spreadsheet.rb
80
81
  - lib/middleman/spreadsheet/extension.rb
81
82
  - lib/middleman/spreadsheet/version.rb
82
83
  - middleman-spreadsheet.gemspec
84
+ - spreadsheet.png
83
85
  homepage: https://github.com/hogelog/sheet_wrap
84
86
  licenses:
85
87
  - MIT