/
guard.rb
75 lines (57 loc) · 1.48 KB
/
guard.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
prepend_file 'Gemfile' do <<-RUBY
require 'rbconfig'
HOST_OS = RbConfig::CONFIG['host_os']
RUBY
end
append_file 'Gemfile' do <<-RUBY
guard_notifications = #{config['guard_notifications'].inspect}
group :development do
case HOST_OS
when /darwin/i
gem 'rb-fsevent'
gem 'ruby_gntp' if guard_notifications
when /linux/i
gem 'libnotify'
gem 'rb-inotify'
when /mswin|windows/i
gem 'rb-fchange'
gem 'win32console'
gem 'rb-notifu' if guard_notifications
end
end
RUBY
end
# LiveReload
application nil, :env => "development" do
"config.middleware.insert_before(Rack::Lock, Rack::LiveReload)"
end
gem_group :development do
gem 'guard-livereload'
gem 'yajl-ruby'
gem 'rack-livereload'
# Guard for other Scrolls
gem 'guard-bundler'
gem 'guard-test' if scrolls.include? 'test_unit'
KNOWN_GUARD_SCROLLS = %w[cucumber haml less passenger puma redis resque rspec spork unicorn]
KNOWN_GUARD_SCROLLS.each do |scroll|
gem "guard-#{scroll}" if scrolls.include? scroll
end
end
after_bundler do
run "bundle exec guard init"
# TODO move livereload to the top of the Guardfile so it is zippy quick
end
__END__
name: Guard
description: Command line tool to file system modification events; Powers Up with other scrolls!
author: drnic
website: https://github.com/guard/guard
requires: []
run_after: []
run_before: []
category: other
# exclusive:
config:
- guard_notifications:
type: boolean
prompt: "Enable desktop Guard/Growl notifications?"