Class: Calatrava::Manifest
- Inherits:
-
Object
- Object
- Calatrava::Manifest
- Includes:
- Rake::DSL
- Defined in:
- lib/calatrava/manifest.rb
Instance Attribute Summary collapse
-
#src_file ⇒ Object
readonly
Returns the value of attribute src_file.
Instance Method Summary collapse
- #coffee_files ⇒ Object
- #css_files ⇒ Object
- #css_tasks(base_output_dir) ⇒ Object
- #feature_files(source, type) ⇒ Object
- #features ⇒ Object
- #haml_files ⇒ Object
-
#initialize(path, app_dir, kernel, shell) ⇒ Manifest
constructor
A new instance of Manifest.
- #kernel_bootstrap ⇒ Object
- #kernel_libraries ⇒ Object
Methods included from Rake::DSL
Constructor Details
#initialize(path, app_dir, kernel, shell) ⇒ Manifest
Returns a new instance of Manifest.
8 9 10 11 12 13 14 |
# File 'lib/calatrava/manifest.rb', line 8 def initialize(path, app_dir, kernel, shell) @path, @kernel, @shell = path, kernel, shell @src_file = "#{app_dir}/manifest.yml" files_to_load = YAML.load(IO.read("#{@path}/#{@src_file}")) @feature_list = files_to_load["features"] @kernel_libraries = files_to_load["kernel_libs"] || [] end |
Instance Attribute Details
#src_file ⇒ Object (readonly)
Returns the value of attribute src_file.
6 7 8 |
# File 'lib/calatrava/manifest.rb', line 6 def src_file @src_file 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(base_output_dir) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/calatrava/manifest.rb', line 42 def css_tasks(base_output_dir) css_files.collect do |style_file| #drop shell/stylesheets in order to preserve sub-directories sub_path = style_file.split("/")[2..-2].join("/") output_dir = "#{base_output_dir}/#{sub_path}" directory output_dir 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
58 59 60 |
# File 'lib/calatrava/manifest.rb', line 58 def feature_files(source, type) source.features.select { |f| @feature_list.include?(f[:name]) }.collect { |f| f[type] }.flatten end |
#features ⇒ Object
20 21 22 |
# File 'lib/calatrava/manifest.rb', line 20 def features @feature_list 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 |
#kernel_libraries ⇒ Object
16 17 18 |
# File 'lib/calatrava/manifest.rb', line 16 def kernel_libraries @kernel_libraries end |