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.
- #root ⇒ Object
Instance Method Details
#package(targets = {}, options = {}) ⇒ Object
targets = { :controller => [:action1, :action2], … } options:
:verbal => false
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/view_assets/packager/packager.rb', line 12 def package(targets = {}, = {}) = { :verbal => false, :compress => true, :manifest => true }.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 = {} # TODO: retrieve application-required assets ('', '', ) targets.each do |controller, actions| # TODO: retrieve controller-dependent assets (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
39 40 41 |
# File 'lib/view_assets/packager/packager.rb', line 39 def root Rails.public_path end |