Class: StaticRails::CompilesSites

Inherits:
Object
  • Object
show all
Defined in:
lib/static-rails/compile.rb

Instance Method Summary collapse

Instance Method Details

#call(config) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/static-rails/compile.rb', line 7

def call(config)
  config.sites.each do |site|
    Dir.chdir(config.app.root.join(site.source_dir)) do
      Bundler.with_unbundled_env do
        puts "=> Compiling static site \"#{site.name}\" to #{site.compile_dir}"
        result = system(site.env, site.compile_command)
        unless result == true
          raise Error.new("Compilation of static site \"#{site.name}\" failed (in directory \"#{site.source_dir}\" with command: `#{site.compile_command}`)")
        end
      end
    end
  end
end