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



39
40
41
42
43
# File 'lib/generators/lines/install_generator.rb', line 39

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

#copy_configObject



29
30
31
# File 'lib/generators/lines/install_generator.rb', line 29

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

#copy_stylesheetsObject



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

def copy_stylesheets
  FileUtils.mkdir_p "app/assets/stylesheets/lines"
  copy_file "../../../app/assets/stylesheets/lines/style.css.scss",        "app/assets/stylesheets/lines/style.css.scss"
  copy_file "../../../app/assets/stylesheets/lines/media_queries.css.scss",        "app/assets/stylesheets/lines/media_queries.css.scss"
  copy_file "../../../app/assets/stylesheets/lines/navbar.css.scss",        "app/assets/stylesheets/lines/navbar.css.scss"
  copy_file "../../../app/assets/stylesheets/lines/pygments.css.erb",        "app/assets/stylesheets/lines/pygments.css.erb"
end

#copy_viewsObject



23
24
25
26
27
# File 'lib/generators/lines/install_generator.rb', line 23

def copy_views
  directory('../../../app/views/lines', 'app/views/lines/', {:exclude_pattern => /admin|sessions/})
  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



45
46
47
# File 'lib/generators/lines/install_generator.rb', line 45

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



34
35
36
37
# File 'lib/generators/lines/install_generator.rb', line 34

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