Skip to content

Commit

Permalink
Drop Ruby 1.8 support and depends on Guard 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rymai committed Sep 25, 2013
1 parent 8d17a43 commit bcbf9f6
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 138 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.bundle
Gemfile.lock
pkg/*
coverage/*
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
language: ruby
bundler_args: --without development
rvm:
- 1.8.7
- 1.9.3
- 2.0.0
- ree
- jruby-18mode
- jruby-19mode
- rbx-18mode
- rbx-19mode
matrix:
allow_failures:
- rvm: jruby-18mode
- rvm: jruby-19mode
notifications:
recipients:
Expand Down
72 changes: 1 addition & 71 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,71 +1 @@
## git master

### Bug fix

* Fix conflict with `guard-bundler`. ([@onemanstartup][])

## 0.5 - April 23, 2013

* [#18][] `.html` is no longer the default extension. ([@rickmzp][])
* [#16][] Added file extension detection. ([@polarblau][])
* [#15][] Enhance `output` option to allow multiple output destinations. ([@jamesgary][])
* [#9][] Fixed encoding issue by using simple -> arrows ([@jamesgary][])
* Added new notifier, Guard compatible methods, Travis-CI testing. ([@kugaevsky][])

## 0.4 - June 2, 2012

* Ensure Guard 1.1 compatibility, use `run_on_changes`, throw `:task_has_failed` on error. ([@manufaktor][])

## 0.3.3 - April 6, 2012

* Appending `.html` to file name if the input file doesn't match the pattern `*.html.haml` or `*.htm.haml`. ([@rtircher][])
* [#6][] Add documentation for `:haml_options`. ([@zhangsu][])

## 0.3.2 - January 22, 2012

* [#5][] Fix bug with ignored options in initialization. ([@ordinaryzelig][])

## 0.3.1 - August 12, 2011

* Guard::Haml is no longer crashing Guard when HAML fails to compile. ([@manufaktor][])

## 0.3.0 - June 17, 2011

* [#2][] Added the input option, to exclude a path from the output path. ([@draiken][])

## 0.2.0 - May 30, 2011

* [#1][] Added output option, to save compiled files into a different directory. ([@nemo157][])

## 0.1.2 - May 24, 2011

* Set empty default HAML options. ([@manufaktor][])

## 0.1.1 - April 29, 2011

* Allow to pass an option hash directly to HAML via `:haml_options => { ... }`. ([@manufaktor][])

## 0.1.0 - April 29, 2011

* Inital release. ([@manufaktor][])

<!--- The following link definition list is generated by PimpMyChangelog --->
[#1]: https://github.com/guard/guard/issues/1
[#2]: https://github.com/guard/guard/issues/2
[#5]: https://github.com/guard/guard/issues/5
[#6]: https://github.com/guard/guard/issues/6
[#9]: https://github.com/guard/guard/issues/9
[#15]: https://github.com/guard/guard/issues/15
[#16]: https://github.com/guard/guard/issues/16
[#18]: https://github.com/guard/guard/issues/18
[@draiken]: https://github.com/draiken
[@jamesgary]: https://github.com/jamesgary
[@kugaevsky]: https://github.com/kugaevsky
[@manufaktor]: https://github.com/manufaktor
[@nemo157]: https://github.com/nemo157
[@onemanstartup]: https://github.com/onemanstartup
[@ordinaryzelig]: https://github.com/ordinaryzelig
[@polarblau]: https://github.com/polarblau
[@rickmzp]: https://github.com/rickmzp
[@rtircher]: https://github.com/rtircher
[@zhangsu]: https://github.com/zhangsu
# Moved to [GitHub releases](https://github.com/guard/guard-haml/releases) page.
5 changes: 2 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'http://rubygems.org'
source 'https://rubygems.org'

gemspec

Expand All @@ -7,13 +7,12 @@ gem 'rake'
group :development do
gem 'ruby_gntp'
gem 'guard-rspec'
gem 'pimpmychangelog'
end

# The test group will be
# installed on Travis CI
#
group :test do
gem 'rspec'
gem 'coveralls', :require => false
gem 'coveralls', require: false
end
6 changes: 6 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
guard :rspec do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
end

47 changes: 27 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
# Guard::Haml

[![Gem Version](https://badge.fury.io/rb/guard-haml.png)](http://badge.fury.io/rb/guard-haml) [![Build Status](https://travis-ci.org/guard/guard-haml.png?branch=master)](https://travis-ci.org/guard/guard-haml) [![Dependency Status](https://gemnasium.com/guard/guard-haml.png)](https://gemnasium.com/guard/guard-haml) [![Code Climate](https://codeclimate.com/github/guard/guard-haml.png)](https://codeclimate.com/github/guard/guard-haml) [![Coverage Status](https://coveralls.io/repos/guard/guard-haml/badge.png?branch=master)](https://coveralls.io/r/guard/guard-haml)

Watches HAML files, compiles them to HTML on change.

* Compatible with HAML >= 3.
* Tested against Ruby 1.9.3, 2.0.0, Rubinius & JRuby (1.9 mode only).

## Install

Please be sure to have [Guard](https://github.com/guard/guard) installed before continuing.

Add the gem to your Gemfile (inside the `:development` or `:tool` group):
Add Guard::Haml to your `Gemfile`:

``` ruby
```ruby
group :development do
gem 'guard-haml'
end
```

Add guard definition to your Guardfile by running this command:

``` bash
```bash
$ guard init haml
```

Expand All @@ -28,8 +32,8 @@ $ guard init haml
If you want to change the output directory use the `output` option in your
Guardfile, e.g.:

``` ruby
guard 'haml', :output => 'public' do
```ruby
guard :haml, output: 'public' do
watch %r{^src/.+(\.html\.haml)}
end
```
Expand All @@ -40,16 +44,16 @@ This output is relative to the Guardfile.

This lets you compile to two (or more) html files from one haml file. This comes in handy if you want to compile to both a dev and prod build directory, for example:

``` ruby
guard 'haml', { :input => 'markup', :output => ['public/dev', 'public/build'] } do
```ruby
guard :haml, { input: 'markup', output: ['public/dev', 'public/build'] } do
watch(%r{^.+(\.haml)$})
end
```

If you maintain your haml files in a directory that should not be part of the output path, you can set the `input` option, e.g.:

``` ruby
guard 'haml', :output => 'public', :input => 'src' do
```ruby
guard :haml, output: 'public', input: 'src' do
watch %r{^src/.+(\.html\.haml)}
end
```
Expand All @@ -60,7 +64,7 @@ it will be saved to `public/partials/_partial.html` without the `src`.

The guard extension will try to add the correct extension based off the input file name. You can provide multiple extensions to control the file name.

``` ruby
```ruby
"foo.haml" -> "foo.html"
"foo" -> "foo.html"
"foo.txt" -> "foo.txt.html"
Expand All @@ -69,8 +73,8 @@ The guard extension will try to add the correct extension based off the input fi

You can override the default extension (`html`) using the `default_ext` option:

``` ruby
guard 'haml', :default_ext => 'txt' do
```ruby
guard :haml, default_ext: 'txt' do
watch %r{^src/.+(\.html\.haml)}
end
```
Expand All @@ -79,8 +83,8 @@ end

If you want to compile haml files on guard start you can use `run_at_start` option.

``` ruby
guard 'haml', :output => 'public', :input => 'src', :run_at_start => true do
```ruby
guard :haml, output: 'public', input: 'src', run_at_start: true do
watch %r{^src/.+(\.html\.haml)}
end
```
Expand All @@ -89,8 +93,8 @@ end

Also you can configure guard notifications (to Growl/lib-notify/Notifu) by setting `notifications` option to `true`

``` ruby
guard 'haml', :output => 'public', :input => 'src', :notifications => true do
```ruby
guard 'haml', output: 'public', input: 'src', notifications: true do
watch %r{^src/.+(\.html\.haml)}
end
```
Expand All @@ -99,8 +103,8 @@ end

If you want to pass options to the Haml engine, you can set the `haml_options` option, e.g.:

``` ruby
guard 'haml', :output => 'public', :input => 'src', :haml_options => { :ugly => true } do
```ruby
guard :haml, output: 'public', input: 'src', haml_options: { ugly: true } do
watch %r{^src/.+(\.html\.haml)}
end
```
Expand All @@ -118,7 +122,6 @@ Pull requests are very welcome! Please try to follow these simple rules if appli
* Make sure your patches are well tested. All specs must pass on [Travis CI](https://travis-ci.org/guard/guard-haml).
* Update the [Yard](http://yardoc.org/) documentation.
* Update the [README](https://github.com/guard/guard-haml/blob/master/README.md).
* Update the [CHANGELOG](https://github.com/guard/guard-haml/blob/master/CHANGELOG.md) for noteworthy changes (don't forget to run `bundle exec pimpmychangelog` and watch the magic happen)!
* Please **do not change** the version number.

For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
Expand All @@ -128,6 +131,10 @@ For questions please join us in our [Google group](http://groups.google.com/grou

[Immanuel Häussermann](https://github.com/manufaktor) ([@manufaktor](http://twitter.com/manufaktor), [manufaktor.com](http://manufaktor.com))

## Maintainer

[Rémy Coutable](https://github.com/rymai) ([@rymai](http://twitter.com/rymai), [rym.ai](http://rym.ai))

## Contributors

https://github.com/guard/guard-haml/contributors
[https://github.com/guard/guard-haml/graphs/contributors](https://github.com/guard/guard-haml/graphs/contributors)
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ require 'bundler/gem_tasks'

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
task default: :spec
25 changes: 15 additions & 10 deletions guard-haml.gemspec
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
# encoding: utf-8
Kernel.load File.expand_path('../lib/guard/haml/version.rb', __FILE__)
$:.push File.expand_path('../lib', __FILE__)
require 'guard/haml/version'

Gem::Specification.new do |s|
s.name = 'guard-haml'
s.version = Guard::HamlVersion::VERSION
s.summary = 'Guard gem for Haml'
s.platform = Gem::Platform::RUBY
s.license = 'MIT'
s.authors = ['Immanuel Häussermann', 'Rémy Coutable']
s.email = ['remy@rymai.me']
s.homepage = 'https://rubygems.org/gems/guard-haml'
s.summary = 'Guard plugin for Haml'
s.description = 'Compiles file.html.haml into file.html'
s.authors = ['Immanuel Häussermann']
s.email = ['haeussermann@gmail.com']
s.homepage = 'http://rubygems.org/gems/guard-haml'

s.files = Dir.glob('{lib}/**/*') + %w[CHANGELOG.md LICENSE README.md]
s.required_ruby_version = '>= 1.9.2'

