Class: Suspenders::ViewsGenerator

Inherits:
Generators::Base show all
Defined in:
lib/suspenders/generators/views_generator.rb

Instance Method Summary collapse

Methods inherited from Generators::Base

default_source_root

Methods included from Actions

#action_mailer_asset_host, #action_mailer_host, #configure_environment, #expand_json, #replace_in_file

Instance Method Details

#add_slim_gemObject



5
6
7
8
# File 'lib/suspenders/generators/views_generator.rb', line 5

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

#configure_slimObject



10
11
12
# File 'lib/suspenders/generators/views_generator.rb', line 10

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

#create_application_layoutObject



33
34
35
36
37
38
# File 'lib/suspenders/generators/views_generator.rb', line 33

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

#create_partials_directoryObject



14
15
16
# File 'lib/suspenders/generators/views_generator.rb', line 14

def create_partials_directory
  empty_directory "app/views/application"
end

#create_shared_css_overridesObject



28
29
30
31
# File 'lib/suspenders/generators/views_generator.rb', line 28

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

#create_shared_flashesObject



18
19
20
21
# File 'lib/suspenders/generators/views_generator.rb', line 18

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

#create_shared_javascriptsObject



23
24
25
26
# File 'lib/suspenders/generators/views_generator.rb', line 23

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