jekyll-securitytxt 0.1.0.pre.pre

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: d2447b077d669e477795a699abc17da5efa9c94cc1e77ae59fca029e10477127
4
+ data.tar.gz: e59865c8ecb4cebb2d0383b4bbdddd58373f00e9da057f597d7916cc993922b5
5
+ SHA512:
6
+ metadata.gz: 669eca2228b1063dd4a1879ec3ad32de75994f4fc86fabac5517834dcad886aff9bd214b538dc81d1a4c9dbdb6f8e349d5c4679b6d4429933e2965a0bbbb34f3
7
+ data.tar.gz: 259b25ccf40e9f143b430015031f5568ed7b8f9c26a3aa9525c3e7690f6571de7994fb7599bef9ea6473fe9406afe7ac27402153598170fb8fb239dabcb5f7a6
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Jekyll::Securitytxt
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ 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/securitytxt`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
14
+
15
+ If bundler is not being used to manage dependencies, install the gem by executing:
16
+
17
+ $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Development
24
+
25
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
+
27
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jekyll-securitytxt.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/jekyll/securitytxt/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "jekyll-securitytxt"
7
+ spec.version = Jekyll::Securitytxt::VERSION
8
+ spec.authors = ["HAHWUL"]
9
+ spec.email = ["hahwul@gmail.com"]
10
+
11
+ spec.summary = "Jekyll plugin for security.txt"
12
+ spec.description = "Jekyll plugin for security.txt"
13
+ spec.homepage = "https://github.com/hahwul/jekyll-securitytxt"
14
+ spec.required_ruby_version = ">= 2.6.0"
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = spec.homepage
18
+
19
+ spec.files = Dir.chdir(__dir__) do
20
+ `git ls-files -z`.split("\x0").reject do |f|
21
+ (File.expand_path(f) == __FILE__) ||
22
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile])
23
+ end
24
+ end
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+ spec.add_dependency "jekyll", "~> 3.8.0"
29
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Securitytxt
5
+ VERSION = "0.1.0-pre"
6
+ end
7
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "securitytxt/version"
4
+ require "jekyll"
5
+
6
+ module Jekyll
7
+ module Securitytxt
8
+ # Jekyll plugin for security.txt
9
+ class Generator < Jekyll::Generator
10
+ safe true
11
+ priority :lowest
12
+
13
+ # Plugin entry point.
14
+ def generate(site)
15
+ @site = site
16
+ @site.pages << verification_file unless a_verification_file_exist?
17
+ end
18
+
19
+ private
20
+
21
+ # Check if a security.txt file already exists in the source tree.
22
+ def a_verification_file_exist?
23
+ file_pattern = %r{.well-known/security\.txt?}
24
+ exists = @site.static_files.any? { |p| p.url =~ file_pattern }
25
+ warn_msg = "Found a security.txt file in source tree matching /#{file_pattern.source}/; not generating one..."
26
+ Jekyll.logger.warn LOG_TAG, warn_msg if exists
27
+ exists
28
+ end
29
+
30
+ # Get path of the template file.
31
+ def source_path(file = "template.html")
32
+ File.expand_path "../#{file}", __dir__
33
+ end
34
+
35
+ # Path of the security.txt file.
36
+ def securitytxt_path
37
+ ".well-known/security.txt"
38
+ end
39
+
40
+ # Construct a file object from a template with content that can be added to generated pages
41
+ def verification_file
42
+ Jekyll.logger.info LOG_TAG, "Generating #{securitytxt_path}"
43
+ page = PageWithoutAFile.new(@site, __dir__, "", securitytxt_path)
44
+ page.content = File.read(source_path)
45
+ page.data["layout"] = nil
46
+ page
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,6 @@
1
+ module Jekyll
2
+ module Securitytxt
3
+ VERSION: String
4
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-securitytxt
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.pre.pre
5
+ platform: ruby
6
+ authors:
7
+ - HAHWUL
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-02-18 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.0
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.0
27
+ description: Jekyll plugin for security.txt
28
+ email:
29
+ - hahwul@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".rspec"
35
+ - ".rubocop.yml"
36
+ - README.md
37
+ - Rakefile
38
+ - jekyll-securitytxt.gemspec
39
+ - lib/jekyll/securitytxt.rb
40
+ - lib/jekyll/securitytxt/version.rb
41
+ - sig/jekyll/securitytxt.rbs
42
+ homepage: https://github.com/hahwul/jekyll-securitytxt
43
+ licenses: []
44
+ metadata:
45
+ homepage_uri: https://github.com/hahwul/jekyll-securitytxt
46
+ source_code_uri: https://github.com/hahwul/jekyll-securitytxt
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 2.6.0
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubygems_version: 3.5.3
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Jekyll plugin for security.txt
66
+ test_files: []