updated README, showing message when compilation has finished.
This commit is contained in:
parent
70ac5aa969
commit
1c278236ad
36
README.md
36
README.md
@ -28,15 +28,17 @@ $ guard init rails-assets
|
|||||||
## Rails 3.1
|
## Rails 3.1
|
||||||
|
|
||||||
The Rails 3.1 is a mandatory requirement, but is not enforeced via dependencies for now.
|
The Rails 3.1 is a mandatory requirement, but is not enforeced via dependencies for now.
|
||||||
The reason is that the assets are currently compiled via command line and thus this guard does not
|
The reason is that the assets can currently be compiled using following "runners":
|
||||||
explicitly depend on Rails.
|
|
||||||
|
|
||||||
Good thing about it is that assets will always be same as produced by Rails.
|
1. rake command (CLI);
|
||||||
|
2. loading the actual Rails environment.
|
||||||
|
|
||||||
|
In the 1st case - this Guard is not actually using Rails directly while in the 2nd - it loads it explicitly.
|
||||||
|
|
||||||
|
Good thing about the 1st approach is that assets will always be same as produced by Rails.
|
||||||
Bad thing is that it is pretty slow (~10 seconds) because it starts Rails from ground zero.
|
Bad thing is that it is pretty slow (~10 seconds) because it starts Rails from ground zero.
|
||||||
|
|
||||||
*NOTE*: The guard runs the `rake assets:clean assets:precopile`.
|
The 2nd approach is good because it is much faster, but does not reload Rails environment (so you have to restart guard).
|
||||||
As of current Rails 3.1 edge that means that the assets will be deleted before they are compiled.
|
|
||||||
|
|
||||||
|
|
||||||
## Guardfile and Options
|
## Guardfile and Options
|
||||||
|
|
||||||
@ -47,10 +49,22 @@ In addition to the standard configuration, this Guard has options to specify whe
|
|||||||
- `:reload` - compile assets when the guard quites (Ctrl-C) (not enabled by default)
|
- `:reload` - compile assets when the guard quites (Ctrl-C) (not enabled by default)
|
||||||
- `:all` - compile assets when running all the guards (Ctrl-/) (not enabled by default)
|
- `:all` - compile assets when running all the guards (Ctrl-/) (not enabled by default)
|
||||||
|
|
||||||
|
Also you can set the `:runner` option:
|
||||||
|
|
||||||
|
- `:cli` - compile assets using the rake task - the most correct method, but slow.
|
||||||
|
- `:rails` - compile assets by loading rails environment (default) - fast, but does not pick up changes.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
# This is the default behaviour
|
||||||
|
guard 'rails-assets', :run_on => [:start, :change], :runner => :rails do
|
||||||
|
watch(%r{^app/assets/.+$})
|
||||||
|
end
|
||||||
|
|
||||||
# compile ONLY when something changes
|
# compile ONLY when something changes
|
||||||
guard 'rails-assets', :run_on => :change do
|
guard 'rails-assets', :run_on => :change do
|
||||||
watch(%r{^app/assets/.+$})
|
watch(%r{^app/assets/.+$})
|
||||||
@ -60,11 +74,6 @@ end
|
|||||||
guard 'rails-assets', :run_on => [:start, :change] do
|
guard 'rails-assets', :run_on => [:start, :change] do
|
||||||
watch(%r{^app/assets/.+$})
|
watch(%r{^app/assets/.+$})
|
||||||
end
|
end
|
||||||
|
|
||||||
# This is the default behaviour
|
|
||||||
guard 'rails-assets', :run_on => [:start, :change] do
|
|
||||||
watch(%r{^app/assets/.+$})
|
|
||||||
end
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
@ -72,7 +81,6 @@ end
|
|||||||
- Source hosted at [GitHub](https://github.com/dnagir/guard-rails-assets)
|
- Source hosted at [GitHub](https://github.com/dnagir/guard-rails-assets)
|
||||||
- Report issues and feature requests to [GitHub Issues](https://github.com/dnagir/guard-rails-assets/issues)
|
- Report issues and feature requests to [GitHub Issues](https://github.com/dnagir/guard-rails-assets/issues)
|
||||||
|
|
||||||
|
|
||||||
Pull requests are very welcome!
|
Pull requests are very welcome!
|
||||||
|
|
||||||
## Licensed under WTFPL
|
## Licensed under WTFPL
|
||||||
@ -92,7 +100,3 @@ Pull requests are very welcome!
|
|||||||
|
|
||||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,13 +29,15 @@ module Guard
|
|||||||
end
|
end
|
||||||
|
|
||||||
def compile_assets
|
def compile_assets
|
||||||
puts 'Compiling rails assets'
|
puts "Compiling rails assets with #{runner.class.name}."
|
||||||
result = runner.compile_assets
|
result = runner.compile_assets
|
||||||
|
|
||||||
if result
|
if result
|
||||||
Notifier::notify 'Assets compiled'
|
Notifier::notify 'Assets compiled'
|
||||||
|
puts 'Assets compiled.'
|
||||||
else
|
else
|
||||||
Notifier::notify 'see the details in the terminal', :title => "Can't compile assets", :image => :failed
|
Notifier::notify 'see the details in the terminal', :title => "Can't compile assets", :image => :failed
|
||||||
|
puts 'Failed to compile assets.'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user