Sha256: 9925b91d603b066cb71bb5db05f2caf7747b41925e0ce105c80bed8d6506f527

Contents?: true

Size: 1.05 KB

Versions: 10

Compression:

Stored size: 1.05 KB

Contents

require_relative "base"

module Suspenders
  class ViewsGenerator < Generators::Base
    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
      remove_file "app/views/layouts/application.html.erb"
      template "suspenders_layout.html.slim",
        "app/views/layouts/application.html.slim",
        force: true
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
welaika-suspenders-3.0 lib/suspenders/generators/views_generator.rb
welaika-suspenders-2.36 lib/suspenders/generators/views_generator.rb
welaika-suspenders-2.35 lib/suspenders/generators/views_generator.rb
welaika-suspenders-2.34 lib/suspenders/generators/views_generator.rb
welaika-suspenders-2.33 lib/suspenders/generators/views_generator.rb
welaika-suspenders-2.32.2 lib/suspenders/generators/views_generator.rb
welaika-suspenders-2.32.1 lib/suspenders/generators/views_generator.rb
welaika-suspenders-2.32.0 lib/suspenders/generators/views_generator.rb
welaika-suspenders-2.31.0 lib/suspenders/generators/views_generator.rb
welaika-suspenders-2.30.0 lib/suspenders/generators/views_generator.rb