jekyll-sanity 1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 244e74fd5255bd63d91a4484e2f91fb446b4d355
4
+ data.tar.gz: b5d00e54eb52577e9e1a4b213f583aff663a660e
5
+ SHA512:
6
+ metadata.gz: 1d1b55e9ffbafd514269a73b45cd9d380d7c53d846716e2be9b3f2ceceafbf3663ff8441965a880e4939a8ad7a32ca3c27eba05af38fff4c0f84d58d64e0e193
7
+ data.tar.gz: e83c98ed92b4aba742cf1534179b22c7e4557260aac7dbc8c9129931bc4b0a00c1ad28b5dd3b07c24306c762f0114cdc2898fa963d34a954a50bcda129ec0855
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source "https://rubygems.org"
2
+ gemspec
3
+
4
+ gem "rake"
5
+ gem "pry"
6
+
7
+ if ENV["JEKYLL_VERSION"]
8
+ # So we can test across all our supported.
9
+ gem "jekyll", "~> #{ENV["JEKYLL_VERSION"]}"
10
+ end
@@ -0,0 +1 @@
1
+ require "jekyll/sanity"
@@ -0,0 +1,101 @@
1
+ module Jekyll
2
+
3
+ # --
4
+ # Reads the Jekyll configuration, this is necessary
5
+ # because some of our stuff loads well before Jekyll
6
+ # to setup, so we need to see the config before
7
+ # Jekyll even sees it's own config.
8
+ # @return [Hash] the config.
9
+ # --
10
+ def self.config
11
+ @config ||= begin
12
+ file = Pathutil.pwd.join("_config.yml")
13
+ Jekyll.configuration(file.read_yaml({
14
+ safe: true
15
+ }))
16
+ end
17
+ end
18
+
19
+
20
+ # --
21
+ # Reloads the configuration file for you, this only
22
+ # affects `self.config` and doesn't really affect the
23
+ # site instance at all, Jekyll is weird.
24
+ # --
25
+ def self.reload_config
26
+ @config = nil || config
27
+ end
28
+
29
+ # --
30
+ # Whether or not we are inside of development
31
+ # environment, this is where most people work
32
+ # but you should set it yourself.
33
+ # @return [true,false] truth.
34
+ # --
35
+ def self.dev?
36
+ @dev ||= begin
37
+ Jekyll.env == "dev" || Jekyll.env == "development"
38
+ end
39
+ end
40
+
41
+ # --
42
+ # Whether or not we are inside of production
43
+ # this is what you should set yourself to if
44
+ # you are building a deployment.
45
+ # @return [true,false] truth.
46
+ # --
47
+ def self.production?
48
+ @production ||= begin
49
+ Jekyll.env == "production" || Jekyll.env == "prod"
50
+ end
51
+ end
52
+
53
+ # --
54
+ # A quick Pathutil (joinable) into the source dir, this
55
+ # hopefully follows the spec of Jekyll by allowing you to
56
+ # set the source dir (with `source`) and then if it's
57
+ # not set, defaulting to the current path.
58
+ # @return [Pathutil] the path.
59
+ # --
60
+ def self.source_dir
61
+ @source_dir ||= begin
62
+ Pathutil.new(config.fetch("source"))
63
+ end
64
+ end
65
+
66
+ # --
67
+ # @note this simply uses the default set by Jekyll
68
+ # A quick `Pathutil` (joinable) into the plugins dir.
69
+ # @return [Pathutil] the path.
70
+ # --
71
+ def self.plugins_dir
72
+ @plugins_dir ||= begin
73
+ Pathutil.new(config.fetch("plugins_dir"))
74
+ end
75
+ end
76
+
77
+ # --
78
+ # A quick Pathutil (joinable) into the cache dir, and as
79
+ # agreed to in https://goo.gl/TdzJWV we will default to
80
+ # `.jekyll-cache` unless you define `cache_dir` key.
81
+ # @return [Pathutil] the path.
82
+ # --
83
+ def self.cache_dir
84
+ @cache_dir ||= begin
85
+ backup = source_dir.join(".jekyll-cache")
86
+ Pathutil.new(config.fetch("cache_dir", backup)). \
87
+ expand_path
88
+ end
89
+ end
90
+
91
+ # --
92
+ # @note this simply uses the default set by Jekyll
93
+ # A quick `Pathutil` (joinable) into the site dir.
94
+ # @return [Pathutil] the path.
95
+ # --
96
+ def self.site_dir
97
+ @site_dir ||= begin
98
+ Pathutil.new(config.fetch("destination"))
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,5 @@
1
+ module Jekyll
2
+ module Sanity
3
+ VERSION = "1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-sanity
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ platform: ruby
6
+ authors:
7
+ - Jordon Bedwell
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-08-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '4'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '4'
33
+ - !ruby/object:Gem::Dependency
34
+ name: luna-rspec-formatters
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.7'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.7'
47
+ - !ruby/object:Gem::Dependency
48
+ name: jekyll
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.1'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.1'
61
+ description: Patches to make Jekyll less insane and easier
62
+ email:
63
+ - jordon@envygeeks.io
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - Gemfile
69
+ - lib/jekyll-sanity.rb
70
+ - lib/jekyll/sanity.rb
71
+ - lib/jekyll/sanity/version.rb
72
+ homepage: http://github.com/envygeeks/jekyll-sanity
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 2.1.0
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.6.11
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Configuration, Paths and other stuff
96
+ test_files: []