jekyll-airtable_data 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fd7a5f04467ce3dd68454bddfd9228f9f14d8cf0456eaf46780a30f0f97cb633
4
+ data.tar.gz: 1d3e805fd7a441c5eeeb080de0ba77fc1d4b99873c41fa1d480ce61942714216
5
+ SHA512:
6
+ metadata.gz: 8bbf76bf5e3b1a97301c8cd5db9130a50c93fe390870940215c4b4a3facf7101aeb5b84792238ff20677485d34bf5c2afbe07f08a1fa5be17a39da52b0a03261
7
+ data.tar.gz: 61c58d8602bc5c5f911c497f177bcc2ca5b7423e72e031a11252ef5347b697d87f3f24782586c2ff73ec27bc7250ed674b031d647da4973054a8b5cb2513802c
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+ gemspec
3
+
4
+ gem 'airtable'
5
+ gem 'bigdecimal'
6
+ gem 'activesupport'
7
+ gem 'json'
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Dan Klammer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Jekyll Airtable Data
2
+
3
+ Jekyll plugin to pull down your Airtable tables as datafiles (JSON) through Jekyll Commands.
4
+
5
+ ## Installation
6
+
7
+ Add plugin to your Gemfile:
8
+
9
+ ```ruby
10
+ gem 'jekyll-airtable_data'
11
+ ```
12
+
13
+ Add Airtable settings to your _config.yml file:
14
+
15
+ ```yml
16
+ airtable_data:
17
+ api_key: [Your Airtable API Key] # Airtable API key available in the API documentation for your base
18
+ app_id: [Your Airtable App ID] # Airtable app ID found in the API documentation for your base
19
+ tables:
20
+ - [Your Airtable Table Name 1]
21
+ - [Your Airtable Table Name 2]
22
+ - [Your Airtable Table Name 3]
23
+ ```
24
+
25
+ ## Run Airtable Data
26
+
27
+ Execute via Jekyll Command as needed:
28
+
29
+ $ bundle exec jekyll airtable_data
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "jekyll/airtable_data"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,35 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "jekyll/airtable_data/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jekyll-airtable_data"
8
+ spec.version = Jekyll::AirtableData::VERSION
9
+ spec.date = "2018-10-29"
10
+ spec.summary = "Airtable Data"
11
+ spec.description = "Jekyll plugin to pull down your Airtable tables to Datafiles.json"
12
+ spec.authors = ["Dan Klammer"]
13
+ spec.homepage = "https://github.com/danklammer/jekyll-airtable_data"
14
+ spec.license = "MIT"
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_dependency "jekyll", "~> 3.8"
26
+ spec.add_dependency "airtable"
27
+ spec.add_dependency "bigdecimal"
28
+ spec.add_dependency "activesupport"
29
+ spec.add_dependency "json"
30
+
31
+ spec.add_development_dependency "bundler", "~> 1.16"
32
+ spec.add_development_dependency "rake", "~> 10.0"
33
+ spec.add_development_dependency "rspec", "~> 3.0"
34
+
35
+ end
@@ -0,0 +1,47 @@
1
+ require "jekyll/airtable_data/version"
2
+ require 'json'
3
+ require 'airtable'
4
+ require 'active_support/all'
5
+
6
+ module Jekyll
7
+ module Commands
8
+ class AirtableData < Command
9
+ class << self
10
+ def init_with_program(prog)
11
+ prog.command(:airtable_data) do |c|
12
+ c.action do |args, options|
13
+
14
+ @airtable_config = Jekyll.configuration({})['airtable_data']
15
+ @api_key = @airtable_config['api_key']
16
+ @app_id = @airtable_config['app_id']
17
+
18
+ @client = Airtable::Client.new("#{@api_key}")
19
+
20
+ @airtable_config['tables'].each do |table|
21
+
22
+ @table = @client.table("#{@app_id}", "#{table}")
23
+ @records = @table.all(:sort => ["Name", :asc])
24
+
25
+ dirname = File.dirname("_data/#{table}")
26
+ unless File.directory?(dirname)
27
+ FileUtils.mkdir_p(dirname)
28
+ end
29
+
30
+ File.open(dirname + "/" + table.parameterize + ".json", "w") do |f|
31
+ data = @records.map { |record| record.attributes }
32
+ f.write(data.to_json)
33
+ end
34
+
35
+ Jekyll.logger.info "Airable:","Generated _data/#{table.parameterize}.json"
36
+
37
+ end
38
+
39
+ Jekyll.logger.info "Airtable: Sync Complete!"
40
+
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,5 @@
1
+ module Jekyll
2
+ module AirtableData
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,164 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-airtable_data
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Dan Klammer
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-10-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.8'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: airtable
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bigdecimal
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: activesupport
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: json
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.16'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.16'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '10.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '10.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.0'
125
+ description: Jekyll plugin to pull down your Airtable tables to Datafiles.json
126
+ email:
127
+ executables: []
128
+ extensions: []
129
+ extra_rdoc_files: []
130
+ files:
131
+ - Gemfile
132
+ - LICENSE
133
+ - README.md
134
+ - Rakefile
135
+ - bin/console
136
+ - bin/setup
137
+ - jekyll-airtable_data.gemspec
138
+ - lib/jekyll/airtable_data.rb
139
+ - lib/jekyll/airtable_data/version.rb
140
+ homepage: https://github.com/danklammer/jekyll-airtable_data
141
+ licenses:
142
+ - MIT
143
+ metadata: {}
144
+ post_install_message:
145
+ rdoc_options: []
146
+ require_paths:
147
+ - lib
148
+ required_ruby_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ requirements: []
159
+ rubyforge_project:
160
+ rubygems_version: 2.7.7
161
+ signing_key:
162
+ specification_version: 4
163
+ summary: Airtable Data
164
+ test_files: []