Sha256: f01d66b04f9e52d672c697844e2b8e75041897e4c24bbf7eed2abffa94a58e3d

Contents?: true

Size: 1.57 KB

Versions: 7

Compression:

Stored size: 1.57 KB

Contents

# frozen_string_literal: true

unless defined?(Archangel::Generators::InstallGenerator)
  require "generators/archangel/install/install_generator"
end

require "generators/archangel/dummy/dummy_generator"

desc "Generates a dummy app for testing"
namespace :dummy do
  task :generate do |_t, _args|
    lib = ENV["LIB_NAME"].to_s

    require lib unless defined?(lib.camelize.constantize)

    ENV["RAILS_ENV"] = "test"

    Archangel::Generators::DummyGenerator.start [
      "--lib_name=#{lib}",
      "--quiet"
    ]

    Archangel::Generators::InstallGenerator.start [
      "--lib_name=#{lib}",
      "--auto-accept",
      "--migrate=false",
      "--seed=false",
      "--sample=false",
      "--quiet"
    ]

    puts "Setting up dummy database..."
    system("bundle exec rake db:drop db:create db:migrate > #{File::NULL}")

    # puts "Precompiling assets..."
    # system("bundle exec rake assets:precompile > #{File::NULL}")

    unless lib == "archangel"
      begin
        require "generators/#{lib}/install/install_generator"

        puts "Running extension installation generator..."

        "#{lib.camelize}::Generators::InstallGenerator"
          .constantize
          .start(
            [
              "--auto-run-migrations",
              "--auto-accept",
              "--migrate",
              "--skip-sample",
              "--skip-seed",
              "--skip-turbolinks",
              "--route-path=#{lib}",
              "--quiet"
            ]
          )
      rescue LoadError
        puts "Skipping extension install. No generator to run..."
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
archangel-0.0.8 lib/archangel/testing_support/rake/dummy_rake.rb
archangel-0.0.7 lib/archangel/testing_support/rake/dummy_rake.rb
archangel-0.0.6 lib/archangel/testing_support/rake/dummy_rake.rb
archangel-0.0.5 lib/archangel/testing_support/rake/dummy_rake.rb
archangel-0.0.4 lib/archangel/testing_support/rake/dummy_rake.rb
archangel-0.0.3 lib/archangel/testing_support/rake/dummy_rake.rb
archangel-0.0.2 lib/archangel/testing_support/rake/dummy_rake.rb