jekyll-spree-client 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -0
  3. data/lib/jekyll-spree-client.rb +14 -11
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 345d7f0e45d1c821288d7a4452601c163f2d82304d317dc72ec425d6abd5cb47
4
- data.tar.gz: b74a132ff5c5592c2989bff62b2403e9a6cb10eacf4af715b5ee287c404f19a6
3
+ metadata.gz: 716e8e0f2ab2c09b987a10a760ed2e4bf36ebb142ff09b1331a03caaa824c57a
4
+ data.tar.gz: 7f5048e01435bde67988e5d4690e3026aed28ffbe75684cfd3b4526febe0d1af
5
5
  SHA512:
6
- metadata.gz: a92e70c17670182523b32ad5e5f6038f3fa0611c23c731a61b30e9f36cb30df6f65dd406921830b35dda8fd303cb60f8738e2e895c73f180390a482762e6725f
7
- data.tar.gz: f918174d0812624c71174e3c414160daa90c28539c1ae32859ce4c2046aa94ff9c222b5a551d3174009975c31939c7de75c30172a1a419290763b7249bf2418a
6
+ metadata.gz: 2824a7951b2c4e9affb55ba9bee0bc249f4e728db341b2704181a16130ec49274d248110a2c8d072921018ab2f807fc870978fd874891bced7925971560f92aa
7
+ data.tar.gz: 61cdaaca089e6fdbeeae9dc3be9d904730e0ba322fd653b36fa9b4d979cccda4c0aa618a7e21e46c7b62157c781e6d37f8035bb05f4f35cbb8a5f39d3ed8b370
data/README.md CHANGED
@@ -82,6 +82,18 @@ depth: 100
82
82
  The layout doesn't matter, but we recommend to use a layout for
83
83
  products.
84
84
 
85
+ ### Layouts
86
+
87
+ You'll need four layouts and at least a corresponding post, one for each
88
+ step of the buying process.
89
+
90
+ * `cart` the cart, shows the order details
91
+ * `shipment` shipping and billing addresses, shipping rates apply here
92
+ * `payment` select payment methods
93
+ * `confirmation` order confirmation page
94
+
95
+ They'll be available on Liquid under the `site.STEP` keys.
96
+
85
97
  ### Hooks
86
98
 
87
99
  If you need to do some data manipulation before and after
@@ -6,7 +6,20 @@ require_relative 'jekyll/spree_client'
6
6
  # matter. The SKU needs to be unique, but this plugin doesn't ensure
7
7
  # that. Duplicated SKUs will be silently ignored for now.
8
8
  Jekyll::Hooks.register :site, :post_read do |site|
9
- next unless ENV['SPREE_API_KEY']
9
+ # Ordered articles
10
+ posts = site.site_payload['site']['posts']
11
+
12
+ # Make steps available to other articles
13
+ %w[cart shipment payment confirmation].each do |step|
14
+ site.config[step] = posts.find do |doc|
15
+ doc.data['layout'] == step
16
+ end
17
+ end
18
+
19
+ unless ENV['SPREE_API_KEY']
20
+ Jekyll.logger.warn "SPREE_API_KEY environment variable missing, skipping syncrhonization"
21
+ next
22
+ end
10
23
 
11
24
  config = site.config['spree']&.transform_keys(&:to_sym) || {}
12
25
  config.merge!(site: site, api_key: ENV['SPREE_API_KEY'], spree_url: ENV['SPREE_URL'])
@@ -18,14 +31,4 @@ Jekyll::Hooks.register :site, :post_read do |site|
18
31
  if ENV['JEKYLL_ENV'] == 'production' && site.respond_to?(:repository)
19
32
  site.repository.commit site.data.dig(site.config['locale'], 'spree', 'commit') || 'Spree synchronization'
20
33
  end
21
-
22
- # Ordered articles
23
- posts = site.site_payload['site']['posts']
24
-
25
- # Make steps available to other articles
26
- %w[cart shipment payment confirmation].each do |step|
27
- site.config[step] = posts.find do |doc|
28
- doc.data['layout'] == step
29
- end
30
- end
31
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-spree-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - f