ngage 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +22 -0
  3. data/exe/ngage +55 -0
  4. data/lib/ngage.rb +3 -0
  5. data/lib/ngage/jekyll.rb +204 -0
  6. data/lib/ngage/jekyll/cleaner.rb +111 -0
  7. data/lib/ngage/jekyll/collection.rb +235 -0
  8. data/lib/ngage/jekyll/command.rb +103 -0
  9. data/lib/ngage/jekyll/commands/build.rb +93 -0
  10. data/lib/ngage/jekyll/commands/clean.rb +45 -0
  11. data/lib/ngage/jekyll/commands/doctor.rb +173 -0
  12. data/lib/ngage/jekyll/commands/help.rb +34 -0
  13. data/lib/ngage/jekyll/commands/new.rb +157 -0
  14. data/lib/ngage/jekyll/commands/new_theme.rb +42 -0
  15. data/lib/ngage/jekyll/commands/serve.rb +354 -0
  16. data/lib/ngage/jekyll/commands/serve/live_reload_reactor.rb +122 -0
  17. data/lib/ngage/jekyll/commands/serve/livereload_assets/livereload.js +1183 -0
  18. data/lib/ngage/jekyll/commands/serve/servlet.rb +203 -0
  19. data/lib/ngage/jekyll/commands/serve/websockets.rb +81 -0
  20. data/lib/ngage/jekyll/configuration.rb +391 -0
  21. data/lib/ngage/jekyll/converter.rb +54 -0
  22. data/lib/ngage/jekyll/converters/identity.rb +41 -0
  23. data/lib/ngage/jekyll/converters/markdown.rb +116 -0
  24. data/lib/ngage/jekyll/converters/markdown/kramdown_parser.rb +122 -0
  25. data/lib/ngage/jekyll/converters/smartypants.rb +70 -0
  26. data/lib/ngage/jekyll/convertible.rb +253 -0
  27. data/lib/ngage/jekyll/deprecator.rb +50 -0
  28. data/lib/ngage/jekyll/document.rb +503 -0
  29. data/lib/ngage/jekyll/drops/collection_drop.rb +20 -0
  30. data/lib/ngage/jekyll/drops/document_drop.rb +69 -0
  31. data/lib/ngage/jekyll/drops/drop.rb +209 -0
  32. data/lib/ngage/jekyll/drops/excerpt_drop.rb +15 -0
  33. data/lib/ngage/jekyll/drops/jekyll_drop.rb +32 -0
  34. data/lib/ngage/jekyll/drops/site_drop.rb +56 -0
  35. data/lib/ngage/jekyll/drops/static_file_drop.rb +14 -0
  36. data/lib/ngage/jekyll/drops/unified_payload_drop.rb +26 -0
  37. data/lib/ngage/jekyll/drops/url_drop.rb +89 -0
  38. data/lib/ngage/jekyll/entry_filter.rb +127 -0
  39. data/lib/ngage/jekyll/errors.rb +20 -0
  40. data/lib/ngage/jekyll/excerpt.rb +180 -0
  41. data/lib/ngage/jekyll/external.rb +76 -0
  42. data/lib/ngage/jekyll/filters.rb +390 -0
  43. data/lib/ngage/jekyll/filters/date_filters.rb +110 -0
  44. data/lib/ngage/jekyll/filters/grouping_filters.rb +64 -0
  45. data/lib/ngage/jekyll/filters/url_filters.rb +68 -0
  46. data/lib/ngage/jekyll/frontmatter_defaults.rb +233 -0
  47. data/lib/ngage/jekyll/generator.rb +5 -0
  48. data/lib/ngage/jekyll/hooks.rb +106 -0
  49. data/lib/ngage/jekyll/layout.rb +62 -0
  50. data/lib/ngage/jekyll/liquid_extensions.rb +22 -0
  51. data/lib/ngage/jekyll/liquid_renderer.rb +63 -0
  52. data/lib/ngage/jekyll/liquid_renderer/file.rb +56 -0
  53. data/lib/ngage/jekyll/liquid_renderer/table.rb +98 -0
  54. data/lib/ngage/jekyll/log_adapter.rb +151 -0
  55. data/lib/ngage/jekyll/mime.types +825 -0
  56. data/lib/ngage/jekyll/page.rb +185 -0
  57. data/lib/ngage/jekyll/page_without_a_file.rb +14 -0
  58. data/lib/ngage/jekyll/plugin.rb +92 -0
  59. data/lib/ngage/jekyll/plugin_manager.rb +115 -0
  60. data/lib/ngage/jekyll/publisher.rb +23 -0
  61. data/lib/ngage/jekyll/reader.rb +154 -0
  62. data/lib/ngage/jekyll/readers/collection_reader.rb +22 -0
  63. data/lib/ngage/jekyll/readers/data_reader.rb +75 -0
  64. data/lib/ngage/jekyll/readers/layout_reader.rb +70 -0
  65. data/lib/ngage/jekyll/readers/page_reader.rb +25 -0
  66. data/lib/ngage/jekyll/readers/post_reader.rb +72 -0
  67. data/lib/ngage/jekyll/readers/static_file_reader.rb +25 -0
  68. data/lib/ngage/jekyll/readers/theme_assets_reader.rb +51 -0
  69. data/lib/ngage/jekyll/regenerator.rb +195 -0
  70. data/lib/ngage/jekyll/related_posts.rb +52 -0
  71. data/lib/ngage/jekyll/renderer.rb +266 -0
  72. data/lib/ngage/jekyll/site.rb +476 -0
  73. data/lib/ngage/jekyll/static_file.rb +169 -0
  74. data/lib/ngage/jekyll/stevenson.rb +60 -0
  75. data/lib/ngage/jekyll/tags/highlight.rb +108 -0
  76. data/lib/ngage/jekyll/tags/include.rb +226 -0
  77. data/lib/ngage/jekyll/tags/link.rb +40 -0
  78. data/lib/ngage/jekyll/tags/post_url.rb +104 -0
  79. data/lib/ngage/jekyll/theme.rb +73 -0
  80. data/lib/ngage/jekyll/theme_builder.rb +121 -0
  81. data/lib/ngage/jekyll/url.rb +160 -0
  82. data/lib/ngage/jekyll/utils.rb +370 -0
  83. data/lib/ngage/jekyll/utils/ansi.rb +57 -0
  84. data/lib/ngage/jekyll/utils/exec.rb +26 -0
  85. data/lib/ngage/jekyll/utils/internet.rb +37 -0
  86. data/lib/ngage/jekyll/utils/platforms.rb +82 -0
  87. data/lib/ngage/jekyll/utils/thread_event.rb +31 -0
  88. data/lib/ngage/jekyll/utils/win_tz.rb +75 -0
  89. data/lib/ngage/site_template/.gitignore +5 -0
  90. data/lib/ngage/site_template/404.html +25 -0
  91. data/lib/ngage/site_template/_config.yml +47 -0
  92. data/lib/ngage/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +29 -0
  93. data/lib/ngage/site_template/about.markdown +18 -0
  94. data/lib/ngage/site_template/index.markdown +6 -0
  95. data/lib/ngage/theme_template/CODE_OF_CONDUCT.md.erb +74 -0
  96. data/lib/ngage/theme_template/Gemfile +4 -0
  97. data/lib/ngage/theme_template/LICENSE.txt.erb +21 -0
  98. data/lib/ngage/theme_template/README.md.erb +52 -0
  99. data/lib/ngage/theme_template/_layouts/default.html +1 -0
  100. data/lib/ngage/theme_template/_layouts/page.html +5 -0
  101. data/lib/ngage/theme_template/_layouts/post.html +5 -0
  102. data/lib/ngage/theme_template/example/_config.yml.erb +1 -0
  103. data/lib/ngage/theme_template/example/_post.md +12 -0
  104. data/lib/ngage/theme_template/example/index.html +14 -0
  105. data/lib/ngage/theme_template/example/style.scss +7 -0
  106. data/lib/ngage/theme_template/gitignore.erb +6 -0
  107. data/lib/ngage/theme_template/theme.gemspec.erb +19 -0
  108. data/lib/ngage/version.rb +5 -0
  109. metadata +328 -0
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Utils
5
+ module Internet
6
+ # Public: Determine whether the present device has a connection to
7
+ # the Internet. This allows plugin writers which require the outside
8
+ # world to have a neat fallback mechanism for offline building.
9
+ #
10
+ # Example:
11
+ # if Internet.connected?
12
+ # Typhoeus.get("https://pages.github.com/versions.json")
13
+ # else
14
+ # Jekyll.logger.warn "Warning:", "Version check has been disabled."
15
+ # Jekyll.logger.warn "", "Connect to the Internet to enable it."
16
+ # nil
17
+ # end
18
+ #
19
+ # Returns true if a DNS call can successfully be made, or false if not.
20
+
21
+ module_function
22
+
23
+ def connected?
24
+ !dns("example.com").nil?
25
+ end
26
+
27
+ def dns(domain)
28
+ require "resolv"
29
+ Resolv::DNS.open do |resolver|
30
+ resolver.getaddress(domain)
31
+ end
32
+ rescue Resolv::ResolvError, Resolv::ResolvTimeout
33
+ nil
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Utils
5
+ module Platforms
6
+ extend self
7
+
8
+ # Provides jruby? and mri? which respectively detect these two types of
9
+ # tested Engines we support, in the future we might probably support the
10
+ # other one that everyone used to talk about.
11
+
12
+ { :jruby? => "jruby", :mri? => "ruby" }.each do |k, v|
13
+ define_method k do
14
+ ::RUBY_ENGINE == v
15
+ end
16
+ end
17
+
18
+ # --
19
+ # Allows you to detect "real" Windows, or what we would consider
20
+ # "real" Windows. That is, that we can pass the basic test and the
21
+ # /proc/version returns nothing to us.
22
+ # --
23
+
24
+ def vanilla_windows?
25
+ RbConfig::CONFIG["host_os"] =~ %r!mswin|mingw|cygwin!i && \
26
+ !proc_version
27
+ end
28
+
29
+ # --
30
+ # XXX: Remove in 4.0
31
+ # --
32
+
33
+ alias_method :really_windows?, \
34
+ :vanilla_windows?
35
+
36
+ #
37
+
38
+ def bash_on_windows?
39
+ RbConfig::CONFIG["host_os"] =~ %r!linux! && \
40
+ proc_version =~ %r!microsoft!i
41
+ end
42
+
43
+ #
44
+
45
+ def windows?
46
+ vanilla_windows? || bash_on_windows?
47
+ end
48
+
49
+ #
50
+
51
+ def linux?
52
+ RbConfig::CONFIG["host_os"] =~ %r!linux! && \
53
+ proc_version !~ %r!microsoft!i
54
+ end
55
+
56
+ # Provides windows?, linux?, osx?, unix? so that we can detect
57
+ # platforms. This is mostly useful for `jekyll doctor` and for testing
58
+ # where we kick off certain tests based on the platform.
59
+
60
+ { :osx? => %r!darwin|mac os!, :unix? => %r!solaris|bsd! }.each do |k, v|
61
+ define_method k do
62
+ !!(
63
+ RbConfig::CONFIG["host_os"] =~ v
64
+ )
65
+ end
66
+ end
67
+
68
+ #
69
+
70
+ private
71
+
72
+ def proc_version
73
+ @proc_version ||=
74
+ begin
75
+ Pathutil.new("/proc/version").read
76
+ rescue Errno::ENOENT, Errno::EACCES
77
+ nil
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Utils
5
+ # Based on the pattern and code from
6
+ # https://emptysqua.re/blog/an-event-synchronization-primitive-for-ruby/
7
+ class ThreadEvent
8
+ attr_reader :flag
9
+
10
+ def initialize
11
+ @lock = Mutex.new
12
+ @cond = ConditionVariable.new
13
+ @flag = false
14
+ end
15
+
16
+ def set
17
+ @lock.synchronize do
18
+ yield if block_given?
19
+ @flag = true
20
+ @cond.broadcast
21
+ end
22
+ end
23
+
24
+ def wait
25
+ @lock.synchronize do
26
+ @cond.wait(@lock) unless @flag
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Utils
5
+ module WinTZ
6
+ extend self
7
+
8
+ # Public: Calculate the Timezone for Windows when the config file has a defined
9
+ # 'timezone' key.
10
+ #
11
+ # timezone - the IANA Time Zone specified in "_config.yml"
12
+ #
13
+ # Returns a string that ultimately re-defines ENV["TZ"] in Windows
14
+ def calculate(timezone)
15
+ External.require_with_graceful_fail("tzinfo") unless defined?(TZInfo)
16
+ tz = TZInfo::Timezone.get(timezone)
17
+ difference = Time.now.to_i - tz.now.to_i
18
+ #
19
+ # POSIX style definition reverses the offset sign.
20
+ # e.g. Eastern Standard Time (EST) that is 5Hrs. to the 'west' of Prime Meridian
21
+ # is denoted as:
22
+ # EST+5 (or) EST+05:00
23
+ # Reference: http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
24
+ sign = difference.negative? ? "-" : "+"
25
+ offset = sign == "-" ? "+" : "-" unless difference.zero?
26
+ #
27
+ # convert the difference (in seconds) to hours, as a rational number, and perform
28
+ # a modulo operation on it.
29
+ modulo = modulo_of(rational_hour(difference))
30
+ #
31
+ # Format the hour as a two-digit number.
32
+ # Establish the minutes based on modulo expression.
33
+ hh = format("%02d", absolute_hour(difference).ceil)
34
+ mm = modulo.zero? ? "00" : "30"
35
+
36
+ Jekyll.logger.debug "Timezone:", "#{timezone} #{offset}#{hh}:#{mm}"
37
+ #
38
+ # Note: The 3-letter-word below doesn't have a particular significance.
39
+ "WTZ#{sign}#{hh}:#{mm}"
40
+ end
41
+
42
+ private
43
+
44
+ # Private: Convert given seconds to an hour as a rational number.
45
+ #
46
+ # seconds - supplied as an integer, it is converted to a rational number.
47
+ # 3600 - no. of seconds in an hour.
48
+ #
49
+ # Returns a rational number.
50
+ def rational_hour(seconds)
51
+ seconds.to_r / 3600
52
+ end
53
+
54
+ # Private: Convert given seconds to an hour as an absolute number.
55
+ #
56
+ # seconds - supplied as an integer, it is converted to its absolute.
57
+ # 3600 - no. of seconds in an hour.
58
+ #
59
+ # Returns an integer.
60
+ def absolute_hour(seconds)
61
+ seconds.abs / 3600
62
+ end
63
+
64
+ # Private: Perform a modulo operation on a given fraction.
65
+ #
66
+ # fraction - supplied as a rational number, its numerator is divided
67
+ # by its denominator and the remainder returned.
68
+ #
69
+ # Returns an integer.
70
+ def modulo_of(fraction)
71
+ fraction.numerator % fraction.denominator
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,5 @@
1
+ _site
2
+ .sass-cache
3
+ .jekyll-cache
4
+ .jekyll-metadata
5
+ vendor
@@ -0,0 +1,25 @@
1
+ ---
2
+ permalink: /404.html
3
+ layout: default
4
+ ---
5
+
6
+ <style type="text/css" media="screen">
7
+ .container {
8
+ margin: 10px auto;
9
+ max-width: 600px;
10
+ text-align: center;
11
+ }
12
+ h1 {
13
+ margin: 30px 0;
14
+ font-size: 4em;
15
+ line-height: 1;
16
+ letter-spacing: -1px;
17
+ }
18
+ </style>
19
+
20
+ <div class="container">
21
+ <h1>404</h1>
22
+
23
+ <p><strong>Page not found :(</strong></p>
24
+ <p>The requested page could not be found.</p>
25
+ </div>
@@ -0,0 +1,47 @@
1
+ # Welcome to Jekyll!
2
+ #
3
+ # This config file is meant for settings that affect your whole blog, values
4
+ # which you are expected to set up once and rarely edit after that. If you find
5
+ # yourself editing this file very often, consider using Jekyll's data files
6
+ # feature for the data you need to update frequently.
7
+ #
8
+ # For technical reasons, this file is *NOT* reloaded automatically when you use
9
+ # 'bundle exec jekyll serve'. If you change this file, please restart the server process.
10
+ #
11
+ # If you need help with YAML syntax, here are some quick references for you:
12
+ # https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml
13
+ # https://learnxinyminutes.com/docs/yaml/
14
+ #
15
+ # Site settings
16
+ # These are used to personalize your new site. If you look in the HTML files,
17
+ # you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
18
+ # You can create any custom variable you would like, and they will be accessible
19
+ # in the templates via {{ site.myvariable }}.
20
+
21
+ title: Your awesome title
22
+ email: your-email@example.com
23
+ description: >- # this means to ignore newlines until "baseurl:"
24
+ Write an awesome description for your new site here. You can edit this
25
+ line in _config.yml. It will appear in your document head meta (for
26
+ Google search results) and in your feed.xml site description.
27
+ baseurl: "" # the subpath of your site, e.g. /blog
28
+ url: "" # the base hostname & protocol for your site, e.g. http://example.com
29
+ twitter_username: jekyllrb
30
+ github_username: jekyll
31
+
32
+ # Build settings
33
+ theme: minima
34
+ plugins:
35
+ - jekyll-feed
36
+
37
+ # Exclude from processing.
38
+ # The following items will not be processed, by default. Create a custom list
39
+ # to override the default setting.
40
+ # exclude:
41
+ # - Gemfile
42
+ # - Gemfile.lock
43
+ # - node_modules
44
+ # - vendor/bundle/
45
+ # - vendor/cache/
46
+ # - vendor/gems/
47
+ # - vendor/ruby/
@@ -0,0 +1,29 @@
1
+ ---
2
+ layout: post
3
+ title: "Welcome to Jekyll!"
4
+ date: <%= Time.now.strftime('%Y-%m-%d %H:%M:%S %z') %>
5
+ categories: jekyll update
6
+ ---
7
+ You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.
8
+
9
+ Jekyll requires blog post files to be named according to the following format:
10
+
11
+ `YEAR-MONTH-DAY-title.MARKUP`
12
+
13
+ Where `YEAR` is a four-digit number, `MONTH` and `DAY` are both two-digit numbers, and `MARKUP` is the file extension representing the format used in the file. After that, include the necessary front matter. Take a look at the source for this post to get an idea about how it works.
14
+
15
+ Jekyll also offers powerful support for code snippets:
16
+
17
+ {% highlight ruby %}
18
+ def print_hi(name)
19
+ puts "Hi, #{name}"
20
+ end
21
+ print_hi('Tom')
22
+ #=> prints 'Hi, Tom' to STDOUT.
23
+ {% endhighlight %}
24
+
25
+ Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll Talk][jekyll-talk].
26
+
27
+ [jekyll-docs]: https://jekyllrb.com/docs/home
28
+ [jekyll-gh]: https://github.com/jekyll/jekyll
29
+ [jekyll-talk]: https://talk.jekyllrb.com/
@@ -0,0 +1,18 @@
1
+ ---
2
+ layout: page
3
+ title: About
4
+ permalink: /about/
5
+ ---
6
+
7
+ This is the base Jekyll theme. You can find out more info about customizing your Jekyll theme, as well as basic Jekyll usage documentation at [jekyllrb.com](https://jekyllrb.com/)
8
+
9
+ You can find the source code for Minima at GitHub:
10
+ [jekyll][jekyll-organization] /
11
+ [minima](https://github.com/jekyll/minima)
12
+
13
+ You can find the source code for Jekyll at GitHub:
14
+ [jekyll][jekyll-organization] /
15
+ [jekyll](https://github.com/jekyll/jekyll)
16
+
17
+
18
+ [jekyll-organization]: https://github.com/jekyll
@@ -0,0 +1,6 @@
1
+ ---
2
+ # Feel free to add content and custom Front Matter to this file.
3
+ # To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults
4
+
5
+ layout: home
6
+ ---
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at <%= user_email %>. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+ gemspec