From d41e8f99d75374b97dbac69ec1309124ced78fce Mon Sep 17 00:00:00 2001 From: suriyaa Date: Wed, 17 Aug 2016 15:05:55 +0200 Subject: [PATCH] Release 2.0.0 --- .travis.yml | 52 ++++++++++++++++++++--------------------- History.markdown | 6 ++++- LICENSE.txt | 1 + README.md | 3 +-- bunto-watch.gemspec | 7 +++--- lib/bunto/watcher.rb | 16 +++++++++++-- spec/test-site/feed.xml | 2 +- spec/watcher_spec.rb | 22 +++++++++++++++++ 8 files changed, 73 insertions(+), 36 deletions(-) diff --git a/.travis.yml b/.travis.yml index 03de471..c5ca6d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,33 +1,31 @@ +# Travis CI sudo: false language: ruby rvm: -- 2.0 -- 2.1 -- 2.2 -before_script: - - chmod +x script -#matrix: -# include: -# - rvm: 1.9.3 -# env: BUNTO_VERSION=2.5 -#env: -# matrix: -# - BUNTO_VERSION=2.5 -# - BUNTO_VERSION=3.0 + - 2.3.1 + - 2.3.0 +matrix: + include: + - rvm: 2.2.5 + env: BUNTO_VERSION=3.0.0 +env: + matrix: + - BUNTO_VERSION=3.0.0 + - BUNTO_VERSION=3.2.1 branches: only: - master -#install: -#- travis_retry script/bootstrap -#script: script/cibuild -#notifications: -# irc: -# on_success: change -# on_failure: change -# channels: -# - irc.freenode.org#bunto -# template: -# - '%{repository}#%{build_number} %{message} %{build_url}' -# email: -# on_success: never -# on_failure: change +before_script: + - chmod a+x script/bootstrap + - chmod a+x script/cibuild + - chmod a+x script/test + - chmod a+x script/test-watcher + - bundle update +script: script/cibuild +notifications: + irc: + on_success: never + on_failure: never + email: + on_success: never + on_failure: never diff --git a/History.markdown b/History.markdown index 759f3fb..45f9381 100644 --- a/History.markdown +++ b/History.markdown @@ -1,3 +1,7 @@ -## 1.0.0 / 2015-02-06 +# HEAD + +## 2.0.0 / 2015-08-17 + * Release 2.0.0 (Fix Travis CI errors) +## 1.0.0 / 2015-02-06 * Birthday! diff --git a/LICENSE.txt b/LICENSE.txt index f014b02..4a06996 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,5 @@ Copyright (c) 2016-present Parker Moore +Copyright (c) 2016-present Suriyaa Kudo MIT License diff --git a/README.md b/README.md index 57ca633..616065f 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,10 @@ Rebuild your Bunto site when a file changes with the `--watch` switch. [![Build Status](https://travis-ci.org/bunto/bunto-watch.svg?branch=master)](https://travis-ci.org/bunto/bunto-watch) -[![Gem Version](https://badge.fury.io/rb/bunto-watch.svg)](https://badge.fury.io/rb/bunto-watch) ## Installation -**`bunto-watch` comes pre-installed with Bunto 1.0 or greater.** +**`bunto-watch` comes pre-installed with Bunto 3.0.0 or greater.** Add this line to your application's Gemfile: diff --git a/bunto-watch.gemspec b/bunto-watch.gemspec index 6524a07..12b66ec 100644 --- a/bunto-watch.gemspec +++ b/bunto-watch.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "bunto-watch" - spec.version = "1.0.0" + spec.version = "2.0.0" spec.authors = ["Parker Moore", "Suriyaa Kudo"] spec.email = ["parkrmoore@gmail.com", "SuriyaaKudoIsc@users.noreply.github.com"] spec.summary = %q{Rebuild your Bunto site when a file changes with the `--watch` switch.} @@ -13,7 +13,8 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_runtime_dependency "listen", "~> 3.0" + # XXX: Remove the lock with Bunto 4 or in 2017 when Ruby 2.1 goes EOL. + spec.add_runtime_dependency "listen", "~> 3.0", "< 3.1" require 'rbconfig' if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ @@ -24,5 +25,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency "rubocop", "~> 0.35.1" spec.add_development_dependency "rake" spec.add_development_dependency "rspec", "~> 3.0" - spec.add_development_dependency "bunto", ENV["BUNTO_VERSION"] ? "~> #{ENV["BUNTO_VERSION"]}" : ">= 1.0" + spec.add_development_dependency "bunto", ENV["BUNTO_VERSION"] ? "~> #{ENV["BUNTO_VERSION"]}" : ">= 2.0" end diff --git a/lib/bunto/watcher.rb b/lib/bunto/watcher.rb index ee500a9..49ae2a3 100644 --- a/lib/bunto/watcher.rb +++ b/lib/bunto/watcher.rb @@ -4,10 +4,22 @@ module Bunto module Watcher extend self - def watch(options) + # Public: Continuously watch for file changes and rebuild the site + # whenever a change is detected. + # + # If the optional site argument is populated, that site instance will be + # reused and the options Hash ignored. Otherwise, a new site instance will + # be instantiated from the options Hash and used. + # + # options - A Hash containing the site configuration + # site - The current site instance (populated starting with Bunto 3.2) + # (optional, default: nil) + # + # Returns nothing. + def watch(options, site = nil) ENV["LISTEN_GEM_DEBUGGING"] ||= "1" if options['verbose'] - site = Bunto::Site.new(options) + site ||= Bunto::Site.new(options) listener = build_listener(site, options) listener.start diff --git a/spec/test-site/feed.xml b/spec/test-site/feed.xml index 022378b..106f01f 100644 --- a/spec/test-site/feed.xml +++ b/spec/test-site/feed.xml @@ -10,7 +10,7 @@ layout: null {{ site.time | date_to_rfc822 }} {{ site.time | date_to_rfc822 }} - Jekyll v{{ jekyll.version }} + Bunto v{{ bunto.version }} {% for post in site.posts limit:10 %} {{ post.title | xml_escape }} diff --git a/spec/watcher_spec.rb b/spec/watcher_spec.rb index d5bb142..66b606e 100644 --- a/spec/watcher_spec.rb +++ b/spec/watcher_spec.rb @@ -63,6 +63,28 @@ end end + describe "#watch using site instance" do + let(:listener) { instance_double(Listen::Listener) } + + let(:opts) { { ignore: default_ignored, force_polling: nil } } + + before do + allow(Listen).to receive(:to).with(options['source'], opts).and_return(listener) + + allow(listener).to receive(:start) + + allow(Bunto.logger).to receive(:info) + + allow(subject).to receive(:sleep_forever) + + subject.watch(options, site) + end + + it 'does not create a new site instance' do + expect(listener).to have_received(:start) + end + end + context "#listen_ignore_paths" do let(:ignored) { subject.listen_ignore_paths(options) } let(:metadata_path) { Bunto.sanitized_path(options['source'], '.bunto-metadata') }