Class: Kango::Reloader::Chrome::ExtensionsReloader
- Inherits:
-
Object
- Object
- Kango::Reloader::Chrome::ExtensionsReloader
- Defined in:
- lib/kango/reloader/chrome/extensions_reloader.rb
Instance Attribute Summary collapse
-
#on ⇒ Object
Returns the value of attribute on.
-
#watch_folder ⇒ Object
Returns the value of attribute watch_folder.
-
#watcher ⇒ Object
Returns the value of attribute watcher.
Instance Method Summary collapse
- #command ⇒ Object
-
#initialize ⇒ ExtensionsReloader
constructor
A new instance of ExtensionsReloader.
- #reload_browser ⇒ Object
- #trigger(&block) ⇒ Object
Constructor Details
#initialize ⇒ ExtensionsReloader
Returns a new instance of ExtensionsReloader.
7 8 9 10 11 |
# File 'lib/kango/reloader/chrome/extensions_reloader.rb', line 7 def initialize self.watch_folder = File.join(Dir.pwd, 'output', 'chrome') STDOUT.puts "#{self.class} watching #{self.watch_folder}" STDOUT.puts "WARNING: This experimental feature requires the chrome extension called ExtensionsReloader and calls the following command: #{command}" end |
Instance Attribute Details
#on ⇒ Object
Returns the value of attribute on.
5 6 7 |
# File 'lib/kango/reloader/chrome/extensions_reloader.rb', line 5 def on @on end |
#watch_folder ⇒ Object
Returns the value of attribute watch_folder.
5 6 7 |
# File 'lib/kango/reloader/chrome/extensions_reloader.rb', line 5 def watch_folder @watch_folder end |
#watcher ⇒ Object
Returns the value of attribute watcher.
5 6 7 |
# File 'lib/kango/reloader/chrome/extensions_reloader.rb', line 5 def watcher @watcher end |
Instance Method Details
#command ⇒ Object
24 25 26 |
# File 'lib/kango/reloader/chrome/extensions_reloader.rb', line 24 def command %{open -a '/Applications/Google\ Chrome\ Canary.app' 'http://reload.extensions'} end |
#reload_browser ⇒ Object
28 29 30 |
# File 'lib/kango/reloader/chrome/extensions_reloader.rb', line 28 def reload_browser system(command) end |
#trigger(&block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/kango/reloader/chrome/extensions_reloader.rb', line 13 def trigger &block return if @on self.watcher = DirectoryWatcher.new(self.watch_folder, :pre_load => true) self.watcher.interval = 1 self.watcher.add_observer do |*args| block.call end self.watcher.start self.on = true end |