jekyll-theme-assets-updated 1.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
+ SHA1:
3
+ metadata.gz: 9a8b89f747f31cac4524e57a55c3f49468ec723c
4
+ data.tar.gz: 10497ec5c3aa5e4e3ab81f2f199dcd4f28e7df02
5
+ SHA512:
6
+ metadata.gz: df78a87aee824119125f43624869282c9a24f7d1247feb5fdbf55e2cef1e07886f2c330dc4ed012a425326e526263c00f8c5abaa7bcdc2a9f760eff77b14efa5
7
+ data.tar.gz: 05c6649894895b4735e1b00b5a7c70742469cbf073bb57941846560adb267aaebad71beb99b6ffbed384ff5caad387d4f5240d79cc649456429713692a943178
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jekyll-theme-assets.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Pavel Tsurbeleu
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Jekyll::Theme::Assets
2
+
3
+ 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/jekyll/theme/assets`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'jekyll-theme-assets'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install jekyll-theme-assets
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jekyll-theme-assets. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,44 @@
1
+ require 'jekyll-assets'
2
+ require 'theme'
3
+
4
+ # Jekyll Assets hook to discover and register assets of a gem-based Jekyll theme.
5
+ Jekyll::Assets::Hook.register :env, :init do
6
+ # Nothing to do if there is no theme
7
+ return unless jekyll.theme
8
+ # fetch from theme's "assets" folder
9
+ fetch_theme_assets(jekyll.theme.public_assets_path)
10
+ # fetch from theme's "_assets" folder
11
+ fetch_theme_assets(jekyll.theme.private_assets_path)
12
+ end
13
+
14
+ private
15
+
16
+ # Simple helper to fetch assets from theme
17
+ def fetch_theme_assets(base_path)
18
+ # Base path is resolved to nil unless it does exists
19
+ return unless base_path
20
+ # Similar snippets could be found in Jekyll's code base (namely reader.rb)
21
+ dot_sources = Dir.chdir(base_path) { filter_entries(Dir.entries("."), base_path) }
22
+ dot_sources.each do |source|
23
+ # TODO: Replace with the link to the original thread on Github on the subject...
24
+ jekyll.sprockets.append_path(File.join(base_path, source))
25
+ end
26
+ end
27
+
28
+ # TODO: This snippet is taken as is from Jekyll with a little tweak
29
+ # to accomodate slight difference in naming convention between Jekyll
30
+ # and Jekyll Assets gem. It would be great to find out a way to reuse
31
+ # this snippet from Jekyll without the need to copy it.
32
+
33
+ # Filter out any files/directories that are hidden or backup files (start
34
+ # with "." or "#" or end with "~"), or contain site content (start with "_"),
35
+ # or are excluded in the site configuration, unless they are web server
36
+ # files such as '.htaccess'.
37
+ #
38
+ # entries - The Array of String file/directory entries to filter.
39
+ # base_directory - The string representing the optional base directory.
40
+ #
41
+ # Returns the Array of filtered entries.
42
+ def filter_entries(entries, base_directory = nil)
43
+ Jekyll::EntryFilter.new(jekyll, base_directory).filter(entries)
44
+ end
data/lib/theme.rb ADDED
@@ -0,0 +1,11 @@
1
+ # Lets extend base class with a few things to make our code
2
+ # less confusing (I hope that is the case LOL).
3
+ class Jekyll::Theme
4
+ # Our theme's public assets.
5
+ alias_method :public_assets_path, :assets_path
6
+
7
+ # Our theme's private assets.
8
+ def private_assets_path
9
+ path_for "_assets".freeze
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-theme-assets-updated
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ platform: ruby
6
+ authors:
7
+ - Pavel Tsurbeleu
8
+ - Kyle Kirkby
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2018-06-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: jekyll-assets
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 2.4.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 2.4.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: jekyll
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '3.0'
35
+ - - "~>"
36
+ - !ruby/object:Gem::Version
37
+ version: '3.1'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '3.0'
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ - !ruby/object:Gem::Dependency
49
+ name: bundler
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.14'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.14'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ - !ruby/object:Gem::Dependency
77
+ name: minitest
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '5.0'
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '5.0'
90
+ description: A Jekyll plugin, that allows you to use private and public assets defined
91
+ in a gem-based Jekyll theme.
92
+ email:
93
+ - pavel.tsurbeleu@me.com
94
+ - kyle.kirkby@linaro.org
95
+ executables: []
96
+ extensions: []
97
+ extra_rdoc_files: []
98
+ files:
99
+ - Gemfile
100
+ - LICENSE
101
+ - README.md
102
+ - Rakefile
103
+ - lib/jekyll-theme-assets.rb
104
+ - lib/theme.rb
105
+ homepage: https://github.com/ptsurbeleu/jekyll-theme-assets/
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.5.2.1
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Assets for a gem-based Jekyll theme
129
+ test_files: []