Sha256: 06d0e481001b057e87266ffadd85ac0d1b325a62d3fde286a4bba98459aec342

Contents?: true

Size: 672 Bytes

Versions: 5

Compression:

Stored size: 672 Bytes

Contents

require 'rake'

namespace :kuby do
  namespace :rails_app do
    namespace :db do
      task rewrite_config: :environment do
        config_file = Kuby.definition.app.root.join('config', 'database.yml')
        database = Kuby.definition.kubernetes.plugin(:rails_app).database
        File.write(config_file, YAML.dump(database.rewritten_configs))
        Kuby.logger.info("Wrote #{config_file}")
      end

      task :create_unless_exists do
        begin
          Rake::Task['environment'].invoke
          ActiveRecord::Base.connection
        rescue ActiveRecord::NoDatabaseError => e
          Rake::Task['db:create'].invoke
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kuby-core-0.5.0 lib/kuby/kubernetes/plugins/rails_app/tasks.rake
kuby-core-0.4.0 lib/kuby/kubernetes/plugins/rails_app/tasks.rake
kuby-core-0.3.0 lib/kuby/kubernetes/plugins/rails_app/tasks.rake
kuby-core-0.2.0 lib/kuby/kubernetes/plugins/rails_app/tasks.rake
kuby-core-0.1.0 lib/kuby/kubernetes/plugins/rails_app/tasks.rake