Sha256: d7d8cf443e8e30f8dcb76eeca5e402b9d679a7db208e918736d1f7afe07a13f9

Contents?: true

Size: 898 Bytes

Versions: 8

Compression:

Stored size: 898 Bytes

Contents

require 'rack'

class Susanoo::Application

  # This controller is responsible for serving/building index.html file.
  class Index < Susanoo::Controller
    def call(env)
      # Tilt template object
      template = Tilt.new(File.join(project_root, 'src/index.html.erb'))
      [200, {'Content-Type' => 'text/html'}, [template.render(self)]]
    end

    def build(generator, options)
      platform = options[:platform]

      # Configure Sprockets::Helpers (if necessary)
      Sprockets::Helpers.configure do |config|
        config.environment = @environment
        config.prefix      = "/#{platform}_asset/www/assets"
        config.debug       = false
      end

      template = Tilt.new(File.join(project_root, 'src/index.html.erb'))
      data = template.render(self)
      # God forgive me for hard coding this part
      generator.create_file 'www/index.html', data
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
susanoo-0.14.0 lib/susanoo/controllers/index.rb
susanoo-0.13.2 lib/susanoo/controllers/index.rb
susanoo-0.13.1 lib/susanoo/controllers/index.rb
susanoo-0.13.0 lib/susanoo/controllers/index.rb
susanoo-0.12.3 lib/susanoo/controllers/index.rb
susanoo-0.12.2 lib/susanoo/controllers/index.rb
susanoo-0.12.1 lib/susanoo/controllers/index.rb
susanoo-0.12.0 lib/susanoo/controllers/index.rb