Skip to content
No description or website provided.
Ruby
Find file
Pull request Compare This branch is 2 commits ahead of carhartl:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib/guard updating version number Jun 14, 2012
spec
.gitignore
Gemfile not using jeweler but bundler instead, less mess Feb 25, 2011
Guardfile adding its own guard Feb 28, 2011
LICENSE removing .txt Feb 25, 2011
README.rdoc try loading config from yml file before resorting to options, event n… Mar 1, 2011
Rakefile not using jeweler but bundler instead, less mess Feb 25, 2011
guard-pusher.gemspec less strict dependencies Jun 14, 2012

README.rdoc

guard-pusher

Pusher guard allows to automatically send a Pusher message to any number of browserswhen files are modified. That message can for instance be used to reload a page during development. Sort of Livereload but for iPad, iPhone etc. without the ability to install the necessary extension.

  • Tested on Ruby 1.8.7 & 1.9.2.

Install

Please be sure to have Guard installed before continue.

Install the gem:

gem install guard-pusher

Or add it to your Gemfile

gem 'guard-pusher'

and run

bundle install

Add guard definition to your Guardfile by running this command:

guard init pusher

Get a free Pusher developer account: pusherapp.com (also available as Heroku add-on).

Create a YAML file containing your API credentials for the development environment and save it in the config directory:

# config/pusher.yml
development:
  app_id: ...
  key: ...
  secret: ...

You can also pass these credentials as option in your guard definition, see Options below.

Include the following JavaScript:

<script src="http://js.pusherapp.com/1.8/pusher.min.js"></script>
<script>
    new Pusher(<key>).subscribe('guard-pusher').bind('guard', function() {
        // do something - for instance simply reload the page:
        location.reload();
   });
</script>

Usage

Please read Guard usage doc

Options

Pass Pusher API credentials as option:

guard 'pusher', :app_id => ..., :key => '...', :secret => '...' do
  ...
end

Set the name of the event you're binding to:

guard 'pusher', :event => 'ping' do
  ...
end

new Pusher(...).subscribe('guard-pusher').bind('ping', function() { ... });

Development

Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change you make.

Authors

Klaus Hartl

Something went wrong with that request. Please try again.