guard-passenger 0.0.3 → 0.0.4

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.
@@ -0,0 +1,51 @@
1
+ module Guard
2
+ class Passenger
3
+ module Runner
4
+ class << self
5
+
6
+ def restart_passenger
7
+ result = system 'touch tmp/restart.txt'
8
+ if result
9
+ UI.info 'Successfully restarted passenger'
10
+ else
11
+ UI.error 'Restarting passenger failed'
12
+ end
13
+
14
+ result
15
+ end
16
+
17
+ def start_passenger(port)
18
+ if passenger_standalone_installed?
19
+ result = system "passenger start -p #{port} -d"
20
+ if result
21
+ UI.info "Passenger standalone startet at port #{port}"
22
+ else
23
+ UI.error "Passenger standalone failed to start at port #{port}"
24
+ end
25
+ result
26
+ else
27
+ UI.error "Passenger standalone is not installed. You need at least passenger version >= 3.0.0.\nPlease run 'gem install passenger' or add it to your Gemfile."
28
+ false
29
+ end
30
+ end
31
+
32
+ def stop_passenger
33
+ result = system 'passenger stop'
34
+ if result
35
+ UI.info "Passenger standalone stopped"
36
+ end
37
+ true
38
+ end
39
+
40
+ def passenger_standalone_installed?
41
+ begin
42
+ gem "passenger", ">=3.0.0"
43
+ rescue Gem::LoadError
44
+ return false
45
+ end
46
+ true
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module PassengerVersion
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
  end
5
5
  end
@@ -1,9 +1,17 @@
1
1
  require 'guard'
2
2
  require 'guard/guard'
3
+ require 'rubygems'
3
4
 
4
5
  module Guard
5
6
  class Passenger < Guard
6
7
 
8
+ autoload :Runner, 'guard/passenger/runner'
9
+
10
+ attr_reader :port
11
+
12
+ def standalone?
13
+ @standalone
14
+ end
7
15
 
8
16
  # ================
9
17
  # = Guard method =
@@ -19,7 +27,7 @@ module Guard
19
27
  def start
20
28
  UI.info "Guard::Passenger is guarding your changes!"
21
29
  if standalone?
22
- start_passenger
30
+ Runner.start_passenger(port)
23
31
  else
24
32
  true
25
33
  end
@@ -28,7 +36,7 @@ module Guard
28
36
  # Call with Ctrl-C signal (when Guard quit)
29
37
  def stop
30
38
  if standalone?
31
- stop_passenger
39
+ Runner.stop_passenger
32
40
  else
33
41
  true
34
42
  end
@@ -36,7 +44,7 @@ module Guard
36
44
 
37
45
  # Call with Ctrl-Z signal
38
46
  def reload
39
- restart_passenger
47
+ Runner.restart_passenger
40
48
  end
41
49
 
42
50
  # Call with Ctrl-/ signal
@@ -46,46 +54,7 @@ module Guard
46
54
 
47
55
  # Call on file(s) modifications
48
56
  def run_on_change(paths)
49
- restart_passenger
50
- end
51
-
52
- def standalone?
53
- @standalone
54
- end
55
-
56
- def port
57
- @port
57
+ Runner.restart_passenger
58
58
  end
59
-
60
- private
61
- def restart_passenger
62
- result = system 'touch tmp/restart.txt'
63
- if result
64
- UI.info 'Successfully restarted passenger'
65
- else
66
- UI.info 'Restarting passenger failed'
67
- end
68
-
69
- result
70
- end
71
-
72
- def start_passenger
73
- result = system "passenger start -p #{port} -d"
74
- if result
75
- UI.info "Passenger standalone startet at port #{port}"
76
- else
77
- UI.info "Passenger standalone failed to start at port #{port}"
78
- end
79
- result
80
- end
81
-
82
- def stop_passenger
83
- result = system 'passenger stop'
84
- if result
85
- UI.info "Passenger standalone stopeed"
86
- end
87
- true
88
- end
89
-
90
59
  end
91
60
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-passenger
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Fabio Kuhn
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-26 00:00:00 +02:00
18
+ date: 2010-10-28 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -60,6 +60,7 @@ extensions: []
60
60
  extra_rdoc_files: []
61
61
 
62
62
  files:
63
+ - lib/guard/passenger/runner.rb
63
64
  - lib/guard/passenger/templates/Guardfile
64
65
  - lib/guard/passenger/version.rb
65
66
  - lib/guard/passenger.rb