initial commit

This commit is contained in:
John Bintz 2011-05-27 14:41:07 -04:00
commit 30390f4aec
6 changed files with 65 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.gem
.bundle
Gemfile.lock
pkg/*

4
Gemfile Normal file
View File

@ -0,0 +1,4 @@
source "http://rubygems.org"
# Specify your gem's dependencies in guard-rails.gemspec
gemspec

2
Rakefile Normal file
View File

@ -0,0 +1,2 @@
require 'bundler'
Bundler::GemHelper.install_tasks

21
guard-rails.gemspec Normal file
View File

@ -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

28
lib/guard/rails.rb Normal file
View File

@ -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

View File

@ -0,0 +1,6 @@
module Guard
class Rails
VERSION = '0.0.1'
end
end