Class: Lines::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_routesObject



11
12
13
# File 'lib/generators/lines/install_generator.rb', line 11

def add_routes
  route 'mount Lines::Engine => "/blog"'
end

#add_userObject



37
38
39
40
41
# File 'lib/generators/lines/install_generator.rb', line 37

def add_user
  if yes?("Would you like to create an admin user? (y/N):")
    rake 'lines:add_user'
  end
end

#copy_configObject



27
28
29
# File 'lib/generators/lines/install_generator.rb', line 27

def copy_config
  copy_file "../../../config/lines_config.yml", 'config/lines_config.yml'
end

#copy_stylesheetsObject



15
16
17
18
# File 'lib/generators/lines/install_generator.rb', line 15

def copy_stylesheets
  FileUtils.mkdir_p "app/assets/stylesheets/lines"
  directory('../../../app/assets/stylesheets/lines/', 'app/assets/stylesheets/lines/', {:exclude_pattern => /admin/} )
end

#copy_viewsObject



20
21
22
23
24
25
# File 'lib/generators/lines/install_generator.rb', line 20

def copy_views
  directory('../../../app/views/lines', 'app/views/lines/', {:exclude_pattern => /admin|sessions/})
  directory('../../../app/views/kaminari', 'app/views/kaminari/')
  copy_file('../../../app/views/layouts/lines/application.html.erb', 'app/views/layouts/lines/application.html.erb')
  copy_file('../../../app/views/layouts/lines/preview.html.erb', 'app/views/layouts/lines/preview.html.erb')
end

#display_readmeObject



43
44
45
# File 'lib/generators/lines/install_generator.rb', line 43

def display_readme
  readme 'README'
end

#install_migrationsObject



7
8
9
# File 'lib/generators/lines/install_generator.rb', line 7

def install_migrations
  rake "lines:install:migrations"
end

#load_seedsObject



32
33
34
35
# File 'lib/generators/lines/install_generator.rb', line 32

def load_seeds
  FileUtils.mkdir_p "vendor/screenshots"
  copy_file './templates/octorel.png', 'vendor/screenshots/octorel.png'
end