prismic_rails 0.1.21 → 0.2.0
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/.gitignore +117 -0
- data/README.md +3 -0
- data/lib/generators/prismic_rails/install_generator.rb +2 -0
- data/lib/generators/templates/prismic_rails.rb +18 -8
- data/lib/prismic_rails/content/document.rb +10 -0
- data/lib/prismic_rails/content/fragment.rb +6 -0
- data/lib/prismic_rails/content/nil_document.rb +8 -0
- data/lib/prismic_rails/content/result.rb +23 -3
- data/lib/prismic_rails/helpers/view_helpers.rb +38 -12
- data/lib/prismic_rails/railtie.rb +2 -0
- data/lib/prismic_rails/services/language_service.rb +20 -6
- data/lib/prismic_rails/services/query_service.rb +22 -3
- data/lib/prismic_rails/version.rb +3 -1
- data/lib/prismic_rails.rb +25 -14
- data/prismic_rails-0.1.21.gem +0 -0
- data/prismic_rails.gemspec +10 -24
- metadata +64 -76
- data/lib/prismic_rails/services/parser_service.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91d0fd6019ba43ed0e35d1c2c0759e11faf11a2f
|
4
|
+
data.tar.gz: 7c4214e800edb0c788b8bf9d8948030682262db4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acf7f7dad35ad004caf7a2331d0d997229d1e0d0ead13ef02ab97345a0c095bc3587ddebb0c240551e5d7275acef9a76c61eca8d2689396e97ad090384c3167e
|
7
|
+
data.tar.gz: 04cfb7a4d598a7ca00d21e4c380a914576dcdf8e9622ed4d4a9d834a1f6ac4050cf21f2dfc1cdcfe083b923912871a7aa42f06b764f5b779ea8f4515ad0e4329
|
data/.gitignore
CHANGED
@@ -10,3 +10,120 @@
|
|
10
10
|
|
11
11
|
# rspec failure tracking
|
12
12
|
.rspec_status
|
13
|
+
|
14
|
+
### Linux ###
|
15
|
+
*~
|
16
|
+
|
17
|
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
18
|
+
.fuse_hidden*
|
19
|
+
|
20
|
+
# KDE directory preferences
|
21
|
+
.directory
|
22
|
+
|
23
|
+
# Linux trash folder which might appear on any partition or disk
|
24
|
+
.Trash-*
|
25
|
+
|
26
|
+
# .nfs files are created when an open file is removed but is still being accessed
|
27
|
+
.nfs*
|
28
|
+
|
29
|
+
### macOS ###
|
30
|
+
*.DS_Store
|
31
|
+
.AppleDouble
|
32
|
+
.LSOverride
|
33
|
+
|
34
|
+
# Icon must end with two \r
|
35
|
+
Icon
|
36
|
+
|
37
|
+
# Thumbnails
|
38
|
+
._*
|
39
|
+
|
40
|
+
# Files that might appear in the root of a volume
|
41
|
+
.DocumentRevisions-V100
|
42
|
+
.fseventsd
|
43
|
+
.Spotlight-V100
|
44
|
+
.TemporaryItems
|
45
|
+
.Trashes
|
46
|
+
.VolumeIcon.icns
|
47
|
+
.com.apple.timemachine.donotpresent
|
48
|
+
|
49
|
+
# Directories potentially created on remote AFP share
|
50
|
+
.AppleDB
|
51
|
+
.AppleDesktop
|
52
|
+
Network Trash Folder
|
53
|
+
Temporary Items
|
54
|
+
.apdisk
|
55
|
+
|
56
|
+
### Ruby ###
|
57
|
+
*.gem
|
58
|
+
*.rbc
|
59
|
+
/.config
|
60
|
+
/coverage/
|
61
|
+
/InstalledFiles
|
62
|
+
/pkg/
|
63
|
+
/spec/reports/
|
64
|
+
/spec/examples.txt
|
65
|
+
/test/tmp/
|
66
|
+
/test/version_tmp/
|
67
|
+
/tmp/
|
68
|
+
|
69
|
+
# Used by dotenv library to load environment variables.
|
70
|
+
# .env
|
71
|
+
|
72
|
+
## Specific to RubyMotion:
|
73
|
+
.dat*
|
74
|
+
.repl_history
|
75
|
+
build/
|
76
|
+
*.bridgesupport
|
77
|
+
build-iPhoneOS/
|
78
|
+
build-iPhoneSimulator/
|
79
|
+
|
80
|
+
## Specific to RubyMotion (use of CocoaPods):
|
81
|
+
#
|
82
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
83
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
84
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
85
|
+
#
|
86
|
+
# vendor/Pods/
|
87
|
+
|
88
|
+
## Documentation cache and generated files:
|
89
|
+
/.yardoc/
|
90
|
+
/_yardoc/
|
91
|
+
/doc/
|
92
|
+
/rdoc/
|
93
|
+
|
94
|
+
## Environment normalization:
|
95
|
+
/.bundle/
|
96
|
+
/vendor/bundle
|
97
|
+
/lib/bundler/man/
|
98
|
+
|
99
|
+
# for a library or gem, you might want to ignore these files since the code is
|
100
|
+
# intended to run in multiple environments; otherwise, check them in:
|
101
|
+
# Gemfile.lock
|
102
|
+
# .ruby-version
|
103
|
+
# .ruby-gemset
|
104
|
+
|
105
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
106
|
+
.rvmrc
|
107
|
+
|
108
|
+
### Windows ###
|
109
|
+
# Windows thumbnail cache files
|
110
|
+
Thumbs.db
|
111
|
+
ehthumbs.db
|
112
|
+
ehthumbs_vista.db
|
113
|
+
|
114
|
+
# Folder config file
|
115
|
+
Desktop.ini
|
116
|
+
|
117
|
+
# Recycle Bin used on file shares
|
118
|
+
$RECYCLE.BIN/
|
119
|
+
|
120
|
+
# Windows Installer files
|
121
|
+
*.cab
|
122
|
+
*.msi
|
123
|
+
*.msm
|
124
|
+
*.msp
|
125
|
+
|
126
|
+
# Windows shortcuts
|
127
|
+
*.lnk
|
128
|
+
|
129
|
+
# End of https://www.gitignore.io/api/ruby,macos,linux,windows
|
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
# PrismicRails
|
2
|
+
[](https://badge.fury.io/rb/prismic_rails)
|
3
|
+
[](https://travis-ci.org/fadendaten/prismic_rails)
|
4
|
+
[](https://codeclimate.com/github/fadendaten/prismic_rails)
|
2
5
|
|
3
6
|
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/prismic-rails`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
7
|
|
@@ -1,10 +1,20 @@
|
|
1
|
+
# Setup your PrismicRails
|
1
2
|
PrismicRails.configure do |config|
|
2
|
-
|
3
|
-
config.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
# Setup the basic API URL to Prismic.io
|
4
|
+
config.url = ENV["PRISMIC_API_URL"]
|
5
|
+
|
6
|
+
# Set the access token of prismic if you have one
|
7
|
+
config.token = ENV["PRISMIC_ACCESS_TOKEN"]
|
8
|
+
|
9
|
+
# Language machting of your app locale to prismic local:
|
10
|
+
# Example
|
11
|
+
# config.languages do |l|
|
12
|
+
# l.en = 'en-gb'
|
13
|
+
# l.de = 'de-ch'
|
14
|
+
# l.fr = 'fr-ch'
|
15
|
+
# l.it = 'it-ch'
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# Set if PrismicRails should use rails caching
|
19
|
+
# config.caching = true
|
10
20
|
end
|
@@ -1,23 +1,33 @@
|
|
1
|
+
# :nodoc:
|
1
2
|
module PrismicRails
|
3
|
+
# The PrismicRails::Document is a wrapper class around Prismic::Document to
|
4
|
+
# support custom features like to_html and to handle nil documents.
|
2
5
|
class Document
|
3
6
|
|
7
|
+
# Creats a new PrismicRails::Document
|
8
|
+
# ====
|
9
|
+
# +document+ A Prismic::Document
|
4
10
|
def initialize(document)
|
5
11
|
@document = document || PrismicRails::NilDocument.new
|
6
12
|
end
|
7
13
|
|
14
|
+
# Returns the document as save html
|
8
15
|
def to_html
|
9
16
|
@document.as_html(nil).html_safe
|
10
17
|
end
|
11
18
|
|
19
|
+
# Returns only the text of a document
|
12
20
|
def to_text
|
13
21
|
@document.as_text
|
14
22
|
end
|
15
23
|
|
24
|
+
# Find a fragment of a specific type in a document
|
16
25
|
def find_fragment(type)
|
17
26
|
fragment = @document.fragments[type]
|
18
27
|
return PrismicRails::Fragment.new(fragment) || NilDocument.new
|
19
28
|
end
|
20
29
|
|
30
|
+
# Tests if the document has the type type.
|
21
31
|
def is_type? type
|
22
32
|
type == @document.type
|
23
33
|
end
|
@@ -1,14 +1,20 @@
|
|
1
|
+
# :nodoc:
|
1
2
|
module PrismicRails
|
3
|
+
# The PrismicRails::Fragment is a wrapper class around Prismic::Fragment
|
2
4
|
class Fragment
|
3
5
|
|
6
|
+
# Create a new instance of PrismicRails::Fragment
|
7
|
+
# +fragment+ A Prismic::Fragment
|
4
8
|
def initialize(fragment)
|
5
9
|
@fragment = fragment
|
6
10
|
end
|
7
11
|
|
12
|
+
# Returns the document as save html
|
8
13
|
def to_html
|
9
14
|
@fragment.as_html(nil).html_safe
|
10
15
|
end
|
11
16
|
|
17
|
+
# Returns only the text of a document
|
12
18
|
def to_text
|
13
19
|
@fragment.as_text
|
14
20
|
end
|
@@ -1,22 +1,30 @@
|
|
1
|
+
# :nodoc:
|
1
2
|
module PrismicRails
|
3
|
+
# The PrismicRails::NilDocument represents a empty document but you can call
|
4
|
+
# any methods on it without getting an exception
|
2
5
|
class NilDocument
|
3
6
|
|
7
|
+
# Create a new instance of a PrismicRails::NilDocument
|
4
8
|
def initialize
|
5
9
|
@document = ''
|
6
10
|
end
|
7
11
|
|
12
|
+
# Returns the document as save html, in this case simply an empty string
|
8
13
|
def to_html
|
9
14
|
@document
|
10
15
|
end
|
11
16
|
|
17
|
+
# Returns the document as text, in this case simply an empty string
|
12
18
|
def to_text
|
13
19
|
@document
|
14
20
|
end
|
15
21
|
|
22
|
+
# Returns the type nil of the NilDocument
|
16
23
|
def type
|
17
24
|
nil
|
18
25
|
end
|
19
26
|
|
27
|
+
# Returns nil
|
20
28
|
def is_type? type
|
21
29
|
false
|
22
30
|
end
|
@@ -1,14 +1,34 @@
|
|
1
|
+
# :nodoc:
|
1
2
|
module PrismicRails
|
3
|
+
# The PrismicRails::Result object is a wrapper object around the
|
4
|
+
# Prismic::Response.
|
5
|
+
# The purpose of this wrapper object is to have an easy access on the included
|
6
|
+
# documents or to query a specific fragment.
|
2
7
|
class Result
|
3
8
|
|
4
9
|
attr_accessor :documents
|
5
10
|
|
6
|
-
|
7
|
-
|
8
|
-
|
11
|
+
# Creates the PrismicRails::Result object with the initial documents.
|
12
|
+
#
|
13
|
+
# ==== Attributes
|
14
|
+
# +response+ The response of the Prismic API query
|
15
|
+
def initialize(response)
|
16
|
+
if response.results
|
17
|
+
@documents = response.results.map do |document|
|
18
|
+
PrismicRails::Document.new(document)
|
19
|
+
end
|
20
|
+
else #Handles the case if the response is nil
|
21
|
+
@documents = []
|
9
22
|
end
|
10
23
|
end
|
11
24
|
|
25
|
+
# Find a specific fragment in the list of all documents.
|
26
|
+
#
|
27
|
+
# ==== Examples
|
28
|
+
#
|
29
|
+
# PrismicRails::Result.find_fragment('image')
|
30
|
+
# This call walks through all the documents and looks for a fragment with
|
31
|
+
# the type 'image'.
|
12
32
|
def find_fragment(type)
|
13
33
|
@documents.each do |document|
|
14
34
|
return document.find_fragment(type)
|
@@ -1,24 +1,50 @@
|
|
1
1
|
require 'prismic'
|
2
2
|
|
3
|
+
# :nodoc:
|
3
4
|
module PrismicRails
|
5
|
+
# :nodoc:
|
4
6
|
module ViewHelpers
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
8
|
+
# Query prismic for a specific type
|
9
|
+
#
|
10
|
+
# ==== Examples:
|
11
|
+
# Query the prismic type 'blog-post' and render each document a html
|
12
|
+
# <%= prismic_type 'blog-post' do |result| %>
|
13
|
+
# <%- result.documents.each do |document| %>
|
14
|
+
# <%= document.to_html %>
|
15
|
+
# <% end %>
|
16
|
+
# <% end %>
|
17
|
+
#
|
18
|
+
# Query the prismic type 'blog-post' in english
|
19
|
+
# <%= prismic_type 'blog-post', lang: 'en' do |result| %>
|
20
|
+
# <%- result.documents.each do |document| %>
|
21
|
+
# <%= document.to_html %>
|
22
|
+
# <% end %>
|
23
|
+
# <% end %>
|
24
|
+
#
|
25
|
+
# Query only the title of the type 'blog-post
|
26
|
+
#
|
27
|
+
# <%= prismic_type 'tea' do |result| %>
|
28
|
+
# <%= result.find_fragment('title').to_html %>
|
29
|
+
# <% end %>
|
30
|
+
#
|
31
|
+
#
|
32
|
+
# Supports Rails caching if the caching is enabled
|
33
|
+
def prismic_type(type, options = {}, &block)
|
14
34
|
|
15
|
-
|
16
|
-
Rails.cache.fetch [PrismicRails.ref, options] do
|
35
|
+
query = Proc.new do
|
17
36
|
response = PrismicRails::QueryService.type(type, options)
|
18
|
-
result = PrismicRails::
|
37
|
+
result = PrismicRails::Result.new(response)
|
19
38
|
capture(result, &block)
|
20
39
|
end
|
21
|
-
end
|
22
40
|
|
41
|
+
if PrismicRails.caching_enabled?
|
42
|
+
Rails.cache.fetch [PrismicRails.ref, options] do
|
43
|
+
query.call
|
44
|
+
end
|
45
|
+
else
|
46
|
+
query.call
|
47
|
+
end
|
48
|
+
end
|
23
49
|
end
|
24
50
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'prismic_rails/helpers/view_helpers'
|
2
2
|
|
3
|
+
# :nodoc:
|
3
4
|
module PrismicRails
|
5
|
+
# Setup class for the custom initializer
|
4
6
|
class Railtie < Rails::Railtie
|
5
7
|
config.prismic_rails = ActiveSupport::OrderedOptions.new # enable namespaced configuration in Rails environments
|
6
8
|
|
@@ -1,25 +1,39 @@
|
|
1
|
+
# :nodoc:
|
1
2
|
module PrismicRails
|
3
|
+
# The PrismicRails::LanguageService tries to match your i18n locale to the
|
4
|
+
# Prismic locale.
|
5
|
+
#
|
6
|
+
# E.g. If your rails app support the locales :en, :de and :fr and you want to
|
7
|
+
# support this locales with your prismic content you have to match this
|
8
|
+
# locals.
|
9
|
+
# In Prismic you have the posibility to define a finer graded set of locals,
|
10
|
+
# e.g. 'en-gb', 'en-us', 'de-de', 'de-ch' and so on.
|
11
|
+
# Unfortunatly Prismic does not support a wildecard query on the locals, so we
|
12
|
+
# solve this problem by setting up a matching logic.
|
13
|
+
#
|
14
|
+
# You can define the matching logic in your PrismicRails configureation.
|
2
15
|
class LanguageService
|
3
16
|
|
17
|
+
# Stores the given locale
|
4
18
|
attr_accessor :locale
|
5
19
|
|
20
|
+
# Call the PrismicRails::LanguageService with a i18n locale form rails. The
|
21
|
+
# PrismicRails::LanguageService tries to match it into a prismic local.
|
6
22
|
def self.call(locale)
|
7
23
|
new(locale).match()
|
8
24
|
end
|
9
25
|
|
26
|
+
# Creates a instance of the class PrismicRails::LanguageService
|
10
27
|
def initialize(locale)
|
11
28
|
@locale = locale
|
12
29
|
end
|
13
30
|
|
31
|
+
# Tries to match the given locale to a prismic locale
|
14
32
|
def match
|
15
|
-
return language_hash[@locale.to_sym]
|
16
|
-
end
|
17
|
-
|
18
|
-
def yaml_file
|
19
|
-
file = File.read(File.expand_path(FILE_PATH, __FILE__))
|
20
|
-
YAML.load(file)
|
33
|
+
return language_hash[@locale.to_sym] || '*'
|
21
34
|
end
|
22
35
|
|
36
|
+
# Creates the language hash out of the PrismicRails::Config
|
23
37
|
def language_hash
|
24
38
|
HashWithIndifferentAccess.new(PrismicRails.config.languages)
|
25
39
|
end
|
@@ -1,9 +1,27 @@
|
|
1
|
+
# :nodoc:
|
1
2
|
module PrismicRails
|
3
|
+
# The PrismicRails::QueryService is a small helper to query the Prismic API with
|
4
|
+
# support for query types.
|
5
|
+
# It also helps to create the right query for your i18n support.
|
2
6
|
module QueryService
|
7
|
+
# :nodoc:
|
3
8
|
class << self
|
4
9
|
|
10
|
+
# Constant that holds the query string to query the document type
|
5
11
|
DOCUMENT_TYPE = 'document.type'.freeze
|
6
12
|
|
13
|
+
# Query the Prismic API with a type
|
14
|
+
# ==== Examples
|
15
|
+
# PrismicRails::QueryService('blog-post')
|
16
|
+
#
|
17
|
+
# This returns a Prismic::Response with all the (published) documents of
|
18
|
+
# the type 'blog-post'
|
19
|
+
#
|
20
|
+
# PrismicRails::QueryService('block-post', {lang: 'en'}
|
21
|
+
#
|
22
|
+
# This returns a Prismic::Response with all the (published) documents of
|
23
|
+
# the type 'blog-post' in english.
|
24
|
+
#
|
7
25
|
def type(type, options = {})
|
8
26
|
match_language options if options[:lang]
|
9
27
|
query(predicates(type), options)
|
@@ -11,22 +29,23 @@ module PrismicRails
|
|
11
29
|
|
12
30
|
private
|
13
31
|
|
32
|
+
# Do the actual query against the Prismic API
|
14
33
|
def query(predicates, options)
|
15
34
|
api.query(predicates,
|
16
35
|
options)
|
17
36
|
end
|
18
37
|
|
38
|
+
# Creates the Prismic::Predicates for a given type
|
19
39
|
def predicates type
|
20
40
|
Prismic::Predicates.at(DOCUMENT_TYPE, type)
|
21
41
|
end
|
22
42
|
|
23
|
-
|
24
|
-
end
|
25
|
-
|
43
|
+
# Returns the Prismic::Api object
|
26
44
|
def api
|
27
45
|
PrismicRails.api
|
28
46
|
end
|
29
47
|
|
48
|
+
# Helper method to match the i18n locale to the prismic locale
|
30
49
|
def match_language options
|
31
50
|
options[:lang] = PrismicRails::LanguageService.call(options[:lang])
|
32
51
|
end
|
data/lib/prismic_rails.rb
CHANGED
@@ -4,32 +4,36 @@ require "prismic_rails/version"
|
|
4
4
|
require 'prismic_rails/railtie'
|
5
5
|
require "prismic_rails/helpers/view_helpers.rb"
|
6
6
|
require "prismic_rails/services/query_service.rb"
|
7
|
-
require "prismic_rails/services/parser_service.rb"
|
8
7
|
require "prismic_rails/services/language_service.rb"
|
9
8
|
require "prismic_rails/content/result.rb"
|
10
9
|
require "prismic_rails/content/document.rb"
|
11
10
|
require "prismic_rails/content/fragment.rb"
|
12
11
|
require "prismic_rails/content/nil_document.rb"
|
13
12
|
|
13
|
+
# :nodoc:
|
14
14
|
module PrismicRails
|
15
15
|
|
16
|
+
# A simple Config class that holds the config objects
|
16
17
|
class Config
|
17
|
-
attr_accessor :url,
|
18
|
-
:token,
|
19
|
-
:client_id,
|
20
|
-
:client_secret,
|
21
|
-
:languages,
|
22
|
-
:caching
|
18
|
+
attr_accessor :url, # Prismic API URL
|
19
|
+
:token, # Prismic API Token
|
20
|
+
:client_id, # Client ID
|
21
|
+
:client_secret, # Client Secret
|
22
|
+
:languages, # Language maching hash
|
23
|
+
:caching # Changing enabled?
|
23
24
|
end
|
24
25
|
|
26
|
+
# Initalize the Config class
|
25
27
|
def self.config
|
26
28
|
@@config ||= Config.new
|
27
29
|
end
|
28
30
|
|
31
|
+
# Set the configs
|
29
32
|
def self.configure
|
30
33
|
yield self.config
|
31
34
|
end
|
32
35
|
|
36
|
+
# Returns the Prismic::API Object or nif if prismic.io is down
|
33
37
|
def self.api
|
34
38
|
begin
|
35
39
|
@api = Prismic.api(self.config.url, self.config.token)
|
@@ -37,11 +41,13 @@ module PrismicRails
|
|
37
41
|
Prismic::API::BadPrismicResponseError,
|
38
42
|
Prismic::API::PrismicWSAuthError,
|
39
43
|
SocketError,
|
40
|
-
Net::OpenTimeout
|
44
|
+
Net::OpenTimeout
|
41
45
|
@api = nil
|
42
46
|
end
|
43
47
|
end
|
44
48
|
|
49
|
+
# Get the master ref of prismic account. This is primary used to establis a
|
50
|
+
# got caching mechanism.
|
45
51
|
def self.ref
|
46
52
|
if caching_enabled?
|
47
53
|
get_cached_ref
|
@@ -50,8 +56,16 @@ module PrismicRails
|
|
50
56
|
end
|
51
57
|
end
|
52
58
|
|
59
|
+
# returns if the caching is enabled
|
60
|
+
def self.caching_enabled?
|
61
|
+
PrismicRails.config.caching
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
# Get the master ref out of the rails cache if prismic is not available
|
53
67
|
def self.get_cached_ref
|
54
|
-
if
|
68
|
+
if api.nil?
|
55
69
|
@ref = Rails.cache.fetch('prismic_rails_ref')
|
56
70
|
else
|
57
71
|
master_ref = get_ref
|
@@ -60,12 +74,9 @@ module PrismicRails
|
|
60
74
|
end
|
61
75
|
end
|
62
76
|
|
77
|
+
# Get the master ref from the Prismic::API object
|
63
78
|
def self.get_ref
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.caching_enabled?
|
68
|
-
PrismicRails.config.caching
|
79
|
+
api.master_ref.ref
|
69
80
|
end
|
70
81
|
|
71
82
|
end
|
Binary file
|
data/prismic_rails.gemspec
CHANGED
@@ -9,21 +9,11 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Felix Langenegger"]
|
10
10
|
spec.email = ["f.langenegger@fadendaten.ch"]
|
11
11
|
|
12
|
-
spec.summary = %q{
|
13
|
-
spec.description = %q{
|
14
|
-
spec.homepage = "https://github.com/fadendaten/
|
12
|
+
spec.summary = %q{PrismicRails provides rails view helpers to query prismic.io.}
|
13
|
+
spec.description = %q{With PrismicRails it is simple to query the prismic.io API for a defined custom type. By providing rails helpers the integration in your rails view is much easier as before.}
|
14
|
+
spec.homepage = "https://github.com/fadendaten/prismic_rails"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
-
# TODO
|
20
|
-
# if spec.respond_to?(:metadata)
|
21
|
-
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
22
|
-
# else
|
23
|
-
# raise "RubyGems 2.0 or newer is required to protect against " \
|
24
|
-
# "public gem pushes."
|
25
|
-
# end
|
26
|
-
|
27
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
28
18
|
f.match(%r{^(test|spec|features)/})
|
29
19
|
end
|
@@ -31,20 +21,16 @@ Gem::Specification.new do |spec|
|
|
31
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
22
|
spec.require_paths = ["lib"]
|
33
23
|
|
34
|
-
spec.add_runtime_dependency "prismic.io", "~> 1.4.1"
|
35
|
-
spec.add_runtime_dependency 'rails'
|
24
|
+
spec.add_runtime_dependency "prismic.io", "~> 1.4", ">= 4.1"
|
25
|
+
spec.add_runtime_dependency 'rails', '>= 4.2', '~> 5.1'
|
36
26
|
|
37
27
|
spec.add_development_dependency "bundler", "~> 1.14"
|
38
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
39
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
40
30
|
|
41
|
-
spec.add_development_dependency "
|
42
|
-
spec.add_development_dependency "
|
43
|
-
spec.add_development_dependency "
|
44
|
-
spec.add_development_dependency "
|
45
|
-
spec.add_development_dependency "
|
46
|
-
spec.add_development_dependency "pry"
|
47
|
-
spec.add_development_dependency "pry-byebug"
|
48
|
-
spec.add_development_dependency "pry-doc"
|
49
|
-
spec.add_development_dependency 'simplecov'
|
31
|
+
spec.add_development_dependency "rdoc", "~> 5.1", ">= 5.1"
|
32
|
+
spec.add_development_dependency "vcr", "~> 3.0.3", ">= 5.1.0"
|
33
|
+
spec.add_development_dependency "dotenv", "~> 2.2", ">= 2.2.1"
|
34
|
+
spec.add_development_dependency "webmock", "~> 3.0", ">= 3.0.1"
|
35
|
+
spec.add_development_dependency 'simplecov', "~> 0.14", ">= 0.14.1"
|
50
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prismic_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Langenegger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prismic.io
|
@@ -16,28 +16,40 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.4
|
19
|
+
version: '1.4'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '4.1'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.4
|
29
|
+
version: '1.4'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '4.1'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rails
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
39
|
+
version: '4.2'
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '5.1'
|
34
43
|
type: :runtime
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
38
47
|
- - ">="
|
39
48
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
49
|
+
version: '4.2'
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '5.1'
|
41
53
|
- !ruby/object:Gem::Dependency
|
42
54
|
name: bundler
|
43
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,132 +93,108 @@ dependencies:
|
|
81
93
|
- !ruby/object:Gem::Version
|
82
94
|
version: '3.0'
|
83
95
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
96
|
+
name: rdoc
|
85
97
|
requirement: !ruby/object:Gem::Requirement
|
86
98
|
requirements:
|
87
|
-
- - "
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
99
|
+
- - "~>"
|
95
100
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: dotenv
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
+
version: '5.1'
|
101
102
|
- - ">="
|
102
103
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
104
|
+
version: '5.1'
|
104
105
|
type: :development
|
105
106
|
prerelease: false
|
106
107
|
version_requirements: !ruby/object:Gem::Requirement
|
107
108
|
requirements:
|
108
|
-
- - "
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: faraday
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
109
|
+
- - "~>"
|
116
110
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
111
|
+
version: '5.1'
|
122
112
|
- - ">="
|
123
113
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
114
|
+
version: '5.1'
|
125
115
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
116
|
+
name: vcr
|
127
117
|
requirement: !ruby/object:Gem::Requirement
|
128
118
|
requirements:
|
129
|
-
- - "
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
119
|
+
- - "~>"
|
137
120
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: webmock
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
121
|
+
version: 3.0.3
|
143
122
|
- - ">="
|
144
123
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
124
|
+
version: 5.1.0
|
146
125
|
type: :development
|
147
126
|
prerelease: false
|
148
127
|
version_requirements: !ruby/object:Gem::Requirement
|
149
128
|
requirements:
|
150
|
-
- - "
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: pry
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
129
|
+
- - "~>"
|
158
130
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
131
|
+
version: 3.0.3
|
164
132
|
- - ">="
|
165
133
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
134
|
+
version: 5.1.0
|
167
135
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
136
|
+
name: dotenv
|
169
137
|
requirement: !ruby/object:Gem::Requirement
|
170
138
|
requirements:
|
139
|
+
- - "~>"
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '2.2'
|
171
142
|
- - ">="
|
172
143
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
144
|
+
version: 2.2.1
|
174
145
|
type: :development
|
175
146
|
prerelease: false
|
176
147
|
version_requirements: !ruby/object:Gem::Requirement
|
177
148
|
requirements:
|
149
|
+
- - "~>"
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '2.2'
|
178
152
|
- - ">="
|
179
153
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
154
|
+
version: 2.2.1
|
181
155
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
156
|
+
name: webmock
|
183
157
|
requirement: !ruby/object:Gem::Requirement
|
184
158
|
requirements:
|
159
|
+
- - "~>"
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '3.0'
|
185
162
|
- - ">="
|
186
163
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
164
|
+
version: 3.0.1
|
188
165
|
type: :development
|
189
166
|
prerelease: false
|
190
167
|
version_requirements: !ruby/object:Gem::Requirement
|
191
168
|
requirements:
|
169
|
+
- - "~>"
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '3.0'
|
192
172
|
- - ">="
|
193
173
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
174
|
+
version: 3.0.1
|
195
175
|
- !ruby/object:Gem::Dependency
|
196
176
|
name: simplecov
|
197
177
|
requirement: !ruby/object:Gem::Requirement
|
198
178
|
requirements:
|
179
|
+
- - "~>"
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0.14'
|
199
182
|
- - ">="
|
200
183
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
184
|
+
version: 0.14.1
|
202
185
|
type: :development
|
203
186
|
prerelease: false
|
204
187
|
version_requirements: !ruby/object:Gem::Requirement
|
205
188
|
requirements:
|
189
|
+
- - "~>"
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
version: '0.14'
|
206
192
|
- - ">="
|
207
193
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
209
|
-
description:
|
194
|
+
version: 0.14.1
|
195
|
+
description: With PrismicRails it is simple to query the prismic.io API for a defined
|
196
|
+
custom type. By providing rails helpers the integration in your rails view is much
|
197
|
+
easier as before.
|
210
198
|
email:
|
211
199
|
- f.langenegger@fadendaten.ch
|
212
200
|
executables: []
|
@@ -233,11 +221,11 @@ files:
|
|
233
221
|
- lib/prismic_rails/helpers/view_helpers.rb
|
234
222
|
- lib/prismic_rails/railtie.rb
|
235
223
|
- lib/prismic_rails/services/language_service.rb
|
236
|
-
- lib/prismic_rails/services/parser_service.rb
|
237
224
|
- lib/prismic_rails/services/query_service.rb
|
238
225
|
- lib/prismic_rails/version.rb
|
226
|
+
- prismic_rails-0.1.21.gem
|
239
227
|
- prismic_rails.gemspec
|
240
|
-
homepage: https://github.com/fadendaten/
|
228
|
+
homepage: https://github.com/fadendaten/prismic_rails
|
241
229
|
licenses:
|
242
230
|
- MIT
|
243
231
|
metadata: {}
|
@@ -260,5 +248,5 @@ rubyforge_project:
|
|
260
248
|
rubygems_version: 2.6.8
|
261
249
|
signing_key:
|
262
250
|
specification_version: 4
|
263
|
-
summary:
|
251
|
+
summary: PrismicRails provides rails view helpers to query prismic.io.
|
264
252
|
test_files: []
|