jekyll-watch-1.3.0/0000755000175000017500000000000012600562464013752 5ustar uwabamiuwabamijekyll-watch-1.3.0/.rspec0000644000175000017500000000003612600562464015066 0ustar uwabamiuwabami--color --require spec_helper jekyll-watch-1.3.0/script/0000755000175000017500000000000012600562464015256 5ustar uwabamiuwabamijekyll-watch-1.3.0/script/bootstrap0000755000175000017500000000024712600562464017224 0ustar uwabamiuwabami#! /bin/bash if [[ "$TRAVIS" == "true" ]]; then echo "We're on Travis! Installing to vendor." time bundle install --path vendor else bundle install --system fi jekyll-watch-1.3.0/script/test0000755000175000017500000000004312600562464016160 0ustar uwabamiuwabami#!/bin/bash bundle exec rspec "$@" jekyll-watch-1.3.0/script/test-watcher0000755000175000017500000000015312600562464017615 0ustar uwabamiuwabami#!/bin/bash local-jekyll serve --watch \ --source spec/test-site \ --destination spec/test-site/_site jekyll-watch-1.3.0/script/cibuild0000755000175000017500000000003612600562464016616 0ustar uwabamiuwabami#!/bin/bash time script/test jekyll-watch-1.3.0/script/unbundle0000755000175000017500000000035512600562464017023 0ustar uwabamiuwabami#!/bin/bash RELEASES_URL="https://github.com/jekyll/jekyll/releases" JEKYLL_VERSION="2.2.0" JEKYLL_BUNDLE="jekyll-${JEKYLL_VERSION}.tar.gz" wget "${RELEASES_URL}/download/v${JEKYLL_VERSION}/${JEKYLL_BUNDLE}" tar -xzvf ${JEKYLL_BUNDLE} jekyll-watch-1.3.0/.gitignore0000644000175000017500000000032312600562464015740 0ustar uwabamiuwabami*.gem *.rbc .bundle .config .yardoc Gemfile.lock InstalledFiles _yardoc coverage doc/ lib/bundler/man pkg rdoc spec/reports test/tmp test/version_tmp tmp *.bundle *.so *.o *.a mkmf.log vendor .sass-cache _site jekyll-watch-1.3.0/History.markdown0000644000175000017500000000143512600562464017162 0ustar uwabamiuwabami## 1.3.0 / 2015-09-23 * Lock to Listen 3.x (#25) ## 1.2.1 / 2015-01-24 * Show regen time & use the same `Site` object across regens (#21) ## 1.2.0 / 2014-12-05 * *Always* ignore `.jekyll-metadata`, even if it doesn't exist. (#18) * Ignore `.jekyll-metadata` by default if it exists (#15) ## 1.1.2 / 2014-11-08 * Only ignore a file or directory if it exists (#13) ## 1.1.1 / 2014-09-05 * Exclude test files from the gem build (#9) ## 1.1.0 / 2014-08-10 ### Minor Enhancements * Refactor the whole watching thing and compartmentalize it. (#5) * Don't listen to things in the `exclude` configuration option. (#5) ### Development Fixes * Add github stuff and the beginnings of the test suite (#6) * Flesh out the test suite (#7) ## 1.0.0 / 2014-06-27 * Birthday! jekyll-watch-1.3.0/LICENSE.txt0000644000175000017500000000205512600562464015577 0ustar uwabamiuwabamiCopyright (c) 2014 Parker Moore MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. jekyll-watch-1.3.0/jekyll-watch.gemspec0000644000175000017500000000171412600562464017720 0ustar uwabamiuwabami# coding: utf-8 Gem::Specification.new do |spec| spec.name = "jekyll-watch" spec.version = "1.3.0" spec.authors = ["Parker Moore"] spec.email = ["parkrmoore@gmail.com"] spec.summary = %q{Rebuild your Jekyll site when a file changes with the `--watch` switch.} spec.homepage = "https://github.com/jekyll/jekyll-watch" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").grep(%r{(bin|lib)/}) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ["lib"] spec.add_runtime_dependency "listen", "~> 3.0" require 'rbconfig' if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ spec.add_runtime_dependency "wdm", "~> 0.1.0" end spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake" spec.add_development_dependency "rspec", "~> 3.0" spec.add_development_dependency "jekyll", ">= 2.0" end jekyll-watch-1.3.0/lib/0000755000175000017500000000000012600562464014520 5ustar uwabamiuwabamijekyll-watch-1.3.0/lib/jekyll/0000755000175000017500000000000012600562464016012 5ustar uwabamiuwabamijekyll-watch-1.3.0/lib/jekyll/watcher.rb0000644000175000017500000000537412600562464020005 0ustar uwabamiuwabamirequire 'listen' module Jekyll module Watcher extend self def watch(options) site = Jekyll::Site.new(options) listener = build_listener(site, options) listener.start Jekyll.logger.info "Auto-regeneration:", "enabled for '#{options['source']}'" unless options['serving'] trap("INT") do listener.stop puts " Halting auto-regeneration." exit 0 end sleep_forever end rescue ThreadError => e # You pressed Ctrl-C, oh my! end # TODO: shouldn't be public API def build_listener(site, options) Listen.to( options['source'], :ignore => listen_ignore_paths(options), :force_polling => options['force_polling'], &(listen_handler(site)) ) end def listen_handler(site) proc { |modified, added, removed| t = Time.now c = modified + added + removed n = c.length print Jekyll.logger.message("Regenerating:", "#{n} file(s) changed at #{t.strftime("%Y-%m-%d %H:%M:%S")} ") begin site.process puts "...done in #{Time.now - t} seconds." rescue => e puts "...error:" Jekyll.logger.warn "Error:", e.message Jekyll.logger.warn "Error:", "Run jekyll build --trace for more information." end } end def custom_excludes(options) Array(options['exclude']).map { |e| Jekyll.sanitized_path(options['source'], e) } end def config_files(options) %w[yml yaml toml].map do |ext| Jekyll.sanitized_path(options['source'], "_config.#{ext}") end end def to_exclude(options) [ config_files(options), options['destination'], custom_excludes(options) ].flatten end # Paths to ignore for the watch option # # options - A Hash of options passed to the command # # Returns a list of relative paths from source that should be ignored def listen_ignore_paths(options) source = Pathname.new(options['source']).expand_path paths = to_exclude(options) paths.map do |p| absolute_path = Pathname.new(p).expand_path if absolute_path.exist? begin relative_path = absolute_path.relative_path_from(source).to_s unless relative_path.start_with?('../') path_to_ignore = Regexp.new(Regexp.escape(relative_path)) Jekyll.logger.debug "Watcher:", "Ignoring #{path_to_ignore}" path_to_ignore end rescue ArgumentError # Could not find a relative path end end end.compact + [/\.jekyll\-metadata/] end def sleep_forever loop { sleep 1000 } end end end jekyll-watch-1.3.0/lib/jekyll/commands/0000755000175000017500000000000012600562464017613 5ustar uwabamiuwabamijekyll-watch-1.3.0/lib/jekyll/commands/watch.rb0000644000175000017500000000121212600562464021242 0ustar uwabamiuwabamimodule Jekyll module Commands module Watch extend self def init_with_program(prog) end # Build your jekyll site # Continuously watch if `watch` is set to true in the config. def process(options) Jekyll.logger.log_level = :error if options['quiet'] watch(site, options) if options['watch'] end # Watch for file changes and rebuild the site. # # site - A Jekyll::Site instance # options - A Hash of options passed to the command # # Returns nothing. def watch(site, options) Jekyll::Watcher.watch(options) end end end end jekyll-watch-1.3.0/lib/jekyll-watch.rb0000644000175000017500000000011312600562464017436 0ustar uwabamiuwabamirequire_relative "jekyll/watcher" require_relative "jekyll/commands/watch" jekyll-watch-1.3.0/.travis.yml0000644000175000017500000000057112600562464016066 0ustar uwabamiuwabamilanguage: ruby rvm: - 1.9.3 - 2.0 - 2.1 install: - travis_retry script/unbundle - travis_retry script/bootstrap script: script/cibuild notifications: irc: on_success: change on_failure: change channels: - irc.freenode.org#jekyll template: - '%{repository}#%{build_number} %{message} %{build_url}' email: on_success: never on_failure: change jekyll-watch-1.3.0/Rakefile0000644000175000017500000000022212600562464015413 0ustar uwabamiuwabamirequire "bundler/gem_tasks" require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |t| t.verbose = false end task default: :spec jekyll-watch-1.3.0/spec/0000755000175000017500000000000012600562464014704 5ustar uwabamiuwabamijekyll-watch-1.3.0/spec/spec_helper.rb0000644000175000017500000000532412600562464017526 0ustar uwabamiuwabamirequire 'jekyll' require File.expand_path('../../lib/jekyll-watch.rb', __FILE__) TEST_DIR = File.expand_path('..', __FILE__) RSpec.configure do |config| # These two settings work together to allow you to limit a spec run # to individual examples or groups you care about by tagging them with # `:focus` metadata. When nothing is tagged with `:focus`, all examples # get run. config.filter_run :focus config.run_all_when_everything_filtered = true # Many RSpec users commonly either run the entire suite or an individual # file, and it's useful to allow more verbose output when running an # individual spec file. if config.files_to_run.one? # Use the documentation formatter for detailed output, # unless a formatter has already been configured # (e.g. via a command-line flag). config.default_formatter = 'doc' end # Print the 10 slowest examples and example groups at the # end of the spec run, to help surface which specs are running # particularly slow. config.profile_examples = 10 # Run specs in random order to surface order dependencies. If you find an # order dependency and want to debug it, you can fix the order by providing # the seed, which is printed after each run. # --seed 1234 config.order = :random # Seed global randomization in this process using the `--seed` CLI option. # Setting this allows you to use `--seed` to deterministically reproduce # test failures related to randomization by passing the same `--seed` value # as the one that triggered the failure. Kernel.srand config.seed # rspec-expectations config goes here. You can use an alternate # assertion/expectation library such as wrong or the stdlib/minitest # assertions if you prefer. config.expect_with :rspec do |expectations| # Enable only the newer, non-monkey-patching expect syntax. # For more details, see: # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax expectations.syntax = :expect end # rspec-mocks config goes here. You can use an alternate test double # library (such as bogus or mocha) by changing the `mock_with` option here. config.mock_with :rspec do |mocks| # Enable only the newer, non-monkey-patching expect syntax. # For more details, see: # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ mocks.syntax = :expect # Prevents you from mocking or stubbing a method that does not exist on # a real object. This is generally recommended. mocks.verify_partial_doubles = true end def test_dir(*files) File.join(TEST_DIR, *files) end def source_dir(*files) test_dir('test-site', *files) end def dest_dir(*files) source_dir('_site', *files) end end jekyll-watch-1.3.0/spec/test-site/0000755000175000017500000000000012600562464016625 5ustar uwabamiuwabamijekyll-watch-1.3.0/spec/test-site/_sass/0000755000175000017500000000000012600562464017735 5ustar uwabamiuwabamijekyll-watch-1.3.0/spec/test-site/_sass/_base.scss0000644000175000017500000000514412600562464021707 0ustar uwabamiuwabami/** * Reset some basic elements */ body, h1, h2, h3, h4, h5, h6, p, blockquote, pre, hr, dl, dd, ol, ul, figure { margin: 0; padding: 0; } /** * Basic styling */ body { font-family: $base-font-family; font-size: $base-font-size; line-height: $base-line-height; font-weight: 300; color: $text-color; background-color: $background-color; } /** * Set `margin-bottom` to maintain vertycal rhythm */ h1, h2, h3, h4, h5, h6, p, blockquote, pre, ul, ol, dl, figure, %vertical-rhythm { margin-bottom: $spacing-unit / 2; } /** * Images */ img { max-width: 100%; vertical-align: middle; } /** * Figures */ figure > img { display: block; } figcaption { font-size: $small-font-size; } /** * Lists */ ul, ol { margin-left: $spacing-unit; } li { > ul, > ol { margin-bottom: 0; } } /** * Headings */ h1, h2, h3, h4, h5, h6 { font-weight: 300; } /** * Links */ a { color: $brand-color; text-decoration: none; &:visited { color: darken($brand-color, 15%); } &:hover { color: $text-color; text-decoration: underline; } } /** * Blockquotes */ blockquote { color: $grey-color; border-left: 4px solid $grey-color-light; padding-left: $spacing-unit / 2; font-size: 18px; letter-spacing: -1px; font-style: italic; > :last-child { margin-bottom: 0; } } /** * Code formatting */ pre, code { font-size: 15px; border: 1px solid $grey-color-light; border-radius: 3px; background-color: #eef; } code { padding: 1px 5px; } pre { padding: 8px 12px; overflow-x: scroll; > code { border: 0; padding-right: 0; padding-left: 0; } } /** * Wrapper */ .wrapper { max-width: -webkit-calc(800px - (#{$spacing-unit} * 2)); max-width: calc(800px - (#{$spacing-unit} * 2)); margin-right: auto; margin-left: auto; padding-right: $spacing-unit; padding-left: $spacing-unit; @extend %clearfix; @include media-query($on-laptop) { max-width: -webkit-calc(800px - (#{$spacing-unit})); max-width: calc(800px - (#{$spacing-unit})); padding-right: $spacing-unit / 2; padding-left: $spacing-unit / 2; } } /** * Clearfix */ %clearfix { &:after { content: ""; display: table; clear: both; } } /** * Icons */ .icon { > svg { display: inline-block; width: 16px; height: 16px; vertical-align: middle; path { fill: $grey-color; } } } jekyll-watch-1.3.0/spec/test-site/_sass/_layout.scss0000644000175000017500000001007112600562464022305 0ustar uwabamiuwabami/** * Site header */ .site-header { border-top: 5px solid $grey-color-dark; border-bottom: 1px solid $grey-color-light; min-height: 56px; // Positioning context for the mobile navigation icon position: relative; } .site-title { font-size: 26px; line-height: 56px; letter-spacing: -1px; margin-bottom: 0; float: left; &, &:visited { color: $grey-color-dark; } } .site-nav { float: right; line-height: 56px; .menu-icon { display: none; } .page-link { color: $text-color; line-height: $base-line-height; // Gaps between nav items, but not on the first one &:not(:first-child) { margin-left: 20px; } } @include media-query($on-palm) { position: absolute; top: 9px; right: 30px; background-color: $background-color; border: 1px solid $grey-color-light; border-radius: 5px; text-align: right; .menu-icon { display: block; float: right; width: 36px; height: 26px; line-height: 0; padding-top: 10px; text-align: center; > svg { width: 18px; height: 15px; path { fill: $grey-color-dark; } } } .trigger { clear: both; display: none; } &:hover .trigger { display: block; padding-bottom: 5px; } .page-link { display: block; padding: 5px 10px; } } } /** * Site footer */ .site-footer { border-top: 1px solid $grey-color-light; padding: $spacing-unit 0; } .footer-heading { font-size: 18px; margin-bottom: $spacing-unit / 2; } .contact-list, .social-media-list { list-style: none; margin-left: 0; } .footer-col-wrapper { font-size: 15px; color: $grey-color; margin-left: -$spacing-unit / 2; @extend %clearfix; } .footer-col { float: left; margin-bottom: $spacing-unit / 2; padding-left: $spacing-unit / 2; } .footer-col-1 { width: -webkit-calc(35% - (#{$spacing-unit} / 2)); width: calc(35% - (#{$spacing-unit} / 2)); } .footer-col-2 { width: -webkit-calc(20% - (#{$spacing-unit} / 2)); width: calc(20% - (#{$spacing-unit} / 2)); } .footer-col-3 { width: -webkit-calc(45% - (#{$spacing-unit} / 2)); width: calc(45% - (#{$spacing-unit} / 2)); } @include media-query($on-laptop) { .footer-col-1, .footer-col-2 { width: -webkit-calc(50% - (#{$spacing-unit} / 2)); width: calc(50% - (#{$spacing-unit} / 2)); } .footer-col-3 { width: -webkit-calc(100% - (#{$spacing-unit} / 2)); width: calc(100% - (#{$spacing-unit} / 2)); } } @include media-query($on-palm) { .footer-col { float: none; width: -webkit-calc(100% - (#{$spacing-unit} / 2)); width: calc(100% - (#{$spacing-unit} / 2)); } } /** * Page content */ .page-content { padding: $spacing-unit 0; } .page-heading { font-size: 20px; } .post-list { margin-left: 0; list-style: none; > li { margin-bottom: $spacing-unit; } } .post-meta { font-size: $small-font-size; color: $grey-color; } .post-link { display: block; font-size: 24px; } /** * Posts */ .post-header { margin-bottom: $spacing-unit; } .post-title { font-size: 42px; letter-spacing: -1px; line-height: 1; @include media-query($on-laptop) { font-size: 36px; } } .post-content { margin-bottom: $spacing-unit; h2 { font-size: 32px; @include media-query($on-laptop) { font-size: 28px; } } h3 { font-size: 26px; @include media-query($on-laptop) { font-size: 22px; } } h4 { font-size: 20px; @include media-query($on-laptop) { font-size: 18px; } } } jekyll-watch-1.3.0/spec/test-site/_sass/_syntax-highlighting.scss0000644000175000017500000000634112600562464024766 0ustar uwabamiuwabami/** * Syntax highlighting styles */ .highlight { background: #fff; @extend %vertical-rhythm; .c { color: #998; font-style: italic } // Comment .err { color: #a61717; background-color: #e3d2d2 } // Error .k { font-weight: bold } // Keyword .o { font-weight: bold } // Operator .cm { color: #998; font-style: italic } // Comment.Multiline .cp { color: #999; font-weight: bold } // Comment.Preproc .c1 { color: #998; font-style: italic } // Comment.Single .cs { color: #999; font-weight: bold; font-style: italic } // Comment.Special .gd { color: #000; background-color: #fdd } // Generic.Deleted .gd .x { color: #000; background-color: #faa } // Generic.Deleted.Specific .ge { font-style: italic } // Generic.Emph .gr { color: #a00 } // Generic.Error .gh { color: #999 } // Generic.Heading .gi { color: #000; background-color: #dfd } // Generic.Inserted .gi .x { color: #000; background-color: #afa } // Generic.Inserted.Specific .go { color: #888 } // Generic.Output .gp { color: #555 } // Generic.Prompt .gs { font-weight: bold } // Generic.Strong .gu { color: #aaa } // Generic.Subheading .gt { color: #a00 } // Generic.Traceback .kc { font-weight: bold } // Keyword.Constant .kd { font-weight: bold } // Keyword.Declaration .kp { font-weight: bold } // Keyword.Pseudo .kr { font-weight: bold } // Keyword.Reserved .kt { color: #458; font-weight: bold } // Keyword.Type .m { color: #099 } // Literal.Number .s { color: #d14 } // Literal.String .na { color: #008080 } // Name.Attribute .nb { color: #0086B3 } // Name.Builtin .nc { color: #458; font-weight: bold } // Name.Class .no { color: #008080 } // Name.Constant .ni { color: #800080 } // Name.Entity .ne { color: #900; font-weight: bold } // Name.Exception .nf { color: #900; font-weight: bold } // Name.Function .nn { color: #555 } // Name.Namespace .nt { color: #000080 } // Name.Tag .nv { color: #008080 } // Name.Variable .ow { font-weight: bold } // Operator.Word .w { color: #bbb } // Text.Whitespace .mf { color: #099 } // Literal.Number.Float .mh { color: #099 } // Literal.Number.Hex .mi { color: #099 } // Literal.Number.Integer .mo { color: #099 } // Literal.Number.Oct .sb { color: #d14 } // Literal.String.Backtick .sc { color: #d14 } // Literal.String.Char .sd { color: #d14 } // Literal.String.Doc .s2 { color: #d14 } // Literal.String.Double .se { color: #d14 } // Literal.String.Escape .sh { color: #d14 } // Literal.String.Heredoc .si { color: #d14 } // Literal.String.Interpol .sx { color: #d14 } // Literal.String.Other .sr { color: #009926 } // Literal.String.Regex .s1 { color: #d14 } // Literal.String.Single .ss { color: #990073 } // Literal.String.Symbol .bp { color: #999 } // Name.Builtin.Pseudo .vc { color: #008080 } // Name.Variable.Class .vg { color: #008080 } // Name.Variable.Global .vi { color: #008080 } // Name.Variable.Instance .il { color: #099 } // Literal.Number.Integer.Long } jekyll-watch-1.3.0/spec/test-site/.gitignore0000644000175000017500000000000512600562464020610 0ustar uwabamiuwabami_sitejekyll-watch-1.3.0/spec/test-site/css/0000755000175000017500000000000012600562464017415 5ustar uwabamiuwabamijekyll-watch-1.3.0/spec/test-site/css/main.scss0000755000175000017500000000201012600562464021232 0ustar uwabamiuwabami--- # Only the main Sass file needs front matter (the dashes are enough) layout: null --- @charset "utf-8"; // Our variables $base-font-family: Helvetica, Arial, sans-serif; $base-font-size: 16px; $small-font-size: $base-font-size * 0.875; $base-line-height: 1.5; $spacing-unit: 30px; $text-color: #111; $background-color: #fdfdfd; $brand-color: #2a7ae2; $grey-color: #828282; $grey-color-light: lighten($grey-color, 40%); $grey-color-dark: darken($grey-color, 25%); $on-palm: 600px; $on-laptop: 800px; // Using media queries with like this: // @include media-query($palm) { // .wrapper { // padding-right: $spacing-unit / 2; // padding-left: $spacing-unit / 2; // } // } @mixin media-query($device) { @media screen and (max-width: $device) { @content; } } // Import partials from `sass_dir` (defaults to `_sass`) @import "base", "layout", "syntax-highlighting" ; jekyll-watch-1.3.0/spec/test-site/_posts/0000755000175000017500000000000012600562464020134 5ustar uwabamiuwabamijekyll-watch-1.3.0/spec/test-site/_posts/2014-08-08-welcome-to-jekyll.markdown0000644000175000017500000000203712600562464026303 0ustar uwabamiuwabami--- layout: post title: "Welcome to Jekyll!" date: 2014-08-08 18:00:36 categories: jekyll update --- You’ll find this post in your `_posts` directory – edit it and re-build (or run with the `--watch` switch) to see your changes. To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works. Jekyll also offers powerful support for code snippets: {% highlight ruby %} def print_hi(name) puts "Hi, #{name}" end print_hi('Tom') #=> prints 'Hi, Tom' to STDOUT. {% endhighlight %} Check out the [Jekyll docs][jekyll] 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’s dedicated Help repository][jekyll-help]. [jekyll]: http://jekyllrb.com [jekyll-gh]: https://github.com/jekyll/jekyll [jekyll-help]: https://github.com/jekyll/jekyll-help jekyll-watch-1.3.0/spec/test-site/_config.yml0000644000175000017500000000111112600562464020746 0ustar uwabamiuwabami# Site settings title: jekyll-watch test site email: your-email@domain.com description: > # this means to ignore newlines until "baseurl:" Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description. baseurl: "" # the subpath of your site, e.g. /blog/ url: "http://yourdomain.com" # the base hostname & protocol for your site twitter_username: jekyllrb github_username: jekyll exclude: [".gitignore"] # Build settings markdown: kramdown jekyll-watch-1.3.0/spec/test-site/index.html0000644000175000017500000000077212600562464020630 0ustar uwabamiuwabami--- layout: default ---

