guard 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +24 -0
- data/README.md +85 -79
- data/lib/guard.rb +6 -3
- data/lib/guard/cli.rb +2 -2
- data/lib/guard/commands/all.rb +34 -0
- data/lib/guard/commands/change.rb +37 -0
- data/lib/guard/commands/notification.rb +27 -0
- data/lib/guard/commands/pause.rb +28 -0
- data/lib/guard/commands/reload.rb +35 -0
- data/lib/guard/commands/show.rb +27 -0
- data/lib/guard/dsl.rb +73 -9
- data/lib/guard/interactor.rb +134 -212
- data/lib/guard/notifier.rb +36 -14
- data/lib/guard/notifiers/emacs.rb +23 -19
- data/lib/guard/notifiers/terminal_title.rb +35 -0
- data/lib/guard/notifiers/tmux.rb +67 -10
- data/lib/guard/runner.rb +6 -2
- data/lib/guard/ui.rb +74 -14
- data/lib/guard/version.rb +1 -1
- metadata +44 -10
- data/lib/guard/interactors/coolline.rb +0 -64
- data/lib/guard/interactors/helpers/completion.rb +0 -32
- data/lib/guard/interactors/helpers/terminal.rb +0 -46
- data/lib/guard/interactors/readline.rb +0 -94
- data/lib/guard/interactors/simple.rb +0 -19
data/lib/guard/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -43,6 +43,38 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: 0.4.2
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: pry
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.9.10
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.10
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: lumberjack
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.0.2
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.0.2
|
46
78
|
- !ruby/object:Gem::Dependency
|
47
79
|
name: bundler
|
48
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +114,7 @@ dependencies:
|
|
82
114
|
requirements:
|
83
115
|
- - ~>
|
84
116
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
117
|
+
version: 2.1.0
|
86
118
|
type: :development
|
87
119
|
prerelease: false
|
88
120
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +122,7 @@ dependencies:
|
|
90
122
|
requirements:
|
91
123
|
- - ~>
|
92
124
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
125
|
+
version: 2.1.0
|
94
126
|
description: Guard is a command line tool to easily handle events on file system modifications.
|
95
127
|
email:
|
96
128
|
- thibaud@thibaud.me
|
@@ -105,6 +137,12 @@ files:
|
|
105
137
|
- images/pending.png
|
106
138
|
- images/success.png
|
107
139
|
- lib/guard/cli.rb
|
140
|
+
- lib/guard/commands/all.rb
|
141
|
+
- lib/guard/commands/change.rb
|
142
|
+
- lib/guard/commands/notification.rb
|
143
|
+
- lib/guard/commands/pause.rb
|
144
|
+
- lib/guard/commands/reload.rb
|
145
|
+
- lib/guard/commands/show.rb
|
108
146
|
- lib/guard/dsl.rb
|
109
147
|
- lib/guard/dsl_describer.rb
|
110
148
|
- lib/guard/group.rb
|
@@ -112,11 +150,6 @@ files:
|
|
112
150
|
- lib/guard/guardfile.rb
|
113
151
|
- lib/guard/hook.rb
|
114
152
|
- lib/guard/interactor.rb
|
115
|
-
- lib/guard/interactors/coolline.rb
|
116
|
-
- lib/guard/interactors/helpers/completion.rb
|
117
|
-
- lib/guard/interactors/helpers/terminal.rb
|
118
|
-
- lib/guard/interactors/readline.rb
|
119
|
-
- lib/guard/interactors/simple.rb
|
120
153
|
- lib/guard/notifier.rb
|
121
154
|
- lib/guard/notifiers/emacs.rb
|
122
155
|
- lib/guard/notifiers/gntp.rb
|
@@ -126,6 +159,7 @@ files:
|
|
126
159
|
- lib/guard/notifiers/notifysend.rb
|
127
160
|
- lib/guard/notifiers/rb_notifu.rb
|
128
161
|
- lib/guard/notifiers/terminal_notifier.rb
|
162
|
+
- lib/guard/notifiers/terminal_title.rb
|
129
163
|
- lib/guard/notifiers/tmux.rb
|
130
164
|
- lib/guard/runner.rb
|
131
165
|
- lib/guard/templates/Guardfile
|
@@ -153,7 +187,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
153
187
|
version: '0'
|
154
188
|
segments:
|
155
189
|
- 0
|
156
|
-
hash:
|
190
|
+
hash: 288885877944990186
|
157
191
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
192
|
none: false
|
159
193
|
requirements:
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'guard'
|
2
|
-
require 'guard/ui'
|
3
|
-
require 'guard/interactor'
|
4
|
-
require 'guard/interactors/helpers/terminal'
|
5
|
-
require 'guard/interactors/helpers/completion'
|
6
|
-
|
7
|
-
module Guard
|
8
|
-
|
9
|
-
# Interactor that uses coolline for getting the user input.
|
10
|
-
# This enables history support and auto-completion,
|
11
|
-
#
|
12
|
-
class CoollineInteractor < ::Guard::Interactor
|
13
|
-
include ::Guard::CompletionHelper
|
14
|
-
include ::Guard::TerminalHelper
|
15
|
-
|
16
|
-
# Test if the Interactor is
|
17
|
-
# available in the current environment?
|
18
|
-
#
|
19
|
-
# @param [Boolean] silent true if no error messages should be shown
|
20
|
-
# @return [Boolean] the availability status
|
21
|
-
#
|
22
|
-
def self.available?(silent = false)
|
23
|
-
if RbConfig::CONFIG['RUBY_PROGRAM_VERSION'] == '1.9.3'
|
24
|
-
require 'coolline'
|
25
|
-
true
|
26
|
-
else
|
27
|
-
::Guard::UI.error 'The :coolline interactor runs only on Ruby 1.9.3.' unless silent
|
28
|
-
false
|
29
|
-
end
|
30
|
-
|
31
|
-
rescue LoadError => e
|
32
|
-
::Guard::UI.error "Please add \"gem 'coolline'\" to your Gemfile and run Guard with \"bundle exec\"." unless silent
|
33
|
-
false
|
34
|
-
end
|
35
|
-
|
36
|
-
# Read a line from stdin with Readline.
|
37
|
-
#
|
38
|
-
def read_line
|
39
|
-
coolline = Coolline.new do |cool|
|
40
|
-
cool.transform_proc = proc do
|
41
|
-
cool.line
|
42
|
-
end
|
43
|
-
|
44
|
-
cool.completion_proc = proc do
|
45
|
-
word = cool.completed_word
|
46
|
-
auto_complete(word)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
while line = coolline.readline(prompt)
|
51
|
-
process_input(line)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
# The current interactor prompt
|
56
|
-
#
|
57
|
-
# @return [String] the prompt to show
|
58
|
-
#
|
59
|
-
def prompt
|
60
|
-
::Guard.listener.paused? ? 'p> ' : '>> '
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'guard'
|
2
|
-
|
3
|
-
module Guard
|
4
|
-
|
5
|
-
# Module for providing word completion to an interactor.
|
6
|
-
#
|
7
|
-
module CompletionHelper
|
8
|
-
|
9
|
-
COMPLETION_ACTIONS = %w[help reload exit pause notification show]
|
10
|
-
|
11
|
-
# Auto complete the given word.
|
12
|
-
#
|
13
|
-
# @param [String] word the partial word
|
14
|
-
# @return [Array<String>] the matching words
|
15
|
-
#
|
16
|
-
def auto_complete(word)
|
17
|
-
completion_list.grep(/^#{ Regexp.escape(word) }/)
|
18
|
-
end
|
19
|
-
|
20
|
-
# Get the auto completion list.
|
21
|
-
#
|
22
|
-
# @return [Array<String>] the list of words
|
23
|
-
#
|
24
|
-
def completion_list
|
25
|
-
groups = ::Guard.groups.map { |group| group.name.to_s }
|
26
|
-
guards = ::Guard.guards.map { |guard| guard.class.to_s.downcase.sub('guard::', '') }
|
27
|
-
|
28
|
-
COMPLETION_ACTIONS + groups + guards - ['default']
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
module Guard
|
2
|
-
|
3
|
-
# Module for resetting terminal options for an interactor.
|
4
|
-
#
|
5
|
-
module TerminalHelper
|
6
|
-
|
7
|
-
# Start the interactor.
|
8
|
-
#
|
9
|
-
def start
|
10
|
-
store_terminal_settings if stty_exists?
|
11
|
-
super
|
12
|
-
end
|
13
|
-
|
14
|
-
# Stop the interactor.
|
15
|
-
#
|
16
|
-
def stop
|
17
|
-
super
|
18
|
-
restore_terminal_settings if stty_exists?
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
# Detects whether or not the stty command exists
|
24
|
-
# on the user machine.
|
25
|
-
#
|
26
|
-
# @return [Boolean] the status of stty
|
27
|
-
#
|
28
|
-
def stty_exists?
|
29
|
-
@stty_exists ||= system('hash', 'stty')
|
30
|
-
end
|
31
|
-
|
32
|
-
# Stores the terminal settings so we can resore them
|
33
|
-
# when stopping.
|
34
|
-
#
|
35
|
-
def store_terminal_settings
|
36
|
-
@stty_save = `stty -g 2>/dev/null`.chomp
|
37
|
-
end
|
38
|
-
|
39
|
-
# Restore terminal settings
|
40
|
-
#
|
41
|
-
def restore_terminal_settings
|
42
|
-
system("stty #{ @stty_save } 2>/dev/null") if @stty_save
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
end
|
@@ -1,94 +0,0 @@
|
|
1
|
-
require 'guard'
|
2
|
-
require 'guard/ui'
|
3
|
-
require 'guard/interactor'
|
4
|
-
require 'guard/interactors/helpers/terminal'
|
5
|
-
require 'guard/interactors/helpers/completion'
|
6
|
-
|
7
|
-
module Guard
|
8
|
-
|
9
|
-
# Interactor that used readline for getting the user input.
|
10
|
-
# This enables history support and auto-completion, but is
|
11
|
-
# broken on OS X without installing `rb-readline` or using JRuby.
|
12
|
-
#
|
13
|
-
# @see http://bugs.ruby-lang.org/issues/5539
|
14
|
-
#
|
15
|
-
class ReadlineInteractor < ::Guard::Interactor
|
16
|
-
include ::Guard::CompletionHelper
|
17
|
-
include ::Guard::TerminalHelper
|
18
|
-
|
19
|
-
# Test if the Interactor is
|
20
|
-
# available in the current environment?
|
21
|
-
#
|
22
|
-
# @param [Boolean] silent true if no error messages should be shown
|
23
|
-
# @return [Boolean] the availability status
|
24
|
-
#
|
25
|
-
def self.available?(silent = false)
|
26
|
-
require 'readline'
|
27
|
-
|
28
|
-
if defined?(RbReadline) || defined?(JRUBY_VERSION) || RbConfig::CONFIG['target_os'] =~ /linux/i
|
29
|
-
true
|
30
|
-
else
|
31
|
-
::Guard::UI.error 'The :readline interactor runs only fine on JRuby, Linux or with the gem \'rb-readline\' installed.' unless silent
|
32
|
-
false
|
33
|
-
end
|
34
|
-
|
35
|
-
rescue LoadError => e
|
36
|
-
::Guard::UI.error "Please install Ruby Readline support or add \"gem 'rb-readline'\" to your Gemfile and run Guard with \"bundle exec\"." unless silent
|
37
|
-
false
|
38
|
-
end
|
39
|
-
|
40
|
-
# Initialize the interactor.
|
41
|
-
#
|
42
|
-
def initialize
|
43
|
-
require 'readline'
|
44
|
-
|
45
|
-
Readline.completion_proc = proc { |word| auto_complete(word) }
|
46
|
-
|
47
|
-
begin
|
48
|
-
Readline.completion_append_character = ' '
|
49
|
-
rescue NotImplementedError
|
50
|
-
# Ignore, we just don't support it then
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# Stop the interactor.
|
55
|
-
#
|
56
|
-
def stop
|
57
|
-
# Erase the current line for Ruby Readline
|
58
|
-
if Readline.respond_to?(:refresh_line) && !defined?(::JRUBY_VERSION)
|
59
|
-
Readline.refresh_line
|
60
|
-
end
|
61
|
-
|
62
|
-
# Erase the current line for Rb-Readline
|
63
|
-
if defined?(RbReadline) && RbReadline.rl_outstream
|
64
|
-
RbReadline._rl_erase_entire_line
|
65
|
-
end
|
66
|
-
|
67
|
-
super
|
68
|
-
end
|
69
|
-
|
70
|
-
# Read a line from stdin with Readline.
|
71
|
-
#
|
72
|
-
def read_line
|
73
|
-
require 'readline'
|
74
|
-
|
75
|
-
while line = Readline.readline(prompt, true)
|
76
|
-
line.gsub!(/^\W*/, '')
|
77
|
-
if line =~ /^\s*$/ or Readline::HISTORY.to_a[-2] == line
|
78
|
-
Readline::HISTORY.pop
|
79
|
-
end
|
80
|
-
|
81
|
-
process_input(line)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
# The current interactor prompt
|
86
|
-
#
|
87
|
-
# @return [String] the prompt to show
|
88
|
-
#
|
89
|
-
def prompt
|
90
|
-
::Guard.listener.paused? ? 'p> ' : '> '
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|
94
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'guard/interactor'
|
2
|
-
|
3
|
-
module Guard
|
4
|
-
|
5
|
-
# Simple interactor that that reads user
|
6
|
-
# input from standard input.
|
7
|
-
#
|
8
|
-
class SimpleInteractor < ::Guard::Interactor
|
9
|
-
|
10
|
-
# Read a line from stdin with Readline.
|
11
|
-
#
|
12
|
-
def read_line
|
13
|
-
while line = $stdin.gets
|
14
|
-
process_input(line.gsub(/^\W*/, '').chomp)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|