Class: ViewAssets::Packager::Packager
- Inherits:
-
Object
- Object
- ViewAssets::Packager::Packager
- Defined in:
- lib/view_assets/packager/packager.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#package(targets = {}, options = {}) ⇒ Object
targets = { :controller => [:action1, :action2], … } options: :verbal => false :compress => true :compress_engine => ‘yui-compressor’ :manifest => true.
- #root ⇒ Object
Instance Method Details
#package(targets = {}, options = {}) ⇒ Object
targets = { :controller => [:action1, :action2], … } options:
:verbal => false
:compress => true
:compress_engine => 'yui-compressor'
:manifest => true
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/view_assets/packager/packager.rb', line 17 def package(targets = {}, = {}) = { :verbal => false, :compress => true, :manifest => true, :compress_engine => 'yui-compressor' }.update() targets = actions_map.retrieve if targets.empty? # Preparing Envs FileUtils.mkdir_p("#{root}/assets/#{CSS_PATH}") FileUtils.mkdir_p("#{root}/assets/#{JS_PATH}") # Packaging @manifest = {} ('', '', ) targets.each do |controller, actions| (controller, '', ) actions.map do |action| (controller, action, ) end end File.open("#{root}/assets/#{asset_path}/manifest.yml", 'w') { |file| YAML.dump(@manifest, file) } if [:manifest] @manifest end |
#root ⇒ Object
42 43 44 |
# File 'lib/view_assets/packager/packager.rb', line 42 def root Rails.public_path end |