Sha256: 9602cd45e7db998cdc00c283c73d9baea283858ec36d69bd46c0e607a1b4dadf

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

class Geri::InstallGenerator < Rails::Generators::Base
  source_root File.expand_path('../templates', __FILE__)

  def create_initializer
    template 'initializer.rb', 'config/initializers/geri/base.rb'
  end

  def add_mount_point
    gsub_file('config/routes.rb', 'Rails.application.routes.draw do', <<-EOF
Rails.application.routes.draw do
  # Sets the mounted location of the Geri CMS, if you wish to mount this elsewhere simply update this line.
  mount Geri::Engine => '/'
    EOF
    )
  end

  def create_site_directory
    empty_directory('app/site')
  end

  def create_default_layout
    copy_file('layout.html.erb', 'app/site/layout.html.erb')
  end

  def create_default_index
    copy_file('index.html.erb', 'app/site/index.html.erb')
  end

  def create_assets_directory
    empty_directory('app/site/assets')
    empty_directory('app/site/assets/vendor')
  end

  def setup_bower
    copy_file('.bowerrc', 'app/site/.bowerrc')
    copy_file('bower.json', 'app/site/bower.json')
    inside('app/site') do
      run 'bower install'
    end
  end

  def install_default_css
    copy_file('site.css.less', 'app/site/assets/stylesheets/site.css.less')
  end

  def install_default_js
    copy_file('site.js', 'app/site/assets/javascripts/site.js')
  end

  def update_gitignore
    append_file('.gitignore', 'app/site/vendor')
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
geri-0.0.1 lib/generators/geri/install/install_generator.rb