Skip to content

Commit

Permalink
Release 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
suriyaa committed Aug 17, 2016
1 parent 4587346 commit d41e8f9
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 36 deletions.
52 changes: 25 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 5 additions & 1 deletion History.markdown
Original file line number Diff line number Diff line change
@@ -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!
1 change: 1 addition & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Copyright (c) 2016-present Parker Moore
Copyright (c) 2016-present Suriyaa Kudo

MIT License

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
7 changes: 4 additions & 3 deletions bunto-watch.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ["[email protected]", "[email protected]"]
spec.summary = %q{Rebuild your Bunto site when a file changes with the `--watch` switch.}
Expand All @@ -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/
Expand All @@ -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
16 changes: 14 additions & 2 deletions lib/bunto/watcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion spec/test-site/feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ layout: null
<atom:link href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}" rel="self" type="application/rss+xml" />
<pubDate>{{ site.time | date_to_rfc822 }}</pubDate>
<lastBuildDate>{{ site.time | date_to_rfc822 }}</lastBuildDate>
<generator>Jekyll v{{ jekyll.version }}</generator>
<generator>Bunto v{{ bunto.version }}</generator>
{% for post in site.posts limit:10 %}
<item>
<title>{{ post.title | xml_escape }}</title>
Expand Down
22 changes: 22 additions & 0 deletions spec/watcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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') }
Expand Down

0 comments on commit d41e8f9

Please sign in to comment.