guard-shell 0.5.2 → 0.7.2

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e735b1798973a3582dd5c5febffb35cee8e34e5db7d7bf8948a22c52e2f5178d
4
+ data.tar.gz: a1dbcdf4cba42fa84431ecc0288802defc9be681e554a30595bb8b5bd1e25943
5
+ SHA512:
6
+ metadata.gz: 05f604999127bb123d3de83d89c1df58cb1fe772ce76511a8d7146303f2069790328ad6c97d1427135c7f5ffa2edb5f882525f622822f936e45556a695db709d
7
+ data.tar.gz: 746079eb0532d05199ddaf60a3a7d590b58add8e76e85ce09079df670367937de06fb31a4807a1c6e2a427345b7e7eb7a7b9772dbb17e2f6a87c3a159104e7c6
data/lib/guard/shell.rb CHANGED
@@ -1,25 +1,34 @@
1
- require 'guard'
2
- require 'guard/guard'
3
- require 'guard/watcher'
1
+ require 'guard/compat/plugin'
2
+ require 'guard/shell/version'
4
3
 
5
4
  module Guard
6
- class Shell < Guard
7
-
8
- VERSION = '0.5.2'
5
+ class Shell < Plugin
9
6
 
10
7
  # Calls #run_all if the :all_on_start option is present.
11
8
  def start
12
9
  run_all if options[:all_on_start]
13
10
  end
14
11
 
12
+ # Defined only to make callback(:stop_begin) and callback(:stop_end) working
13
+ def stop
14
+ end
15
+
15
16
  # Call #run_on_change for all files which match this guard.
16
17
  def run_all
17
- run_on_modifications(Watcher.match_files(self, Dir.glob('{,**/}*{,.*}').uniq))
18
+ available_watchers.each do |watcher|
19
+ output = watcher.call_action([])
20
+
21
+ run_on_modifications(output)
22
+ end
18
23
  end
19
24
 
20
25
  # Print the result of the command(s), if there are results to be printed.
21
26
  def run_on_modifications(res)
22
- puts res if res
27
+ $stdout.puts res if res
28
+ end
29
+
30
+ def available_watchers
31
+ watchers
23
32
  end
24
33
 
25
34
  end
@@ -27,7 +36,27 @@ module Guard
27
36
  class Dsl
28
37
  # Easy method to display a notification
29
38
  def n(msg, title='', image=nil)
30
- Notifier.notify(msg, :title => title, :image => image)
39
+ Compat::UI.notify(msg, :title => title, :image => image)
40
+ end
41
+
42
+ # Eager prints the result for stdout and stderr as it would be written when
43
+ # running the command from the terminal. This is useful for long running
44
+ # tasks.
45
+ def eager(command)
46
+ require 'pty'
47
+
48
+ begin
49
+ PTY.spawn command do |r, w, pid|
50
+ begin
51
+ $stdout.puts
52
+ r.each {|line| print line }
53
+ rescue Errno::EIO
54
+ # the process has finished
55
+ end
56
+ end
57
+ rescue PTY::ChildExited
58
+ $stdout.puts "The child process exited!"
59
+ end
31
60
  end
32
61
  end
33
62
  end
@@ -0,0 +1,5 @@
1
+ module Guard
2
+ module ShellVersion
3
+ VERSION = '0.7.2'
4
+ end
5
+ end
metadata CHANGED
@@ -1,66 +1,78 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-shell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
5
- prerelease:
4
+ version: 0.7.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Joshua Hawxwell
9
- autorequire:
8
+ - Codruț Constantin Gușoi
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-16 00:00:00.000000000 Z
12
+ date: 2021-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
16
16
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
17
  requirements:
19
- - - ! '>='
18
+ - - ">="
20
19
  - !ruby/object:Gem::Version
21
- version: 1.1.0
20
+ version: 2.0.0
22
21
  type: :runtime
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
- - - ! '>='
25
+ - - ">="
28
26
  - !ruby/object:Gem::Version
29
- version: 1.1.0
30
- description: ! " Guard::Shell automatically runs shell commands when watched files
31
- are\n modified.\n"
32
- email: m@hawx.me
27
+ version: 2.0.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: guard-compat
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.0'
42
+ description: |2
43
+ Guard::Shell automatically runs shell commands when watched files are
44
+ modified.
45
+ email: mail+rubygems@codrut.pro
33
46
  executables: []
34
47
  extensions: []
35
48
  extra_rdoc_files: []
36
49
  files:
37
- - Readme.md
38
50
  - LICENSE
39
- - lib/guard/shell/templates/Guardfile
51
+ - Readme.md
40
52
  - lib/guard/shell.rb
41
- homepage: http://github.com/hawx/guard-shell
42
- licenses: []
43
- post_install_message:
53
+ - lib/guard/shell/templates/Guardfile
54
+ - lib/guard/shell/version.rb
55
+ homepage: http://github.com/sdwolfz/guard-shell
56
+ licenses:
57
+ - MIT
58
+ metadata: {}
59
+ post_install_message:
44
60
  rdoc_options: []
45
61
  require_paths:
46
62
  - lib
47
63
  required_ruby_version: !ruby/object:Gem::Requirement
48
- none: false
49
64
  requirements:
50
- - - ! '>='
65
+ - - ">="
51
66
  - !ruby/object:Gem::Version
52
67
  version: '0'
53
68
  required_rubygems_version: !ruby/object:Gem::Requirement
54
- none: false
55
69
  requirements:
56
- - - ! '>='
70
+ - - ">="
57
71
  - !ruby/object:Gem::Version
58
72
  version: '0'
59
73
  requirements: []
60
- rubyforge_project:
61
- rubygems_version: 1.8.23
62
- signing_key:
63
- specification_version: 3
74
+ rubygems_version: 3.2.15
75
+ signing_key:
76
+ specification_version: 4
64
77
  summary: Guard gem for running shell commands
65
78
  test_files: []
66
- has_rdoc: