Sha256: b1061124d9a977e4790560bbe592f44aaae3b659499fdba75de80b7a86a69bf7

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

module Spina
  class InstallGenerator < Rails::Generators::Base
    source_root File.expand_path("../templates", __FILE__)

    def create_initializer_file
      template "spina.rb", "config/initializers/spina.rb"
    end

    def create_theme_initializer
      template "theme.rb", "config/initializers/themes/default.rb"
    end

    def copy_migrations
      rake "spina:install:migrations"
    end

    def run_migrations
      rake "db:migrate"
    end

    def copy_views
      template "application.html.erb", "app/views/layouts/default/application.html.erb"
      template "homepage.html.erb", "app/views/default/pages/homepage.html.erb"
      template "show.html.erb", "app/views/default/pages/show.html.erb"
    end

    def create_account
      name = ask("What would you like to name your website?")
      Account.create name: name, theme: 'default'
    end

    def create_user
      email = ask("Please enter an email address for your first user:")
      password = ask("Create a temporary password:")
      User.create name: 'admin', email: email, password: password, admin: true
    end

    def bootstrap_spina
      rake "spina:bootstrap"
    end

    def add_route
      route "mount Spina::Engine => '/'"
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
spina-0.7.0 lib/generators/spina/install_generator.rb
spina-0.6.29 lib/generators/spina/install_generator.rb
spina-0.6.28 lib/generators/spina/install_generator.rb
spina-0.6.27 lib/generators/spina/install_generator.rb
spina-0.6.26 lib/generators/spina/install_generator.rb
spina-0.6.25 lib/generators/spina/install_generator.rb
spina-0.6.24 lib/generators/spina/install_generator.rb
spina-0.6.23 lib/generators/spina/install_generator.rb