Class: Guard::Rails
- Inherits:
-
Guard
- Object
- Guard
- Guard::Rails
- Defined in:
- lib/guard/rails.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ :CLI => nil, :daemon => false, :debugger => false, :environment => 'development', :force_runs => false, :pid_file => nil, # construct the filename based on options[:environment] on runtime :port => 3000, :server => nil, # specified by rails :start_on_start => true, :timeout => 30, :zeus_plan => 'server', :zeus => false, }
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Use gem ‘version` to support versioning is_versioned.
-
#runner ⇒ Object
readonly
Use gem ‘version` to support versioning is_versioned.
Instance Method Summary collapse
-
#initialize(watchers = [], options = {}) ⇒ Rails
constructor
A new instance of Rails.
- #reload(action = "restart") ⇒ Object
- #run_on_changes(paths) ⇒ Object (also: #run_on_change)
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(watchers = [], options = {}) ⇒ Rails
Returns a new instance of Rails.
28 29 30 31 32 33 |
# File 'lib/guard/rails.rb', line 28 def initialize(watchers = [], = {}) super @options = DEFAULT_OPTIONS.merge() @runner = RailsRunner.new(@options) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Use gem ‘version` to support versioning is_versioned
11 12 13 |
# File 'lib/guard/rails.rb', line 11 def @options end |
#runner ⇒ Object (readonly)
Use gem ‘version` to support versioning is_versioned
11 12 13 |
# File 'lib/guard/rails.rb', line 11 def runner @runner end |
Instance Method Details
#reload(action = "restart") ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/guard/rails.rb', line 40 def reload(action = "restart") title = "#{action.capitalize}ing Rails..." UI.info title Notifier.notify("Rails #{action}ing on port #{[:port]} in #{[:environment]}...", :title => title, :image => :pending) if runner.restart UI.info "Rails #{action}ed, pid #{runner.pid}" Notifier.notify("Rails #{action}ed on port #{[:port]}.", :title => "Rails #{action}ed!", :image => :success) else UI.info "Rails NOT #{action}ed, check your log files." Notifier.notify("Rails NOT #{action}ed, check your log files.", :title => "Rails NOT #{action}ed!", :image => :failed) end end |
#run_on_changes(paths) ⇒ Object Also known as: run_on_change
58 59 60 |
# File 'lib/guard/rails.rb', line 58 def run_on_changes(paths) reload end |
#start ⇒ Object
35 36 37 38 |
# File 'lib/guard/rails.rb', line 35 def start UI.info "[Guard::Rails] will restart #{[:server]} on port #{[:port]} in #{[:environment]}." reload("start") if [:start_on_start] end |
#stop ⇒ Object
53 54 55 56 |
# File 'lib/guard/rails.rb', line 53 def stop Notifier.notify("Until next time...", :title => "Rails shutting down.", :image => :pending) runner.stop end |