initial commit
This commit is contained in:
commit
30390f4aec
|
@ -0,0 +1,4 @@
|
|||
*.gem
|
||||
.bundle
|
||||
Gemfile.lock
|
||||
pkg/*
|
|
@ -0,0 +1,4 @@
|
|||
source "http://rubygems.org"
|
||||
|
||||
# Specify your gem's dependencies in guard-rails.gemspec
|
||||
gemspec
|
|
@ -0,0 +1,21 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
$:.push File.expand_path("../lib", __FILE__)
|
||||
require "guard/rails/version"
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "guard-rails"
|
||||
s.version = Guard::Rails::VERSION
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.authors = ["TODO: Write your name"]
|
||||
s.email = ["TODO: Write your email address"]
|
||||
s.homepage = ""
|
||||
s.summary = %q{TODO: Write a gem summary}
|
||||
s.description = %q{TODO: Write a gem description}
|
||||
|
||||
s.rubyforge_project = "guard-rails"
|
||||
|
||||
s.files = `git ls-files`.split("\n")
|
||||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
||||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
||||
s.require_paths = ["lib"]
|
||||
end
|
|
@ -0,0 +1,28 @@
|
|||
require 'guard'
|
||||
require 'guard/guard'
|
||||
|
||||
module Guard
|
||||
class Rails < ::Guard::Guard
|
||||
attr_reader :options
|
||||
|
||||
def initialize(watchers = [], options = {})
|
||||
@options = { :port => 3000, :environment => 'development', :start_on_start => true }.merge(options)
|
||||
end
|
||||
|
||||
def start
|
||||
UI.info "Guard::Rails restarting app on port #{options[:port]} using #{options[:environment]} environment."
|
||||
run_all if options[:start_on_start]
|
||||
end
|
||||
|
||||
def run_all
|
||||
Notifier.notify("Rails restarting on port #{options[:port]} in #{options[:environment]}", :title => "Restarting Rails...", :image => :pending)
|
||||
system %{sh -c '[[ -f tmp/pids/#{options[:environment]}.pid ]] && kill $(cat tmp/pids/#{options[:environment]}.pid)'}
|
||||
system %{rails s -d e #{options[:environment]} -p #{options[:port]}}
|
||||
end
|
||||
|
||||
def run_on_change(paths)
|
||||
run_all
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
module Guard
|
||||
class Rails
|
||||
VERSION = '0.0.1'
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue