Sha256: 3dfa77ae57face33852ffd05edd84a0203506d6aedbede766413a87bf1580656

Contents?: true

Size: 1.32 KB

Versions: 7

Compression:

Stored size: 1.32 KB

Contents

require 'rails/generators'

module Symphonia
  class SetupGenerator < Rails::Generators::Base
    # include Rails::Generators::Migration

    source_root File.expand_path('templates', __dir__)

    def create_settings
      copy_file 'settings.rb', 'config/initializers/settings.rb'
    end

    def copy_static
      copy_file '404.html', 'public/404.html'
      copy_file '500.html', 'public/500.html'
    end

    def copy_assets
      append_to_file 'app/assets/javascripts/application.js', '//= require symphonia/application'
      copy_file 'design.scss', 'app/assets/stylesheets/general.scss'
    end

    def copy_rspec
      copy_file 'spec_helper.rb', 'spec/spec_helper.rb'

      create_file '.rspec' do
        '--require spec_helper'
        '--format documentation'
      end
    end

    def copy_setup_file

      copy_file 'base_layout.html.erb', 'app/views/layouts/application.html.erb'

      append_to_file 'db/seeds.rb', 'Symphonia::Engine.load_seed'
      append_to_file '.gitignore', 'public/system'

      inject_into_file 'config/routes.rb', after: "Rails.application.routes.draw do\n" do
        "  mount Symphonia::Engine => '/'"
      end

    end

    # def setup_gemfile
    #   append_to_file 'Gemfile' do
    #     File.read(File.join(File.dirname(__FILE__), 'templates/Gemfile'))
    #   end
    #
    # end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
symphonia-3.1.5 lib/generators/symphonia/setup/setup_generator.rb
symphonia-3.1.4 lib/generators/symphonia/setup/setup_generator.rb
symphonia-3.1.3 lib/generators/symphonia/setup/setup_generator.rb
symphonia-3.1.2 lib/generators/symphonia/setup/setup_generator.rb
symphonia-3.1.1 lib/generators/symphonia/setup/setup_generator.rb
symphonia-3.1.0 lib/generators/symphonia/setup/setup_generator.rb
symphonia-3.0.3 lib/generators/symphonia/setup/setup_generator.rb