Class: Styleguide::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/styleguide/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_private_assetsObject



26
27
28
29
30
31
# File 'lib/generators/styleguide/install/install_generator.rb', line 26

def add_private_assets
  empty_directory 'public/stylesheets'
  copy_file 'styleguide.css', 'public/stylesheets/styleguide.css'
  empty_directory 'public/javascripts'
  copy_file 'styleguide.js', 'public/javascripts/styleguide.js'
end

#create_controllerObject



8
9
10
# File 'lib/generators/styleguide/install/install_generator.rb', line 8

def create_controller
  copy_file 'styleguide_controller.rb', 'app/controllers/styleguide_controller.rb'
end

#create_routeObject



12
13
14
# File 'lib/generators/styleguide/install/install_generator.rb', line 12

def create_route
  route "get 'styleguide' => 'styleguide#index' if Rails.env.development?"
end

#create_viewsObject



16
17
18
19
20
21
22
23
24
# File 'lib/generators/styleguide/install/install_generator.rb', line 16

def create_views
  copy_file 'styleguide.html.erb', 'app/views/layouts/styleguide.html.erb'

  empty_directory 'app/views/styleguide/widgets'
  empty_directory 'app/assets/stylesheets/widgets'
  copy_file 'index.html.erb', 'app/views/styleguide/index.html.erb'
  copy_file '_widget.html.erb', 'app/views/styleguide/_widget.html.erb'
  copy_file '_widget_link.html.erb', 'app/views/styleguide/_widget_link.html.erb'
end

#enable_guard_reloadingObject



37
38
39
# File 'lib/generators/styleguide/install/install_generator.rb', line 37

def enable_guard_reloading
  copy_file 'Guardfile', 'Guardfile'
end

#supply_basic_guideObject



33
34
35
# File 'lib/generators/styleguide/install/install_generator.rb', line 33

def supply_basic_guide
  copy_file '_example_elements.html', 'app/views/styleguide/widgets/_example_elements.html'
end