Posts

subscribe via RSS

jekyll-watch-1.3.0/spec/test-site/feed.xml0000644000175000017500000000241412600562464020253 0ustar uwabamiuwabami--- layout: null --- {{ site.title | xml_escape }} {{ site.description | xml_escape }} {{ site.url }}{{ site.baseurl }}/ {{ site.time | date_to_rfc822 }} {{ site.time | date_to_rfc822 }} Jekyll v{{ jekyll.version }} {% for post in site.posts limit:10 %} {{ post.title | xml_escape }} {{ post.content | xml_escape }} {{ post.date | date_to_rfc822 }} {{ post.url | prepend: site.baseurl | prepend: site.url }} {{ post.url | prepend: site.baseurl | prepend: site.url }} {% for tag in post.tags %} {{ tag | xml_escape }} {% endfor %} {% for cat in post.categories %} {{ cat | xml_escape }} {% endfor %} {% endfor %} jekyll-watch-1.3.0/spec/test-site/_config.dev.toml0000644000175000017500000000001712600562464021701 0ustar uwabamiuwabamihello = "there"jekyll-watch-1.3.0/spec/test-site/about.md0000644000175000017500000000072612600562464020266 0ustar uwabamiuwabami--- layout: page title: About permalink: /about/ --- 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](http://jekyllrb.com/) You can find the source code for the Jekyll new theme at: [github.com/jglovier/jekyll-new](https://github.com/jglovier/jekyll-new) You can find the source code for Jekyll at [github.com/jekyll/jekyll](https://github.com/jekyll/jekyll) jekyll-watch-1.3.0/spec/test-site/_includes/0000755000175000017500000000000012600562464020572 5ustar uwabamiuwabamijekyll-watch-1.3.0/spec/test-site/_includes/head.html0000644000175000017500000000100112600562464022351 0ustar uwabamiuwabami {% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %} jekyll-watch-1.3.0/spec/test-site/_includes/footer.html0000644000175000017500000000603412600562464022761 0ustar uwabamiuwabami jekyll-watch-1.3.0/spec/test-site/_includes/header.html0000644000175000017500000000212412600562464022707 0ustar uwabamiuwabami jekyll-watch-1.3.0/spec/test-site/_layouts/0000755000175000017500000000000012600562464020464 5ustar uwabamiuwabamijekyll-watch-1.3.0/spec/test-site/_layouts/default.html0000644000175000017500000000037012600562464022776 0ustar uwabamiuwabami {% include head.html %} {% include header.html %}
{{ content }}
{% include footer.html %} jekyll-watch-1.3.0/spec/test-site/_layouts/post.html0000644000175000017500000000057112600562464022342 0ustar uwabamiuwabami--- layout: default ---

{{ page.title }}

{{ content }}
jekyll-watch-1.3.0/spec/test-site/_layouts/page.html0000644000175000017500000000032112600562464022262 0ustar uwabamiuwabami--- layout: default ---

{{ page.title }}

{{ content }}
jekyll-watch-1.3.0/spec/watcher_spec.rb0000644000175000017500000001006412600562464017701 0ustar uwabamiuwabamirequire 'spec_helper' describe(Jekyll::Watcher) do let(:base_opts) do { 'source' => source_dir, 'destination' => dest_dir } end let(:options) { base_opts } let(:site) { instance_double(Jekyll::Site) } let(:default_ignored) { [/_config\.yml/, /_site/, /\.jekyll\-metadata/] } subject { described_class } before(:each) do FileUtils.mkdir(options['destination']) if options['destination'] end after(:each) do FileUtils.rm_rf(options['destination']) if options['destination'] end describe "#watch" do let(:listener) { instance_double(Listen::Listener) } let(:opts) { { ignore: default_ignored, force_polling: options['force_polling'] } } before do allow(Listen).to receive(:to).with(options['source'], opts).and_return(listener) allow(listener).to receive(:start) allow(Jekyll::Site).to receive(:new).with(options).and_return(site) allow(Jekyll.logger).to receive(:info) allow(subject).to receive(:sleep_forever) subject.watch(options) end it 'starts the listener' do expect(listener).to have_received(:start) end it 'sleeps' do expect(subject).to have_received(:sleep_forever) end it "ignores the config and site by default" do expect(Listen).to have_received(:to).with(anything, hash_including(ignore: default_ignored)) end it "defaults to no force_polling" do expect(Listen).to have_received(:to).with(anything, hash_including(force_polling: nil)) end context "with force_polling turned on" do let(:options) { base_opts.merge('force_polling' => true) } it "respects the custom value of force_polling" do expect(Listen).to have_received(:to).with(anything, hash_including(force_polling: true)) end end end context "#listen_ignore_paths" do let(:ignored) { subject.listen_ignore_paths(options) } let(:metadata_path) { Jekyll.sanitized_path(options['source'], '.jekyll-metadata') } before(:each) { FileUtils.touch(metadata_path) } after(:each) { FileUtils.rm(metadata_path) } it "ignores config.yml, .jekyll-metadata, and _site by default" do expect(ignored).to eql(default_ignored) end context "with something excluded" do let(:excluded) { ['README.md', 'LICENSE'] } let(:excluded_absolute) { excluded.map { |p| Jekyll.sanitized_path(options['source'], p) }} let(:options) { base_opts.merge('exclude' => excluded) } before(:each) { FileUtils.touch(excluded_absolute) } after(:each) { FileUtils.rm(excluded_absolute) } it "ignores the excluded files" do expect(ignored).to include(/README\.md/) expect(ignored).to include(/LICENSE/) end end context "with a custom destination" do let(:default_ignored) { [/_config\.yml/, /_dest/, /\.jekyll\-metadata/] } context "when source is absolute" do context "when destination is absolute" do let(:options) { base_opts.merge('destination' => source_dir('_dest')) } it "ignores the destination" do expect(ignored).to eql(default_ignored) end end context "when destination is relative" do let(:options) { base_opts.merge('destination' => 'spec/test-site/_dest') } it "ignores the destination" do expect(ignored).to eql(default_ignored) end end end context "when source is relative" do let(:base_opts) { {'source' => Pathname.new(source_dir).relative_path_from(Pathname.new('.').expand_path).to_s } } context "when destination is absolute" do let(:options) { base_opts.merge('destination' => source_dir('_dest')) } it "ignores the destination" do expect(ignored).to eql(default_ignored) end end context "when destination is relative" do let(:options) { base_opts.merge('destination' => 'spec/test-site/_dest') } it "ignores the destination" do expect(ignored).to eql(default_ignored) end end end end end end jekyll-watch-1.3.0/Gemfile0000644000175000017500000000004612600562464015245 0ustar uwabamiuwabamisource 'https://rubygems.org' gemspec jekyll-watch-1.3.0/README.md0000644000175000017500000000211012600562464015223 0ustar uwabamiuwabami# Jekyll Watch Rebuild your Jekyll site when a file changes with the `--watch` switch. [![Build Status](https://travis-ci.org/jekyll/jekyll-watch.svg?branch=master)](https://travis-ci.org/jekyll/jekyll-watch) ## Installation **`jekyll-watch` comes pre-installed with Jekyll 2.1 or greater.** Add this line to your application's Gemfile: gem 'jekyll-watch' And then execute: $ bundle Or install it yourself as: $ gem install jekyll-watch ## Usage Pass the `--watch` flag to `jekyll build` or `jekyll serve`: ```bash $ jekyll build --watch $ jekyll serve --watch # this flag is the default, so no need to specify it here for the 'serve' command ``` The `--watch` flag can be used in combination with any other flags for those two commands, except `--detach` for the `serve` command. ## Contributing 1. Fork it ( https://github.com/jekyll/jekyll-watch/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create a new Pull Request