guard-mozrepl 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in guard-mozrepl.gemspec
4
+ gemspec
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,20 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require "guard/mozrepl/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "guard-mozrepl"
6
+ s.version = Guard::Mozrepl::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["Phil Hofmann"]
9
+ s.email = ["phil@branch14.org"]
10
+ s.homepage = "http://branch14.org/guard-mozrepl"
11
+ s.summary = %q{make guard reload the current tab when things change}
12
+ s.description = %q{make guard reload the current tab when things change}
13
+
14
+ #s.rubyforge_project = "guard-mozrepl"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+ end
@@ -0,0 +1,5 @@
1
+ module Guard
2
+ module Mozrepl
3
+ # Your code goes here...
4
+ end
5
+ end
@@ -0,0 +1,60 @@
1
+ require 'net/telnet'
2
+ require 'guard'
3
+ require 'guard/guard'
4
+
5
+ module Guard
6
+ class Mozrepl < Guard
7
+
8
+ def initialize(watchers=[], options={})
9
+ super
10
+ @options = options
11
+ end
12
+
13
+ # Called once when Guard starts
14
+ # Please override initialize method to init stuff
15
+ def start
16
+ true
17
+ end
18
+
19
+ # Called on Ctrl-C signal (when Guard quits)
20
+ def stop
21
+ close!
22
+ end
23
+
24
+ # Called on Ctrl-Z signal
25
+ # This method should be mainly used for "reload" (really!) actions
26
+ # like reloading passenger/spork/bundler/...
27
+ def reload
28
+ true
29
+ end
30
+
31
+ # Called on Ctrl-/ signal
32
+ # This method should be principally used for long action like running all specs/tests/...
33
+ def run_all
34
+ true
35
+ end
36
+
37
+ # Called on file(s) modifications
38
+ def run_on_change(paths)
39
+ reload_current_tab!
40
+ end
41
+
42
+ private
43
+
44
+ def reload_current_tab!
45
+ mozrepl.cmd('content.location.reload();')
46
+ end
47
+
48
+ def mozrepl
49
+ @mozrepl ||= Net::Telnet::new("Host" => @options[:host],
50
+ "Port" => @options[:port])
51
+ end
52
+
53
+ def close!
54
+ @mozrepl.close
55
+ end
56
+
57
+ end
58
+ end
59
+
60
+
@@ -0,0 +1,6 @@
1
+ guard 'mozrepl', :host => 'localhost', :port => 4242 do
2
+ watch(%r{app/.+\.(erb|haml)})
3
+ watch(%r{app/helpers/.+\.rb})
4
+ watch(%r{public/.+\.(css|js|html)})
5
+ watch(%r{config/locales/.+\.yml})
6
+ end
@@ -0,0 +1,5 @@
1
+ module Guard
2
+ module Mozrepl
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-mozrepl
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Phil Hofmann
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-05-17 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: make guard reload the current tab when things change
23
+ email:
24
+ - phil@branch14.org
25
+ executables: []
26
+
27
+ extensions: []
28
+
29
+ extra_rdoc_files: []
30
+
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - Rakefile
35
+ - guard-mozrepl.gemspec
36
+ - lib/guard-mozrepl.rb
37
+ - lib/guard/mozrepl.rb
38
+ - lib/guard/mozrepl/templates/Guardfile
39
+ - lib/guard/mozrepl/version.rb
40
+ has_rdoc: true
41
+ homepage: http://branch14.org/guard-mozrepl
42
+ licenses: []
43
+
44
+ post_install_message:
45
+ rdoc_options: []
46
+
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ hash: 3
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ hash: 3
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ requirements: []
68
+
69
+ rubyforge_project:
70
+ rubygems_version: 1.4.1
71
+ signing_key:
72
+ specification_version: 3
73
+ summary: make guard reload the current tab when things change
74
+ test_files: []
75
+