Module: Coyote
- Defined in:
- lib/coyote.rb,
lib/coyote/asset.rb,
lib/coyote/bundle.rb,
lib/coyote/fs_listener.rb,
lib/coyote/notifications.rb,
lib/coyote/closure_compiler.rb,
lib/coyote/assets/javascript.rb,
lib/coyote/fs_listeners/linux.rb,
lib/coyote/assets/coffeescript.rb,
lib/coyote/fs_listeners/darwin.rb,
lib/coyote/fs_listeners/polling.rb,
lib/coyote/fs_listeners/windows.rb
Defined Under Namespace
Modules: Notifications
Classes: Asset, Bundle, ClosureCompiler, CoffeeScript, Darwin, FSListener, JavaScript, Linux, Polling, Windows
Constant Summary
collapse
- VERSION =
'1.0.2'
Class Method Summary
collapse
Class Method Details
.build(bundle) ⇒ Object
24
25
26
27
28
29
|
# File 'lib/coyote.rb', line 24
def self.build(bundle)
notify bundle.manifest unless @@options[:quiet]
bundle.compress! if @@options[:compress]
bundle.save
notify "#{Time.new.strftime("%I:%M:%S")} Saved bundle to #{@@output_path} [#{bundle.files.length} files]", :success
end
|
.options ⇒ Object
20
21
22
|
# File 'lib/coyote.rb', line 20
def self.options
['compress', 'watch', 'quiet', 'version']
end
|
.run(input_path, output_path, options = {}) ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/coyote.rb', line 11
def self.run(input_path, output_path, options = {})
@@input_path = input_path
@@output_path = output_path
@@options = options
bundle = Coyote::Bundle.new(input_path, output_path)
build bundle
watch bundle if @@options[:watch]
end
|
.watch(bundle) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/coyote.rb', line 32
def self.watch(bundle)
listener = Coyote::FSListener.select_and_init
listener.on_change do |changed_files|
changed_files = bundle.files & changed_files
if changed_files.length > 0
notify "#{Time.new.strftime("%I:%M:%S")} Detected change, recompiling...", :warning
bundle.update! changed_files
build bundle
end
end
notify "#{Time.new.strftime("%I:%M:%S")} Watching for changes to your bundle. CTRL+C to stop."
listener.start
end
|