Sha256: ecf9fccdc34c1dcbcaf05da2d883d6df19c49b3522fb3e5f2d241727a3bd0a08

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

require "rails/generators"

module Suspenders
  class ViewsGenerator < Rails::Generators::Base
    source_root File.expand_path(
      File.join("..", "..", "..", "templates"),
      File.dirname(__FILE__),
    )

    def add_slim_gem
      gem "slim-rails"
      Bundler.with_clean_env { run "bundle install" }
    end

    def configure_slim
      copy_file 'slim.rb', 'config/initializers/slim.rb'
    end

    def create_partials_directory
      empty_directory "app/views/application"
    end

    def create_shared_flashes
      copy_file "_flashes.html.slim", "app/views/application/_flashes.html.slim"
      copy_file "flashes_helper.rb", "app/helpers/flashes_helper.rb"
    end

    def create_shared_javascripts
      copy_file "_javascript.html.slim",
        "app/views/application/_javascript.html.slim"
    end

    def create_shared_css_overrides
      copy_file "_css_overrides.html.slim",
        "app/views/application/_css_overrides.html.slim"
    end

    def create_application_layout
      template "suspenders_layout.html.slim",
        "app/views/layouts/application.html.slim",
        force: true
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
welaika-suspenders-2.29.0.alpha.3 lib/suspenders/generators/views_generator.rb
welaika-suspenders-2.29.0.alpha.2 lib/suspenders/generators/views_generator.rb
welaika-suspenders-2.29.0.alpha.1 lib/suspenders/generators/views_generator.rb