Sha256: d24864e3731b2909452449f287d486f74cf6e05e0445e091513b75894b8d2a8a

Contents?: true

Size: 730 Bytes

Versions: 1

Compression:

Stored size: 730 Bytes

Contents

module Rehearsal
  class InstallGenerator < ::Rails::Generators::Base
    source_root File.expand_path('../templates', __FILE__)
    argument :type, :as => :string, :default => 'global'

    def remove_other_config
      case type
      when 'global'
        remove_file ".rehearsal"
      when 'user'
        remove_file "config/initializers/rehearsal.rb"
      end
    end

    def copy_initializer_file
      case type
      when 'global'
        copy_file "initializer.rb", "config/initializers/rehearsal.rb"
      when 'user'
        copy_file "rehearsal.yml", ".rehearsal"
      end
    end

    def add_config_to_gitignore
      if type == 'user'
        append_file(".gitignore", ".rehearsal")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rehearsal-2.0.0 lib/generators/rehearsal/install/install_generator.rb