Sha256: 91faf9b5706bf179ba8d802710a7eb66bf859961ee518860f39d29f34324c1d1

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

module Medivo
  module Generators #:nodoc:
    class InstallGenerator < Rails::Generators::Base #:nodoc:
      source_root File.expand_path('../templates', __FILE__)


      def database_file
        copy_file "medivo.yml", "config/medivo.yml"
      end

      def test_helper
        if rspec?
          inject_into_file("spec/spec_helper.rb", :after => "Rspec.configure do |config|\n") do
            "  # Reset the Machinist cache before each spec.\n" +
            "  config.before(:each) { Machinist.reset_before_test }\n\n"
          end
        else
          inject_into_file("test/test_helper.rb", :after => "require 'rails/test_help'\n") do
            "require File.expand_path(File.dirname(__FILE__) + '/blueprints')\n"
          end
          inject_into_class("test/test_helper.rb", ActiveSupport::TestCase) do
            "  # Reset the Machinist cache before each test.\n" +
            "  setup { Machinist.reset_before_test }\n\n"
          end
        end
      end

      def cucumber_support
        if options[:cucumber]
          template "machinist.rb.erb", "features/support/machinist.rb"
        end
      end

    private

      def rspec?
        options[:test_framework].to_sym == :rspec
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
medivo-0.0.4 lib/generators/medivo/install/install_generator.rb
medivo-0.0.3 lib/generators/medivo/install/install_generator.rb
medivo-0.0.2 lib/generators/medivo/install/install_generator.rb
medivo-0.0.1 lib/generators/medivo/install/install_generator.rb