guard 2.12.9 → 2.13.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.
- checksums.yaml +4 -4
- data/bin/guard +106 -23
- data/lib/guard/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c6b3428b071bd5e34a0b9a05235d5814f7fe190
|
4
|
+
data.tar.gz: 19dae3ff061b4d697789e01dcfd3a4558047672e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f539620c78fa10c40df9b8fb11bab2519772b6f2ad1c3839c964f1e2efda97e0ab10397baa591dc036552b30c77ef91e05e1901912db83a55527a01798070eb9
|
7
|
+
data.tar.gz: f234c272662f566f641a3fb684d010291c809630e5b4fc6ee6fc7bb8b0a0e1c2a859e64c5d6b892b8ed1d447287bc71fe3488d1846f3874bd498599ab6a6ea59
|
data/bin/guard
CHANGED
@@ -2,31 +2,114 @@
|
|
2
2
|
|
3
3
|
require "pathname"
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
5
|
+
class GuardReloader
|
6
|
+
class Config
|
7
|
+
def using_rubygems?
|
8
|
+
ENV["RUBYGEMS_GEMDEPS"]
|
9
|
+
end
|
10
|
+
|
11
|
+
def setup_rubygems_for_deps
|
12
|
+
require "rubygems"
|
13
|
+
end
|
14
|
+
|
15
|
+
def current_bundler_gemfile
|
16
|
+
ENV["BUNDLE_GEMFILE"]
|
17
|
+
end
|
18
|
+
|
19
|
+
def using_bundler?
|
20
|
+
ENV["BUNDLE_GEMFILE"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def setup_bundler_env(gemfile)
|
24
|
+
ENV["BUNDLE_GEMFILE"] = gemfile
|
25
|
+
end
|
26
|
+
|
27
|
+
def setup_bundler
|
28
|
+
require "rubygems"
|
29
|
+
require "bundler/setup"
|
30
|
+
end
|
31
|
+
|
32
|
+
def program_path
|
33
|
+
Pathname(__FILE__)
|
34
|
+
end
|
35
|
+
|
36
|
+
def program_arguments
|
37
|
+
ARGV
|
38
|
+
end
|
39
|
+
|
40
|
+
def windows?
|
41
|
+
Gem.win_platform?
|
42
|
+
end
|
43
|
+
|
44
|
+
def default_system_ruby
|
45
|
+
RbConfig.ruby
|
46
|
+
end
|
47
|
+
|
48
|
+
def exit_with(code)
|
49
|
+
exit(code)
|
50
|
+
end
|
51
|
+
|
52
|
+
def spawn_with(*args)
|
53
|
+
spawn(*args)
|
54
|
+
end
|
55
|
+
|
56
|
+
def wait_ignoring_interrupts(pid)
|
57
|
+
Process.wait2(pid)[1].exitstatus
|
58
|
+
rescue Interrupt
|
59
|
+
retry
|
60
|
+
rescue Errno::ECHILD
|
61
|
+
1
|
62
|
+
end
|
63
|
+
|
64
|
+
def exist?(path)
|
65
|
+
path.exist?
|
66
|
+
end
|
67
|
+
|
68
|
+
def guard_core_path
|
69
|
+
Gem.bin_path("guard", "_guard-core")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
attr_reader :config
|
74
|
+
def initialize(config)
|
75
|
+
@config = config
|
76
|
+
end
|
77
|
+
|
78
|
+
def setup
|
79
|
+
return config.setup_bundler if config.using_bundler?
|
80
|
+
return config.setup_rubygems_for_deps if config.using_rubygems?
|
81
|
+
|
82
|
+
# No dependency management detected - check if binstubbed by bundler
|
83
|
+
relative_to_binstub = config.program_path + "../../Gemfile"
|
84
|
+
if config.exist?(relative_to_binstub)
|
85
|
+
config.setup_bundler_env(relative_to_binstub.to_s)
|
86
|
+
config.setup_bundler
|
87
|
+
return
|
88
|
+
end
|
89
|
+
|
90
|
+
unless config.exist?(Pathname("Gemfile"))
|
91
|
+
# Running guard with bare ruby here - it's up to the user
|
92
|
+
# to setup/install missing deps
|
93
|
+
return
|
94
|
+
end
|
95
|
+
|
96
|
+
STDERR.puts "Warning: you have a Gemfile, but you're not using"\
|
97
|
+
" bundler or RUBYGEMS_GEMDEPS"
|
98
|
+
end
|
16
99
|
|
17
|
-
def
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
100
|
+
def auto_restart
|
101
|
+
args = [config.guard_core_path] + config.program_arguments
|
102
|
+
args.unshift(config.default_system_ruby) if config.windows?
|
103
|
+
loop do
|
104
|
+
exitcode = config.wait_ignoring_interrupts(config.spawn_with(*args))
|
105
|
+
config.exit_with(exitcode) if exitcode != 2
|
106
|
+
end
|
24
107
|
end
|
25
|
-
$? == 0
|
26
108
|
end
|
27
109
|
|
28
|
-
|
29
|
-
|
30
|
-
|
110
|
+
unless ENV["GUARD_SPECS_RUNNING"]
|
111
|
+
config = GuardReloader::Config.new
|
112
|
+
reloader = GuardReloader.new(config)
|
113
|
+
reloader.setup
|
114
|
+
reloader.auto_restart
|
31
115
|
end
|
32
|
-
exit($?.exitstatus)
|
data/lib/guard/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibaud Guillaume-Gentil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|