Sha256: 6ffedbd7e1e459cdc7d8d6eb5e2a70afdf76b6c02b635f52a2a2423c61b51326

Contents?: true

Size: 1.41 KB

Versions: 51

Compression:

Stored size: 1.41 KB

Contents

require "rails/generators/rails/app/app_generator"

module PushType
  class PushType::DummyGenerator < Rails::Generators::Base
    desc "Creates blank Rails application and installs PushType"

    source_root File.expand_path('../templates', __FILE__)

    class_option :lib_name, default: 'push_type_core'
    class_option :path,     default: 'test/dummy'
    class_option :skip_javascript, type: :boolean, default: false

    def clean_up_test_dummy
      remove_dir(dummy_path) if File.directory?(dummy_path)
    end

    def generate_test_dummy
      opts = {}.merge options
      opts[:database]       = 'postgresql'
      opts[:force]          = true
      opts[:skip_git]       = true
      opts[:skip_keeps]     = true
      opts[:skip_gemfile]   = true
      opts[:skip_bundle]    = true

      say "Generating dummy Rails application... (#{options[:lib_name]})"
      invoke Rails::Generators::AppGenerator, [ File.expand_path(dummy_path, destination_root) ], opts
    end

    def test_dummy_config
      template  'application.rb', "#{ dummy_path }/config/application.rb",  force: true
      copy_file 'boot.rb',        "#{ dummy_path }/config/boot.rb",         force: true
    end

    def clean_test_dummy
      remove_file "#{ dummy_path }/test"
      remove_file "#{ dummy_path }/vendor"
    end

    protected

    def dummy_path
      options[:path]
    end

    def lib_name
      options[:lib_name]
    end

  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
push_type_core-0.12.1 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.12.0 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.12.0.beta.1 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.11.2 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.11.1 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.11.0.beta.2 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.11.0.beta.1 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.10.4 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.10.3 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.10.2 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.10.1 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.10.0 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.10.0.beta.5 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.10.0.beta.3 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.9.5 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.9.3 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.9.2 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.9.1 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.9.0 lib/generators/push_type/dummy/dummy_generator.rb
push_type_core-0.9.0.beta.4 lib/generators/push_type/dummy/dummy_generator.rb