Class: Calatrava::Manifest
- Inherits:
-
Object
- Object
- Calatrava::Manifest
- Defined in:
- lib/calatrava/manifest.rb
Instance Method Summary collapse
- #coffee_files ⇒ Object
- #css_files ⇒ Object
- #css_tasks(output_dir) ⇒ Object
- #feature_files(source, type) ⇒ Object
- #features ⇒ Object
- #haml(js_src) ⇒ Object
- #haml_files ⇒ Object
-
#initialize(path, app_dir, kernel, shell) ⇒ Manifest
constructor
A new instance of Manifest.
- #kernel_bootstrap ⇒ Object
- #load_file(target_dir, js_load_path, options) ⇒ Object
- #text(js_src) ⇒ Object
Constructor Details
#initialize(path, app_dir, kernel, shell) ⇒ Manifest
Returns a new instance of Manifest.
4 5 6 7 |
# File 'lib/calatrava/manifest.rb', line 4 def initialize(path, app_dir, kernel, shell) @path, @kernel, @shell = path, kernel, shell @feature_list = YAML.load(IO.read("#{@path}/#{app_dir}/manifest.yml")) end |
Instance Method Details
#coffee_files ⇒ Object
24 25 26 27 28 |
# File 'lib/calatrava/manifest.rb', line 24 def coffee_files [@shell, @kernel].collect do |src| src.coffee_files + feature_files(src, :coffee) end.flatten end |
#css_files ⇒ Object
38 39 40 |
# File 'lib/calatrava/manifest.rb', line 38 def css_files @shell.css_files end |
#css_tasks(output_dir) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/calatrava/manifest.rb', line 42 def css_tasks(output_dir) css_files.collect do |style_file| file "#{output_dir}/#{File.basename(style_file, '.*')}.css" => [output_dir, style_file] do |t| if style_file =~ /css$/ cp style_file, output_dir else sh "sass #{style_file} #{t.name}" end end end end |
#feature_files(source, type) ⇒ Object
54 55 56 |
# File 'lib/calatrava/manifest.rb', line 54 def feature_files(source, type) source.features.select { |f| @feature_list.include?(f[:name]) }.collect { |f| f[type] }.flatten end |
#features ⇒ Object
9 10 11 |
# File 'lib/calatrava/manifest.rb', line 9 def features @feature_list end |
#haml(js_src) ⇒ Object
58 59 60 |
# File 'lib/calatrava/manifest.rb', line 58 def haml(js_src) %{%script(type="text/javascript" src="#{js_src}")} end |
#haml_files ⇒ Object
34 35 36 |
# File 'lib/calatrava/manifest.rb', line 34 def haml_files @shell.haml_files + feature_files(@shell, :haml) end |
#kernel_bootstrap ⇒ Object
30 31 32 |
# File 'lib/calatrava/manifest.rb', line 30 def kernel_bootstrap @kernel.coffee_files + feature_files(@kernel, :coffee) end |
#load_file(target_dir, js_load_path, options) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/calatrava/manifest.rb', line 13 def load_file(target_dir, js_load_path, ) File.open("#{target_dir}/load_file.#{[:type]}", "w+") do |f| @feature_list.each do |feature| coffee_files(feature, :include_pages => [:include_pages]).each do |coffee_file| js_src = File.join(js_load_path, File.basename(coffee_file, '.coffee') + ".js") f.puts self.send([:type], js_src) end end end end |
#text(js_src) ⇒ Object
62 63 64 |
# File 'lib/calatrava/manifest.rb', line 62 def text(js_src) js_src end |