Sha256: 9561a63d660ff28bd7246e3d3e8e16c3877d2eb436fe73fa81450a35ca5c63c5

Contents?: true

Size: 1.62 KB

Versions: 3

Compression:

Stored size: 1.62 KB

Contents

require 'spree'
require 'generators/spree/test_app_generator'

module SpreeRetailers
  module Generators
    class TestAppGenerator < Spree::Generators::TestAppGenerator
      
      class_option :app_name, :type => :string,
                        :desc => "The name of the test rails app to generate. Defaults to test_app.",
                        :default => "dummy"


      source_paths << File.expand_path("../../templates", __FILE__)
      
      def install_spree_core
        inside "test/#{test_app}" do
          run 'rake spree_core:install'
          run 'rake spree_auth:install'
          run 'rake spree_retailers:install'
        end
      end
      
      def generate_app
        silence_stream(STDOUT) {
          remove_directory_if_exists("test/#{test_app}")
          inside "test" do
            run "rails new #{test_app} -GJTq --skip-gemfile"
          end
        }
      end
      
      def replace_gemfile
        true
      end
      
      def setup_environments
        remove_file 'config/boot.rb'
        template 'config/boot.rb'
      end
      
      def tweak_gemfile
        true
      end
      
      def create_rspec_gemfile
        true
      end
      
      def create_root
        self.destination_root = File.expand_path("test/#{test_app}", destination_root)
      end
    
      def migrate_db  
        run_migrations
      end
    
      protected
      
      def full_path_for_local_gems
        <<-gems
gem 'spree_core', '>= 0.40.2'
gem 'spree_auth', '>= 0.40.2'
gem 'spree_retailers', :path => File.expand_path('../../../../', __FILE__)
gem 'geokit',     '>= 1.5.0'
        gems
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_retailers-0.50.0.0 lib/spree_retailers/generators/test_app_generator.rb
spree_retailers-0.40.0.4 lib/spree_retailers/generators/test_app_generator.rb
spree_retailers-0.40.0.2 lib/spree_retailers/generators/test_app_generator.rb