s.add_dependency 'guard', '~> 1.1'
s.add_dependency 'haml', '>= 3.0'
s.add_runtime_dependency 'guard', '>= 2.0.0.pre.3'
s.add_runtime_dependency 'haml', '>= 3.0'

s.add_development_dependency 'bundler', '~> 1.3'
s.add_development_dependency 'bundler'
s.add_development_dependency 'rspec'

s.files = Dir.glob('{lib}/**/*') + %w[CHANGELOG.md LICENSE README.md]
s.require_path = 'lib'
end
end
15 changes: 8 additions & 7 deletions lib/guard/haml.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
require 'guard'
require 'guard/guard'
require 'guard/plugin'
require 'guard/watcher'
require 'haml'

module Guard
class Haml < Guard
class Haml < Plugin
autoload :Notifier, 'guard/haml/notifier'

def initialize(watchers = [], options = {})
def initialize(options = {})
@options = {
:notifications => true,
:default_ext => 'html',
:auto_append_file_ext => false
notifications: true,
default_ext: 'html',
auto_append_file_ext: false
}.merge options
super(watchers, @options)

super(@options)
end

def start
Expand Down
4 changes: 2 additions & 2 deletions lib/guard/haml/notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def image result

def notify( result, message )
::Guard::Notifier.notify( message,
:title => 'Guard::Haml',
:image => image( result )
title: 'Guard::Haml',
image: image( result )
)
end
end
Expand Down
10 changes: 5 additions & 5 deletions lib/guard/haml/templates/Guardfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Sample guardfile block for Guard::Haml
# You can use some options to change guard-haml configuration
# :output => 'public' set output directory for compiled files
# :input => 'src' set input directory with haml files
# :run_at_start => true compile files when guard starts
# :notifications => true send notifictions to Growl/libnotify/Notifu
# :haml_options => { :ugly => true } pass options to the Haml engine
# output: 'public' set output directory for compiled files
# input: 'src' set input directory with haml files
# run_at_start: true compile files when guard starts
# notifications: true send notifictions to Growl/libnotify/Notifu
# haml_options: { ugly: true } pass options to the Haml engine

guard 'haml' do
watch(/^.+(\.html\.haml)$/)
Expand Down
2 changes: 1 addition & 1 deletion lib/guard/haml/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Guard
class HamlVersion
VERSION = '0.5'
VERSION = '1.0.0'
end
end
8 changes: 4 additions & 4 deletions spec/guard/haml/notifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
it 'should call Guard::Notifier with success image' do
::Guard::Notifier.should_receive(:notify).with(
'Successful compilation!',
:title => 'Guard::Haml',
:image => :success
title: 'Guard::Haml',
image: :success
)
subject.notify(true, 'Successful compilation!')
end
Expand All @@ -29,8 +29,8 @@
it 'should call Guard::Notifier with failed image' do
::Guard::Notifier.should_receive(:notify).with(
'Compilation failed!',
:title => 'Guard::Haml',
:image => :failed
title: 'Guard::Haml',
image: :failed
)
subject.notify(false, 'Compilation failed!')
end
Expand Down
Loading

0 comments on commit bcbf9f6

Please sign in to comment.