Sha256: 3fa007b6ee3e5f472e5e93b0eba520ca0f6cee3db044b92820858598ed794483

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

namespace :rails_admin do
  desc 'Install rails_admin'
  task :install do
    system 'rails g rails_admin:install'
  end

  desc 'Uninstall rails_admin'
  task :uninstall do
    system 'rails g rails_admin:uninstall'
  end

  desc 'CI env for GitHub Actions'
  task :prepare_ci_env do
    adapter = ENV['CI_DB_ADAPTER'] || 'sqlite3'
    database = (adapter == 'sqlite3' ? 'db/development.sqlite3' : 'ci_rails_admin')
    username =
      case adapter
      when 'postgresql'
        'postgres'
      when 'mysql2'
        'root'
      else
        ''
      end

    configuration = {
      'test' => {
        'adapter' => adapter,
        'database' => database,
        'username' => username,
        'password' => (adapter == 'postgresql' ? 'postgres' : ''),
        'host' => '127.0.0.1',
        'encoding' => 'utf8',
        'pool' => 5,
        'timeout' => 5000,
      },
    }

    filename = Rails.root.join('config/database.yml')

    File.open(filename, 'w') do |f|
      f.write(configuration.to_yaml)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails_admin-3.0.0 lib/tasks/rails_admin.rake
rails_admin-3.0.0.rc4 lib/tasks/rails_admin.rake
rails_admin-3.0.0.rc3 lib/tasks/rails_admin.rake
rails_admin-3.0.0.rc2 lib/tasks/rails_admin.rake
rails_admin-3.0.0.rc lib/tasks/rails_admin.rake
rails_admin-3.0.0.beta2 lib/tasks/rails_admin.rake
rails_admin-3.0.0.beta lib/tasks/rails_admin.rake